Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
authorDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 21:45:36 +0000 (14:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 21:45:36 +0000 (14:45 -0700)
Pablo Neira Ayuso says:

====================
Netfilter/IPVS fixes for net

The following patchset contains Netfilter/IPVS fixes for your net tree:

1) Fix crash when dumping rules after conversion to RCU,
   from Florian Westphal.

2) Fix incorrect hook reinjection from nf_queue in case NF_REPEAT,
   from Jagdish Motwani.

3) Fix check for route existence in fib extension, from Phil Sutter.

4) Fix use after free in ip_vs_in() hook, from YueHaibing.

5) Check for veth existence from netfilter selftests,
   from Jeffrin Jose T.

6) Checksum corruption in UDP NAT helpers due to typo,
   from Florian Westphal.

7) Pass up packets to classic forwarding path regardless of
   IPv4 DF bit, patch for the flowtable infrastructure from Florian.

8) Set liberal TCP tracking for flows that are placed in the
   flowtable, in case they need to go back to classic forwarding path,
   also from Florian.

9) Don't add flow with sequence adjustment to flowtable, from Florian.

10) Skip IPv4 options from IPv6 datapath in flowtable, from Florian.

11) Add selftest for the flowtable infrastructure, from Florian.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5916 files changed:
.get_maintainer.ignore
.gitignore
Documentation/ABI/testing/sysfs-class-power
Documentation/accounting/psi.txt
Documentation/admin-guide/kernel-parameters.txt
Documentation/arm64/perf.txt [new file with mode: 0644]
Documentation/arm64/pointer-authentication.txt
Documentation/core-api/kernel-api.rst
Documentation/dev-tools/gcov.rst
Documentation/device-mapper/dm-dust.txt [new file with mode: 0644]
Documentation/device-mapper/dm-integrity.txt
Documentation/devicetree/bindings/arm/amlogic.txt
Documentation/devicetree/bindings/arm/atmel-at91.txt
Documentation/devicetree/bindings/arm/atmel-sysregs.txt
Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
Documentation/devicetree/bindings/arm/fsl.yaml
Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
Documentation/devicetree/bindings/arm/omap/omap.txt
Documentation/devicetree/bindings/arm/rockchip.yaml
Documentation/devicetree/bindings/arm/sunxi.txt [deleted file]
Documentation/devicetree/bindings/arm/sunxi.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/bus/ti-sysc.txt
Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.txt [new file with mode: 0644]
Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt
Documentation/devicetree/bindings/fpga/xlnx,zynqmp-pcap-fpga.txt [new file with mode: 0644]
Documentation/devicetree/bindings/gpu/arm,mali-midgard.txt
Documentation/devicetree/bindings/hwmon/pwm-fan.txt
Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt [new file with mode: 0644]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt [new file with mode: 0644]
Documentation/devicetree/bindings/memory-controllers/fsl/mmdc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
Documentation/devicetree/bindings/power/amlogic,meson-gx-pwrc.txt
Documentation/devicetree/bindings/power/reset/syscon-reboot.txt
Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
Documentation/devicetree/bindings/power/supply/gpio-charger.txt
Documentation/devicetree/bindings/power/supply/ingenic,battery.txt [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/lt3651-charger.txt [moved from Documentation/devicetree/bindings/power/supply/ltc3651-charger.txt with 71% similarity]
Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt [new file with mode: 0644]
Documentation/devicetree/bindings/power/supply/olpc_battery.txt
Documentation/devicetree/bindings/pps/pps-gpio.txt
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt
Documentation/devicetree/bindings/riscv/sifive-l2-cache.txt [new file with mode: 0644]
Documentation/devicetree/bindings/serial/mtk-uart.txt
Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt [new file with mode: 0644]
Documentation/devicetree/bindings/thermal/nvidia,tegra124-soctherm.txt
Documentation/devicetree/bindings/thermal/qcom-tsens.txt
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
Documentation/devicetree/bindings/thermal/thermal-generic-adc.txt
Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt
Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
Documentation/devicetree/bindings/vendor-prefixes.txt [deleted file]
Documentation/devicetree/bindings/vendor-prefixes.yaml [new file with mode: 0644]
Documentation/driver-model/devres.txt
Documentation/filesystems/autofs-mount-control.txt
Documentation/filesystems/autofs.txt
Documentation/firmware-guide/acpi/dsd/data-node-references.rst
Documentation/firmware-guide/acpi/dsd/graph.rst
Documentation/kbuild/makefiles.txt
Documentation/media/uapi/v4l/field-order.rst
Documentation/networking/device_drivers/index.rst [new file with mode: 0644]
Documentation/networking/index.rst
Documentation/networking/ip-sysctl.txt
Documentation/networking/rxrpc.txt
Documentation/networking/segmentation-offloads.rst
Documentation/networking/tls-offload-layers.svg [new file with mode: 0644]
Documentation/networking/tls-offload-reorder-bad.svg [new file with mode: 0644]
Documentation/networking/tls-offload-reorder-good.svg [new file with mode: 0644]
Documentation/networking/tls-offload.rst [new file with mode: 0644]
Documentation/networking/tls.rst [moved from Documentation/networking/tls.txt with 88% similarity]
Documentation/trace/ftrace.rst
Documentation/trace/histogram.rst
Documentation/virtual/kvm/api.txt
Documentation/virtual/kvm/devices/vm.txt
Documentation/virtual/kvm/devices/xive.txt [new file with mode: 0644]
Documentation/x86/mds.rst
Documentation/xilinx/eemi.txt
MAINTAINERS
Makefile
arch/Kconfig
arch/alpha/Makefile
arch/alpha/configs/defconfig [moved from arch/alpha/defconfig with 100% similarity]
arch/alpha/include/asm/segment.h [deleted file]
arch/alpha/kernel/smc37c669.c
arch/alpha/kernel/smc37c93x.c
arch/alpha/kernel/syscalls/syscall.tbl
arch/alpha/math-emu/Makefile
arch/alpha/math-emu/math.c
arch/alpha/mm/Makefile
arch/arc/include/asm/uaccess.h
arch/arc/plat-eznps/Makefile
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/aks-cdu.dts
arch/arm/boot/dts/am335x-baltos-ir2110.dts
arch/arm/boot/dts/am335x-baltos-ir3220.dts
arch/arm/boot/dts/am335x-baltos-ir5221.dts
arch/arm/boot/dts/am335x-baltos-leds.dtsi
arch/arm/boot/dts/am335x-baltos.dtsi
arch/arm/boot/dts/am335x-base0033.dts
arch/arm/boot/dts/am335x-bone-common.dtsi
arch/arm/boot/dts/am335x-boneblack-common.dtsi
arch/arm/boot/dts/am335x-boneblack-wireless.dts
arch/arm/boot/dts/am335x-boneblue.dts
arch/arm/boot/dts/am335x-bonegreen-common.dtsi
arch/arm/boot/dts/am335x-bonegreen-wireless.dts
arch/arm/boot/dts/am335x-chiliboard.dts
arch/arm/boot/dts/am335x-chilisom.dtsi
arch/arm/boot/dts/am335x-cm-t335.dts
arch/arm/boot/dts/am335x-evm.dts
arch/arm/boot/dts/am335x-evmsk.dts
arch/arm/boot/dts/am335x-icev2.dts
arch/arm/boot/dts/am335x-igep0033.dtsi
arch/arm/boot/dts/am335x-lxm.dts
arch/arm/boot/dts/am335x-moxa-uc-2100-common.dtsi
arch/arm/boot/dts/am335x-moxa-uc-2101.dts
arch/arm/boot/dts/am335x-moxa-uc-8100-me-t.dts
arch/arm/boot/dts/am335x-nano.dts
arch/arm/boot/dts/am335x-osd3358-sm-red.dts
arch/arm/boot/dts/am335x-osd335x-common.dtsi
arch/arm/boot/dts/am335x-pcm-953.dtsi
arch/arm/boot/dts/am335x-pdu001.dts
arch/arm/boot/dts/am335x-pepper.dts
arch/arm/boot/dts/am335x-phycore-som.dtsi
arch/arm/boot/dts/am335x-pocketbeagle.dts
arch/arm/boot/dts/am335x-sancloud-bbe.dts
arch/arm/boot/dts/am335x-sbc-t335.dts
arch/arm/boot/dts/am335x-shc.dts
arch/arm/boot/dts/am335x-sl50.dts
arch/arm/boot/dts/am335x-wega.dtsi
arch/arm/boot/dts/am43x-epos-evm.dts
arch/arm/boot/dts/am5718.dtsi [new file with mode: 0644]
arch/arm/boot/dts/am571x-idk.dts
arch/arm/boot/dts/am5728.dtsi [new file with mode: 0644]
arch/arm/boot/dts/am572x-idk.dts
arch/arm/boot/dts/am5748.dtsi [new file with mode: 0644]
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/armada-38x.dtsi
arch/arm/boot/dts/aspeed-ast2500-evb.dts
arch/arm/boot/dts/aspeed-bmc-facebook-cmm.dts
arch/arm/boot/dts/aspeed-bmc-facebook-tiogapass.dts
arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
arch/arm/boot/dts/aspeed-g4.dtsi
arch/arm/boot/dts/aspeed-g5.dtsi
arch/arm/boot/dts/at91-ariag25.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.dts
arch/arm/boot/dts/at91-kizboxmini.dts
arch/arm/boot/dts/at91-linea.dtsi
arch/arm/boot/dts/at91-sam9_l9260.dts
arch/arm/boot/dts/at91-sama5d27_som1.dtsi
arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
arch/arm/boot/dts/at91-sama5d2_xplained.dts
arch/arm/boot/dts/at91-sama5d3_xplained.dts
arch/arm/boot/dts/at91-sama5d4_xplained.dts
arch/arm/boot/dts/at91-sama5d4ek.dts
arch/arm/boot/dts/at91-tse850-3.dts
arch/arm/boot/dts/at91-vinco.dts
arch/arm/boot/dts/at91rm9200.dtsi
arch/arm/boot/dts/at91rm9200_pqfp.dtsi
arch/arm/boot/dts/at91sam9260.dtsi
arch/arm/boot/dts/at91sam9260ek.dts
arch/arm/boot/dts/at91sam9g15ek.dts
arch/arm/boot/dts/at91sam9g25ek.dts
arch/arm/boot/dts/at91sam9g35ek.dts
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/at91sam9x25ek.dts
arch/arm/boot/dts/at91sam9x35ek.dts
arch/arm/boot/dts/at91sam9x5.dtsi
arch/arm/boot/dts/at91sam9x5cm.dtsi
arch/arm/boot/dts/at91sam9x5dm.dtsi
arch/arm/boot/dts/at91sam9x5ek.dtsi
arch/arm/boot/dts/at91sam9xe.dtsi
arch/arm/boot/dts/atlas6-evb.dts
arch/arm/boot/dts/atlas6.dtsi
arch/arm/boot/dts/atlas7-evb.dts
arch/arm/boot/dts/atlas7.dtsi
arch/arm/boot/dts/axp81x.dtsi
arch/arm/boot/dts/dra7-l4.dtsi
arch/arm/boot/dts/dra7.dtsi
arch/arm/boot/dts/emev2-kzm9d.dts
arch/arm/boot/dts/ep7209.dtsi
arch/arm/boot/dts/ep7211-edb7211.dts
arch/arm/boot/dts/ep7211.dtsi
arch/arm/boot/dts/evk-pro3.dts
arch/arm/boot/dts/exynos3250.dtsi
arch/arm/boot/dts/exynos4.dtsi
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/exynos4412-odroidu3.dts
arch/arm/boot/dts/exynos4412-origen.dts
arch/arm/boot/dts/exynos4412-smdk4412.dts
arch/arm/boot/dts/exynos4412-trats2.dts
arch/arm/boot/dts/exynos4412.dtsi
arch/arm/boot/dts/exynos5250-smdk5250.dts
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/boot/dts/exynos5260-pinctrl.dtsi
arch/arm/boot/dts/exynos5260-xyref5260.dts
arch/arm/boot/dts/exynos5260.dtsi
arch/arm/boot/dts/exynos5410-odroidxu.dts
arch/arm/boot/dts/exynos5410-smdk5410.dts
arch/arm/boot/dts/exynos5420-arndale-octa.dts
arch/arm/boot/dts/exynos5420-smdk5420.dts
arch/arm/boot/dts/exynos5420.dtsi
arch/arm/boot/dts/exynos5422-odroidxu3-audio.dtsi
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
arch/arm/boot/dts/exynos54xx.dtsi
arch/arm/boot/dts/ge863-pro3.dtsi
arch/arm/boot/dts/gemini-dlink-dir-685.dts
arch/arm/boot/dts/hi3519-demb.dts
arch/arm/boot/dts/hi3519.dtsi
arch/arm/boot/dts/imx35.dtsi
arch/arm/boot/dts/imx50-kobo-aura.dts [new file with mode: 0644]
arch/arm/boot/dts/imx50.dtsi
arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi
arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
arch/arm/boot/dts/imx51-zii-rdu1.dts
arch/arm/boot/dts/imx51.dtsi
arch/arm/boot/dts/imx53-m53.dtsi
arch/arm/boot/dts/imx53-m53menlo.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53.dtsi
arch/arm/boot/dts/imx6-logicpd-baseboard.dtsi
arch/arm/boot/dts/imx6dl-eckelmann-ci4x10.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-riotboard.dts
arch/arm/boot/dts/imx6dl-sabreauto.dts
arch/arm/boot/dts/imx6q-ba16.dtsi
arch/arm/boot/dts/imx6q-gw54xx.dts
arch/arm/boot/dts/imx6q-logicpd.dts
arch/arm/boot/dts/imx6q-marsboard.dts
arch/arm/boot/dts/imx6q-tbs2910.dts
arch/arm/boot/dts/imx6q-zii-rdu2.dts
arch/arm/boot/dts/imx6qdl-apf6.dtsi
arch/arm/boot/dts/imx6qdl-emcon.dtsi
arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
arch/arm/boot/dts/imx6qdl-gw551x.dtsi
arch/arm/boot/dts/imx6qdl-gw5903.dtsi
arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
arch/arm/boot/dts/imx6qdl-sabresd.dtsi
arch/arm/boot/dts/imx6qdl-sr-som.dtsi
arch/arm/boot/dts/imx6qdl-var-dart.dtsi
arch/arm/boot/dts/imx6qdl-wandboard.dtsi
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
arch/arm/boot/dts/imx6qdl.dtsi
arch/arm/boot/dts/imx6qp-zii-rdu2.dts
arch/arm/boot/dts/imx6sl.dtsi
arch/arm/boot/dts/imx6sll.dtsi
arch/arm/boot/dts/imx6sx-sabreauto.dts
arch/arm/boot/dts/imx6sx-sdb.dtsi
arch/arm/boot/dts/imx6sx.dtsi
arch/arm/boot/dts/imx6ul.dtsi
arch/arm/boot/dts/imx7-mba7.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx7-tqma7.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx7d-mba7.dts [new file with mode: 0644]
arch/arm/boot/dts/imx7d-pico.dtsi
arch/arm/boot/dts/imx7d-tqma7.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx7d-zii-rpu2.dts [new file with mode: 0644]
arch/arm/boot/dts/imx7d.dtsi
arch/arm/boot/dts/imx7s-mba7.dts [new file with mode: 0644]
arch/arm/boot/dts/imx7s-tqma7.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx7s-warp.dts
arch/arm/boot/dts/imx7s.dtsi
arch/arm/boot/dts/imx7ulp.dtsi
arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts [new file with mode: 0644]
arch/arm/boot/dts/intel-ixp42x.dtsi [new file with mode: 0644]
arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts [new file with mode: 0644]
arch/arm/boot/dts/intel-ixp43x.dtsi [new file with mode: 0644]
arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi [new file with mode: 0644]
arch/arm/boot/dts/intel-ixp4xx.dtsi [new file with mode: 0644]
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
arch/arm/boot/dts/lpc3250-ea3250.dts
arch/arm/boot/dts/lpc3250-phy3250.dts
arch/arm/boot/dts/lpc32xx.dtsi
arch/arm/boot/dts/ls1021a-moxa-uc-8410a.dts
arch/arm/boot/dts/ls1021a-qds.dts
arch/arm/boot/dts/ls1021a-twr.dts
arch/arm/boot/dts/ls1021a.dtsi
arch/arm/boot/dts/meson.dtsi
arch/arm/boot/dts/meson8.dtsi
arch/arm/boot/dts/meson8b-ec100.dts
arch/arm/boot/dts/meson8b-odroidc1.dts
arch/arm/boot/dts/meson8b.dtsi
arch/arm/boot/dts/moxart-uc7112lx.dts
arch/arm/boot/dts/moxart.dtsi
arch/arm/boot/dts/omap2420-n810.dts
arch/arm/boot/dts/omap3-n900.dts
arch/arm/boot/dts/omap4-duovero.dtsi
arch/arm/boot/dts/omap4-l4-abe.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap4-mcpdm.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap4-panda-common.dtsi
arch/arm/boot/dts/omap4-sdp.dts
arch/arm/boot/dts/omap4-var-som-om44.dtsi
arch/arm/boot/dts/omap4.dtsi
arch/arm/boot/dts/omap5-board-common.dtsi
arch/arm/boot/dts/omap5-l4-abe.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/ox810se-wd-mbwe.dts
arch/arm/boot/dts/ox810se.dtsi
arch/arm/boot/dts/ox820-cloudengines-pogoplug-series-3.dts
arch/arm/boot/dts/ox820.dtsi
arch/arm/boot/dts/prima2-evb.dts
arch/arm/boot/dts/prima2.dtsi
arch/arm/boot/dts/pxa2xx.dtsi
arch/arm/boot/dts/qcom-apq8064.dtsi
arch/arm/boot/dts/qcom-ipq4019.dtsi
arch/arm/boot/dts/qcom-mdm9615.dtsi
arch/arm/boot/dts/qcom-msm8660.dtsi
arch/arm/boot/dts/qcom-pma8084.dtsi
arch/arm/boot/dts/r7s72100-rskrza1.dts
arch/arm/boot/dts/r8a73a4-ape6evm.dts
arch/arm/boot/dts/r8a77470-iwg23s-sbc.dts
arch/arm/boot/dts/r8a77470.dtsi
arch/arm/boot/dts/r8a7778-bockw.dts
arch/arm/boot/dts/r8a7779-marzen.dts
arch/arm/boot/dts/r8a7792-blanche.dts
arch/arm/boot/dts/r8a7792.dtsi
arch/arm/boot/dts/r8a7794-alt.dts
arch/arm/boot/dts/rk3036-kylin.dts
arch/arm/boot/dts/rk3036.dtsi
arch/arm/boot/dts/rk3066a-marsboard.dts
arch/arm/boot/dts/rk3066a-mk808.dts
arch/arm/boot/dts/rk3066a-rayeager.dts
arch/arm/boot/dts/rk3066a.dtsi
arch/arm/boot/dts/rk3188-px3-evb.dts
arch/arm/boot/dts/rk3188-radxarock.dts
arch/arm/boot/dts/rk3188.dtsi
arch/arm/boot/dts/rk322x.dtsi
arch/arm/boot/dts/rk3288-evb-act8846.dts
arch/arm/boot/dts/rk3288-evb.dtsi
arch/arm/boot/dts/rk3288-fennec.dts
arch/arm/boot/dts/rk3288-firefly-beta.dts
arch/arm/boot/dts/rk3288-firefly-reload-core.dtsi
arch/arm/boot/dts/rk3288-firefly-reload.dts
arch/arm/boot/dts/rk3288-firefly.dts
arch/arm/boot/dts/rk3288-firefly.dtsi
arch/arm/boot/dts/rk3288-miqi.dts
arch/arm/boot/dts/rk3288-phycore-rdk.dts
arch/arm/boot/dts/rk3288-phycore-som.dtsi
arch/arm/boot/dts/rk3288-r89.dts
arch/arm/boot/dts/rk3288-rock2-som.dtsi
arch/arm/boot/dts/rk3288-rock2-square.dts
arch/arm/boot/dts/rk3288-tinker-s.dts
arch/arm/boot/dts/rk3288-tinker.dtsi
arch/arm/boot/dts/rk3288-veyron-analog-audio.dtsi
arch/arm/boot/dts/rk3288-veyron-brain.dts
arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
arch/arm/boot/dts/rk3288-veyron-jaq.dts
arch/arm/boot/dts/rk3288-veyron-jerry.dts
arch/arm/boot/dts/rk3288-veyron-mickey.dts
arch/arm/boot/dts/rk3288-veyron-mighty.dts [new file with mode: 0644]
arch/arm/boot/dts/rk3288-veyron-minnie.dts
arch/arm/boot/dts/rk3288-veyron-pinky.dts
arch/arm/boot/dts/rk3288-veyron-sdmmc.dtsi
arch/arm/boot/dts/rk3288-veyron-speedy.dts
arch/arm/boot/dts/rk3288-veyron.dtsi
arch/arm/boot/dts/rk3288-vyasa.dts
arch/arm/boot/dts/rk3288.dtsi
arch/arm/boot/dts/rv1108-elgin-r1.dts
arch/arm/boot/dts/rv1108.dtsi
arch/arm/boot/dts/s5pv210-goni.dts
arch/arm/boot/dts/s5pv210.dtsi
arch/arm/boot/dts/sama5d2.dtsi
arch/arm/boot/dts/sama5d3.dtsi
arch/arm/boot/dts/sama5d31.dtsi
arch/arm/boot/dts/sama5d31ek.dts
arch/arm/boot/dts/sama5d33.dtsi
arch/arm/boot/dts/sama5d33ek.dts
arch/arm/boot/dts/sama5d34.dtsi
arch/arm/boot/dts/sama5d34ek.dts
arch/arm/boot/dts/sama5d35.dtsi
arch/arm/boot/dts/sama5d35ek.dts
arch/arm/boot/dts/sama5d36.dtsi
arch/arm/boot/dts/sama5d36ek.dts
arch/arm/boot/dts/sama5d36ek_cmp.dts
arch/arm/boot/dts/sama5d3xcm.dtsi
arch/arm/boot/dts/sama5d3xcm_cmp.dtsi
arch/arm/boot/dts/sama5d3xdm.dtsi
arch/arm/boot/dts/sama5d3xmb.dtsi
arch/arm/boot/dts/sama5d3xmb_cmp.dtsi
arch/arm/boot/dts/sama5d3xmb_emac.dtsi
arch/arm/boot/dts/sama5d3xmb_gmac.dtsi
arch/arm/boot/dts/sama5d4.dtsi
arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts
arch/arm/boot/dts/ste-dbx5x0.dtsi
arch/arm/boot/dts/ste-href-stuib.dtsi
arch/arm/boot/dts/ste-href-tvk1281618.dtsi
arch/arm/boot/dts/stm32f429.dtsi
arch/arm/boot/dts/stm32f769-disco.dts
arch/arm/boot/dts/stm32h743-pinctrl.dtsi
arch/arm/boot/dts/stm32h743.dtsi
arch/arm/boot/dts/stm32h743i-disco.dts
arch/arm/boot/dts/stm32h743i-eval.dts
arch/arm/boot/dts/stm32mp157-pinctrl.dtsi
arch/arm/boot/dts/stm32mp157a-dk1.dts [new file with mode: 0644]
arch/arm/boot/dts/stm32mp157c-dk2.dts [new file with mode: 0644]
arch/arm/boot/dts/stm32mp157c-ed1.dts
arch/arm/boot/dts/stm32mp157c.dtsi
arch/arm/boot/dts/sun4i-a10-chuwi-v7-cw0825.dts
arch/arm/boot/dts/sun4i-a10-cubieboard.dts
arch/arm/boot/dts/sun4i-a10-dserve-dsrv9703c.dts
arch/arm/boot/dts/sun4i-a10-hyundai-a7hd.dts
arch/arm/boot/dts/sun4i-a10-inet1.dts
arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts
arch/arm/boot/dts/sun4i-a10-marsboard.dts
arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
arch/arm/boot/dts/sun4i-a10-pcduino.dts
arch/arm/boot/dts/sun4i-a10-pov-protab2-ips9.dts
arch/arm/boot/dts/sun4i-a10.dtsi
arch/arm/boot/dts/sun5i-a10s-auxtek-t004.dts
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
arch/arm/boot/dts/sun5i-a13-empire-electronix-d709.dts
arch/arm/boot/dts/sun5i-a13-hsg-h702.dts
arch/arm/boot/dts/sun5i-a13-licheepi-one.dts
arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
arch/arm/boot/dts/sun5i-a13-olinuxino.dts
arch/arm/boot/dts/sun5i-a13-q8-tablet.dts
arch/arm/boot/dts/sun5i-a13-utoo-p66.dts
arch/arm/boot/dts/sun5i-gr8-chip-pro.dts
arch/arm/boot/dts/sun5i-gr8-evb.dts
arch/arm/boot/dts/sun5i-r8-chip.dts
arch/arm/boot/dts/sun5i-reference-design-tablet.dtsi
arch/arm/boot/dts/sun5i.dtsi
arch/arm/boot/dts/sun6i-a31-colombus.dts
arch/arm/boot/dts/sun6i-a31-hummingbird.dts
arch/arm/boot/dts/sun6i-a31-i7.dts
arch/arm/boot/dts/sun6i-a31.dtsi
arch/arm/boot/dts/sun6i-a31s-primo81.dts
arch/arm/boot/dts/sun6i-reference-design-tablet.dtsi
arch/arm/boot/dts/sun7i-a20-bananapi.dts
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts
arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts
arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
arch/arm/boot/dts/sun7i-a20-orangepi-mini.dts
arch/arm/boot/dts/sun7i-a20-orangepi.dts
arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts
arch/arm/boot/dts/sun7i-a20-pcduino3.dts
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts
arch/arm/boot/dts/sun7i-a20-wits-pro-a20-dkt.dts
arch/arm/boot/dts/sun7i-a20.dtsi
arch/arm/boot/dts/sun8i-a23-a33.dtsi
arch/arm/boot/dts/sun8i-a23-q8-tablet.dts
arch/arm/boot/dts/sun8i-a33-q8-tablet.dts
arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
arch/arm/boot/dts/sun8i-a33.dtsi
arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
arch/arm/boot/dts/sun8i-a83t.dtsi
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
arch/arm/boot/dts/sun8i-h3-mapleboard-mp130.dts
arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dts
arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts
arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts
arch/arm/boot/dts/sun8i-h3-nanopi.dtsi
arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
arch/arm/boot/dts/sun8i-h3-orangepi-lite.dts
arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
arch/arm/boot/dts/sun8i-h3-rervision-dvk.dts [new file with mode: 0644]
arch/arm/boot/dts/sun8i-h3.dtsi
arch/arm/boot/dts/sun8i-q8-common.dtsi
arch/arm/boot/dts/sun8i-r16-nintendo-nes-classic.dts
arch/arm/boot/dts/sun8i-r16-parrot.dts
arch/arm/boot/dts/sun8i-r40.dtsi
arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi
arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts
arch/arm/boot/dts/sun8i-v3s.dtsi
arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
arch/arm/boot/dts/sun9i-a80-optimus.dts
arch/arm/boot/dts/sun9i-a80.dtsi
arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
arch/arm/boot/dts/sunxi-h3-h5.dtsi
arch/arm/boot/dts/sunxi-libretech-all-h3-cc.dtsi
arch/arm/boot/dts/tegra124-apalis-emc.dtsi
arch/arm/boot/dts/tegra124-apalis-eval.dts
arch/arm/boot/dts/tegra124-apalis-v1.2-eval.dts
arch/arm/boot/dts/tegra124-apalis-v1.2.dtsi
arch/arm/boot/dts/tegra124-apalis.dtsi
arch/arm/boot/dts/tegra124-jetson-tk1.dts
arch/arm/boot/dts/tegra124-nyan.dtsi
arch/arm/boot/dts/tegra124-venice2.dts
arch/arm/boot/dts/tegra30.dtsi
arch/arm/boot/dts/usb_a9260.dts
arch/arm/boot/dts/usb_a9260_common.dtsi
arch/arm/boot/dts/usb_a9g20.dts
arch/arm/boot/dts/usb_a9g20_common.dtsi
arch/arm/boot/dts/usb_a9g20_lpw.dts
arch/arm/boot/dts/vf610-zii-cfu1.dts
arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
arch/arm/boot/dts/vf610-zii-dev-rev-c.dts
arch/arm/boot/dts/vf610-zii-dev.dtsi
arch/arm/boot/dts/vf610-zii-scu4-aib.dts
arch/arm/boot/dts/vf610-zii-spb4.dts [new file with mode: 0644]
arch/arm/boot/dts/vf610-zii-ssmb-dtu.dts
arch/arm/boot/dts/vf610-zii-ssmb-spu3.dts
arch/arm/boot/dts/vt8500-bv07.dts
arch/arm/boot/dts/vt8500.dtsi
arch/arm/boot/dts/wm8505-ref.dts
arch/arm/boot/dts/wm8505.dtsi
arch/arm/boot/dts/wm8650-mid.dts
arch/arm/boot/dts/wm8650.dtsi
arch/arm/boot/dts/wm8750-apc8750.dts
arch/arm/boot/dts/wm8750.dtsi
arch/arm/boot/dts/wm8850-w70v2.dts
arch/arm/boot/dts/wm8850.dtsi
arch/arm/common/sa1111.c
arch/arm/configs/exynos_defconfig
arch/arm/configs/mini2440_defconfig
arch/arm/configs/multi_v7_defconfig
arch/arm/configs/pxa_defconfig
arch/arm/configs/qcom_defconfig
arch/arm/configs/sama5_defconfig
arch/arm/configs/shmobile_defconfig
arch/arm/configs/socfpga_defconfig
arch/arm/configs/tegra_defconfig
arch/arm/firmware/Kconfig [deleted file]
arch/arm/firmware/Makefile [deleted file]
arch/arm/include/asm/Kbuild
arch/arm/include/asm/domain.h
arch/arm/include/asm/firmware.h
arch/arm/include/asm/futex.h
arch/arm/include/asm/hardirq.h
arch/arm/include/asm/kvm_emulate.h
arch/arm/include/asm/kvm_host.h
arch/arm/include/asm/limits.h [deleted file]
arch/arm/include/asm/opcodes-virt.h
arch/arm/include/asm/processor.h
arch/arm/include/asm/uaccess.h
arch/arm/include/asm/virt.h
arch/arm/include/debug/sirf.S
arch/arm/kernel/atags.h
arch/arm/kernel/hyp-stub.S
arch/arm/kernel/smp.c
arch/arm/kernel/stacktrace.c
arch/arm/mach-actions/Makefile
arch/arm/mach-alpine/Makefile
arch/arm/mach-artpec/Kconfig
arch/arm/mach-artpec/Makefile
arch/arm/mach-asm9260/Kconfig
arch/arm/mach-aspeed/Kconfig
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/Makefile.boot
arch/arm/mach-at91/at91rm9200.c
arch/arm/mach-at91/at91sam9.c
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm_suspend.S
arch/arm/mach-at91/sama5.c
arch/arm/mach-at91/samv7.c
arch/arm/mach-berlin/Kconfig
arch/arm/mach-berlin/Makefile
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-omapl138-hawk.c
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-digicolor/Makefile
arch/arm/mach-dove/Makefile.boot
arch/arm/mach-dove/common.c
arch/arm/mach-ebsa110/Makefile
arch/arm/mach-ebsa110/Makefile.boot
arch/arm/mach-efm32/Makefile
arch/arm/mach-efm32/Makefile.boot
arch/arm/mach-ep93xx/Kconfig
arch/arm/mach-ep93xx/Makefile.boot
arch/arm/mach-ep93xx/adssphere.c
arch/arm/mach-ep93xx/clock.c
arch/arm/mach-ep93xx/core.c
arch/arm/mach-ep93xx/dma.c
arch/arm/mach-ep93xx/edb93xx.c
arch/arm/mach-ep93xx/gesbc9312.c
arch/arm/mach-ep93xx/gpio-ep93xx.h [moved from arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h with 100% similarity]
arch/arm/mach-ep93xx/hardware.h [moved from arch/arm/mach-ep93xx/include/mach/hardware.h with 96% similarity]
arch/arm/mach-ep93xx/micro9.c
arch/arm/mach-ep93xx/platform.h [moved from arch/arm/mach-ep93xx/include/mach/platform.h with 65% similarity]
arch/arm/mach-ep93xx/simone.c
arch/arm/mach-ep93xx/snappercl15.c
arch/arm/mach-ep93xx/ts72xx.c
arch/arm/mach-ep93xx/vision_ep9307.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/firmware.c
arch/arm/mach-exynos/mcpm-exynos.c
arch/arm/mach-exynos/platsmp.c
arch/arm/mach-exynos/smc.h
arch/arm/mach-exynos/suspend.c
arch/arm/mach-footbridge/Kconfig
arch/arm/mach-footbridge/Makefile.boot
arch/arm/mach-gemini/Kconfig
arch/arm/mach-gemini/Makefile
arch/arm/mach-highbank/Kconfig
arch/arm/mach-highbank/Makefile
arch/arm/mach-hisi/Kconfig
arch/arm/mach-hisi/Makefile
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/avic.c
arch/arm/mach-imx/board-mx31lilly.h
arch/arm/mach-imx/board-mx31lite.h
arch/arm/mach-imx/board-mx31moboard.h
arch/arm/mach-imx/cpu-imx27.c
arch/arm/mach-imx/crmregs-imx3.h
arch/arm/mach-imx/devices/Kconfig
arch/arm/mach-imx/devices/devices.c
arch/arm/mach-imx/devices/platform-fec.c
arch/arm/mach-imx/devices/platform-gpio_keys.c
arch/arm/mach-imx/devices/platform-imx2-wdt.c
arch/arm/mach-imx/devices/platform-mxc_nand.c
arch/arm/mach-imx/hardware.h
arch/arm/mach-imx/iim.h
arch/arm/mach-imx/iomux-imx31.c
arch/arm/mach-imx/iomux-mx21.h
arch/arm/mach-imx/iomux-mx27.h
arch/arm/mach-imx/iomux-mx2x.h
arch/arm/mach-imx/iomux-mx3.h
arch/arm/mach-imx/iomux-mx35.h
arch/arm/mach-imx/iomux-v1.h
arch/arm/mach-imx/iomux-v3.c
arch/arm/mach-imx/iomux-v3.h
arch/arm/mach-imx/irq-common.c
arch/arm/mach-imx/irq-common.h
arch/arm/mach-imx/mach-armadillo5x0.c
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mm-imx21.c
arch/arm/mach-imx/mm-imx27.c
arch/arm/mach-imx/mx21.h
arch/arm/mach-imx/mx27.h
arch/arm/mach-imx/mx2x.h
arch/arm/mach-imx/mxc.h
arch/arm/mach-imx/pm-imx6.c
arch/arm/mach-integrator/Kconfig
arch/arm/mach-integrator/impd1.c
arch/arm/mach-iop13xx/Makefile.boot
arch/arm/mach-iop13xx/pci.c
arch/arm/mach-iop13xx/tpmi.c
arch/arm/mach-iop32x/Makefile.boot
arch/arm/mach-iop33x/Kconfig
arch/arm/mach-iop33x/Makefile
arch/arm/mach-iop33x/Makefile.boot
arch/arm/mach-ixp4xx/Kconfig
arch/arm/mach-ixp4xx/Makefile
arch/arm/mach-ixp4xx/Makefile.boot
arch/arm/mach-ixp4xx/avila-pci.c
arch/arm/mach-ixp4xx/avila-setup.c
arch/arm/mach-ixp4xx/common-pci.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-ixp4xx/coyote-pci.c
arch/arm/mach-ixp4xx/coyote-setup.c
arch/arm/mach-ixp4xx/dsmg600-pci.c
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/fsg-pci.c
arch/arm/mach-ixp4xx/fsg-setup.c
arch/arm/mach-ixp4xx/gateway7001-pci.c
arch/arm/mach-ixp4xx/gateway7001-setup.c
arch/arm/mach-ixp4xx/gtwx5715-pci.c
arch/arm/mach-ixp4xx/gtwx5715-setup.c
arch/arm/mach-ixp4xx/include/mach/entry-macro.S [deleted file]
arch/arm/mach-ixp4xx/include/mach/irqs.h [deleted file]
arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
arch/arm/mach-ixp4xx/include/mach/qmgr.h [deleted file]
arch/arm/mach-ixp4xx/irqs.h [new file with mode: 0644]
arch/arm/mach-ixp4xx/ixdp425-pci.c
arch/arm/mach-ixp4xx/ixdp425-setup.c
arch/arm/mach-ixp4xx/ixdpg425-pci.c
arch/arm/mach-ixp4xx/ixp4xx-of.c [new file with mode: 0644]
arch/arm/mach-ixp4xx/nas100d-pci.c
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-pci.c
arch/arm/mach-ixp4xx/nslu2-setup.c
arch/arm/mach-ixp4xx/wg302v2-pci.c
arch/arm/mach-ixp4xx/wg302v2-setup.c
arch/arm/mach-keystone/Kconfig
arch/arm/mach-ks8695/Kconfig
arch/arm/mach-ks8695/Makefile.boot
arch/arm/mach-ks8695/include/mach/hardware.h
arch/arm/mach-lpc18xx/Makefile
arch/arm/mach-lpc18xx/Makefile.boot
arch/arm/mach-lpc32xx/Makefile
arch/arm/mach-lpc32xx/Makefile.boot
arch/arm/mach-lpc32xx/phy3250.c
arch/arm/mach-mediatek/Kconfig
arch/arm/mach-mediatek/Makefile
arch/arm/mach-mediatek/mediatek.c
arch/arm/mach-meson/Kconfig
arch/arm/mach-meson/Makefile
arch/arm/mach-milbeaut/Makefile
arch/arm/mach-mmp/Kconfig
arch/arm/mach-moxart/Kconfig
arch/arm/mach-moxart/Makefile
arch/arm/mach-mv78xx0/Kconfig
arch/arm/mach-mv78xx0/common.c
arch/arm/mach-mvebu/Kconfig
arch/arm/mach-mvebu/board-v7.c
arch/arm/mach-mvebu/coherency_ll.S
arch/arm/mach-mvebu/kirkwood.c
arch/arm/mach-mvebu/pm-board.c
arch/arm/mach-mvebu/pmsu_ll.S
arch/arm/mach-mxs/Kconfig
arch/arm/mach-mxs/Makefile
arch/arm/mach-netx/Kconfig
arch/arm/mach-netx/Makefile
arch/arm/mach-netx/Makefile.boot
arch/arm/mach-nomadik/Kconfig
arch/arm/mach-nomadik/Makefile
arch/arm/mach-npcm/Kconfig
arch/arm/mach-npcm/Makefile
arch/arm/mach-nspire/Kconfig
arch/arm/mach-nspire/Makefile
arch/arm/mach-omap1/Kconfig
arch/arm/mach-omap1/Makefile.boot
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-omap1/include/mach/hardware.h
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/common.h
arch/arm/mach-omap2/i2c.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/mmc.h
arch/arm/mach-omap2/omap-wakeupgen.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/omap_hwmod.h
arch/arm/mach-omap2/omap_hwmod_2420_data.c
arch/arm/mach-omap2/omap_hwmod_2430_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.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_3xxx_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/pm33xx-core.c
arch/arm/mach-omap2/sleep43xx.S
arch/arm/mach-omap2/sr_device.c
arch/arm/mach-orion5x/Kconfig
arch/arm/mach-orion5x/common.c
arch/arm/mach-oxnas/Kconfig
arch/arm/mach-oxnas/Makefile
arch/arm/mach-picoxcell/Kconfig
arch/arm/mach-picoxcell/Makefile
arch/arm/mach-prima2/Kconfig
arch/arm/mach-prima2/common.c
arch/arm/mach-prima2/common.h
arch/arm/mach-prima2/headsmp.S
arch/arm/mach-prima2/hotplug.c
arch/arm/mach-prima2/platsmp.c
arch/arm/mach-prima2/pm.c
arch/arm/mach-prima2/pm.h
arch/arm/mach-prima2/rstc.c
arch/arm/mach-prima2/rtciobrg.c
arch/arm/mach-prima2/sleep.S
arch/arm/mach-pxa/Kconfig
arch/arm/mach-pxa/Makefile.boot
arch/arm/mach-pxa/balloon3.c
arch/arm/mach-pxa/colibri-pxa270.c
arch/arm/mach-pxa/colibri-pxa300.c
arch/arm/mach-pxa/colibri-pxa320.c
arch/arm/mach-pxa/colibri-pxa3xx.c
arch/arm/mach-pxa/gumstix.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/lubbock.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/trizeps4.c
arch/arm/mach-pxa/viper.c
arch/arm/mach-qcom/Kconfig
arch/arm/mach-qcom/Makefile
arch/arm/mach-rda/Kconfig
arch/arm/mach-rda/Makefile
arch/arm/mach-realview/Kconfig
arch/arm/mach-realview/Makefile
arch/arm/mach-rockchip/Kconfig
arch/arm/mach-rockchip/Makefile
arch/arm/mach-rockchip/platsmp.c
arch/arm/mach-rockchip/pm.c
arch/arm/mach-rockchip/rockchip.c
arch/arm/mach-rpc/Makefile
arch/arm/mach-rpc/Makefile.boot
arch/arm/mach-s3c24xx/include/mach/hardware.h
arch/arm/mach-s3c64xx/mach-crag6410-module.c
arch/arm/mach-sa1100/Kconfig
arch/arm/mach-sa1100/Makefile.boot
arch/arm/mach-sa1100/include/mach/memory.h
arch/arm/mach-sa1100/neponset.c
arch/arm/mach-shmobile/pm-rcar-gen2.c
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
arch/arm/mach-socfpga/Kconfig
arch/arm/mach-socfpga/socfpga.c
arch/arm/mach-spear/Kconfig
arch/arm/mach-sti/Kconfig
arch/arm/mach-sti/Makefile
arch/arm/mach-stm32/Kconfig
arch/arm/mach-stm32/Makefile
arch/arm/mach-stm32/Makefile.boot
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-sunxi/Makefile
arch/arm/mach-sunxi/mc_smp.c
arch/arm/mach-sunxi/platsmp.c
arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/cpuidle-tegra114.c
arch/arm/mach-tegra/cpuidle-tegra20.c
arch/arm/mach-tegra/cpuidle-tegra30.c
arch/arm/mach-tegra/iomap.h
arch/arm/mach-tegra/irammap.h
arch/arm/mach-tegra/pm.c
arch/arm/mach-tegra/reset-handler.S
arch/arm/mach-tegra/reset.c
arch/arm/mach-tegra/reset.h
arch/arm/mach-tegra/sleep-tegra20.S
arch/arm/mach-tegra/sleep-tegra30.S
arch/arm/mach-tegra/sleep.S
arch/arm/mach-tegra/tegra.c
arch/arm/mach-u300/Makefile
arch/arm/mach-u300/regulator.c
arch/arm/mach-ux500/Makefile
arch/arm/mach-versatile/Makefile
arch/arm/mach-vexpress/Makefile.boot
arch/arm/mach-vt8500/Makefile
arch/arm/mach-vt8500/Makefile.boot
arch/arm/mach-w90x900/Makefile.boot
arch/arm/mach-w90x900/include/mach/hardware.h
arch/arm/mach-zx/Makefile
arch/arm/mach-zynq/Makefile
arch/arm/mach-zynq/common.c
arch/arm/mach-zynq/pm.c
arch/arm/mm/init.c
arch/arm/mm/ioremap.c
arch/arm/mm/nommu.c
arch/arm/net/Makefile
arch/arm/plat-omap/Makefile
arch/arm/plat-orion/Makefile
arch/arm/plat-pxa/Kconfig
arch/arm/plat-pxa/Makefile
arch/arm/plat-pxa/ssp.c
arch/arm/plat-versatile/Kconfig
arch/arm/plat-versatile/Makefile
arch/arm/probes/uprobes/Makefile
arch/arm/tools/syscall.tbl
arch/arm/vdso/Makefile
arch/arm/vfp/Makefile
arch/arm/xen/Makefile
arch/arm/xen/efi.c
arch/arm/xen/enlighten.c
arch/arm/xen/mm.c
arch/arm/xen/p2m.c
arch/arm64/Kconfig
arch/arm64/Kconfig.debug
arch/arm64/Kconfig.platforms
arch/arm64/boot/dts/Makefile
arch/arm64/boot/dts/al/Makefile
arch/arm64/boot/dts/allwinner/Makefile
arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
arch/arm64/boot/dts/allwinner/sun50i-a64-oceanic-5205-5inmfd.dts [new file with mode: 0644]
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-sopine.dtsi
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-emlid-neutis-n5-devboard.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-emlid-neutis-n5.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus.dts
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts [new file with mode: 0644]
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
arch/arm64/boot/dts/altera/Makefile
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts
arch/arm64/boot/dts/amlogic/Makefile
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts
arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-phicomm-n1.dts
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
arch/arm64/boot/dts/bitmain/bm1880-sophon-edge.dts
arch/arm64/boot/dts/bitmain/bm1880.dtsi
arch/arm64/boot/dts/broadcom/northstar2/Makefile
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
arch/arm64/boot/dts/exynos/exynos5433-tm2.dts
arch/arm64/boot/dts/exynos/exynos5433.dtsi
arch/arm64/boot/dts/exynos/exynos7.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-qds.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
arch/arm64/boot/dts/freescale/fsl-lx2160a-qds.dts
arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
arch/arm64/boot/dts/freescale/imx8mm-evk.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mm.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-evk.dts
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-zest.dts [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/freescale/imx8mq.dtsi
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
arch/arm64/boot/dts/freescale/imx8qxp.dtsi
arch/arm64/boot/dts/hisilicon/hi3660.dtsi
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts
arch/arm64/boot/dts/hisilicon/hi3670.dtsi
arch/arm64/boot/dts/hisilicon/hikey970-pinctrl.dtsi
arch/arm64/boot/dts/intel/Makefile [new file with mode: 0644]
arch/arm64/boot/dts/intel/socfpga_agilex.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts [new file with mode: 0644]
arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
arch/arm64/boot/dts/mediatek/mt8173.dtsi
arch/arm64/boot/dts/mediatek/mt8183-pinfunc.h [new file with mode: 0644]
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/tegra210-p2180.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts [new file with mode: 0644]
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts
arch/arm64/boot/dts/nvidia/tegra210.dtsi
arch/arm64/boot/dts/qcom/apq8096-db820c-pins.dtsi
arch/arm64/boot/dts/qcom/apq8096-db820c-pmic-pins.dtsi
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
arch/arm64/boot/dts/qcom/msm8916.dtsi
arch/arm64/boot/dts/qcom/msm8996-pins.dtsi
arch/arm64/boot/dts/qcom/msm8996.dtsi
arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi
arch/arm64/boot/dts/qcom/msm8998.dtsi
arch/arm64/boot/dts/qcom/pm8005.dtsi
arch/arm64/boot/dts/qcom/pm8998.dtsi
arch/arm64/boot/dts/qcom/pmi8994.dtsi
arch/arm64/boot/dts/qcom/pmi8998.dtsi
arch/arm64/boot/dts/qcom/pms405.dtsi
arch/arm64/boot/dts/qcom/qcs404-evb-1000.dts
arch/arm64/boot/dts/qcom/qcs404-evb-4000.dts
arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
arch/arm64/boot/dts/qcom/qcs404.dtsi
arch/arm64/boot/dts/qcom/sdm845-mtp.dts
arch/arm64/boot/dts/qcom/sdm845.dtsi
arch/arm64/boot/dts/realtek/Makefile
arch/arm64/boot/dts/renesas/cat875.dtsi
arch/arm64/boot/dts/renesas/r8a774a1.dtsi
arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
arch/arm64/boot/dts/renesas/r8a774c0.dtsi
arch/arm64/boot/dts/renesas/r8a7795.dtsi
arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts
arch/arm64/boot/dts/renesas/r8a7796.dtsi
arch/arm64/boot/dts/renesas/r8a77965.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/salvator-common.dtsi
arch/arm64/boot/dts/rockchip/Makefile
arch/arm64/boot/dts/rockchip/px30-evb.dts
arch/arm64/boot/dts/rockchip/rk3328-evb.dts
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
arch/arm64/boot/dts/rockchip/rk3328.dtsi
arch/arm64/boot/dts/rockchip/rk3368-evb.dtsi
arch/arm64/boot/dts/rockchip/rk3368-geekbox.dts
arch/arm64/boot/dts/rockchip/rk3368-lion-haikou.dts
arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi
arch/arm64/boot/dts/rockchip/rk3368-orion-r68-meta.dts
arch/arm64/boot/dts/rockchip/rk3368-px5-evb.dts
arch/arm64/boot/dts/rockchip/rk3368-r88.dts
arch/arm64/boot/dts/rockchip/rk3368.dtsi
arch/arm64/boot/dts/rockchip/rk3399-evb.dts
arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts
arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts
arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
arch/arm64/boot/dts/rockchip/rk3399-nanopi-neo4.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts [new file with mode: 0644]
arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts
arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi
arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi
arch/arm64/boot/dts/rockchip/rk3399.dtsi
arch/arm64/boot/dts/sprd/whale2.dtsi
arch/arm64/boot/dts/xilinx/zynqmp-zc1751-xm016-dc2.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts
arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts
arch/arm64/boot/dts/zte/Makefile
arch/arm64/configs/defconfig
arch/arm64/include/asm/Kbuild
arch/arm64/include/asm/assembler.h
arch/arm64/include/asm/boot.h
arch/arm64/include/asm/cpufeature.h
arch/arm64/include/asm/fpsimd.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_hyp.h
arch/arm64/include/asm/kvm_ptrauth.h [new file with mode: 0644]
arch/arm64/include/asm/memory.h
arch/arm64/include/asm/sysreg.h
arch/arm64/include/asm/unistd.h
arch/arm64/include/asm/unistd32.h
arch/arm64/include/uapi/asm/kvm.h
arch/arm64/kernel/asm-offsets.c
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/fpsimd.c
arch/arm64/kernel/perf_event.c
arch/arm64/kernel/signal.c
arch/arm64/kernel/vdso/Makefile
arch/arm64/kvm/Makefile
arch/arm64/kvm/fpsimd.c
arch/arm64/kvm/guest.c
arch/arm64/kvm/handle_exit.c
arch/arm64/kvm/hyp/entry.S
arch/arm64/kvm/hyp/switch.c
arch/arm64/kvm/pmu.c [new file with mode: 0644]
arch/arm64/kvm/reset.c
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/sys_regs.h
arch/arm64/mm/dma-mapping.c
arch/arm64/mm/fault.c
arch/arm64/mm/init.c
arch/arm64/mm/mmu.c
arch/arm64/net/Makefile
arch/arm64/xen/Makefile
arch/c6x/include/asm/Kbuild
arch/c6x/lib/Makefile
arch/c6x/mm/Makefile
arch/c6x/platforms/Makefile
arch/csky/Kconfig
arch/csky/Kconfig.debug
arch/csky/Makefile
arch/csky/abiv1/Makefile
arch/csky/abiv2/Makefile
arch/csky/boot/Makefile
arch/csky/boot/dts/Makefile
arch/csky/boot/dts/include/dt-bindings [deleted symlink]
arch/csky/include/asm/Kbuild
arch/csky/kernel/Makefile
arch/csky/lib/Makefile
arch/csky/mm/Makefile
arch/h8300/Kconfig
arch/h8300/Kconfig.debug
arch/h8300/include/asm/Kbuild
arch/h8300/include/asm/uaccess.h [deleted file]
arch/h8300/kernel/setup.c
arch/h8300/lib/Makefile
arch/h8300/mm/Makefile
arch/hexagon/Kconfig.debug
arch/hexagon/include/asm/Kbuild
arch/hexagon/include/asm/uaccess.h
arch/hexagon/lib/Makefile
arch/hexagon/mm/Makefile
arch/ia64/hp/common/Makefile
arch/ia64/hp/zx1/Makefile
arch/ia64/include/asm/segment.h [deleted file]
arch/ia64/kernel/Makefile.gate
arch/ia64/kernel/esi.c
arch/ia64/kernel/esi_stub.S
arch/ia64/kernel/machvec.c
arch/ia64/kernel/mca.c
arch/ia64/kernel/mca_drv.c
arch/ia64/kernel/palinfo.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/perfmon_default_smpl.c
arch/ia64/kernel/sal.c
arch/ia64/kernel/salinfo.c
arch/ia64/kernel/smp.c
arch/ia64/kernel/smpboot.c
arch/ia64/kernel/syscalls/syscall.tbl
arch/ia64/kernel/time.c
arch/ia64/lib/flush.S
arch/ia64/mm/tlb.c
arch/ia64/pci/Makefile
arch/ia64/pci/pci.c
arch/m68k/amiga/Makefile
arch/m68k/apollo/Makefile
arch/m68k/atari/Makefile
arch/m68k/bvme6000/Makefile
arch/m68k/emu/Makefile
arch/m68k/hp300/Makefile
arch/m68k/kernel/syscalls/syscall.tbl
arch/m68k/kernel/time.c
arch/m68k/mac/Makefile
arch/m68k/mac/psc.c
arch/m68k/math-emu/Makefile
arch/m68k/mvme147/Makefile
arch/m68k/mvme16x/Makefile
arch/m68k/q40/Makefile
arch/m68k/sun3/Makefile
arch/m68k/sun3/prom/Makefile
arch/m68k/sun3x/Makefile
arch/microblaze/Kconfig
arch/microblaze/Kconfig.debug
arch/microblaze/Kconfig.platform
arch/microblaze/kernel/syscalls/syscall.tbl
arch/microblaze/mm/Makefile
arch/microblaze/pci/Makefile
arch/mips/Kconfig
arch/mips/alchemy/Makefile
arch/mips/alchemy/common/Makefile
arch/mips/alchemy/common/platform.c
arch/mips/alchemy/common/usb.c
arch/mips/alchemy/common/vss.c
arch/mips/alchemy/devboards/Makefile
arch/mips/alchemy/devboards/bcsr.c
arch/mips/ath79/clock.c
arch/mips/ath79/setup.c
arch/mips/bcm47xx/Makefile
arch/mips/bcm63xx/boards/Makefile
arch/mips/bmips/Makefile
arch/mips/boot/dts/mscc/Makefile
arch/mips/boot/dts/ni/Makefile
arch/mips/cavium-octeon/oct_ilm.c
arch/mips/cobalt/Makefile
arch/mips/cobalt/buttons.c
arch/mips/cobalt/lcd.c
arch/mips/cobalt/led.c
arch/mips/cobalt/mtd.c
arch/mips/cobalt/rtc.c
arch/mips/cobalt/serial.c
arch/mips/cobalt/time.c
arch/mips/configs/ip22_defconfig
arch/mips/configs/ip27_defconfig
arch/mips/dec/Makefile
arch/mips/dec/prom/Makefile
arch/mips/emma/Makefile
arch/mips/fw/cfe/Makefile
arch/mips/fw/lib/Makefile
arch/mips/fw/sni/Makefile
arch/mips/generic/init.c
arch/mips/include/asm/Kbuild
arch/mips/include/asm/bitops.h
arch/mips/include/asm/ds1287.h
arch/mips/include/asm/irq_gt641xx.h
arch/mips/include/asm/mach-cobalt/mach-gt64120.h
arch/mips/include/asm/mach-ip27/topology.h
arch/mips/include/asm/mach-rc32434/cpu-feature-overrides.h
arch/mips/include/asm/pci/bridge.h
arch/mips/include/asm/sn/irq_alloc.h [new file with mode: 0644]
arch/mips/include/asm/xtalk/xtalk.h
arch/mips/jazz/Makefile
arch/mips/jz4740/board-qi_lb60.c
arch/mips/kernel/cevt-ds1287.c
arch/mips/kernel/cevt-gt641xx.c
arch/mips/kernel/cpu-bugs64.c
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/early_printk_8250.c
arch/mips/kernel/irq-gt641xx.c
arch/mips/kernel/perf_event_mipsxx.c
arch/mips/kernel/stacktrace.c
arch/mips/kernel/syscalls/syscall_n32.tbl
arch/mips/kernel/syscalls/syscall_n64.tbl
arch/mips/kernel/syscalls/syscall_o32.tbl
arch/mips/lantiq/falcon/Makefile
arch/mips/lantiq/xway/Makefile
arch/mips/lasat/picvue.c
arch/mips/lasat/picvue_proc.c
arch/mips/loongson32/Makefile
arch/mips/loongson32/common/Makefile
arch/mips/loongson32/ls1b/Makefile
arch/mips/loongson32/ls1c/Makefile
arch/mips/loongson64/Makefile
arch/mips/loongson64/common/cs5536/Makefile
arch/mips/loongson64/fuloong-2e/Makefile
arch/mips/loongson64/lemote-2f/Makefile
arch/mips/loongson64/loongson-3/Makefile
arch/mips/net/Makefile
arch/mips/netlogic/Makefile
arch/mips/netlogic/xlr/Makefile
arch/mips/pci/Makefile
arch/mips/pci/ops-bridge.c [deleted file]
arch/mips/pci/pci-ar2315.c
arch/mips/pci/pci-ip27.c
arch/mips/pci/pci-xtalk-bridge.c [new file with mode: 0644]
arch/mips/pic32/Makefile
arch/mips/pic32/common/Makefile
arch/mips/pic32/pic32mzda/Makefile
arch/mips/pistachio/Makefile
arch/mips/pnx833x/Makefile
arch/mips/pnx833x/Platform
arch/mips/pnx833x/common/Makefile
arch/mips/pnx833x/stb22x/Makefile
arch/mips/power/Makefile
arch/mips/rb532/Makefile
arch/mips/rb532/prom.c
arch/mips/sgi-ip22/ip22-gio.c
arch/mips/sgi-ip22/ip22-platform.c
arch/mips/sgi-ip27/ip27-init.c
arch/mips/sgi-ip27/ip27-irq.c
arch/mips/sgi-ip27/ip27-xtalk.c
arch/mips/sgi-ip32/Makefile
arch/mips/sibyte/bcm1480/Makefile
arch/mips/sibyte/common/Makefile
arch/mips/sibyte/sb1250/Makefile
arch/mips/sibyte/swarm/Makefile
arch/mips/sni/Makefile
arch/mips/txx9/generic/setup.c
arch/mips/txx9/jmr3927/Makefile
arch/mips/txx9/rbtx4927/Makefile
arch/mips/txx9/rbtx4938/Makefile
arch/mips/txx9/rbtx4939/Makefile
arch/mips/vr41xx/casio-e55/Makefile
arch/mips/vr41xx/common/Makefile
arch/mips/vr41xx/common/giu.c
arch/mips/vr41xx/common/rtc.c
arch/mips/vr41xx/common/siu.c
arch/mips/vr41xx/ibm-workpad/Makefile
arch/nds32/Kconfig
arch/nds32/Kconfig.cpu
arch/nds32/Kconfig.debug
arch/nds32/Makefile
arch/nds32/boot/Makefile
arch/nds32/boot/dts/Makefile
arch/nds32/include/asm/Kbuild
arch/nds32/include/asm/assembler.h
arch/nds32/include/asm/barrier.h
arch/nds32/include/asm/bitfield.h
arch/nds32/include/asm/cache.h
arch/nds32/include/asm/cache_info.h
arch/nds32/include/asm/cacheflush.h
arch/nds32/include/asm/current.h
arch/nds32/include/asm/delay.h
arch/nds32/include/asm/elf.h
arch/nds32/include/asm/fixmap.h
arch/nds32/include/asm/futex.h
arch/nds32/include/asm/highmem.h
arch/nds32/include/asm/io.h
arch/nds32/include/asm/irqflags.h
arch/nds32/include/asm/l2_cache.h
arch/nds32/include/asm/linkage.h
arch/nds32/include/asm/memory.h
arch/nds32/include/asm/mmu.h
arch/nds32/include/asm/mmu_context.h
arch/nds32/include/asm/module.h
arch/nds32/include/asm/nds32.h
arch/nds32/include/asm/page.h
arch/nds32/include/asm/pgalloc.h
arch/nds32/include/asm/pgtable.h
arch/nds32/include/asm/proc-fns.h
arch/nds32/include/asm/processor.h
arch/nds32/include/asm/ptrace.h
arch/nds32/include/asm/shmparam.h
arch/nds32/include/asm/string.h
arch/nds32/include/asm/swab.h
arch/nds32/include/asm/syscall.h
arch/nds32/include/asm/syscalls.h
arch/nds32/include/asm/thread_info.h
arch/nds32/include/asm/tlb.h
arch/nds32/include/asm/tlbflush.h
arch/nds32/include/asm/uaccess.h
arch/nds32/include/asm/unistd.h
arch/nds32/include/asm/vdso.h
arch/nds32/include/asm/vdso_datapage.h
arch/nds32/include/asm/vdso_timer_info.h
arch/nds32/include/uapi/asm/auxvec.h
arch/nds32/include/uapi/asm/byteorder.h
arch/nds32/include/uapi/asm/cachectl.h
arch/nds32/include/uapi/asm/param.h
arch/nds32/include/uapi/asm/ptrace.h
arch/nds32/include/uapi/asm/sigcontext.h
arch/nds32/include/uapi/asm/unistd.h
arch/nds32/kernel/.gitignore [new file with mode: 0644]
arch/nds32/kernel/Makefile
arch/nds32/kernel/cacheinfo.c
arch/nds32/kernel/ex-exit.S
arch/nds32/kernel/ftrace.c
arch/nds32/kernel/head.S
arch/nds32/kernel/nds32_ksyms.c
arch/nds32/kernel/vdso.c
arch/nds32/kernel/vdso/.gitignore [new file with mode: 0644]
arch/nds32/kernel/vdso/Makefile
arch/nds32/kernel/vdso/gettimeofday.c
arch/nds32/lib/Makefile
arch/nds32/math-emu/Makefile
arch/nds32/mm/Makefile
arch/nds32/mm/init.c
arch/nios2/boot/compressed/console.c
arch/nios2/boot/compressed/misc.c
arch/nios2/boot/compressed/vmlinux.lds.S
arch/nios2/boot/dts/3c120_devboard.dts
arch/nios2/include/asm/Kbuild
arch/nios2/include/asm/asm-macros.h
arch/nios2/include/asm/asm-offsets.h
arch/nios2/include/asm/cache.h
arch/nios2/include/asm/cpuinfo.h
arch/nios2/include/asm/elf.h
arch/nios2/include/asm/irq.h
arch/nios2/include/asm/irqflags.h
arch/nios2/include/asm/kgdb.h
arch/nios2/include/asm/linkage.h
arch/nios2/include/asm/registers.h
arch/nios2/include/asm/setup.h
arch/nios2/include/asm/tlbflush.h
arch/nios2/kernel/asm-offsets.c
arch/nios2/kernel/cpuinfo.c
arch/nios2/kernel/insnemu.S
arch/nios2/kernel/irq.c
arch/nios2/kernel/kgdb.c
arch/nios2/kernel/prom.c
arch/nios2/kernel/vmlinux.lds.S
arch/nios2/lib/Makefile
arch/nios2/platform/Kconfig.platform
arch/nios2/platform/Makefile
arch/openrisc/Kconfig.debug
arch/openrisc/include/asm/Kbuild
arch/openrisc/kernel/ptrace.c
arch/openrisc/kernel/setup.c
arch/openrisc/kernel/traps.c
arch/openrisc/lib/Makefile
arch/openrisc/mm/Makefile
arch/openrisc/mm/init.c
arch/openrisc/mm/tlb.c
arch/parisc/boot/Makefile
arch/parisc/boot/compressed/Makefile
arch/parisc/include/asm/Kbuild
arch/parisc/kernel/ftrace.c
arch/parisc/kernel/stacktrace.c
arch/parisc/kernel/syscalls/syscall.tbl
arch/parisc/lib/Makefile
arch/parisc/mm/Makefile
arch/powerpc/Makefile
arch/powerpc/crypto/crc32c-vpmsum_glue.c
arch/powerpc/include/asm/book3s/64/hash.h
arch/powerpc/include/asm/io-workarounds.h
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/include/asm/kvm_ppc.h
arch/powerpc/include/asm/livepatch.h
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/include/asm/xive.h
arch/powerpc/include/uapi/asm/kvm.h
arch/powerpc/kernel/cacheinfo.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/syscalls/syscall.tbl
arch/powerpc/kernel/sysfs.c
arch/powerpc/kernel/traps.c
arch/powerpc/kvm/Makefile
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_64_vio_hv.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_builtin.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/book3s_xive.c
arch/powerpc/kvm/book3s_xive.h
arch/powerpc/kvm/book3s_xive_native.c [new file with mode: 0644]
arch/powerpc/kvm/book3s_xive_template.c
arch/powerpc/kvm/powerpc.c
arch/powerpc/mm/book3s32/hash_low.S
arch/powerpc/mm/book3s64/radix_tlb.c
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/platforms/40x/Makefile
arch/powerpc/platforms/4xx/Makefile
arch/powerpc/platforms/amigaone/Makefile
arch/powerpc/platforms/cell/cbe_regs.c
arch/powerpc/platforms/cell/spider-pci.c
arch/powerpc/platforms/cell/spu_callbacks.c
arch/powerpc/platforms/chrp/Makefile
arch/powerpc/platforms/maple/Makefile
arch/powerpc/platforms/pasemi/Makefile
arch/powerpc/platforms/powermac/backlight.c
arch/powerpc/platforms/powermac/pfunc_core.c
arch/powerpc/platforms/powernv/opal-hmi.c
arch/powerpc/sysdev/ge/Makefile
arch/powerpc/sysdev/xive/Makefile
arch/powerpc/sysdev/xive/native.c
arch/powerpc/xmon/spu-dis.c
arch/powerpc/xmon/spu-insns.h
arch/powerpc/xmon/spu-opc.c
arch/powerpc/xmon/spu.h
arch/riscv/Kconfig
arch/riscv/Makefile
arch/riscv/include/asm/Kbuild
arch/riscv/include/asm/bug.h
arch/riscv/include/asm/cacheflush.h
arch/riscv/include/asm/csr.h
arch/riscv/include/asm/elf.h
arch/riscv/include/asm/futex.h
arch/riscv/include/asm/irqflags.h
arch/riscv/include/asm/mmu_context.h
arch/riscv/include/asm/ptrace.h
arch/riscv/include/asm/sbi.h
arch/riscv/include/asm/sifive_l2_cache.h [new file with mode: 0644]
arch/riscv/include/asm/thread_info.h
arch/riscv/include/asm/uaccess.h
arch/riscv/kernel/Makefile
arch/riscv/kernel/asm-offsets.c
arch/riscv/kernel/cpu.c
arch/riscv/kernel/entry.S
arch/riscv/kernel/head.S
arch/riscv/kernel/irq.c
arch/riscv/kernel/perf_event.c
arch/riscv/kernel/reset.c
arch/riscv/kernel/setup.c
arch/riscv/kernel/signal.c
arch/riscv/kernel/smp.c
arch/riscv/kernel/smpboot.c
arch/riscv/kernel/stacktrace.c
arch/riscv/kernel/traps.c
arch/riscv/kernel/vdso/Makefile
arch/riscv/lib/Makefile
arch/riscv/mm/Makefile
arch/riscv/mm/cacheflush.c
arch/riscv/mm/context.c [new file with mode: 0644]
arch/riscv/mm/fault.c
arch/riscv/mm/sifive_l2_cache.c [new file with mode: 0644]
arch/riscv/net/Makefile
arch/s390/Makefile
arch/s390/boot/Makefile
arch/s390/boot/compressed/vmlinux.lds.S
arch/s390/configs/defconfig [moved from arch/s390/defconfig with 100% similarity]
arch/s390/include/asm/cpacf.h
arch/s390/include/asm/kvm_host.h
arch/s390/include/asm/livepatch.h
arch/s390/include/asm/segment.h [deleted file]
arch/s390/include/uapi/asm/kvm.h
arch/s390/kernel/ptrace.c
arch/s390/kernel/syscalls/syscall.tbl
arch/s390/kvm/Kconfig
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/vsie.c
arch/s390/mm/kasan_init.c
arch/s390/tools/gen_facilities.c
arch/sh/Makefile
arch/sh/boards/board-apsh4a3a.c
arch/sh/boards/board-apsh4ad0a.c
arch/sh/boards/board-edosk7705.c
arch/sh/boards/board-edosk7760.c
arch/sh/boards/board-espt.c
arch/sh/boards/board-urquell.c
arch/sh/boards/mach-microdev/setup.c
arch/sh/boards/mach-sdk7786/fpga.c
arch/sh/boards/mach-sdk7786/setup.c
arch/sh/boards/mach-sdk7786/sram.c
arch/sh/boards/mach-se/7343/irq.c
arch/sh/boards/mach-se/7722/irq.c
arch/sh/boot/.gitignore
arch/sh/boot/dts/Makefile
arch/sh/cchips/hd6446x/Makefile
arch/sh/drivers/pci/pci-sh7751.c
arch/sh/drivers/pci/pci-sh7780.c
arch/sh/drivers/pci/pcie-sh7786.c
arch/sh/include/asm/Kbuild
arch/sh/kernel/syscalls/syscall.tbl
arch/sh/kernel/vsyscall/Makefile
arch/sh/math-emu/Makefile
arch/sh/mm/init.c
arch/sh/mm/pmb.c
arch/sh/mm/uncached.c
arch/sparc/Kconfig
arch/sparc/crypto/aes_glue.c
arch/sparc/crypto/camellia_glue.c
arch/sparc/crypto/crc32c_glue.c
arch/sparc/crypto/des_glue.c
arch/sparc/crypto/md5_glue.c
arch/sparc/crypto/sha1_glue.c
arch/sparc/crypto/sha256_glue.c
arch/sparc/crypto/sha512_glue.c
arch/sparc/include/asm/uprobes.h
arch/sparc/include/uapi/asm/oradax.h
arch/sparc/kernel/chmc.c
arch/sparc/kernel/ds.c
arch/sparc/kernel/helpers.S
arch/sparc/kernel/led.c
arch/sparc/kernel/nmi.c
arch/sparc/kernel/of_device_common.c
arch/sparc/kernel/pcr.c
arch/sparc/kernel/ptrace_64.c
arch/sparc/kernel/stacktrace.c
arch/sparc/kernel/syscalls/syscall.tbl
arch/sparc/kernel/time_64.c
arch/sparc/kernel/traps_64.c
arch/sparc/kernel/uprobes.c
arch/sparc/lib/divdi3.S
arch/sparc/lib/muldi3.S
arch/sparc/lib/udivdi3.S
arch/sparc/math-emu/Makefile
arch/sparc/net/Makefile
arch/sparc/oprofile/Makefile
arch/sparc/power/Makefile
arch/sparc/vdso/Makefile
arch/um/drivers/mmapper_kern.c
arch/um/include/asm/mmu_context.h
arch/unicore32/configs/unicore32_defconfig
arch/unicore32/include/asm/Kbuild
arch/unicore32/include/asm/memory.h
arch/unicore32/include/asm/mmu_context.h
arch/unicore32/mm/init.c
arch/unicore32/mm/ioremap.c
arch/unicore32/mm/mmu.c
arch/x86/Kconfig
arch/x86/Kconfig.debug
arch/x86/crypto/aes_glue.c
arch/x86/entry/entry_64.S
arch/x86/entry/syscalls/syscall_32.tbl
arch/x86/entry/syscalls/syscall_64.tbl
arch/x86/entry/vdso/vdso2c.c
arch/x86/entry/vsyscall/Makefile
arch/x86/events/Makefile
arch/x86/events/amd/core.c
arch/x86/events/amd/iommu.c
arch/x86/events/intel/bts.c
arch/x86/events/intel/core.c
arch/x86/events/intel/rapl.c
arch/x86/events/intel/uncore.c
arch/x86/events/perf_event.h
arch/x86/hyperv/Makefile
arch/x86/ia32/Makefile
arch/x86/ia32/ia32_aout.c
arch/x86/include/asm/arch_hweight.h
arch/x86/include/asm/e820/api.h
arch/x86/include/asm/ftrace.h
arch/x86/include/asm/hyperv-tlfs.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/livepatch.h
arch/x86/include/asm/mmu_context.h
arch/x86/include/asm/mpx.h
arch/x86/include/asm/msr-index.h
arch/x86/include/asm/orc_lookup.h
arch/x86/include/asm/orc_types.h
arch/x86/include/asm/text-patching.h
arch/x86/include/asm/vdso.h
arch/x86/kernel/Makefile
arch/x86/kernel/acpi/cstate.c
arch/x86/kernel/alternative.c
arch/x86/kernel/apic/apic.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/intel_epb.c
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/dev-mcelog.c
arch/x86/kernel/cpu/mce/therm_throt.c
arch/x86/kernel/cpu/microcode/Makefile
arch/x86/kernel/cpu/mtrr/Makefile
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/crash.c
arch/x86/kernel/e820.c
arch/x86/kernel/fpu/Makefile
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/init.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/ftrace.c
arch/x86/kernel/ftrace_32.S
arch/x86/kernel/ftrace_64.S
arch/x86/kernel/hpet.c
arch/x86/kernel/irq.c
arch/x86/kernel/kprobes/Makefile
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/kvm.c
arch/x86/kernel/livepatch.c
arch/x86/kernel/nmi.c
arch/x86/kernel/process_64.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/setup.c
arch/x86/kernel/traps.c
arch/x86/kernel/tsc.c
arch/x86/kernel/unwind_frame.c
arch/x86/kernel/unwind_guess.c
arch/x86/kernel/unwind_orc.c
arch/x86/kvm/cpuid.c
arch/x86/kvm/hyperv.c
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu.c
arch/x86/kvm/mtrr.c
arch/x86/kvm/paging_tmpl.h
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/capabilities.h
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/pmu_intel.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h
arch/x86/lib/clear_page_64.S
arch/x86/lib/cpu.c
arch/x86/lib/memcpy_64.S
arch/x86/lib/usercopy_64.c
arch/x86/mm/Makefile
arch/x86/mm/debug_pagetables.c
arch/x86/mm/extable.c
arch/x86/mm/highmem_32.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/ioremap.c
arch/x86/mm/mem_encrypt.c
arch/x86/mm/mm_internal.h
arch/x86/mm/mpx.c
arch/x86/mm/numa.c
arch/x86/mm/pageattr.c
arch/x86/mm/pat.c
arch/x86/mm/testmmiotrace.c
arch/x86/mm/tlb.c
arch/x86/net/Makefile
arch/x86/pci/common.c
arch/x86/pci/legacy.c
arch/x86/pci/xen.c
arch/x86/platform/atom/Makefile
arch/x86/platform/ce4100/Makefile
arch/x86/platform/efi/quirks.c
arch/x86/platform/geode/Makefile
arch/x86/platform/goldfish/Makefile
arch/x86/platform/intel-mid/Makefile
arch/x86/platform/intel-quark/Makefile
arch/x86/platform/intel-quark/imr.c
arch/x86/platform/intel/Makefile
arch/x86/platform/iris/Makefile
arch/x86/platform/olpc/olpc_dt.c
arch/x86/platform/olpc/olpc_ofw.c
arch/x86/platform/pvh/enlighten.c
arch/x86/platform/scx200/Makefile
arch/x86/platform/scx200/scx200_32.c
arch/x86/platform/sfi/Makefile
arch/x86/platform/ts5500/Makefile
arch/x86/platform/uv/Makefile
arch/x86/video/Makefile
arch/x86/xen/efi.c
arch/x86/xen/enlighten_pv.c
arch/x86/xen/enlighten_pvh.c
arch/x86/xen/time.c
arch/x86/xen/xen-ops.h
arch/xtensa/boot/lib/Makefile
arch/xtensa/include/asm/Kbuild
arch/xtensa/include/asm/irqflags.h
arch/xtensa/include/asm/segment.h [deleted file]
arch/xtensa/kernel/smp.c
arch/xtensa/kernel/syscalls/syscall.tbl
arch/xtensa/lib/Makefile
arch/xtensa/mm/Makefile
arch/xtensa/platforms/iss/Makefile
arch/xtensa/platforms/xt2000/Makefile
arch/xtensa/platforms/xtfpga/Makefile
arch/xtensa/platforms/xtfpga/setup.c
block/bio-integrity.c
crypto/camellia_generic.c
crypto/hmac.c
crypto/simd.c
crypto/twofish_common.c
crypto/twofish_generic.c
crypto/xcbc.c
drivers/accessibility/Makefile
drivers/accessibility/braille/Makefile
drivers/acpi/acpi_apd.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/arm64/Kconfig
drivers/acpi/arm64/Makefile
drivers/acpi/custom_method.c
drivers/acpi/debugfs.c
drivers/acpi/device_sysfs.c
drivers/acpi/dptf/Makefile
drivers/acpi/hmat/Makefile
drivers/acpi/nfit/Makefile
drivers/acpi/processor_core.c
drivers/acpi/scan.c
drivers/acpi/sleep.c
drivers/amba/Makefile
drivers/amba/tegra-ahb.c
drivers/android/Makefile
drivers/ata/acard-ahci.c
drivers/ata/ahci.c
drivers/ata/ahci.h
drivers/ata/ahci_xgene.c
drivers/ata/ata_piix.c
drivers/ata/libahci.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/ata/libata-trace.c
drivers/ata/libata.h
drivers/ata/pata_acpi.c
drivers/ata/pata_amd.c
drivers/ata/pata_artop.c
drivers/ata/pata_atiixp.c
drivers/ata/pata_cmd640.c
drivers/ata/pata_cmd64x.c
drivers/ata/pata_cypress.c
drivers/ata/pata_efar.c
drivers/ata/pata_ep93xx.c
drivers/ata/pata_ftide010.c
drivers/ata/pata_hpt366.c
drivers/ata/pata_hpt37x.c
drivers/ata/pata_hpt3x2n.c
drivers/ata/pata_icside.c
drivers/ata/pata_isapnp.c
drivers/ata/pata_it8213.c
drivers/ata/pata_jmicron.c
drivers/ata/pata_legacy.c
drivers/ata/pata_macio.c
drivers/ata/pata_marvell.c
drivers/ata/pata_mpiix.c
drivers/ata/pata_netcell.c
drivers/ata/pata_ninja32.c
drivers/ata/pata_ns87410.c
drivers/ata/pata_ns87415.c
drivers/ata/pata_oldpiix.c
drivers/ata/pata_opti.c
drivers/ata/pata_optidma.c
drivers/ata/pata_pcmcia.c
drivers/ata/pata_pdc202xx_old.c
drivers/ata/pata_pxa.c
drivers/ata/pata_radisys.c
drivers/ata/pata_rdc.c
drivers/ata/pata_rz1000.c
drivers/ata/pata_serverworks.c
drivers/ata/pata_sis.c
drivers/ata/pata_sl82c105.c
drivers/ata/pata_via.c
drivers/ata/pdc_adma.c
drivers/ata/sata_gemini.c
drivers/ata/sata_nv.c
drivers/ata/sata_promise.c
drivers/ata/sata_promise.h
drivers/ata/sata_rcar.c
drivers/ata/sata_sil.c
drivers/ata/sata_sis.c
drivers/ata/sata_svw.c
drivers/ata/sata_sx4.c
drivers/ata/sata_uli.c
drivers/ata/sata_via.c
drivers/ata/sata_vsc.c
drivers/atm/adummy.c
drivers/atm/atmtcp.c
drivers/atm/eni.c
drivers/atm/idt77105.c
drivers/atm/nicstar.c
drivers/atm/suni.c
drivers/atm/uPD98402.c
drivers/atm/zatm.c
drivers/base/power/domain.c
drivers/block/amiflop.c
drivers/block/aoe/Makefile
drivers/block/ataflop.c
drivers/block/brd.c
drivers/block/floppy.c
drivers/block/mtip32xx/Makefile
drivers/block/null_blk_main.c
drivers/block/ps3vram.c
drivers/block/rbd.c
drivers/block/rsxx/Makefile
drivers/block/sunvdc.c
drivers/block/virtio_blk.c
drivers/block/xen-blkback/Makefile
drivers/block/zram/Makefile
drivers/bus/tegra-aconnect.c
drivers/bus/ti-sysc.c
drivers/cdrom/gdrom.c
drivers/char/agp/amd64-agp.c
drivers/char/agp/uninorth-agp.c
drivers/char/agp/via-agp.c
drivers/char/apm-emulation.c
drivers/char/applicom.c
drivers/char/ds1620.c
drivers/char/dtlk.c
drivers/char/efirtc.c
drivers/char/hw_random/Kconfig
drivers/char/hw_random/n2-drv.c
drivers/char/hw_random/xgene-rng.c
drivers/char/ipmi/Kconfig
drivers/char/lp.c
drivers/char/mwave/Makefile
drivers/char/nsc_gpio.c
drivers/char/nvram.c
drivers/char/nwbutton.c
drivers/char/nwflash.c
drivers/char/pc8736x_gpio.c
drivers/char/pcmcia/Kconfig
drivers/char/pcmcia/Makefile
drivers/char/pcmcia/scr24x_cs.c
drivers/char/powernv-op-panel.c
drivers/char/raw.c
drivers/char/scx200_gpio.c
drivers/char/tpm/Kconfig
drivers/char/tpm/st33zp24/Kconfig
drivers/char/tpm/st33zp24/i2c.c
drivers/char/tpm/st33zp24/spi.c
drivers/char/tpm/st33zp24/st33zp24.c
drivers/char/tpm/tpm_i2c_atmel.c
drivers/char/tpm/tpm_i2c_nuvoton.c
drivers/char/xilinx_hwicap/Makefile
drivers/char/xillybus/Kconfig
drivers/char/xillybus/Makefile
drivers/clk/actions/Kconfig
drivers/clk/actions/Makefile
drivers/clk/analogbits/Kconfig
drivers/clk/axis/Makefile
drivers/clk/axs10x/Makefile
drivers/clk/axs10x/i2s_pll_clock.c
drivers/clk/axs10x/pll_clock.c
drivers/clk/bcm/Kconfig
drivers/clk/bcm/clk-bcm2835-aux.c
drivers/clk/bcm/clk-bcm2835.c
drivers/clk/bcm/clk-kona.c
drivers/clk/berlin/Makefile
drivers/clk/berlin/berlin2-div.c
drivers/clk/berlin/bg2.c
drivers/clk/berlin/bg2q.c
drivers/clk/clk-fixed-mmio.c
drivers/clk/clk-fractional-divider.c
drivers/clk/clk-hsdk-pll.c
drivers/clk/clk-multiplier.c
drivers/clk/davinci/pll-da850.c
drivers/clk/h8300/Makefile
drivers/clk/h8300/clk-div.c
drivers/clk/h8300/clk-h8s2678.c
drivers/clk/hisilicon/Kconfig
drivers/clk/hisilicon/clk-hi3519.c
drivers/clk/hisilicon/clk-hi3620.c
drivers/clk/hisilicon/clk-hi3660-stub.c
drivers/clk/hisilicon/clk-hip04.c
drivers/clk/hisilicon/clk.c
drivers/clk/hisilicon/clk.h
drivers/clk/hisilicon/clkgate-separated.c
drivers/clk/hisilicon/crg-hi3516cv300.c
drivers/clk/hisilicon/crg-hi3798cv200.c
drivers/clk/hisilicon/reset.c
drivers/clk/hisilicon/reset.h
drivers/clk/imgtec/Kconfig
drivers/clk/imgtec/Makefile
drivers/clk/imx/clk-composite-8m.c
drivers/clk/imx/clk-frac-pll.c
drivers/clk/imx/clk-imx21.c
drivers/clk/imx/clk-imx25.c
drivers/clk/imx/clk-imx27.c
drivers/clk/imx/clk-imx31.c
drivers/clk/imx/clk-pfdv2.c
drivers/clk/imx/clk-pllv4.c
drivers/clk/imx/clk-sccg-pll.c
drivers/clk/ingenic/Kconfig
drivers/clk/ingenic/Makefile
drivers/clk/ingenic/cgu.c
drivers/clk/ingenic/jz4740-cgu.c
drivers/clk/ingenic/jz4770-cgu.c
drivers/clk/ingenic/jz4780-cgu.c
drivers/clk/keystone/Kconfig
drivers/clk/keystone/Makefile
drivers/clk/loongson1/Makefile
drivers/clk/loongson1/clk-loongson1c.c
drivers/clk/mediatek/Kconfig
drivers/clk/meson/Kconfig
drivers/clk/meson/Makefile
drivers/clk/microchip/Makefile
drivers/clk/microchip/clk-core.c
drivers/clk/microchip/clk-pic32mzda.c
drivers/clk/mvebu/Kconfig
drivers/clk/mvebu/armada-37xx-periph.c
drivers/clk/mvebu/armada-37xx-tbg.c
drivers/clk/mvebu/clk-corediv.c
drivers/clk/mxs/Makefile
drivers/clk/nxp/Makefile
drivers/clk/nxp/clk-lpc18xx-ccu.c
drivers/clk/nxp/clk-lpc18xx-cgu.c
drivers/clk/nxp/clk-lpc32xx.c
drivers/clk/pistachio/Makefile
drivers/clk/pxa/Makefile
drivers/clk/pxa/clk-pxa.c
drivers/clk/qcom/Kconfig
drivers/clk/renesas/clk-r8a73a4.c
drivers/clk/renesas/clk-r8a7740.c
drivers/clk/renesas/clk-rcar-gen2.c
drivers/clk/renesas/clk-rz.c
drivers/clk/renesas/clk-sh73a0.c
drivers/clk/renesas/r9a06g032-clocks.c
drivers/clk/renesas/rcar-usb2-clock-sel.c
drivers/clk/renesas/renesas-cpg-mssr.c
drivers/clk/rockchip/clk-half-divider.c
drivers/clk/rockchip/clk-px30.c
drivers/clk/rockchip/clk-rk3036.c
drivers/clk/rockchip/clk-rk3128.c
drivers/clk/rockchip/clk-rk3188.c
drivers/clk/rockchip/clk-rk3228.c
drivers/clk/rockchip/clk-rk3288.c
drivers/clk/rockchip/clk-rk3328.c
drivers/clk/rockchip/clk-rk3368.c
drivers/clk/rockchip/clk-rk3399.c
drivers/clk/rockchip/clk-rv1108.c
drivers/clk/rockchip/clk.c
drivers/clk/samsung/Kconfig
drivers/clk/samsung/clk-cpu.c
drivers/clk/samsung/clk-exynos-clkout.c
drivers/clk/samsung/clk-exynos3250.c
drivers/clk/samsung/clk-exynos4.c
drivers/clk/samsung/clk-exynos5-subcmu.c
drivers/clk/samsung/clk-exynos5250.c
drivers/clk/samsung/clk-pll.c
drivers/clk/samsung/clk-s3c2410-dclk.c
drivers/clk/samsung/clk-s3c2412.c
drivers/clk/samsung/clk-s3c2443.c
drivers/clk/samsung/clk.c
drivers/clk/sifive/Makefile
drivers/clk/sifive/fu540-prci.c
drivers/clk/sirf/Makefile
drivers/clk/sirf/clk-atlas6.c
drivers/clk/sirf/clk-atlas7.c
drivers/clk/sirf/clk-common.c
drivers/clk/sirf/clk-prima2.c
drivers/clk/socfpga/clk-gate-s10.c
drivers/clk/socfpga/clk-periph-s10.c
drivers/clk/socfpga/clk-pll-s10.c
drivers/clk/socfpga/clk.c
drivers/clk/sprd/Kconfig
drivers/clk/sprd/Makefile
drivers/clk/st/Makefile
drivers/clk/st/clkgen-mux.c
drivers/clk/sunxi-ng/Kconfig
drivers/clk/sunxi-ng/ccu-sun4i-a10.c
drivers/clk/sunxi-ng/ccu-sun50i-a64.c
drivers/clk/sunxi-ng/ccu-sun50i-h6.c
drivers/clk/sunxi-ng/ccu-sun5i.c
drivers/clk/sunxi-ng/ccu-sun6i-a31.c
drivers/clk/sunxi-ng/ccu-sun8i-a23.c
drivers/clk/sunxi-ng/ccu-sun8i-a33.c
drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
drivers/clk/sunxi-ng/ccu-sun8i-h3.c
drivers/clk/sunxi-ng/ccu-sun8i-r40.c
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
drivers/clk/sunxi-ng/ccu-sun9i-a80.c
drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
drivers/clk/sunxi-ng/ccu_div.c
drivers/clk/sunxi-ng/ccu_frac.c
drivers/clk/sunxi-ng/ccu_gate.c
drivers/clk/sunxi-ng/ccu_mmc_timing.c
drivers/clk/sunxi-ng/ccu_mp.c
drivers/clk/sunxi-ng/ccu_mult.c
drivers/clk/sunxi-ng/ccu_mux.c
drivers/clk/sunxi-ng/ccu_nk.c
drivers/clk/sunxi-ng/ccu_nkm.c
drivers/clk/sunxi-ng/ccu_nkmp.c
drivers/clk/sunxi-ng/ccu_nm.c
drivers/clk/sunxi-ng/ccu_phase.c
drivers/clk/sunxi-ng/ccu_sdm.c
drivers/clk/sunxi/Kconfig
drivers/clk/sunxi/clk-a10-mod1.c
drivers/clk/sunxi/clk-a10-pll2.c
drivers/clk/sunxi/clk-a10-ve.c
drivers/clk/sunxi/clk-a20-gmac.c
drivers/clk/sunxi/clk-mod0.c
drivers/clk/sunxi/clk-simple-gates.c
drivers/clk/sunxi/clk-sun4i-display.c
drivers/clk/sunxi/clk-sun4i-pll3.c
drivers/clk/sunxi/clk-sun4i-tcon-ch1.c
drivers/clk/sunxi/clk-sun8i-apb0.c
drivers/clk/sunxi/clk-sun8i-bus-gates.c
drivers/clk/sunxi/clk-sun8i-mbus.c
drivers/clk/sunxi/clk-sun9i-cpus.c
drivers/clk/sunxi/clk-sun9i-mmc.c
drivers/clk/sunxi/clk-sunxi.c
drivers/clk/sunxi/clk-usb.c
drivers/clk/tegra/Kconfig
drivers/clk/tegra/clk-emc.c
drivers/clk/tegra/clk-periph-fixed.c
drivers/clk/tegra/clk-sdmmc-mux.c
drivers/clk/tegra/clk.c
drivers/clk/ti/Kconfig
drivers/clk/ti/adpll.c
drivers/clk/ti/clk.c
drivers/clk/ti/fapll.c
drivers/clk/uniphier/Kconfig
drivers/clk/versatile/Kconfig
drivers/clk/versatile/Makefile
drivers/clk/versatile/clk-sp810.c
drivers/clk/x86/Makefile
drivers/clk/x86/clk-pmc-atom.c
drivers/clk/zte/Makefile
drivers/clk/zynq/Makefile
drivers/clk/zynqmp/clkc.c
drivers/clocksource/Kconfig
drivers/clocksource/Makefile
drivers/clocksource/timer-atlas7.c
drivers/clocksource/timer-atmel-tcb.c [moved from drivers/clocksource/tcb_clksrc.c with 80% similarity]
drivers/clocksource/timer-ixp4xx.c [new file with mode: 0644]
drivers/clocksource/timer-milbeaut.c
drivers/clocksource/timer-prima2.c
drivers/clocksource/timer-sun4i.c
drivers/clocksource/timer-tegra20.c
drivers/connector/Kconfig
drivers/connector/Makefile
drivers/counter/Kconfig
drivers/counter/Makefile
drivers/cpufreq/Kconfig
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/Kconfig.powerpc
drivers/cpufreq/Kconfig.x86
drivers/cpufreq/cpufreq.c
drivers/cpufreq/ia64-acpi-cpufreq.c
drivers/cpufreq/loongson1-cpufreq.c
drivers/cpufreq/sparc-us2e-cpufreq.c
drivers/cpufreq/sparc-us3-cpufreq.c
drivers/cpufreq/speedstep-centrino.c
drivers/cpuidle/Kconfig
drivers/cpuidle/Kconfig.arm
drivers/cpuidle/Kconfig.mips
drivers/cpuidle/Kconfig.powerpc
drivers/cpuidle/governors/Makefile
drivers/crypto/Kconfig
drivers/crypto/amcc/Makefile
drivers/crypto/axis/Makefile
drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/bcm/Makefile
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamalg_qi.c
drivers/crypto/caam/caamalg_qi2.c
drivers/crypto/caam/ctrl.c
drivers/crypto/caam/error.c
drivers/crypto/caam/jr.c
drivers/crypto/caam/regs.h
drivers/crypto/cavium/Makefile
drivers/crypto/cavium/cpt/Kconfig
drivers/crypto/cavium/cpt/Makefile
drivers/crypto/cavium/nitrox/Kconfig
drivers/crypto/cavium/nitrox/nitrox_main.c
drivers/crypto/ccp/Kconfig
drivers/crypto/chelsio/Kconfig
drivers/crypto/chelsio/Makefile
drivers/crypto/chelsio/chcr_algo.c
drivers/crypto/chelsio/chcr_core.c
drivers/crypto/chelsio/chcr_ipsec.c
drivers/crypto/chelsio/chtls/Makefile
drivers/crypto/inside-secure/Makefile
drivers/crypto/ixp4xx_crypto.c
drivers/crypto/marvell/Makefile
drivers/crypto/mediatek/Makefile
drivers/crypto/n2_core.c
drivers/crypto/nx/Kconfig
drivers/crypto/nx/nx-842-pseries.c
drivers/crypto/padlock-aes.c
drivers/crypto/qat/Kconfig
drivers/crypto/qat/qat_c3xxx/Makefile
drivers/crypto/qat/qat_c3xxxvf/Makefile
drivers/crypto/qat/qat_c62x/Makefile
drivers/crypto/qat/qat_c62xvf/Makefile
drivers/crypto/qat/qat_dh895xcc/Makefile
drivers/crypto/qat/qat_dh895xccvf/Makefile
drivers/crypto/rockchip/Makefile
drivers/crypto/stm32/Kconfig
drivers/crypto/stm32/Makefile
drivers/crypto/sunxi-ss/Makefile
drivers/crypto/virtio/Kconfig
drivers/crypto/virtio/virtio_crypto_algs.c
drivers/crypto/virtio/virtio_crypto_common.h
drivers/crypto/virtio/virtio_crypto_core.c
drivers/crypto/virtio/virtio_crypto_mgr.c
drivers/crypto/vmx/Kconfig
drivers/crypto/vmx/aesp8-ppc.pl
drivers/crypto/vmx/ghash.c
drivers/dax/Kconfig
drivers/dax/pmem/Makefile
drivers/dax/pmem/core.c
drivers/dca/Kconfig
drivers/dca/Makefile
drivers/devfreq/Kconfig
drivers/devfreq/event/Kconfig
drivers/devfreq/event/Makefile
drivers/dio/Makefile
drivers/dma-buf/Kconfig
drivers/dma-buf/Makefile
drivers/dma-buf/dma-fence.c
drivers/dma/Kconfig
drivers/dma/bestcomm/Kconfig
drivers/dma/dmaengine.c
drivers/dma/dw-axi-dmac/Makefile
drivers/dma/hsu/Kconfig
drivers/dma/hsu/Makefile
drivers/dma/ioat/Makefile
drivers/dma/ioat/dma.h
drivers/dma/ioat/hw.h
drivers/dma/ioat/registers.h
drivers/dma/ipu/Makefile
drivers/dma/mediatek/Kconfig
drivers/dma/mediatek/Makefile
drivers/dma/mmp_tdma.c
drivers/dma/mpc512x_dma.c
drivers/dma/mv_xor_v2.c
drivers/dma/ppc4xx/Makefile
drivers/dma/ppc4xx/adma.c
drivers/dma/qcom/Kconfig
drivers/dma/sirf-dma.c
drivers/dma/ti/Kconfig
drivers/dma/ti/cppi41.c
drivers/dma/xgene-dma.c
drivers/dma/xilinx/Makefile
drivers/edac/Kconfig
drivers/edac/amd64_edac.c
drivers/edac/debugfs.c
drivers/edac/edac_mc.c
drivers/edac/ie31200_edac.c
drivers/edac/mce_amd.c
drivers/edac/wq.c
drivers/edac/xgene_edac.c
drivers/eisa/Kconfig
drivers/extcon/Kconfig
drivers/firewire/Kconfig
drivers/firewire/net.c
drivers/firmware/Kconfig
drivers/firmware/Makefile
drivers/firmware/arm_scmi/Makefile
drivers/firmware/arm_scmi/driver.c
drivers/firmware/broadcom/Kconfig
drivers/firmware/broadcom/Makefile
drivers/firmware/dmi-sysfs.c
drivers/firmware/dmi_scan.c
drivers/firmware/efi/Kconfig
drivers/firmware/efi/test/Makefile
drivers/firmware/google/Kconfig
drivers/firmware/google/gsmi.c
drivers/firmware/imx/Kconfig
drivers/firmware/imx/Makefile
drivers/firmware/imx/imx-scu-irq.c [new file with mode: 0644]
drivers/firmware/imx/imx-scu.c
drivers/firmware/imx/scu-pd.c
drivers/firmware/meson/Kconfig
drivers/firmware/meson/Makefile
drivers/firmware/psci/Kconfig
drivers/firmware/tegra/Kconfig
drivers/firmware/tegra/Makefile
drivers/firmware/ti_sci.c
drivers/firmware/ti_sci.h
drivers/firmware/trusted_foundations.c [moved from arch/arm/firmware/trusted_foundations.c with 62% similarity]
drivers/firmware/xilinx/zynqmp-debug.c
drivers/firmware/xilinx/zynqmp.c
drivers/fmc/Kconfig
drivers/fpga/Kconfig
drivers/fpga/Makefile
drivers/fpga/zynqmp-fpga.c [new file with mode: 0644]
drivers/fsi/Kconfig
drivers/fsi/Makefile
drivers/fsi/fsi-master-gpio.c
drivers/gnss/Kconfig
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-altera.c
drivers/gpio/gpio-ixp4xx.c [new file with mode: 0644]
drivers/gpio/gpio-thunderx.c
drivers/gpio/gpio-xgene-sb.c
drivers/gpu/Makefile
drivers/gpu/drm/Kconfig
drivers/gpu/drm/amd/acp/Kconfig
drivers/gpu/drm/amd/amdgpu/Kconfig
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
drivers/gpu/drm/amd/amdgpu/vega10_ih.c
drivers/gpu/drm/amd/amdkfd/Kconfig
drivers/gpu/drm/amd/display/Kconfig
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/arc/Kconfig
drivers/gpu/drm/arc/Makefile
drivers/gpu/drm/arm/Makefile
drivers/gpu/drm/armada/Kconfig
drivers/gpu/drm/aspeed/Kconfig
drivers/gpu/drm/aspeed/Makefile
drivers/gpu/drm/ast/Kconfig
drivers/gpu/drm/ast/Makefile
drivers/gpu/drm/atmel-hlcdc/Kconfig
drivers/gpu/drm/bochs/Kconfig
drivers/gpu/drm/bochs/Makefile
drivers/gpu/drm/bridge/Kconfig
drivers/gpu/drm/bridge/adv7511/Kconfig
drivers/gpu/drm/bridge/adv7511/Makefile
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
drivers/gpu/drm/bridge/analogix/Kconfig
drivers/gpu/drm/bridge/analogix/Makefile
drivers/gpu/drm/bridge/synopsys/Kconfig
drivers/gpu/drm/bridge/synopsys/Makefile
drivers/gpu/drm/cirrus/Kconfig
drivers/gpu/drm/cirrus/Makefile
drivers/gpu/drm/drm_of.c
drivers/gpu/drm/etnaviv/Kconfig
drivers/gpu/drm/exynos/Kconfig
drivers/gpu/drm/fsl-dcu/Kconfig
drivers/gpu/drm/gma500/Kconfig
drivers/gpu/drm/hisilicon/Kconfig
drivers/gpu/drm/hisilicon/Makefile
drivers/gpu/drm/hisilicon/hibmc/Kconfig
drivers/gpu/drm/hisilicon/hibmc/Makefile
drivers/gpu/drm/hisilicon/kirin/Kconfig
drivers/gpu/drm/hisilicon/kirin/Makefile
drivers/gpu/drm/i2c/Kconfig
drivers/gpu/drm/i810/Makefile
drivers/gpu/drm/i915/Kconfig
drivers/gpu/drm/i915/Kconfig.debug
drivers/gpu/drm/i915/gvt/debugfs.c
drivers/gpu/drm/i915/gvt/dmabuf.c
drivers/gpu/drm/i915/gvt/gtt.c
drivers/gpu/drm/i915/gvt/gtt.h
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/mmio_context.c
drivers/gpu/drm/i915/gvt/reg.h
drivers/gpu/drm/i915/gvt/scheduler.c
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/intel_breadcrumbs.c
drivers/gpu/drm/i915/intel_context.c
drivers/gpu/drm/i915/intel_context_types.h
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fbc.c
drivers/gpu/drm/i915/intel_guc_submission.c
drivers/gpu/drm/i915/intel_pipe_crc.c
drivers/gpu/drm/imx/Kconfig
drivers/gpu/drm/mediatek/Kconfig
drivers/gpu/drm/meson/Kconfig
drivers/gpu/drm/meson/Makefile
drivers/gpu/drm/meson/meson_crtc.c
drivers/gpu/drm/meson/meson_crtc.h
drivers/gpu/drm/meson/meson_drv.c
drivers/gpu/drm/meson/meson_drv.h
drivers/gpu/drm/meson/meson_dw_hdmi.c
drivers/gpu/drm/meson/meson_dw_hdmi.h
drivers/gpu/drm/meson/meson_plane.c
drivers/gpu/drm/meson/meson_plane.h
drivers/gpu/drm/meson/meson_vclk.c
drivers/gpu/drm/meson/meson_vclk.h
drivers/gpu/drm/meson/meson_venc.c
drivers/gpu/drm/meson/meson_venc.h
drivers/gpu/drm/meson/meson_venc_cvbs.c
drivers/gpu/drm/meson/meson_venc_cvbs.h
drivers/gpu/drm/meson/meson_viu.c
drivers/gpu/drm/meson/meson_viu.h
drivers/gpu/drm/meson/meson_vpp.c
drivers/gpu/drm/meson/meson_vpp.h
drivers/gpu/drm/mga/Makefile
drivers/gpu/drm/mgag200/Kconfig
drivers/gpu/drm/mgag200/Makefile
drivers/gpu/drm/msm/Kconfig
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_gem.h
drivers/gpu/drm/mxsfb/Kconfig
drivers/gpu/drm/mxsfb/Makefile
drivers/gpu/drm/nouveau/Kconfig
drivers/gpu/drm/nouveau/dispnv50/disp.h
drivers/gpu/drm/nouveau/dispnv50/head.c
drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c
drivers/gpu/drm/nouveau/dispnv50/wndw.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
drivers/gpu/drm/omapdrm/Kconfig
drivers/gpu/drm/omapdrm/displays/Kconfig
drivers/gpu/drm/omapdrm/dss/Kconfig
drivers/gpu/drm/panel/Kconfig
drivers/gpu/drm/panfrost/panfrost_device.c
drivers/gpu/drm/panfrost/panfrost_drv.c
drivers/gpu/drm/pl111/Kconfig
drivers/gpu/drm/pl111/pl111_display.c
drivers/gpu/drm/pl111/pl111_versatile.c
drivers/gpu/drm/qxl/Kconfig
drivers/gpu/drm/qxl/Makefile
drivers/gpu/drm/r128/Makefile
drivers/gpu/drm/radeon/Kconfig
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/rockchip/Kconfig
drivers/gpu/drm/savage/Makefile
drivers/gpu/drm/selftests/Makefile
drivers/gpu/drm/selftests/test-drm_mm.c
drivers/gpu/drm/sis/Makefile
drivers/gpu/drm/sti/Kconfig
drivers/gpu/drm/stm/Kconfig
drivers/gpu/drm/stm/Makefile
drivers/gpu/drm/sun4i/Kconfig
drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
drivers/gpu/drm/tdfx/Makefile
drivers/gpu/drm/tegra/Kconfig
drivers/gpu/drm/tilcdc/Kconfig
drivers/gpu/drm/tinydrm/Kconfig
drivers/gpu/drm/tinydrm/Makefile
drivers/gpu/drm/tinydrm/core/Makefile
drivers/gpu/drm/tve200/Kconfig
drivers/gpu/drm/tve200/Makefile
drivers/gpu/drm/udl/Kconfig
drivers/gpu/drm/udl/Makefile
drivers/gpu/drm/udl/udl_dmabuf.c
drivers/gpu/drm/v3d/Kconfig
drivers/gpu/drm/v3d/Makefile
drivers/gpu/drm/vc4/Kconfig
drivers/gpu/drm/vc4/vc4_dsi.c
drivers/gpu/drm/vgem/Makefile
drivers/gpu/drm/via/Makefile
drivers/gpu/drm/virtio/Kconfig
drivers/gpu/drm/vkms/Makefile
drivers/gpu/drm/xen/Kconfig
drivers/gpu/drm/zte/Kconfig
drivers/gpu/host1x/Kconfig
drivers/gpu/ipu-v3/Kconfig
drivers/gpu/vga/Kconfig
drivers/gpu/vga/Makefile
drivers/hid/Kconfig
drivers/hid/hid-aureal.c
drivers/hid/i2c-hid/Kconfig
drivers/hid/i2c-hid/Makefile
drivers/hid/intel-ish-hid/Kconfig
drivers/hid/intel-ish-hid/Makefile
drivers/hid/usbhid/Kconfig
drivers/hsi/Kconfig
drivers/hsi/clients/Kconfig
drivers/hsi/clients/Makefile
drivers/hsi/controllers/Kconfig
drivers/hsi/controllers/Makefile
drivers/hwmon/Kconfig
drivers/hwmon/aspeed-pwm-tacho.c
drivers/hwmon/g762.c
drivers/hwmon/gpio-fan.c
drivers/hwmon/hwmon.c
drivers/hwmon/k8temp.c
drivers/hwmon/ltq-cputemp.c
drivers/hwmon/mlxreg-fan.c
drivers/hwmon/npcm750-pwm-fan.c
drivers/hwmon/occ/Kconfig
drivers/hwmon/occ/Makefile
drivers/hwmon/pmbus/Kconfig
drivers/hwmon/pwm-fan.c
drivers/hwmon/ultra45_env.c
drivers/hwmon/xgene-hwmon.c
drivers/hwtracing/Kconfig
drivers/hwtracing/coresight/Kconfig
drivers/hwtracing/intel_th/Kconfig
drivers/hwtracing/stm/Kconfig
drivers/i2c/Kconfig
drivers/i2c/algos/Kconfig
drivers/i2c/algos/Makefile
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-sirf.c
drivers/i2c/busses/i2c-xgene-slimpro.c
drivers/i2c/i2c-core-base.c
drivers/i2c/muxes/Kconfig
drivers/i3c/master/Kconfig
drivers/i3c/master/Makefile
drivers/ide/Kconfig
drivers/ide/aec62xx.c
drivers/ide/ali14xx.c
drivers/ide/atiixp.c
drivers/ide/cmd640.c
drivers/ide/cmd64x.c
drivers/ide/cy82c693.c
drivers/ide/dtc2278.c
drivers/ide/hpt366.c
drivers/ide/ht6560b.c
drivers/ide/icside.c
drivers/ide/ide-4drives.c
drivers/ide/ide-atapi.c
drivers/ide/ide-dma-sff.c
drivers/ide/ide-eh.c
drivers/ide/ide-gd.c
drivers/ide/ide-io-std.c
drivers/ide/ide-ioctls.c
drivers/ide/ide-iops.c
drivers/ide/ide-legacy.c
drivers/ide/ide-lib.c
drivers/ide/ide-probe.c
drivers/ide/ide-proc.c
drivers/ide/ide-taskfile.c
drivers/ide/ide-xfer-mode.c
drivers/ide/ide.c
drivers/ide/it8213.c
drivers/ide/ns87415.c
drivers/ide/opti621.c
drivers/ide/pdc202xx_old.c
drivers/ide/qd65xx.c
drivers/ide/rapide.c
drivers/ide/rz1000.c
drivers/ide/serverworks.c
drivers/ide/sl82c105.c
drivers/ide/slc90e66.c
drivers/ide/umc8672.c
drivers/idle/Kconfig
drivers/idle/Makefile
drivers/iio/Kconfig
drivers/iio/accel/Kconfig
drivers/iio/accel/bmc150-accel-spi.c
drivers/iio/accel/kxsd9-spi.c
drivers/iio/adc/Kconfig
drivers/iio/adc/qcom-pm8xxx-xoadc.c
drivers/iio/afe/Kconfig
drivers/iio/afe/Makefile
drivers/iio/amplifiers/Kconfig
drivers/iio/amplifiers/Makefile
drivers/iio/buffer/Kconfig
drivers/iio/buffer/kfifo_buf.c
drivers/iio/chemical/Kconfig
drivers/iio/chemical/Makefile
drivers/iio/common/Kconfig
drivers/iio/common/cros_ec_sensors/Kconfig
drivers/iio/common/cros_ec_sensors/Makefile
drivers/iio/common/hid-sensors/Kconfig
drivers/iio/common/hid-sensors/Makefile
drivers/iio/common/ms_sensors/Kconfig
drivers/iio/common/ms_sensors/Makefile
drivers/iio/common/ssp_sensors/Kconfig
drivers/iio/common/ssp_sensors/Makefile
drivers/iio/common/st_sensors/Kconfig
drivers/iio/dac/Kconfig
drivers/iio/dummy/Kconfig
drivers/iio/frequency/Kconfig
drivers/iio/frequency/Makefile
drivers/iio/gyro/Kconfig
drivers/iio/gyro/bmg160_i2c.c
drivers/iio/gyro/bmg160_spi.c
drivers/iio/gyro/mpu3050-core.c
drivers/iio/gyro/mpu3050-i2c.c
drivers/iio/health/Kconfig
drivers/iio/health/Makefile
drivers/iio/humidity/Kconfig
drivers/iio/imu/Kconfig
drivers/iio/imu/bmi160/Kconfig
drivers/iio/imu/bmi160/Makefile
drivers/iio/imu/inv_mpu6050/Kconfig
drivers/iio/imu/st_lsm6dsx/Kconfig
drivers/iio/imu/st_lsm6dsx/Makefile
drivers/iio/inkern.c
drivers/iio/light/Kconfig
drivers/iio/light/bh1780.c
drivers/iio/light/cm3605.c
drivers/iio/magnetometer/Kconfig
drivers/iio/magnetometer/ak8974.c
drivers/iio/magnetometer/ak8975.c
drivers/iio/multiplexer/Kconfig
drivers/iio/multiplexer/Makefile
drivers/iio/orientation/Kconfig
drivers/iio/orientation/Makefile
drivers/iio/potentiometer/Kconfig
drivers/iio/potentiostat/Kconfig
drivers/iio/potentiostat/Makefile
drivers/iio/pressure/Kconfig
drivers/iio/pressure/bmp280-i2c.c
drivers/iio/pressure/bmp280-spi.c
drivers/iio/proximity/Kconfig
drivers/iio/resolver/Kconfig
drivers/iio/resolver/Makefile
drivers/iio/temperature/Kconfig
drivers/iio/trigger/Kconfig
drivers/infiniband/Kconfig
drivers/infiniband/Makefile
drivers/infiniband/core/addr.c
drivers/infiniband/core/nldev.c
drivers/infiniband/hw/bnxt_re/Kconfig
drivers/infiniband/hw/cxgb3/Kconfig
drivers/infiniband/hw/cxgb4/Kconfig
drivers/infiniband/hw/cxgb4/Makefile
drivers/infiniband/hw/hfi1/Kconfig
drivers/infiniband/hw/hns/Kconfig
drivers/infiniband/hw/hns/Makefile
drivers/infiniband/hw/i40iw/Kconfig
drivers/infiniband/hw/mlx4/Kconfig
drivers/infiniband/hw/mlx4/Makefile
drivers/infiniband/hw/mlx5/Kconfig
drivers/infiniband/hw/mlx5/Makefile
drivers/infiniband/hw/mlx5/devx.c
drivers/infiniband/hw/mthca/Kconfig
drivers/infiniband/hw/nes/Kconfig
drivers/infiniband/hw/nes/Makefile
drivers/infiniband/hw/ocrdma/Kconfig
drivers/infiniband/hw/ocrdma/Makefile
drivers/infiniband/hw/ocrdma/ocrdma_ah.c
drivers/infiniband/hw/ocrdma/ocrdma_hw.c
drivers/infiniband/hw/qedr/Kconfig
drivers/infiniband/hw/qedr/Makefile
drivers/infiniband/hw/qib/Kconfig
drivers/infiniband/hw/usnic/Kconfig
drivers/infiniband/hw/vmw_pvrdma/Kconfig
drivers/infiniband/hw/vmw_pvrdma/Makefile
drivers/infiniband/sw/Makefile
drivers/infiniband/sw/rdmavt/Kconfig
drivers/infiniband/sw/rdmavt/Makefile
drivers/infiniband/sw/rxe/Kconfig
drivers/infiniband/ulp/ipoib/Kconfig
drivers/infiniband/ulp/iser/Kconfig
drivers/infiniband/ulp/iser/Makefile
drivers/infiniband/ulp/isert/Kconfig
drivers/infiniband/ulp/isert/Makefile
drivers/infiniband/ulp/opa_vnic/Kconfig
drivers/infiniband/ulp/opa_vnic/Makefile
drivers/infiniband/ulp/srp/Kconfig
drivers/infiniband/ulp/srpt/Kconfig
drivers/infiniband/ulp/srpt/Makefile
drivers/input/Kconfig
drivers/input/gameport/Kconfig
drivers/input/joystick/Kconfig
drivers/input/joystick/grip_mp.c
drivers/input/joystick/iforce/Kconfig
drivers/input/joystick/iforce/Makefile
drivers/input/joystick/maplecontrol.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/dlink-dir685-touchkeys.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/tegra-kbc.c
drivers/input/misc/Kconfig
drivers/input/misc/cobalt_btns.c
drivers/input/misc/ixp4xx-beeper.c
drivers/input/misc/powermate.c
drivers/input/misc/rb532_button.c
drivers/input/misc/sgi_btns.c
drivers/input/misc/sirfsoc-onkey.c
drivers/input/misc/sparcspkr.c
drivers/input/mouse/Kconfig
drivers/input/mouse/maplemouse.c
drivers/input/rmi4/Kconfig
drivers/input/serio/Kconfig
drivers/input/serio/sun4i-ps2.c
drivers/input/tablet/Kconfig
drivers/input/tablet/kbtab.c
drivers/input/tablet/pegasus_notetaker.c
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/hp680_ts_input.c
drivers/input/touchscreen/ili210x.c
drivers/interconnect/Kconfig
drivers/interconnect/qcom/Kconfig
drivers/iommu/Kconfig
drivers/iommu/dma-iommu.c
drivers/iommu/irq_remapping.c
drivers/iommu/msm_iommu.c
drivers/ipack/Kconfig
drivers/ipack/Makefile
drivers/ipack/carriers/Kconfig
drivers/ipack/carriers/Makefile
drivers/ipack/devices/Kconfig
drivers/ipack/devices/Makefile
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/irq-bcm7038-l1.c
drivers/irqchip/irq-bcm7120-l2.c
drivers/irqchip/irq-brcmstb-l2.c
drivers/irqchip/irq-gic-pm.c
drivers/irqchip/irq-gic-v2m.c
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3-mbi.c
drivers/irqchip/irq-imx-irqsteer.c
drivers/irqchip/irq-ixp4xx.c [new file with mode: 0644]
drivers/irqchip/irq-ls-scfg-msi.c
drivers/irqchip/irq-mxs.c
drivers/irqchip/irq-renesas-intc-irqpin.c
drivers/irqchip/irq-sirfsoc.c
drivers/irqchip/irq-stm32-exti.c
drivers/irqchip/irq-ti-sci-inta.c [new file with mode: 0644]
drivers/irqchip/irq-ti-sci-intr.c [new file with mode: 0644]
drivers/isdn/Kconfig
drivers/isdn/capi/Kconfig
drivers/isdn/divert/Makefile
drivers/isdn/gigaset/Kconfig
drivers/isdn/hardware/Kconfig
drivers/isdn/hardware/Makefile
drivers/isdn/hardware/avm/Kconfig
drivers/isdn/hardware/mISDN/Kconfig
drivers/isdn/hisax/Kconfig
drivers/isdn/hisax/teles_cs.c
drivers/isdn/hysdn/Kconfig
drivers/isdn/hysdn/Makefile
drivers/isdn/i4l/Kconfig
drivers/isdn/isdnloop/Makefile
drivers/isdn/mISDN/Kconfig
drivers/isdn/mISDN/dsp_cmx.c
drivers/isdn/mISDN/socket.c
drivers/leds/Kconfig
drivers/leds/leds-clevo-mail.c
drivers/leds/leds-cobalt-qube.c
drivers/leds/leds-cobalt-raq.c
drivers/leds/leds-rb532.c
drivers/leds/leds-sunfire.c
drivers/leds/leds-tca6507.c
drivers/leds/trigger/Kconfig
drivers/lightnvm/Kconfig
drivers/lightnvm/core.c
drivers/lightnvm/pblk-cache.c
drivers/lightnvm/pblk-core.c
drivers/lightnvm/pblk-gc.c
drivers/lightnvm/pblk-init.c
drivers/lightnvm/pblk-map.c
drivers/lightnvm/pblk-rb.c
drivers/lightnvm/pblk-read.c
drivers/lightnvm/pblk-recovery.c
drivers/lightnvm/pblk-write.c
drivers/lightnvm/pblk.h
drivers/macintosh/Kconfig
drivers/macintosh/ams/Makefile
drivers/macintosh/ams/ams-core.c
drivers/macintosh/mac_hid.c
drivers/macintosh/therm_adt746x.c
drivers/macintosh/windfarm_cpufreq_clamp.c
drivers/mailbox/Kconfig
drivers/mailbox/mailbox-xgene-slimpro.c
drivers/mailbox/mtk-cmdq-mailbox.c
drivers/mcb/Kconfig
drivers/mcb/mcb-parse.c
drivers/md/Kconfig
drivers/md/Makefile
drivers/md/bcache/Kconfig
drivers/md/dm-cache-metadata.c
drivers/md/dm-crypt.c
drivers/md/dm-delay.c
drivers/md/dm-dust.c [new file with mode: 0644]
drivers/md/dm-era-target.c
drivers/md/dm-exception-store.h
drivers/md/dm-init.c
drivers/md/dm-integrity.c
drivers/md/dm-ioctl.c
drivers/md/dm-mpath.c
drivers/md/dm-rq.c
drivers/md/dm-snap.c
drivers/md/dm-target.c
drivers/md/dm-thin-metadata.c
drivers/md/dm-writecache.c
drivers/md/dm-zoned-metadata.c
drivers/md/dm-zoned-target.c
drivers/md/dm.c
drivers/md/md-bitmap.c
drivers/md/persistent-data/Kconfig
drivers/md/persistent-data/dm-space-map-common.c
drivers/media/Kconfig
drivers/media/cec/Kconfig
drivers/media/common/Kconfig
drivers/media/common/Makefile
drivers/media/common/b2c2/Kconfig
drivers/media/common/b2c2/Makefile
drivers/media/common/cypress_firmware.c
drivers/media/common/saa7146/Kconfig
drivers/media/common/saa7146/Makefile
drivers/media/common/saa7146/saa7146_fops.c
drivers/media/common/saa7146/saa7146_hlp.c
drivers/media/common/siano/Kconfig
drivers/media/common/siano/smscoreapi.h
drivers/media/common/siano/smsdvb-main.c
drivers/media/common/siano/smsdvb.h
drivers/media/common/siano/smsendian.c
drivers/media/common/siano/smsendian.h
drivers/media/common/v4l2-tpg/Kconfig
drivers/media/common/v4l2-tpg/Makefile
drivers/media/common/videobuf2/Kconfig
drivers/media/dvb-core/Kconfig
drivers/media/dvb-frontends/cxd2820r.h
drivers/media/dvb-frontends/cxd2820r_c.c
drivers/media/dvb-frontends/cxd2820r_core.c
drivers/media/dvb-frontends/cxd2820r_priv.h
drivers/media/dvb-frontends/cxd2820r_t.c
drivers/media/dvb-frontends/cxd2820r_t2.c
drivers/media/dvb-frontends/cxd2880/Makefile
drivers/media/dvb-frontends/dibx000_common.c
drivers/media/dvb-frontends/drx39xyj/Kconfig
drivers/media/dvb-frontends/drx39xyj/Makefile
drivers/media/dvb-frontends/rtl2832.c
drivers/media/dvb-frontends/rtl2832.h
drivers/media/dvb-frontends/rtl2832_priv.h
drivers/media/dvb-frontends/rtl2832_sdr.c
drivers/media/dvb-frontends/rtl2832_sdr.h
drivers/media/dvb-frontends/sp887x.c
drivers/media/dvb-frontends/tda10071.c
drivers/media/dvb-frontends/tda10071.h
drivers/media/dvb-frontends/tda10071_priv.h
drivers/media/firewire/Kconfig
drivers/media/firewire/Makefile
drivers/media/firewire/firedtv-fw.c
drivers/media/i2c/Kconfig
drivers/media/i2c/adv748x/Makefile
drivers/media/i2c/cx25840/Kconfig
drivers/media/i2c/cx25840/Makefile
drivers/media/i2c/et8ek8/Kconfig
drivers/media/i2c/et8ek8/Makefile
drivers/media/i2c/m5mols/Kconfig
drivers/media/i2c/m5mols/Makefile
drivers/media/i2c/s5c73m3/Makefile
drivers/media/i2c/smiapp/Kconfig
drivers/media/i2c/smiapp/Makefile
drivers/media/mmc/Kconfig
drivers/media/mmc/siano/Kconfig
drivers/media/mmc/siano/Makefile
drivers/media/pci/Kconfig
drivers/media/pci/b2c2/Kconfig
drivers/media/pci/b2c2/Makefile
drivers/media/pci/b2c2/flexcop-pci.c
drivers/media/pci/bt8xx/Kconfig
drivers/media/pci/bt8xx/Makefile
drivers/media/pci/cobalt/Kconfig
drivers/media/pci/cx18/Kconfig
drivers/media/pci/cx18/Makefile
drivers/media/pci/cx23885/Kconfig
drivers/media/pci/cx23885/Makefile
drivers/media/pci/cx25821/Kconfig
drivers/media/pci/cx88/Kconfig
drivers/media/pci/cx88/Makefile
drivers/media/pci/ddbridge/Kconfig
drivers/media/pci/ddbridge/Makefile
drivers/media/pci/dm1105/Kconfig
drivers/media/pci/dm1105/Makefile
drivers/media/pci/dt3155/Kconfig
drivers/media/pci/dt3155/Makefile
drivers/media/pci/intel/Makefile
drivers/media/pci/intel/ipu3/Kconfig
drivers/media/pci/intel/ipu3/Makefile
drivers/media/pci/ivtv/Kconfig
drivers/media/pci/mantis/Kconfig
drivers/media/pci/mantis/Makefile
drivers/media/pci/meye/Kconfig
drivers/media/pci/meye/Makefile
drivers/media/pci/netup_unidvb/Kconfig
drivers/media/pci/netup_unidvb/Makefile
drivers/media/pci/ngene/Kconfig
drivers/media/pci/ngene/Makefile
drivers/media/pci/pluto2/Kconfig
drivers/media/pci/pluto2/Makefile
drivers/media/pci/pt1/Kconfig
drivers/media/pci/pt1/Makefile
drivers/media/pci/pt3/Kconfig
drivers/media/pci/pt3/Makefile
drivers/media/pci/saa7134/Kconfig
drivers/media/pci/saa7146/Kconfig
drivers/media/pci/saa7146/Makefile
drivers/media/pci/saa7164/Kconfig
drivers/media/pci/smipcie/Kconfig
drivers/media/pci/smipcie/Makefile
drivers/media/pci/solo6x10/Kconfig
drivers/media/pci/solo6x10/Makefile
drivers/media/pci/sta2x11/Kconfig
drivers/media/pci/sta2x11/Makefile
drivers/media/pci/ttpci/Kconfig
drivers/media/pci/ttpci/Makefile
drivers/media/pci/tw5864/Kconfig
drivers/media/pci/tw5864/Makefile
drivers/media/pci/tw68/Kconfig
drivers/media/pci/tw68/Makefile
drivers/media/pci/tw686x/Kconfig
drivers/media/pci/tw686x/Makefile
drivers/media/platform/Kconfig
drivers/media/platform/am437x/Kconfig
drivers/media/platform/am437x/Makefile
drivers/media/platform/atmel/Kconfig
drivers/media/platform/atmel/Makefile
drivers/media/platform/atmel/atmel-isc-regs.h
drivers/media/platform/atmel/atmel-isc.c
drivers/media/platform/cadence/Kconfig
drivers/media/platform/cec-gpio/Makefile
drivers/media/platform/coda/Makefile
drivers/media/platform/coda/coda-common.c
drivers/media/platform/cros-ec-cec/Makefile
drivers/media/platform/davinci/Kconfig
drivers/media/platform/davinci/vpbe.c
drivers/media/platform/exynos-gsc/Makefile
drivers/media/platform/exynos4-is/Kconfig
drivers/media/platform/marvell-ccic/Kconfig
drivers/media/platform/marvell-ccic/Makefile
drivers/media/platform/meson/Makefile
drivers/media/platform/mtk-jpeg/Makefile
drivers/media/platform/mtk-vpu/Makefile
drivers/media/platform/omap/Kconfig
drivers/media/platform/omap/Makefile
drivers/media/platform/omap/omap_vout.c
drivers/media/platform/qcom/camss/Makefile
drivers/media/platform/rcar-vin/rcar-csi2.c
drivers/media/platform/rockchip/rga/Makefile
drivers/media/platform/s3c-camif/Makefile
drivers/media/platform/s5p-cec/Makefile
drivers/media/platform/s5p-g2d/Makefile
drivers/media/platform/s5p-jpeg/Makefile
drivers/media/platform/seco-cec/Makefile
drivers/media/platform/sti/bdisp/Makefile
drivers/media/platform/sti/c8sectpfe/Kconfig
drivers/media/platform/sti/c8sectpfe/Makefile
drivers/media/platform/sti/cec/Makefile
drivers/media/platform/sti/delta/Makefile
drivers/media/platform/sti/hva/Makefile
drivers/media/platform/stm32/Makefile
drivers/media/platform/sunxi/sun6i-csi/Kconfig
drivers/media/platform/sunxi/sun6i-csi/Makefile
drivers/media/platform/tegra-cec/Makefile
drivers/media/platform/tegra-cec/tegra_cec.c
drivers/media/platform/vicodec/Kconfig
drivers/media/platform/vimc/Kconfig
drivers/media/platform/vivid/Kconfig
drivers/media/radio/Kconfig
drivers/media/radio/Makefile
drivers/media/radio/radio-aimslab.c
drivers/media/radio/radio-aztech.c
drivers/media/radio/radio-cadet.c
drivers/media/radio/radio-gemtek.c
drivers/media/radio/radio-maxiradio.c
drivers/media/radio/radio-miropcm20.c
drivers/media/radio/radio-rtrack2.c
drivers/media/radio/radio-sf16fmi.c
drivers/media/radio/radio-sf16fmr2.c
drivers/media/radio/radio-terratec.c
drivers/media/radio/radio-trust.c
drivers/media/radio/radio-typhoon.c
drivers/media/radio/radio-zoltrix.c
drivers/media/radio/si470x/Kconfig
drivers/media/radio/si470x/Makefile
drivers/media/radio/si4713/Kconfig
drivers/media/radio/si4713/Makefile
drivers/media/radio/wl128x/Kconfig
drivers/media/radio/wl128x/Makefile
drivers/media/rc/Kconfig
drivers/media/rc/img-ir/Kconfig
drivers/media/rc/keymaps/Kconfig
drivers/media/rc/keymaps/rc-alink-dtu-m.c
drivers/media/rc/keymaps/rc-anysee.c
drivers/media/rc/keymaps/rc-ati-x10.c
drivers/media/rc/keymaps/rc-avermedia-rm-ks.c
drivers/media/rc/keymaps/rc-azurewave-ad-tu700.c
drivers/media/rc/keymaps/rc-digitalnow-tinytwin.c
drivers/media/rc/keymaps/rc-digittrade.c
drivers/media/rc/keymaps/rc-leadtek-y04g0051.c
drivers/media/rc/keymaps/rc-medion-x10-digitainer.c
drivers/media/rc/keymaps/rc-medion-x10-or2x.c
drivers/media/rc/keymaps/rc-medion-x10.c
drivers/media/rc/keymaps/rc-msi-digivox-ii.c
drivers/media/rc/keymaps/rc-msi-digivox-iii.c
drivers/media/rc/keymaps/rc-reddo.c
drivers/media/rc/keymaps/rc-snapstream-firefly.c
drivers/media/rc/keymaps/rc-terratec-slim-2.c
drivers/media/rc/keymaps/rc-terratec-slim.c
drivers/media/rc/keymaps/rc-total-media-in-hand-02.c
drivers/media/rc/keymaps/rc-total-media-in-hand.c
drivers/media/rc/keymaps/rc-trekstor.c
drivers/media/rc/keymaps/rc-twinhan1027.c
drivers/media/spi/Kconfig
drivers/media/spi/Makefile
drivers/media/tuners/Kconfig
drivers/media/tuners/e4000.c
drivers/media/tuners/e4000.h
drivers/media/tuners/e4000_priv.h
drivers/media/tuners/fc2580.c
drivers/media/tuners/fc2580.h
drivers/media/tuners/fc2580_priv.h
drivers/media/tuners/mt20xx.c
drivers/media/tuners/r820t.h
drivers/media/tuners/tda18212.c
drivers/media/tuners/tda18212.h
drivers/media/tuners/tda9887.c
drivers/media/tuners/tuner-simple.c
drivers/media/tuners/tuner-types.c
drivers/media/usb/Kconfig
drivers/media/usb/airspy/Kconfig
drivers/media/usb/airspy/Makefile
drivers/media/usb/as102/Kconfig
drivers/media/usb/as102/Makefile
drivers/media/usb/au0828/Kconfig
drivers/media/usb/au0828/Makefile
drivers/media/usb/au0828/au0828-vbi.c
drivers/media/usb/b2c2/Kconfig
drivers/media/usb/b2c2/Makefile
drivers/media/usb/b2c2/flexcop-usb.c
drivers/media/usb/cpia2/Kconfig
drivers/media/usb/cpia2/Makefile
drivers/media/usb/cx231xx/Kconfig
drivers/media/usb/cx231xx/Makefile
drivers/media/usb/dvb-usb-v2/Kconfig
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/af9035.h
drivers/media/usb/dvb-usb-v2/dvb_usb.h
drivers/media/usb/dvb-usb-v2/dvb_usb_common.h
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
drivers/media/usb/dvb-usb-v2/rtl28xxu.h
drivers/media/usb/dvb-usb/Kconfig
drivers/media/usb/em28xx/Kconfig
drivers/media/usb/em28xx/Makefile
drivers/media/usb/go7007/Kconfig
drivers/media/usb/go7007/Makefile
drivers/media/usb/gspca/Kconfig
drivers/media/usb/gspca/benq.c
drivers/media/usb/gspca/conex.c
drivers/media/usb/gspca/dtcs033.c
drivers/media/usb/gspca/finepix.c
drivers/media/usb/gspca/gl860/Kconfig
drivers/media/usb/gspca/jeilinj.c
drivers/media/usb/gspca/jl2005bcd.c
drivers/media/usb/gspca/jpeg.h
drivers/media/usb/gspca/kinect.c
drivers/media/usb/gspca/konica.c
drivers/media/usb/gspca/m5602/Kconfig
drivers/media/usb/gspca/mars.c
drivers/media/usb/gspca/mr97310a.c
drivers/media/usb/gspca/nw80x.c
drivers/media/usb/gspca/ov519.c
drivers/media/usb/gspca/ov534.c
drivers/media/usb/gspca/ov534_9.c
drivers/media/usb/gspca/pac7302.c
drivers/media/usb/gspca/pac7311.c
drivers/media/usb/gspca/sn9c2028.c
drivers/media/usb/gspca/sn9c20x.c
drivers/media/usb/gspca/sonixb.c
drivers/media/usb/gspca/sonixj.c
drivers/media/usb/gspca/spca1528.c
drivers/media/usb/gspca/spca500.c
drivers/media/usb/gspca/spca501.c
drivers/media/usb/gspca/spca505.c
drivers/media/usb/gspca/spca506.c
drivers/media/usb/gspca/spca508.c
drivers/media/usb/gspca/spca561.c
drivers/media/usb/gspca/sq905.c
drivers/media/usb/gspca/sq905c.c
drivers/media/usb/gspca/sq930x.c
drivers/media/usb/gspca/stk014.c
drivers/media/usb/gspca/stk1135.c
drivers/media/usb/gspca/stk1135.h
drivers/media/usb/gspca/stv06xx/Kconfig
drivers/media/usb/gspca/sunplus.c
drivers/media/usb/gspca/t613.c
drivers/media/usb/gspca/topro.c
drivers/media/usb/gspca/touptek.c
drivers/media/usb/gspca/tv8532.c
drivers/media/usb/gspca/vc032x.c
drivers/media/usb/gspca/vicam.c
drivers/media/usb/gspca/w996Xcf.c
drivers/media/usb/hackrf/Kconfig
drivers/media/usb/hackrf/Makefile
drivers/media/usb/hdpvr/Kconfig
drivers/media/usb/hdpvr/Makefile
drivers/media/usb/msi2500/Kconfig
drivers/media/usb/msi2500/Makefile
drivers/media/usb/pulse8-cec/Kconfig
drivers/media/usb/pulse8-cec/Makefile
drivers/media/usb/pvrusb2/Kconfig
drivers/media/usb/pvrusb2/Makefile
drivers/media/usb/pwc/Kconfig
drivers/media/usb/pwc/Makefile
drivers/media/usb/rainshadow-cec/Kconfig
drivers/media/usb/rainshadow-cec/Makefile
drivers/media/usb/s2255/Kconfig
drivers/media/usb/s2255/Makefile
drivers/media/usb/siano/Kconfig
drivers/media/usb/siano/Makefile
drivers/media/usb/siano/smsusb.c
drivers/media/usb/stk1160/Kconfig
drivers/media/usb/stkwebcam/Kconfig
drivers/media/usb/stkwebcam/Makefile
drivers/media/usb/stkwebcam/stk-webcam.c
drivers/media/usb/stkwebcam/stk-webcam.h
drivers/media/usb/tm6000/Kconfig
drivers/media/usb/tm6000/Makefile
drivers/media/usb/ttusb-budget/Kconfig
drivers/media/usb/ttusb-budget/Makefile
drivers/media/usb/ttusb-dec/Kconfig
drivers/media/usb/ttusb-dec/Makefile
drivers/media/usb/usbtv/Kconfig
drivers/media/usb/usbtv/Makefile
drivers/media/usb/usbvision/Kconfig
drivers/media/usb/usbvision/Makefile
drivers/media/usb/uvc/Kconfig
drivers/media/usb/zr364xx/Kconfig
drivers/media/usb/zr364xx/Makefile
drivers/media/v4l2-core/Kconfig
drivers/media/v4l2-core/tuner-core.c
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/memory/Kconfig
drivers/memory/emif.h
drivers/memory/tegra/Kconfig
drivers/memory/tegra/mc.c
drivers/memory/tegra/mc.h
drivers/memory/tegra/tegra114.c
drivers/memory/tegra/tegra124-emc.c
drivers/memory/tegra/tegra124.c
drivers/memory/tegra/tegra20.c
drivers/memory/tegra/tegra210.c
drivers/memory/tegra/tegra30.c
drivers/memory/ti-emif-pm.c
drivers/memory/ti-emif-sram-pm.S
drivers/memstick/Kconfig
drivers/memstick/Makefile
drivers/memstick/core/Kconfig
drivers/memstick/core/Makefile
drivers/memstick/host/Kconfig
drivers/memstick/host/rtsx_pci_ms.c
drivers/message/Makefile
drivers/message/fusion/Kconfig
drivers/mfd/Kconfig
drivers/mfd/cros_ec_dev.c
drivers/mfd/cros_ec_dev.h
drivers/mfd/intel-lpss.c
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/altera-stapl/Kconfig
drivers/misc/altera-stapl/Makefile
drivers/misc/atmel_tclib.c
drivers/misc/c2port/Kconfig
drivers/misc/c2port/Makefile
drivers/misc/cardreader/Kconfig
drivers/misc/cardreader/Makefile
drivers/misc/cardreader/rtl8411.c
drivers/misc/cardreader/rts5209.c
drivers/misc/cardreader/rts5227.c
drivers/misc/cardreader/rts5229.c
drivers/misc/cardreader/rts5249.c
drivers/misc/cardreader/rts5260.c
drivers/misc/cardreader/rtsx_pcr.c
drivers/misc/cardreader/rtsx_pcr.h
drivers/misc/cb710/Kconfig
drivers/misc/cb710/Makefile
drivers/misc/cxl/Kconfig
drivers/misc/echo/Kconfig
drivers/misc/echo/Makefile
drivers/misc/eeprom/Kconfig
drivers/misc/genwqe/Kconfig
drivers/misc/genwqe/Makefile
drivers/misc/habanalabs/Kconfig
drivers/misc/habanalabs/Makefile
drivers/misc/habanalabs/goya/Makefile
drivers/misc/lis3lv02d/Kconfig
drivers/misc/lis3lv02d/Makefile
drivers/misc/mic/Kconfig
drivers/misc/mic/bus/Makefile
drivers/misc/mic/cosm_client/Makefile
drivers/misc/mic/vop/Makefile
drivers/misc/ocxl/Kconfig
drivers/misc/sgi-gru/Makefile
drivers/misc/sram.c
drivers/misc/ti-st/Kconfig
drivers/misc/ti-st/Makefile
drivers/misc/vmw_vmci/Kconfig
drivers/misc/vmw_vmci/Makefile
drivers/mmc/Kconfig
drivers/mmc/Makefile
drivers/mmc/core/Kconfig
drivers/mmc/host/Kconfig
drivers/mmc/host/meson-mx-sdio.c
drivers/mmc/host/mvsdio.c
drivers/mmc/host/mxs-mmc.c
drivers/mmc/host/pxamci.c
drivers/mmc/host/rtsx_pci_sdmmc.c
drivers/mmc/host/sdhci-pci-data.c
drivers/mmc/host/sdhci-sirf.c
drivers/mtd/chips/Kconfig
drivers/mtd/chips/chipreg.c
drivers/mtd/chips/map_absent.c
drivers/mtd/devices/Kconfig
drivers/mtd/devices/bcm47xxsflash.c
drivers/mtd/devices/phram.c
drivers/mtd/devices/slram.c
drivers/mtd/lpddr/Kconfig
drivers/mtd/lpddr/Makefile
drivers/mtd/lpddr/lpddr_cmds.c
drivers/mtd/lpddr/qinfo_probe.c
drivers/mtd/maps/Kconfig
drivers/mtd/maps/amd76xrom.c
drivers/mtd/maps/ck804xrom.c
drivers/mtd/maps/esb2rom.c
drivers/mtd/maps/ichxrom.c
drivers/mtd/maps/ixp4xx.c
drivers/mtd/maps/l440gx.c
drivers/mtd/maps/map_funcs.c
drivers/mtd/maps/nettel.c
drivers/mtd/maps/sa1100-flash.c
drivers/mtd/maps/scb2_flash.c
drivers/mtd/maps/scx200_docflash.c
drivers/mtd/maps/sun_uflash.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/onenand/Kconfig
drivers/mtd/nand/raw/Kconfig
drivers/mtd/nand/raw/atmel/Makefile
drivers/mtd/nand/raw/bcm47xxnflash/Makefile
drivers/mtd/nand/raw/cafe_nand.c
drivers/mtd/nand/raw/diskonchip.c
drivers/mtd/nand/raw/gpmi-nand/Makefile
drivers/mtd/nand/raw/gpmi-nand/bch-regs.h
drivers/mtd/nand/raw/gpmi-nand/gpmi-regs.h
drivers/mtd/nand/raw/ingenic/Kconfig
drivers/mtd/nand/raw/ingenic/Makefile
drivers/mtd/nand/raw/mpc5121_nfc.c
drivers/mtd/nand/raw/vf610_nfc.c
drivers/mtd/nand/spi/Kconfig
drivers/mtd/parsers/Kconfig
drivers/mtd/parsers/Makefile
drivers/mtd/rfd_ftl.c
drivers/mtd/spi-nor/Kconfig
drivers/mtd/spi-nor/hisi-sfc.c
drivers/mtd/tests/mtd_nandecctest.c
drivers/mtd/ubi/Kconfig
drivers/net/Kconfig
drivers/net/appletalk/Kconfig
drivers/net/appletalk/Makefile
drivers/net/arcnet/Kconfig
drivers/net/bonding/Makefile
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_sysfs.c
drivers/net/caif/Kconfig
drivers/net/can/Kconfig
drivers/net/can/c_can/Kconfig
drivers/net/can/c_can/Makefile
drivers/net/can/cc770/Kconfig
drivers/net/can/cc770/Makefile
drivers/net/can/ifi_canfd/Kconfig
drivers/net/can/ifi_canfd/Makefile
drivers/net/can/m_can/Kconfig
drivers/net/can/m_can/Makefile
drivers/net/can/mscan/Kconfig
drivers/net/can/mscan/Makefile
drivers/net/can/peak_canfd/Kconfig
drivers/net/can/peak_canfd/Makefile
drivers/net/can/sja1000/Kconfig
drivers/net/can/sja1000/tscan1.c
drivers/net/can/softing/Kconfig
drivers/net/can/softing/Makefile
drivers/net/can/spi/Kconfig
drivers/net/can/spi/Makefile
drivers/net/can/usb/Kconfig
drivers/net/can/usb/kvaser_usb/Makefile
drivers/net/can/usb/peak_usb/Makefile
drivers/net/dsa/Kconfig
drivers/net/dsa/b53/Kconfig
drivers/net/dsa/dsa_loop_bdinfo.c
drivers/net/dsa/microchip/Kconfig
drivers/net/dsa/microchip/Makefile
drivers/net/dsa/mv88e6xxx/Kconfig
drivers/net/dsa/sja1105/Kconfig
drivers/net/dsa/sja1105/Makefile
drivers/net/dummy.c
drivers/net/ethernet/3com/Kconfig
drivers/net/ethernet/8390/8390.c
drivers/net/ethernet/8390/8390p.c
drivers/net/ethernet/8390/Kconfig
drivers/net/ethernet/Kconfig
drivers/net/ethernet/adaptec/Kconfig
drivers/net/ethernet/adaptec/Makefile
drivers/net/ethernet/aeroflex/Kconfig
drivers/net/ethernet/aeroflex/Makefile
drivers/net/ethernet/agere/Kconfig
drivers/net/ethernet/agere/Makefile
drivers/net/ethernet/alacritech/Kconfig
drivers/net/ethernet/alacritech/Makefile
drivers/net/ethernet/allwinner/Kconfig
drivers/net/ethernet/allwinner/Makefile
drivers/net/ethernet/alteon/Kconfig
drivers/net/ethernet/alteon/Makefile
drivers/net/ethernet/altera/Kconfig
drivers/net/ethernet/altera/Makefile
drivers/net/ethernet/amazon/Kconfig
drivers/net/ethernet/amazon/Makefile
drivers/net/ethernet/amazon/ena/Makefile
drivers/net/ethernet/amd/7990.c
drivers/net/ethernet/amd/Kconfig
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/amd8111e.h
drivers/net/ethernet/amd/declance.c
drivers/net/ethernet/amd/hplance.c
drivers/net/ethernet/amd/mvme147.c
drivers/net/ethernet/amd/sunlance.c
drivers/net/ethernet/apm/Kconfig
drivers/net/ethernet/apm/Makefile
drivers/net/ethernet/apm/xgene-v2/Kconfig
drivers/net/ethernet/apm/xgene-v2/Makefile
drivers/net/ethernet/apm/xgene-v2/enet.c
drivers/net/ethernet/apm/xgene-v2/enet.h
drivers/net/ethernet/apm/xgene-v2/ethtool.c
drivers/net/ethernet/apm/xgene-v2/ethtool.h
drivers/net/ethernet/apm/xgene-v2/mac.c
drivers/net/ethernet/apm/xgene-v2/mac.h
drivers/net/ethernet/apm/xgene-v2/main.c
drivers/net/ethernet/apm/xgene-v2/main.h
drivers/net/ethernet/apm/xgene-v2/mdio.c
drivers/net/ethernet/apm/xgene-v2/ring.c
drivers/net/ethernet/apm/xgene-v2/ring.h
drivers/net/ethernet/apm/xgene/Kconfig
drivers/net/ethernet/apm/xgene/Makefile
drivers/net/ethernet/apm/xgene/xgene_enet_cle.c
drivers/net/ethernet/apm/xgene/xgene_enet_cle.h
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
drivers/net/ethernet/apm/xgene/xgene_enet_main.h
drivers/net/ethernet/apm/xgene/xgene_enet_ring2.c
drivers/net/ethernet/apm/xgene/xgene_enet_ring2.h
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h
drivers/net/ethernet/apple/Kconfig
drivers/net/ethernet/apple/Makefile
drivers/net/ethernet/apple/bmac.c
drivers/net/ethernet/apple/mace.c
drivers/net/ethernet/aquantia/Kconfig
drivers/net/ethernet/aquantia/Makefile
drivers/net/ethernet/arc/Kconfig
drivers/net/ethernet/arc/Makefile
drivers/net/ethernet/atheros/Kconfig
drivers/net/ethernet/atheros/alx/Makefile
drivers/net/ethernet/atheros/atl1c/Makefile
drivers/net/ethernet/atheros/atl1e/Makefile
drivers/net/ethernet/atheros/atlx/Makefile
drivers/net/ethernet/aurora/Kconfig
drivers/net/ethernet/aurora/Makefile
drivers/net/ethernet/broadcom/Kconfig
drivers/net/ethernet/broadcom/bnx2x/Makefile
drivers/net/ethernet/broadcom/bnxt/Makefile
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
drivers/net/ethernet/broadcom/genet/Makefile
drivers/net/ethernet/broadcom/sb1250-mac.c
drivers/net/ethernet/brocade/Kconfig
drivers/net/ethernet/brocade/Makefile
drivers/net/ethernet/brocade/bna/Kconfig
drivers/net/ethernet/brocade/bna/Makefile
drivers/net/ethernet/cadence/Kconfig
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/calxeda/Kconfig
drivers/net/ethernet/calxeda/Makefile
drivers/net/ethernet/cavium/Kconfig
drivers/net/ethernet/cavium/Makefile
drivers/net/ethernet/cavium/common/Makefile
drivers/net/ethernet/cavium/octeon/Makefile
drivers/net/ethernet/chelsio/Kconfig
drivers/net/ethernet/chelsio/cxgb/Makefile
drivers/net/ethernet/chelsio/cxgb3/Makefile
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
drivers/net/ethernet/chelsio/cxgb4vf/Makefile
drivers/net/ethernet/chelsio/libcxgb/Makefile
drivers/net/ethernet/cirrus/Kconfig
drivers/net/ethernet/cirrus/Makefile
drivers/net/ethernet/cirrus/ep93xx_eth.c
drivers/net/ethernet/cisco/Kconfig
drivers/net/ethernet/cisco/Makefile
drivers/net/ethernet/cisco/enic/Kconfig
drivers/net/ethernet/cisco/enic/Makefile
drivers/net/ethernet/davicom/Kconfig
drivers/net/ethernet/davicom/Makefile
drivers/net/ethernet/dec/Kconfig
drivers/net/ethernet/dec/Makefile
drivers/net/ethernet/dec/tulip/Kconfig
drivers/net/ethernet/dlink/Kconfig
drivers/net/ethernet/dlink/Makefile
drivers/net/ethernet/emulex/Kconfig
drivers/net/ethernet/emulex/Makefile
drivers/net/ethernet/emulex/benet/Kconfig
drivers/net/ethernet/emulex/benet/Makefile
drivers/net/ethernet/ezchip/Kconfig
drivers/net/ethernet/ezchip/Makefile
drivers/net/ethernet/faraday/Kconfig
drivers/net/ethernet/faraday/Makefile
drivers/net/ethernet/freescale/Kconfig
drivers/net/ethernet/freescale/dpaa/Kconfig
drivers/net/ethernet/freescale/dpaa2/Kconfig
drivers/net/ethernet/freescale/fman/Kconfig
drivers/net/ethernet/freescale/fs_enet/Kconfig
drivers/net/ethernet/fujitsu/Kconfig
drivers/net/ethernet/fujitsu/Makefile
drivers/net/ethernet/hisilicon/Kconfig
drivers/net/ethernet/hisilicon/hisi_femac.c
drivers/net/ethernet/hp/Kconfig
drivers/net/ethernet/hp/Makefile
drivers/net/ethernet/huawei/Kconfig
drivers/net/ethernet/huawei/Makefile
drivers/net/ethernet/huawei/hinic/Kconfig
drivers/net/ethernet/huawei/hinic/Makefile
drivers/net/ethernet/i825xx/Kconfig
drivers/net/ethernet/i825xx/sni_82596.c
drivers/net/ethernet/ibm/Kconfig
drivers/net/ethernet/ibm/Makefile
drivers/net/ethernet/ibm/ehea/Makefile
drivers/net/ethernet/ibm/emac/Kconfig
drivers/net/ethernet/ibm/emac/phy.c
drivers/net/ethernet/ibm/ibmveth.c
drivers/net/ethernet/ibm/ibmveth.h
drivers/net/ethernet/intel/Kconfig
drivers/net/ethernet/marvell/Kconfig
drivers/net/ethernet/marvell/mv643xx_eth.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
drivers/net/ethernet/marvell/octeontx2/Kconfig
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/mediatek/Kconfig
drivers/net/ethernet/mediatek/Makefile
drivers/net/ethernet/mellanox/Kconfig
drivers/net/ethernet/mellanox/Makefile
drivers/net/ethernet/mellanox/mlx4/Kconfig
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/mellanox/mlx4/port.c
drivers/net/ethernet/mellanox/mlx5/core/Kconfig
drivers/net/ethernet/mellanox/mlx5/core/accel/Makefile
drivers/net/ethernet/mellanox/mlx5/core/diag/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en_accel/Makefile
drivers/net/ethernet/mellanox/mlx5/core/eq.c
drivers/net/ethernet/mellanox/mlx5/core/fpga/Makefile
drivers/net/ethernet/mellanox/mlx5/core/ipoib/Makefile
drivers/net/ethernet/mellanox/mlx5/core/lib/Makefile
drivers/net/ethernet/mellanox/mlxfw/Kconfig
drivers/net/ethernet/mellanox/mlxfw/Makefile
drivers/net/ethernet/mellanox/mlxsw/Kconfig
drivers/net/ethernet/micrel/Kconfig
drivers/net/ethernet/microchip/Kconfig
drivers/net/ethernet/microchip/Makefile
drivers/net/ethernet/moxa/Kconfig
drivers/net/ethernet/moxa/Makefile
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot.h
drivers/net/ethernet/myricom/Kconfig
drivers/net/ethernet/myricom/Makefile
drivers/net/ethernet/myricom/myri10ge/Makefile
drivers/net/ethernet/natsemi/Kconfig
drivers/net/ethernet/natsemi/ns83820.c
drivers/net/ethernet/natsemi/sonic.c
drivers/net/ethernet/neterion/Kconfig
drivers/net/ethernet/neterion/Makefile
drivers/net/ethernet/neterion/vxge/Makefile
drivers/net/ethernet/netronome/Kconfig
drivers/net/ethernet/netronome/Makefile
drivers/net/ethernet/ni/Kconfig
drivers/net/ethernet/ni/Makefile
drivers/net/ethernet/nuvoton/Kconfig
drivers/net/ethernet/nuvoton/Makefile
drivers/net/ethernet/nvidia/Kconfig
drivers/net/ethernet/nvidia/Makefile
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/nxp/Kconfig
drivers/net/ethernet/nxp/Makefile
drivers/net/ethernet/oki-semi/Kconfig
drivers/net/ethernet/oki-semi/Makefile
drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
drivers/net/ethernet/oki-semi/pch_gbe/Makefile
drivers/net/ethernet/packetengines/Kconfig
drivers/net/ethernet/packetengines/Makefile
drivers/net/ethernet/pasemi/Kconfig
drivers/net/ethernet/pasemi/Makefile
drivers/net/ethernet/qlogic/Kconfig
drivers/net/ethernet/qlogic/netxen/Makefile
drivers/net/ethernet/qlogic/netxen/netxen_nic.h
drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.h
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
drivers/net/ethernet/qlogic/qede/Makefile
drivers/net/ethernet/qlogic/qlge/Makefile
drivers/net/ethernet/qualcomm/Kconfig
drivers/net/ethernet/qualcomm/emac/Makefile
drivers/net/ethernet/qualcomm/rmnet/Kconfig
drivers/net/ethernet/qualcomm/rmnet/Makefile
drivers/net/ethernet/rdc/Kconfig
drivers/net/ethernet/rdc/Makefile
drivers/net/ethernet/rdc/r6040.c
drivers/net/ethernet/realtek/Kconfig
drivers/net/ethernet/realtek/Makefile
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/rocker/Kconfig
drivers/net/ethernet/rocker/Makefile
drivers/net/ethernet/samsung/Kconfig
drivers/net/ethernet/samsung/Makefile
drivers/net/ethernet/samsung/sxgbe/Makefile
drivers/net/ethernet/seeq/Kconfig
drivers/net/ethernet/seeq/Makefile
drivers/net/ethernet/seeq/sgiseeq.c
drivers/net/ethernet/sfc/Kconfig
drivers/net/ethernet/sfc/falcon/Kconfig
drivers/net/ethernet/sgi/Kconfig
drivers/net/ethernet/sgi/Makefile
drivers/net/ethernet/silan/Kconfig
drivers/net/ethernet/silan/Makefile
drivers/net/ethernet/silan/sc92031.c
drivers/net/ethernet/sis/Kconfig
drivers/net/ethernet/sis/Makefile
drivers/net/ethernet/smsc/Kconfig
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/smsc/smc911x.h
drivers/net/ethernet/smsc/smc91x.c
drivers/net/ethernet/smsc/smc91x.h
drivers/net/ethernet/smsc/smsc911x.c
drivers/net/ethernet/smsc/smsc911x.h
drivers/net/ethernet/smsc/smsc9420.c
drivers/net/ethernet/smsc/smsc9420.h
drivers/net/ethernet/socionext/Kconfig
drivers/net/ethernet/stmicro/Kconfig
drivers/net/ethernet/stmicro/Makefile
drivers/net/ethernet/stmicro/stmmac/Kconfig
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/synopsys/Kconfig
drivers/net/ethernet/tehuti/Kconfig
drivers/net/ethernet/tehuti/Makefile
drivers/net/ethernet/ti/Kconfig
drivers/net/ethernet/toshiba/Kconfig
drivers/net/ethernet/tundra/Kconfig
drivers/net/ethernet/tundra/Makefile
drivers/net/ethernet/tundra/tsi108_eth.h
drivers/net/ethernet/via/Kconfig
drivers/net/ethernet/via/Makefile
drivers/net/ethernet/via/via-velocity.c
drivers/net/ethernet/via/via-velocity.h
drivers/net/ethernet/wiznet/Kconfig
drivers/net/ethernet/wiznet/Makefile
drivers/net/ethernet/xilinx/Kconfig
drivers/net/ethernet/xilinx/ll_temac_main.c
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/ethernet/xircom/Kconfig
drivers/net/ethernet/xircom/Makefile
drivers/net/ethernet/xscale/Kconfig
drivers/net/ethernet/xscale/Makefile
drivers/net/ethernet/xscale/ixp4xx_eth.c
drivers/net/fddi/Kconfig
drivers/net/fddi/Makefile
drivers/net/fddi/skfp/hwmtm.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/Kconfig
drivers/net/hippi/Kconfig
drivers/net/hippi/Makefile
drivers/net/hyperv/Kconfig
drivers/net/hyperv/Makefile
drivers/net/ieee802154/Kconfig
drivers/net/ieee802154/ca8210.c
drivers/net/ipvlan/Makefile
drivers/net/ipvlan/ipvtap.c
drivers/net/macvlan.c
drivers/net/macvtap.c
drivers/net/nlmon.c
drivers/net/phy/Kconfig
drivers/net/phy/phy-c45.c
drivers/net/phy/phylink.c
drivers/net/phy/sfp-bus.c
drivers/net/plip/Kconfig
drivers/net/plip/Makefile
drivers/net/ppp/Kconfig
drivers/net/slip/Kconfig
drivers/net/slip/Makefile
drivers/net/slip/slip.c
drivers/net/sungem_phy.c
drivers/net/tap.c
drivers/net/team/Kconfig
drivers/net/usb/Kconfig
drivers/net/usb/asix.h
drivers/net/usb/asix_common.c
drivers/net/usb/asix_devices.c
drivers/net/usb/ax88172a.c
drivers/net/usb/ax88179_178a.c
drivers/net/usb/catc.c
drivers/net/usb/cdc_eem.c
drivers/net/usb/cdc_ether.c
drivers/net/usb/cdc_subset.c
drivers/net/usb/cx82310_eth.c
drivers/net/usb/gl620a.c
drivers/net/usb/int51x1.c
drivers/net/usb/ipheth.c
drivers/net/usb/kaweth.c
drivers/net/usb/lg-vl600.c
drivers/net/usb/mcs7830.c
drivers/net/usb/net1080.c
drivers/net/usb/plusb.c
drivers/net/usb/rndis_host.c
drivers/net/usb/sierra_net.c
drivers/net/usb/smsc75xx.c
drivers/net/usb/smsc75xx.h
drivers/net/usb/smsc95xx.c
drivers/net/usb/smsc95xx.h
drivers/net/usb/usbnet.c
drivers/net/usb/zaurus.c
drivers/net/veth.c
drivers/net/virtio_net.c
drivers/net/vsockmon.c
drivers/net/wan/Kconfig
drivers/net/wan/hostess_sv11.c
drivers/net/wan/ixp4xx_hss.c
drivers/net/wan/lmc/Makefile
drivers/net/wan/x25_asy.c
drivers/net/wimax/Kconfig
drivers/net/wimax/Makefile
drivers/net/wimax/i2400m/Kconfig
drivers/net/wireless/Kconfig
drivers/net/wireless/admtek/Kconfig
drivers/net/wireless/admtek/Makefile
drivers/net/wireless/ath/Kconfig
drivers/net/wireless/ath/ar5523/Kconfig
drivers/net/wireless/ath/ar5523/Makefile
drivers/net/wireless/ath/ath10k/Kconfig
drivers/net/wireless/ath/ath5k/Kconfig
drivers/net/wireless/ath/ath6kl/Kconfig
drivers/net/wireless/ath/ath9k/Kconfig
drivers/net/wireless/ath/carl9170/Kconfig
drivers/net/wireless/ath/carl9170/Makefile
drivers/net/wireless/ath/wcn36xx/Kconfig
drivers/net/wireless/ath/wil6210/Kconfig
drivers/net/wireless/atmel/Kconfig
drivers/net/wireless/atmel/Makefile
drivers/net/wireless/broadcom/Kconfig
drivers/net/wireless/broadcom/Makefile
drivers/net/wireless/broadcom/b43/Kconfig
drivers/net/wireless/broadcom/b43/bus.c
drivers/net/wireless/broadcom/b43/debugfs.c
drivers/net/wireless/broadcom/b43/dma.c
drivers/net/wireless/broadcom/b43/leds.c
drivers/net/wireless/broadcom/b43/lo.c
drivers/net/wireless/broadcom/b43/main.c
drivers/net/wireless/broadcom/b43/main.h
drivers/net/wireless/broadcom/b43/phy_common.c
drivers/net/wireless/broadcom/b43/phy_g.c
drivers/net/wireless/broadcom/b43/phy_ht.c
drivers/net/wireless/broadcom/b43/phy_lp.c
drivers/net/wireless/broadcom/b43/phy_n.c
drivers/net/wireless/broadcom/b43/pio.c
drivers/net/wireless/broadcom/b43/radio_2055.c
drivers/net/wireless/broadcom/b43/radio_2056.c
drivers/net/wireless/broadcom/b43/radio_2057.c
drivers/net/wireless/broadcom/b43/radio_2059.c
drivers/net/wireless/broadcom/b43/rfkill.c
drivers/net/wireless/broadcom/b43/sysfs.c
drivers/net/wireless/broadcom/b43/tables.c
drivers/net/wireless/broadcom/b43/tables_lpphy.c
drivers/net/wireless/broadcom/b43/tables_nphy.c
drivers/net/wireless/broadcom/b43/tables_phy_ht.c
drivers/net/wireless/broadcom/b43/tables_phy_lcn.c
drivers/net/wireless/broadcom/b43/wa.c
drivers/net/wireless/broadcom/b43/xmit.c
drivers/net/wireless/broadcom/b43legacy/Kconfig
drivers/net/wireless/broadcom/b43legacy/debugfs.c
drivers/net/wireless/broadcom/b43legacy/dma.c
drivers/net/wireless/broadcom/b43legacy/ilt.c
drivers/net/wireless/broadcom/b43legacy/leds.c
drivers/net/wireless/broadcom/b43legacy/main.c
drivers/net/wireless/broadcom/b43legacy/main.h
drivers/net/wireless/broadcom/b43legacy/phy.c
drivers/net/wireless/broadcom/b43legacy/phy.h
drivers/net/wireless/broadcom/b43legacy/pio.c
drivers/net/wireless/broadcom/b43legacy/radio.c
drivers/net/wireless/broadcom/b43legacy/radio.h
drivers/net/wireless/broadcom/b43legacy/rfkill.c
drivers/net/wireless/broadcom/b43legacy/sysfs.c
drivers/net/wireless/broadcom/b43legacy/xmit.c
drivers/net/wireless/broadcom/brcm80211/Kconfig
drivers/net/wireless/cisco/Kconfig
drivers/net/wireless/cisco/Makefile
drivers/net/wireless/intel/Kconfig
drivers/net/wireless/intel/Makefile
drivers/net/wireless/intel/ipw2x00/Kconfig
drivers/net/wireless/intel/iwlegacy/Kconfig
drivers/net/wireless/intel/iwlwifi/Kconfig
drivers/net/wireless/intersil/Kconfig
drivers/net/wireless/intersil/Makefile
drivers/net/wireless/intersil/hostap/Kconfig
drivers/net/wireless/intersil/hostap/hostap_cs.c
drivers/net/wireless/intersil/hostap/hostap_pci.c
drivers/net/wireless/intersil/hostap/hostap_plx.c
drivers/net/wireless/intersil/orinoco/Kconfig
drivers/net/wireless/intersil/p54/Kconfig
drivers/net/wireless/intersil/prism54/Makefile
drivers/net/wireless/marvell/Kconfig
drivers/net/wireless/marvell/Makefile
drivers/net/wireless/marvell/libertas/Kconfig
drivers/net/wireless/marvell/libertas/cmd.c
drivers/net/wireless/marvell/libertas/firmware.c
drivers/net/wireless/marvell/libertas/if_cs.c
drivers/net/wireless/marvell/libertas/if_usb.c
drivers/net/wireless/marvell/libertas/main.c
drivers/net/wireless/marvell/libertas/rx.c
drivers/net/wireless/marvell/libertas/tx.c
drivers/net/wireless/marvell/libertas_tf/Kconfig
drivers/net/wireless/marvell/libertas_tf/Makefile
drivers/net/wireless/marvell/mwifiex/Kconfig
drivers/net/wireless/mediatek/Kconfig
drivers/net/wireless/mediatek/Makefile
drivers/net/wireless/mediatek/mt76/Kconfig
drivers/net/wireless/mediatek/mt76/Makefile
drivers/net/wireless/mediatek/mt76/mt7603/Kconfig
drivers/net/wireless/mediatek/mt76/mt7603/Makefile
drivers/net/wireless/mediatek/mt76/mt7615/Kconfig
drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig
drivers/net/wireless/mediatek/mt76/mt76x0/Makefile
drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig
drivers/net/wireless/mediatek/mt76/mt76x2/Makefile
drivers/net/wireless/mediatek/mt7601u/Kconfig
drivers/net/wireless/mediatek/mt7601u/Makefile
drivers/net/wireless/quantenna/Kconfig
drivers/net/wireless/quantenna/qtnfmac/Kconfig
drivers/net/wireless/ralink/Kconfig
drivers/net/wireless/ralink/Makefile
drivers/net/wireless/ralink/rt2x00/Kconfig
drivers/net/wireless/ralink/rt2x00/rt2400pci.c
drivers/net/wireless/ralink/rt2x00/rt2400pci.h
drivers/net/wireless/ralink/rt2x00/rt2500pci.c
drivers/net/wireless/ralink/rt2x00/rt2500pci.h
drivers/net/wireless/ralink/rt2x00/rt2500usb.c
drivers/net/wireless/ralink/rt2x00/rt2500usb.h
drivers/net/wireless/ralink/rt2x00/rt2800.h
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
drivers/net/wireless/ralink/rt2x00/rt2800lib.h
drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
drivers/net/wireless/ralink/rt2x00/rt2800pci.c
drivers/net/wireless/ralink/rt2x00/rt2800pci.h
drivers/net/wireless/ralink/rt2x00/rt2800soc.c
drivers/net/wireless/ralink/rt2x00/rt2800usb.c
drivers/net/wireless/ralink/rt2x00/rt2800usb.h
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt2x00config.c
drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
drivers/net/wireless/ralink/rt2x00/rt2x00debug.h
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
drivers/net/wireless/ralink/rt2x00/rt2x00dump.h
drivers/net/wireless/ralink/rt2x00/rt2x00firmware.c
drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
drivers/net/wireless/ralink/rt2x00/rt2x00leds.h
drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
drivers/net/wireless/ralink/rt2x00/rt2x00link.c
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c
drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h
drivers/net/wireless/ralink/rt2x00/rt2x00pci.c
drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
drivers/net/wireless/ralink/rt2x00/rt2x00reg.h
drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
drivers/net/wireless/ralink/rt2x00/rt2x00usb.h
drivers/net/wireless/ralink/rt2x00/rt61pci.c
drivers/net/wireless/ralink/rt2x00/rt61pci.h
drivers/net/wireless/ralink/rt2x00/rt73usb.c
drivers/net/wireless/ralink/rt2x00/rt73usb.h
drivers/net/wireless/realtek/Kconfig
drivers/net/wireless/realtek/Makefile
drivers/net/wireless/realtek/rtl818x/Kconfig
drivers/net/wireless/realtek/rtl818x/Makefile
drivers/net/wireless/realtek/rtl818x/rtl8180/Makefile
drivers/net/wireless/realtek/rtl818x/rtl8187/Makefile
drivers/net/wireless/realtek/rtl8xxxu/Kconfig
drivers/net/wireless/realtek/rtl8xxxu/Makefile
drivers/net/wireless/realtek/rtlwifi/Kconfig
drivers/net/wireless/realtek/rtw88/Kconfig
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rsi/Kconfig
drivers/net/wireless/st/Kconfig
drivers/net/wireless/st/Makefile
drivers/net/wireless/st/cw1200/Kconfig
drivers/net/wireless/ti/Kconfig
drivers/net/wireless/ti/wl1251/Kconfig
drivers/net/wireless/ti/wl12xx/Kconfig
drivers/net/wireless/ti/wl12xx/Makefile
drivers/net/wireless/ti/wl18xx/Kconfig
drivers/net/wireless/ti/wl18xx/Makefile
drivers/net/wireless/ti/wlcore/Kconfig
drivers/net/wireless/wl3501_cs.c
drivers/net/wireless/zydas/Kconfig
drivers/net/wireless/zydas/Makefile
drivers/net/wireless/zydas/zd1211rw/Kconfig
drivers/net/wireless/zydas/zd1211rw/zd_chip.c
drivers/net/wireless/zydas/zd1211rw/zd_chip.h
drivers/net/wireless/zydas/zd1211rw/zd_def.h
drivers/net/wireless/zydas/zd1211rw/zd_mac.c
drivers/net/wireless/zydas/zd1211rw/zd_mac.h
drivers/net/wireless/zydas/zd1211rw/zd_rf.c
drivers/net/wireless/zydas/zd1211rw/zd_rf.h
drivers/net/wireless/zydas/zd1211rw/zd_rf_al2230.c
drivers/net/wireless/zydas/zd1211rw/zd_rf_al7230b.c
drivers/net/wireless/zydas/zd1211rw/zd_rf_rf2959.c
drivers/net/wireless/zydas/zd1211rw/zd_rf_uw2453.c
drivers/net/wireless/zydas/zd1211rw/zd_usb.c
drivers/net/wireless/zydas/zd1211rw/zd_usb.h
drivers/net/xen-netback/Makefile
drivers/net/xen-netback/xenbus.c
drivers/nfc/Kconfig
drivers/nfc/fdp/Kconfig
drivers/nfc/fdp/Makefile
drivers/nfc/microread/Kconfig
drivers/nfc/microread/microread.h
drivers/nfc/nfcmrvl/Kconfig
drivers/nfc/nxp-nci/Kconfig
drivers/nfc/nxp-nci/Makefile
drivers/nfc/pn533/Kconfig
drivers/nfc/pn533/Makefile
drivers/nfc/pn533/i2c.c
drivers/nfc/pn533/pn533.c
drivers/nfc/pn533/pn533.h
drivers/nfc/pn533/usb.c
drivers/nfc/pn544/Kconfig
drivers/nfc/pn544/Makefile
drivers/nfc/pn544/pn544.h
drivers/nfc/s3fwrn5/Kconfig
drivers/nfc/s3fwrn5/Makefile
drivers/nfc/st-nci/Kconfig
drivers/nfc/st21nfca/Kconfig
drivers/nfc/st21nfca/Makefile
drivers/nfc/st95hf/Kconfig
drivers/nfc/st95hf/Makefile
drivers/ntb/Kconfig
drivers/ntb/Makefile
drivers/ntb/hw/Kconfig
drivers/ntb/hw/Makefile
drivers/ntb/hw/amd/Kconfig
drivers/ntb/hw/amd/Makefile
drivers/ntb/hw/idt/Kconfig
drivers/ntb/hw/idt/Makefile
drivers/ntb/hw/intel/Kconfig
drivers/ntb/hw/intel/Makefile
drivers/ntb/hw/mscc/Kconfig
drivers/ntb/hw/mscc/Makefile
drivers/ntb/test/Kconfig
drivers/ntb/test/Makefile
drivers/nubus/Makefile
drivers/nvdimm/Kconfig
drivers/nvdimm/e820.c
drivers/nvdimm/label.c
drivers/nvdimm/namespace_devs.c
drivers/nvdimm/nd.h
drivers/nvme/Kconfig
drivers/nvme/Makefile
drivers/nvme/host/Kconfig
drivers/nvme/host/core.c
drivers/nvme/host/fabrics.c
drivers/nvme/host/fc.c
drivers/nvme/host/lightnvm.c
drivers/nvme/host/multipath.c
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/host/trace.h
drivers/nvme/target/Kconfig
drivers/nvmem/Kconfig
drivers/nvmem/zynqmp_nvmem.c
drivers/opp/Kconfig
drivers/opp/Makefile
drivers/parisc/Kconfig
drivers/parport/Kconfig
drivers/parport/parport_amiga.c
drivers/parport/parport_atari.c
drivers/parport/parport_mfc3.c
drivers/parport/parport_pc.c
drivers/parport/parport_sunbpp.c
drivers/pcmcia/Kconfig
drivers/pcmcia/db1xxx_ss.c
drivers/pcmcia/i82092.c
drivers/pcmcia/omap_cf.c
drivers/pcmcia/sa1111_generic.c
drivers/pcmcia/xxs1500_ss.c
drivers/pcmcia/yenta_socket.c
drivers/perf/Kconfig
drivers/perf/arm_pmu.c
drivers/perf/arm_spe_pmu.c
drivers/perf/hisilicon/Makefile
drivers/perf/xgene_pmu.c
drivers/phy/Kconfig
drivers/phy/allwinner/Kconfig
drivers/phy/allwinner/Makefile
drivers/phy/amlogic/Kconfig
drivers/phy/amlogic/Makefile
drivers/phy/broadcom/Kconfig
drivers/phy/cadence/Kconfig
drivers/phy/cadence/Makefile
drivers/phy/freescale/Kconfig
drivers/phy/freescale/Makefile
drivers/phy/hisilicon/Kconfig
drivers/phy/hisilicon/Makefile
drivers/phy/hisilicon/phy-hisi-inno-usb2.c
drivers/phy/lantiq/Kconfig
drivers/phy/lantiq/Makefile
drivers/phy/marvell/Kconfig
drivers/phy/mediatek/Kconfig
drivers/phy/motorola/Kconfig
drivers/phy/motorola/Makefile
drivers/phy/mscc/Kconfig
drivers/phy/mscc/Makefile
drivers/phy/phy-xgene.c
drivers/phy/qualcomm/Kconfig
drivers/phy/ralink/Kconfig
drivers/phy/ralink/Makefile
drivers/phy/rockchip/Kconfig
drivers/phy/samsung/Kconfig
drivers/phy/socionext/Kconfig
drivers/phy/st/Kconfig
drivers/phy/st/Makefile
drivers/phy/tegra/Kconfig
drivers/phy/tegra/Makefile
drivers/phy/ti/Kconfig
drivers/pinctrl/Kconfig
drivers/pinctrl/actions/Kconfig
drivers/pinctrl/actions/Makefile
drivers/pinctrl/aspeed/Kconfig
drivers/pinctrl/aspeed/Makefile
drivers/pinctrl/bcm/Kconfig
drivers/pinctrl/berlin/Kconfig
drivers/pinctrl/berlin/Makefile
drivers/pinctrl/cirrus/Kconfig
drivers/pinctrl/cirrus/Makefile
drivers/pinctrl/freescale/Kconfig
drivers/pinctrl/mediatek/Kconfig
drivers/pinctrl/meson/Kconfig
drivers/pinctrl/meson/Makefile
drivers/pinctrl/mvebu/Kconfig
drivers/pinctrl/nomadik/Kconfig
drivers/pinctrl/nuvoton/Kconfig
drivers/pinctrl/pinctrl-mcp23s08.c
drivers/pinctrl/pinctrl-u300.c
drivers/pinctrl/pinctrl-zynq.c
drivers/pinctrl/pxa/Kconfig
drivers/pinctrl/pxa/Makefile
drivers/pinctrl/qcom/Kconfig
drivers/pinctrl/sirf/Makefile
drivers/pinctrl/sirf/pinctrl-atlas6.c
drivers/pinctrl/sirf/pinctrl-atlas7.c
drivers/pinctrl/sirf/pinctrl-prima2.c
drivers/pinctrl/sirf/pinctrl-sirf.c
drivers/pinctrl/sirf/pinctrl-sirf.h
drivers/pinctrl/spear/Kconfig
drivers/pinctrl/sprd/Kconfig
drivers/pinctrl/sprd/Makefile
drivers/pinctrl/stm32/Kconfig
drivers/pinctrl/sunxi/Kconfig
drivers/pinctrl/tegra/Kconfig
drivers/pinctrl/ti/Kconfig
drivers/pinctrl/ti/Makefile
drivers/pinctrl/uniphier/Kconfig
drivers/pinctrl/vt8500/Kconfig
drivers/pinctrl/zte/Kconfig
drivers/pinctrl/zte/Makefile
drivers/platform/Kconfig
drivers/platform/chrome/Kconfig
drivers/platform/chrome/wilco_ec/Kconfig
drivers/platform/goldfish/Kconfig
drivers/platform/goldfish/Makefile
drivers/platform/mips/Kconfig
drivers/platform/mips/Makefile
drivers/platform/mips/cpu_hwmon.c
drivers/platform/olpc/Makefile
drivers/platform/x86/Kconfig
drivers/platform/x86/classmate-laptop.c
drivers/platform/x86/compal-laptop.c
drivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/hp-wireless.c
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/msi-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/pnp/Kconfig
drivers/pnp/isapnp/Kconfig
drivers/pnp/isapnp/Makefile
drivers/pnp/pnpacpi/Kconfig
drivers/pnp/pnpacpi/Makefile
drivers/pnp/pnpbios/Kconfig
drivers/pnp/pnpbios/Makefile
drivers/power/Kconfig
drivers/power/Makefile
drivers/power/avs/Kconfig
drivers/power/avs/Makefile
drivers/power/reset/Kconfig
drivers/power/reset/at91-sama5d2_shdwc.c
drivers/power/reset/syscon-reboot.c
drivers/power/supply/Kconfig
drivers/power/supply/Makefile
drivers/power/supply/ab8500_bmdata.c
drivers/power/supply/axp20x_usb_power.c
drivers/power/supply/axp288_charger.c
drivers/power/supply/axp288_fuel_gauge.c
drivers/power/supply/bq27xxx_battery.c
drivers/power/supply/charger-manager.c
drivers/power/supply/cpcap-battery.c
drivers/power/supply/cpcap-charger.c
drivers/power/supply/gpio-charger.c
drivers/power/supply/ingenic-battery.c [new file with mode: 0644]
drivers/power/supply/lt3651-charger.c [moved from drivers/power/supply/ltc3651-charger.c with 50% similarity]
drivers/power/supply/ltc2941-battery-gauge.c
drivers/power/supply/max14656_charger_detector.c
drivers/power/supply/olpc_battery.c
drivers/power/supply/power_supply_core.c
drivers/power/supply/power_supply_sysfs.c
drivers/power/supply/rx51_battery.c
drivers/power/supply/twl4030_madc_battery.c
drivers/power/supply/ucs1002_power.c [new file with mode: 0644]
drivers/powercap/Kconfig
drivers/powercap/Makefile
drivers/pps/Kconfig
drivers/pps/Makefile
drivers/pps/clients/Kconfig
drivers/pps/clients/Makefile
drivers/pps/clients/pps-gpio.c
drivers/pps/generators/Kconfig
drivers/pps/generators/Makefile
drivers/ps3/Makefile
drivers/ptp/Kconfig
drivers/pwm/Kconfig
drivers/pwm/core.c
drivers/pwm/pwm-atmel-tcb.c
drivers/pwm/pwm-ep93xx.c
drivers/pwm/pwm-hibvt.c
drivers/pwm/pwm-tegra.c
drivers/rapidio/Kconfig
drivers/rapidio/devices/Kconfig
drivers/rapidio/devices/Makefile
drivers/rapidio/devices/tsi721_dma.c
drivers/rapidio/rio_cm.c
drivers/rapidio/switches/Kconfig
drivers/ras/Kconfig
drivers/ras/Makefile
drivers/ras/debugfs.c
drivers/regulator/Kconfig
drivers/remoteproc/Kconfig
drivers/reset/Kconfig
drivers/reset/hisilicon/Kconfig
drivers/reset/hisilicon/Makefile
drivers/reset/reset-zynqmp.c
drivers/reset/sti/Kconfig
drivers/reset/sti/Makefile
drivers/reset/tegra/Kconfig
drivers/reset/tegra/Makefile
drivers/rtc/Kconfig
drivers/rtc/rtc-bq4802.c
drivers/rtc/rtc-ds1216.c
drivers/rtc/rtc-generic.c
drivers/rtc/rtc-mc146818-lib.c
drivers/rtc/rtc-msm6242.c
drivers/rtc/rtc-omap.c
drivers/rtc/rtc-r7301.c
drivers/rtc/rtc-rp5c01.c
drivers/rtc/rtc-sirfsoc.c
drivers/rtc/rtc-sunxi.c
drivers/s390/block/dasd_eckd.c
drivers/s390/cio/qdio_main.c
drivers/s390/cio/trace.c
drivers/s390/cio/trace.h
drivers/sbus/Makefile
drivers/sbus/char/Kconfig
drivers/sbus/char/bbc_i2c.c
drivers/sbus/char/display7seg.c
drivers/sbus/char/envctrl.c
drivers/sbus/char/flash.c
drivers/sbus/char/oradax.c
drivers/sbus/char/uctrl.c
drivers/scsi/Kconfig
drivers/scsi/a2091.c
drivers/scsi/a3000.c
drivers/scsi/a4000t.c
drivers/scsi/aacraid/Makefile
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/commctrl.c
drivers/scsi/aacraid/comminit.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/dpcsup.c
drivers/scsi/aacraid/linit.c
drivers/scsi/aacraid/nark.c
drivers/scsi/aacraid/rkt.c
drivers/scsi/aacraid/rx.c
drivers/scsi/aacraid/sa.c
drivers/scsi/aacraid/src.c
drivers/scsi/aha1542.c
drivers/scsi/aic7xxx/Kconfig.aic79xx
drivers/scsi/aic7xxx/Kconfig.aic7xxx
drivers/scsi/am53c974.c
drivers/scsi/arcmsr/Makefile
drivers/scsi/arm/Kconfig
drivers/scsi/arm/arxescsi.c
drivers/scsi/arm/cumana_1.c
drivers/scsi/arm/oak.c
drivers/scsi/atp870u.c
drivers/scsi/be2iscsi/Kconfig
drivers/scsi/be2iscsi/Makefile
drivers/scsi/bnx2fc/Kconfig
drivers/scsi/bnx2fc/Makefile
drivers/scsi/bnx2i/Kconfig
drivers/scsi/bnx2i/Makefile
drivers/scsi/bvme6000_scsi.c
drivers/scsi/ch.c
drivers/scsi/csiostor/Kconfig
drivers/scsi/cxgbi/Kconfig
drivers/scsi/cxgbi/Makefile
drivers/scsi/cxgbi/cxgb3i/Kconfig
drivers/scsi/cxgbi/cxgb4i/Kconfig
drivers/scsi/cxlflash/Kconfig
drivers/scsi/cxlflash/Makefile
drivers/scsi/device_handler/Kconfig
drivers/scsi/device_handler/Makefile
drivers/scsi/device_handler/scsi_dh_emc.c
drivers/scsi/device_handler/scsi_dh_hp_sw.c
drivers/scsi/esas2r/Kconfig
drivers/scsi/esas2r/Makefile
drivers/scsi/esp_scsi.c
drivers/scsi/fcoe/Makefile
drivers/scsi/g_NCR5380.c
drivers/scsi/gvp11.c
drivers/scsi/hisi_sas/Kconfig
drivers/scsi/hisi_sas/Makefile
drivers/scsi/hosts.c
drivers/scsi/ibmvscsi/Makefile
drivers/scsi/ibmvscsi_tgt/Makefile
drivers/scsi/imm.c
drivers/scsi/initio.c
drivers/scsi/jazz_esp.c
drivers/scsi/libsas/sas_task.c
drivers/scsi/mac53c94.c
drivers/scsi/mac_esp.c
drivers/scsi/mac_scsi.c
drivers/scsi/megaraid/Kconfig.megaraid
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fp.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/megaraid/megaraid_sas_fusion.h
drivers/scsi/mesh.c
drivers/scsi/mvme16x_scsi.c
drivers/scsi/osst.c
drivers/scsi/pcmcia/Kconfig
drivers/scsi/qedf/Kconfig
drivers/scsi/qedf/Makefile
drivers/scsi/qedi/Kconfig
drivers/scsi/qedi/Makefile
drivers/scsi/qla2xxx/Kconfig
drivers/scsi/qla4xxx/Kconfig
drivers/scsi/qla4xxx/Makefile
drivers/scsi/qlogicpti.c
drivers/scsi/scsi.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_pm.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/sd.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/scsi/sun3_scsi.c
drivers/scsi/sun3x_esp.c
drivers/scsi/sun_esp.c
drivers/scsi/sym53c8xx_2/Makefile
drivers/scsi/wd719x.c
drivers/scsi/zalon.c
drivers/scsi/zorro7xx.c
drivers/sfi/Kconfig
drivers/sfi/Makefile
drivers/sh/Kconfig
drivers/sh/clk/Makefile
drivers/sh/intc/Kconfig
drivers/sh/intc/Makefile
drivers/sh/intc/userimask.c
drivers/sh/maple/Makefile
drivers/sh/superhyway/Makefile
drivers/siox/Kconfig
drivers/siox/Makefile
drivers/sn/Kconfig
drivers/sn/Makefile
drivers/sn/ioc3.c
drivers/soc/Kconfig
drivers/soc/Makefile
drivers/soc/actions/Kconfig
drivers/soc/amlogic/Kconfig
drivers/soc/amlogic/Makefile
drivers/soc/amlogic/meson-gx-pwrc-vpu.c
drivers/soc/amlogic/meson-gx-socinfo.c
drivers/soc/aspeed/Kconfig [new file with mode: 0644]
drivers/soc/aspeed/Makefile [new file with mode: 0644]
drivers/soc/aspeed/aspeed-lpc-ctrl.c [moved from drivers/misc/aspeed-lpc-ctrl.c with 100% similarity]
drivers/soc/aspeed/aspeed-lpc-snoop.c [moved from drivers/misc/aspeed-lpc-snoop.c with 100% similarity]
drivers/soc/aspeed/aspeed-p2a-ctrl.c [moved from drivers/misc/aspeed-p2a-ctrl.c with 100% similarity]
drivers/soc/atmel/Kconfig
drivers/soc/atmel/Makefile
drivers/soc/bcm/Kconfig
drivers/soc/bcm/Makefile
drivers/soc/bcm/brcmstb/Kconfig
drivers/soc/bcm/brcmstb/Makefile
drivers/soc/bcm/brcmstb/pm/Makefile
drivers/soc/dove/Makefile
drivers/soc/fsl/Kconfig
drivers/soc/fsl/Makefile
drivers/soc/fsl/qbman/Kconfig
drivers/soc/fsl/qe/Kconfig
drivers/soc/fsl/qe/gpio.c
drivers/soc/imx/Kconfig
drivers/soc/imx/Makefile
drivers/soc/imx/gpc.c
drivers/soc/imx/gpcv2.c
drivers/soc/imx/soc-imx8.c [new file with mode: 0644]
drivers/soc/ixp4xx/Kconfig [new file with mode: 0644]
drivers/soc/ixp4xx/Makefile [new file with mode: 0644]
drivers/soc/ixp4xx/ixp4xx-npe.c [moved from arch/arm/mach-ixp4xx/ixp4xx_npe.c with 94% similarity]
drivers/soc/ixp4xx/ixp4xx-qmgr.c [moved from arch/arm/mach-ixp4xx/ixp4xx_qmgr.c with 66% similarity]
drivers/soc/lantiq/Makefile
drivers/soc/mediatek/Kconfig
drivers/soc/mediatek/Makefile
drivers/soc/mediatek/mtk-pmic-wrap.c
drivers/soc/qcom/Kconfig
drivers/soc/qcom/cmd-db.c
drivers/soc/qcom/qmi_interface.c
drivers/soc/qcom/rmtfs_mem.c
drivers/soc/qcom/rpmh-rsc.c
drivers/soc/renesas/renesas-soc.c
drivers/soc/rockchip/Kconfig
drivers/soc/rockchip/Makefile
drivers/soc/rockchip/grf.c
drivers/soc/sunxi/Kconfig
drivers/soc/sunxi/Makefile
drivers/soc/tegra/Kconfig
drivers/soc/tegra/pmc.c
drivers/soc/ti/Kconfig
drivers/soc/ti/Makefile
drivers/soc/ti/pm33xx.c
drivers/soc/ti/ti_sci_inta_msi.c [new file with mode: 0644]
drivers/soc/ux500/Kconfig
drivers/soc/ux500/Makefile
drivers/soc/versatile/Kconfig
drivers/soc/versatile/Makefile
drivers/soc/xilinx/zynqmp_pm_domains.c
drivers/soc/xilinx/zynqmp_power.c
drivers/soc/zte/Kconfig
drivers/soc/zte/Makefile
drivers/soundwire/Kconfig
drivers/soundwire/Makefile
drivers/spi/Kconfig
drivers/spi/spi-cavium-thunderx.c
drivers/spi/spi-jcore.c
drivers/spi/spi-pxa2xx-pci.c
drivers/spi/spi-rockchip.c
drivers/spi/spi-sirf.c
drivers/spi/spi-zynqmp-gqspi.c
drivers/spmi/Kconfig
drivers/spmi/Makefile
drivers/ssb/Kconfig
drivers/staging/fieldbus/Kconfig
drivers/staging/fieldbus/anybuss/Kconfig
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-capture.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx-media.h
drivers/staging/media/imx/imx7-media-csi.c
drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c
drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c
drivers/target/Kconfig
drivers/target/iscsi/Kconfig
drivers/target/iscsi/cxgbit/Kconfig
drivers/target/iscsi/cxgbit/Makefile
drivers/target/loopback/Kconfig
drivers/target/loopback/Makefile
drivers/target/sbp/Kconfig
drivers/target/sbp/Makefile
drivers/target/tcm_fc/Kconfig
drivers/tc/Makefile
drivers/tee/Kconfig
drivers/tee/optee/Kconfig
drivers/tee/optee/core.c
drivers/thermal/Kconfig
drivers/thermal/Makefile
drivers/thermal/broadcom/Kconfig
drivers/thermal/broadcom/Makefile
drivers/thermal/broadcom/sr-thermal.c
drivers/thermal/cpu_cooling.c
drivers/thermal/intel/Kconfig
drivers/thermal/intel/int340x_thermal/Kconfig
drivers/thermal/intel/int340x_thermal/int3403_thermal.c
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
drivers/thermal/of-thermal.c
drivers/thermal/qcom/Kconfig
drivers/thermal/qcom/Makefile
drivers/thermal/qcom/tsens-8916.c [deleted file]
drivers/thermal/qcom/tsens-8960.c
drivers/thermal/qcom/tsens-common.c
drivers/thermal/qcom/tsens-v0_1.c [moved from drivers/thermal/qcom/tsens-8974.c with 56% similarity]
drivers/thermal/qcom/tsens-v1.c [new file with mode: 0644]
drivers/thermal/qcom/tsens-v2.c
drivers/thermal/qcom/tsens.c
drivers/thermal/qcom/tsens.h
drivers/thermal/qoriq_thermal.c
drivers/thermal/rcar_gen3_thermal.c
drivers/thermal/rcar_thermal.c
drivers/thermal/rockchip_thermal.c
drivers/thermal/samsung/Kconfig
drivers/thermal/samsung/Makefile
drivers/thermal/st/Kconfig
drivers/thermal/st/Makefile
drivers/thermal/st/stm_thermal.c
drivers/thermal/tango_thermal.c
drivers/thermal/tegra/Kconfig
drivers/thermal/tegra/soctherm.c
drivers/thermal/tegra/soctherm.h
drivers/thermal/tegra/tegra124-soctherm.c
drivers/thermal/tegra/tegra132-soctherm.c
drivers/thermal/tegra/tegra210-soctherm.c
drivers/thermal/thermal-generic-adc.c
drivers/thermal/thermal_core.c
drivers/thermal/thermal_mmio.c [new file with mode: 0644]
drivers/thermal/ti-soc-thermal/Kconfig
drivers/thunderbolt/Kconfig
drivers/thunderbolt/Makefile
drivers/thunderbolt/nhi.c
drivers/tty/hvc/hvc_riscv_sbi.c
drivers/tty/sysrq.c
drivers/uio/Kconfig
drivers/usb/host/ohci-da8xx.c
drivers/usb/storage/Makefile
drivers/uwb/Kconfig
drivers/uwb/i1480/Makefile
drivers/vfio/Kconfig
drivers/vfio/mdev/Kconfig
drivers/vfio/mdev/Makefile
drivers/vfio/pci/Kconfig
drivers/vfio/pci/Makefile
drivers/vfio/platform/Kconfig
drivers/vfio/platform/reset/Kconfig
drivers/vhost/Kconfig
drivers/vhost/Kconfig.vringh
drivers/vhost/vringh.c
drivers/video/Kconfig
drivers/video/backlight/Kconfig
drivers/video/backlight/backlight.c
drivers/video/backlight/lcd.c
drivers/video/backlight/pwm_bl.c
drivers/video/console/Kconfig
drivers/video/console/dummycon.c
drivers/video/console/newport_con.c
drivers/video/console/sticore.c
drivers/video/fbdev/Kconfig
drivers/video/fbdev/aty/aty128fb.c
drivers/video/fbdev/bw2.c
drivers/video/fbdev/carminefb.c
drivers/video/fbdev/cg14.c
drivers/video/fbdev/cg3.c
drivers/video/fbdev/cg6.c
drivers/video/fbdev/cobalt_lcdfb.c
drivers/video/fbdev/dnfb.c
drivers/video/fbdev/efifb.c
drivers/video/fbdev/fb-puv3.c
drivers/video/fbdev/ffb.c
drivers/video/fbdev/geode/Kconfig
drivers/video/fbdev/gxt4500.c
drivers/video/fbdev/hpfb.c
drivers/video/fbdev/i740fb.c
drivers/video/fbdev/kyro/Makefile
drivers/video/fbdev/leo.c
drivers/video/fbdev/matrox/Makefile
drivers/video/fbdev/matrox/i2c-matroxfb.c
drivers/video/fbdev/matrox/matroxfb_DAC1064.c
drivers/video/fbdev/matrox/matroxfb_Ti3026.c
drivers/video/fbdev/matrox/matroxfb_accel.c
drivers/video/fbdev/matrox/matroxfb_base.c
drivers/video/fbdev/matrox/matroxfb_crtc2.c
drivers/video/fbdev/matrox/matroxfb_g450.c
drivers/video/fbdev/matrox/matroxfb_maven.c
drivers/video/fbdev/matrox/matroxfb_misc.c
drivers/video/fbdev/mb862xx/Makefile
drivers/video/fbdev/mbx/Makefile
drivers/video/fbdev/mmp/Kconfig
drivers/video/fbdev/mmp/Makefile
drivers/video/fbdev/mmp/core.c
drivers/video/fbdev/mmp/fb/Kconfig
drivers/video/fbdev/mmp/fb/Makefile
drivers/video/fbdev/mmp/fb/mmpfb.c
drivers/video/fbdev/mmp/fb/mmpfb.h
drivers/video/fbdev/mmp/hw/Kconfig
drivers/video/fbdev/mmp/hw/Makefile
drivers/video/fbdev/mmp/hw/mmp_ctrl.c
drivers/video/fbdev/mmp/hw/mmp_ctrl.h
drivers/video/fbdev/mmp/hw/mmp_spi.c
drivers/video/fbdev/mmp/panel/Makefile
drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c
drivers/video/fbdev/omap/Kconfig
drivers/video/fbdev/omap2/Kconfig
drivers/video/fbdev/omap2/Makefile
drivers/video/fbdev/omap2/omapfb/Kconfig
drivers/video/fbdev/omap2/omapfb/displays/Kconfig
drivers/video/fbdev/p9100.c
drivers/video/fbdev/pvr2fb.c
drivers/video/fbdev/savage/Makefile
drivers/video/fbdev/sis/Makefile
drivers/video/fbdev/sstfb.c
drivers/video/fbdev/tcx.c
drivers/video/fbdev/tdfxfb.c
drivers/video/fbdev/tridentfb.c
drivers/video/fbdev/uvesafb.c
drivers/video/fbdev/vermilion/Makefile
drivers/video/fbdev/vesafb.c
drivers/video/fbdev/via/via-core.c
drivers/video/logo/Kconfig
drivers/video/logo/logo.c
drivers/virt/Kconfig
drivers/virt/Makefile
drivers/virt/fsl_hypervisor.c
drivers/virt/vboxguest/Kconfig
drivers/virt/vboxguest/Makefile
drivers/virtio/Kconfig
drivers/virtio/virtio.c
drivers/virtio/virtio_input.c
drivers/visorbus/Kconfig
drivers/vlynq/Kconfig
drivers/vlynq/Makefile
drivers/vme/Kconfig
drivers/vme/Makefile
drivers/vme/boards/Kconfig
drivers/vme/boards/Makefile
drivers/vme/bridges/Kconfig
drivers/vme/bridges/Makefile
drivers/w1/Kconfig
drivers/w1/Makefile
drivers/w1/masters/Kconfig
drivers/w1/slaves/Kconfig
drivers/watchdog/Kconfig
drivers/watchdog/alim7101_wdt.c
drivers/watchdog/asm9260_wdt.c
drivers/watchdog/cpwd.c
drivers/watchdog/diag288_wdt.c
drivers/watchdog/ixp4xx_wdt.c
drivers/watchdog/pcwd.c
drivers/watchdog/pika_wdt.c
drivers/watchdog/riowd.c
drivers/watchdog/sirfsoc_wdt.c
drivers/xen/Kconfig
drivers/xen/dbgp.c
drivers/xen/efi.c
drivers/xen/events/Makefile
drivers/xen/events/events_base.c
drivers/xen/features.c
drivers/xen/manage.c
drivers/xen/privcmd.c
drivers/xen/tmem.c
drivers/xen/xen-acpi-cpuhotplug.c
drivers/xen/xen-acpi-memhotplug.c
drivers/xen/xen-pciback/xenbus.c
drivers/xen/xen-stub.c
drivers/xen/xenbus/xenbus_dev_frontend.c
drivers/xen/xenbus/xenbus_probe_frontend.c
drivers/xen/xenfs/Makefile
drivers/xen/xenfs/super.c
drivers/zorro/Kconfig
fs/9p/Kconfig
fs/Kconfig
fs/Kconfig.binfmt
fs/adfs/Kconfig
fs/adfs/Makefile
fs/affs/Kconfig
fs/affs/Makefile
fs/affs/super.c
fs/afs/Kconfig
fs/afs/addr_list.c
fs/afs/afs.h
fs/afs/callback.c
fs/afs/cell.c
fs/afs/cmservice.c
fs/afs/dir.c
fs/afs/dir_silly.c
fs/afs/dynroot.c
fs/afs/file.c
fs/afs/flock.c
fs/afs/fs_probe.c
fs/afs/fsclient.c
fs/afs/inode.c
fs/afs/internal.h
fs/afs/proc.c
fs/afs/rotate.c
fs/afs/rxrpc.c
fs/afs/security.c
fs/afs/server.c
fs/afs/super.c
fs/afs/vl_list.c
fs/afs/vl_probe.c
fs/afs/vl_rotate.c
fs/afs/vlclient.c
fs/afs/write.c
fs/afs/xattr.c
fs/afs/yfsclient.c
fs/anon_inodes.c
fs/autofs/Kconfig
fs/autofs/Makefile
fs/befs/Kconfig
fs/befs/Makefile
fs/befs/linuxvfs.c
fs/bfs/Kconfig
fs/bfs/Makefile
fs/bfs/inode.c
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/binfmt_em86.c
fs/binfmt_misc.c
fs/binfmt_script.c
fs/block_dev.c
fs/btrfs/compression.c
fs/btrfs/extent-tree.c
fs/btrfs/file.c
fs/btrfs/props.c
fs/btrfs/root-tree.c
fs/btrfs/sysfs.c
fs/btrfs/tree-checker.c
fs/btrfs/tree-log.c
fs/buffer.c
fs/cachefiles/Kconfig
fs/cachefiles/namei.c
fs/ceph/Kconfig
fs/ceph/caps.c
fs/ceph/debugfs.c
fs/ceph/export.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/locks.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/mdsmap.c
fs/ceph/quota.c
fs/ceph/super.c
fs/ceph/super.h
fs/cifs/Kconfig
fs/cifs/cifs_debug.c
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/connect.c
fs/cifs/dns_resolve.c
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c
fs/cifs/smbdirect.c
fs/cifs/transport.c
fs/coda/Kconfig
fs/coda/Makefile
fs/coda/psdev.c
fs/configfs/Kconfig
fs/configfs/Makefile
fs/configfs/dir.c
fs/cramfs/Kconfig
fs/cramfs/Makefile
fs/crypto/Kconfig
fs/crypto/Makefile
fs/crypto/crypto.c
fs/crypto/hooks.c
fs/dcache.c
fs/dcookies.c
fs/debugfs/Makefile
fs/devpts/Makefile
fs/direct-io.c
fs/dlm/Kconfig
fs/ecryptfs/Kconfig
fs/ecryptfs/Makefile
fs/efivarfs/Kconfig
fs/efivarfs/Makefile
fs/efs/Kconfig
fs/efs/Makefile
fs/efs/inode.c
fs/eventfd.c
fs/exec.c
fs/exportfs/Makefile
fs/exportfs/expfs.c
fs/ext2/Kconfig
fs/ext2/super.c
fs/ext4/Kconfig
fs/ext4/block_validity.c
fs/ext4/extents.c
fs/ext4/file.c
fs/ext4/fsmap.c
fs/ext4/ioctl.c
fs/ext4/namei.c
fs/ext4/super.c
fs/f2fs/Kconfig
fs/fat/Kconfig
fs/fat/dir.c
fs/fat/file.c
fs/fat/inode.c
fs/fat/misc.c
fs/fat/namei_msdos.c
fs/fat/namei_vfat.c
fs/file_table.c
fs/freevxfs/Kconfig
fs/freevxfs/Makefile
fs/fs-writeback.c
fs/fs_struct.c
fs/fscache/Kconfig
fs/fsopen.c
fs/fuse/Kconfig
fs/fuse/Makefile
fs/gfs2/Kconfig
fs/gfs2/lock_dlm.c
fs/hfs/Kconfig
fs/hfs/Makefile
fs/hfsplus/Kconfig
fs/hfsplus/super.c
fs/hpfs/Kconfig
fs/hpfs/Makefile
fs/hpfs/super.c
fs/hugetlbfs/Makefile
fs/inode.c
fs/io_uring.c
fs/isofs/Kconfig
fs/isofs/inode.c
fs/jbd2/Kconfig
fs/jbd2/Makefile
fs/jbd2/journal.c
fs/jbd2/revoke.c
fs/jbd2/transaction.c
fs/jffs2/Kconfig
fs/jfs/Kconfig
fs/kernfs/Kconfig
fs/kernfs/Makefile
fs/libfs.c
fs/lockd/clntlock.c
fs/lockd/clntproc.c
fs/lockd/svc.c
fs/lockd/svcsubs.c
fs/locks.c
fs/mbcache.c
fs/minix/Kconfig
fs/minix/Makefile
fs/minix/inode.c
fs/nfs/Kconfig
fs/nfs/blocklayout/Makefile
fs/nfs/callback.c
fs/nfs/callback_xdr.c
fs/nfs/client.c
fs/nfs/delegation.c
fs/nfs/dir.c
fs/nfs/direct.c
fs/nfs/dns_resolve.c
fs/nfs/file.c
fs/nfs/filelayout/Makefile
fs/nfs/flexfilelayout/Makefile
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/inode.c
fs/nfs/namespace.c
fs/nfs/nfs2super.c
fs/nfs/nfs3client.c
fs/nfs/nfs3super.c
fs/nfs/nfs4client.c
fs/nfs/nfs4session.c
fs/nfs/nfs4super.c
fs/nfs/pagelist.c
fs/nfs/pnfs_nfs.c
fs/nfs/read.c
fs/nfs/super.c
fs/nfs/write.c
fs/nfs_common/Makefile
fs/nfs_common/grace.c
fs/nfs_common/nfsacl.c
fs/nfsd/Kconfig
fs/nfsd/export.c
fs/nfsd/netns.h
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4idmap.c
fs/nfsd/nfs4layouts.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4recover.c
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsctl.c
fs/nfsd/nfsd.h
fs/nfsd/nfssvc.c
fs/nfsd/nfsxdr.c
fs/nfsd/state.h
fs/nfsd/vfs.c
fs/nfsd/vfs.h
fs/nilfs2/Kconfig
fs/nls/Kconfig
fs/notify/Kconfig
fs/notify/dnotify/Kconfig
fs/notify/dnotify/Makefile
fs/notify/fanotify/Kconfig
fs/notify/fanotify/Makefile
fs/notify/fsnotify.c
fs/notify/group.c
fs/notify/inotify/Kconfig
fs/notify/inotify/Makefile
fs/notify/mark.c
fs/notify/notification.c
fs/ntfs/Kconfig
fs/ocfs2/Kconfig
fs/ocfs2/cluster/Makefile
fs/ocfs2/dlm/Makefile
fs/ocfs2/dlmfs/Makefile
fs/omfs/Kconfig
fs/omfs/Makefile
fs/open.c
fs/openpromfs/Makefile
fs/openpromfs/inode.c
fs/orangefs/Kconfig
fs/orangefs/orangefs-mod.c
fs/overlayfs/Kconfig
fs/overlayfs/Makefile
fs/posix_acl.c
fs/proc/Kconfig
fs/proc/base.c
fs/proc/generic.c
fs/proc/proc_net.c
fs/proc/vmcore.c
fs/pstore/Kconfig
fs/qnx4/Kconfig
fs/qnx4/Makefile
fs/qnx4/inode.c
fs/qnx6/Kconfig
fs/qnx6/Makefile
fs/qnx6/inode.c
fs/quota/Kconfig
fs/quota/quota_tree.c
fs/quota/quota_v1.c
fs/quota/quota_v2.c
fs/ramfs/Makefile
fs/reiserfs/Kconfig
fs/reiserfs/xattr.c
fs/romfs/Kconfig
fs/splice.c
fs/squashfs/Kconfig
fs/stack.c
fs/sysfs/Kconfig
fs/sysfs/Makefile
fs/sysv/Kconfig
fs/sysv/Makefile
fs/sysv/super.c
fs/tracefs/Makefile
fs/ubifs/Kconfig
fs/ubifs/sb.c
fs/ubifs/ubifs.h
fs/ubifs/xattr.c
fs/udf/Kconfig
fs/udf/Makefile
fs/ufs/Kconfig
fs/ufs/Makefile
fs/ufs/super.c
fs/unicode/Kconfig
fs/unicode/README.utf8data
fs/unicode/utf8-norm.c
fs/xattr.c
fs/xfs/Kconfig
fs/xfs/Makefile
include/acpi/acpi_bus.h
include/acpi/acpixf.h
include/acpi/platform/aclinux.h
include/asm-generic/mm_hooks.h
include/asm-generic/segment.h [deleted file]
include/asm-generic/shmparam.h
include/asm-generic/sizes.h [deleted file]
include/asm-generic/uaccess.h
include/crypto/hash.h
include/dt-bindings/clock/at91.h
include/dt-bindings/clock/hi3516cv300-clock.h
include/dt-bindings/clock/hi3519-clock.h
include/dt-bindings/clock/hi3620-clock.h
include/dt-bindings/clock/hip04-clock.h
include/dt-bindings/clock/histb-clock.h
include/dt-bindings/clock/xlnx-zynqmp-clk.h [moved from include/dt-bindings/clock/xlnx,zynqmp-clk.h with 85% similarity]
include/dt-bindings/firmware/imx/rsrc.h
include/dt-bindings/pinctrl/am33xx.h
include/dt-bindings/pinctrl/omap.h
include/dt-bindings/power/r8a77965-sysc.h
include/dt-bindings/thermal/tegra124-soctherm.h
include/linux/ata.h
include/linux/binfmts.h
include/linux/bitops.h
include/linux/ceph/ceph_fs.h
include/linux/ceph/messenger.h
include/linux/ceph/osdmap.h
include/linux/clk-provider.h
include/linux/clk/at91_pmc.h
include/linux/compiler.h
include/linux/compiler_types.h
include/linux/console.h
include/linux/cpufreq.h
include/linux/cpumask.h
include/linux/device-mapper.h
include/linux/dma-iommu.h
include/linux/dmaengine.h
include/linux/dns_resolver.h
include/linux/firmware/imx/sci.h
include/linux/firmware/trusted_foundations.h [moved from arch/arm/include/asm/trusted_foundations.h with 77% similarity]
include/linux/firmware/xlnx-zynqmp.h
include/linux/ftrace.h
include/linux/host1x.h
include/linux/i2c-algo-pcf.h
include/linux/i2c-dev.h
include/linux/i2c-mux.h
include/linux/i2c-smbus.h
include/linux/i2c.h
include/linux/iio/consumer.h
include/linux/ipc_namespace.h
include/linux/irq.h
include/linux/irqchip/arm-gic-v3.h
include/linux/irqchip/irq-ixp4xx.h [new file with mode: 0644]
include/linux/irqdomain.h
include/linux/jbd2.h
include/linux/kernel.h
include/linux/kthread.h
include/linux/kvm_host.h
include/linux/latencytop.h
include/linux/libata.h
include/linux/lightnvm.h
include/linux/list.h
include/linux/list_bl.h
include/linux/list_sort.h
include/linux/livepatch.h
include/linux/lockd/bind.h
include/linux/memcontrol.h
include/linux/mfd/tps65090.h
include/linux/microchipphy.h
include/linux/mlx5/mlx5_ifc.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/mmzone.h
include/linux/msi.h
include/linux/nvme.h
include/linux/of_net.h
include/linux/overflow.h
include/linux/percpu-defs.h
include/linux/perf_event.h
include/linux/platform_data/ata-pxa.h
include/linux/platform_data/eth-ep93xx.h [new file with mode: 0644]
include/linux/platform_data/keypad-ep93xx.h
include/linux/platform_data/mtd-mxc_nand.h
include/linux/platform_data/pm33xx.h
include/linux/platform_data/serial-imx.h
include/linux/platform_data/st33zp24.h
include/linux/platform_data/ti-sysc.h
include/linux/platform_data/timer-ixp4xx.h [new file with mode: 0644]
include/linux/platform_data/xtalk-bridge.h [new file with mode: 0644]
include/linux/plist.h
include/linux/pm_domain.h
include/linux/poll.h
include/linux/power/bq2415x_charger.h
include/linux/power/sbs-battery.h
include/linux/power_supply.h
include/linux/pps-gpio.h
include/linux/printk.h
include/linux/psi.h
include/linux/psi_types.h
include/linux/qcom-geni-se.h
include/linux/random.h
include/linux/reboot.h
include/linux/regulator/max8973-regulator.h
include/linux/regulator/pfuze100.h
include/linux/regulator/tps51632-regulator.h
include/linux/regulator/tps62360.h
include/linux/reset.h
include/linux/rtc/rtc-omap.h [new file with mode: 0644]
include/linux/rtc/sirfsoc_rtciobrg.h
include/linux/rtsx_common.h
include/linux/rtsx_pci.h
include/linux/sched.h
include/linux/sched/signal.h
include/linux/slab_def.h
include/linux/soc/cirrus/ep93xx.h [new file with mode: 0644]
include/linux/soc/ixp4xx/npe.h [moved from arch/arm/mach-ixp4xx/include/mach/npe.h with 95% similarity]
include/linux/soc/ixp4xx/qmgr.h [new file with mode: 0644]
include/linux/soc/ti/ti_sci_inta_msi.h [new file with mode: 0644]
include/linux/soc/ti/ti_sci_protocol.h
include/linux/sunrpc/svc.h
include/linux/sunrpc/svc_xprt.h
include/linux/sunrpc/svcsock.h
include/linux/syslog.h
include/linux/thermal.h
include/linux/ti-emif-sram.h
include/linux/tracepoint.h
include/linux/vmalloc.h
include/linux/wait_bit.h
include/media/davinci/vpbe.h
include/net/af_rxrpc.h
include/net/bond_alb.h
include/net/calipso.h
include/net/cipso_ipv4.h
include/net/dn_nsp.h
include/net/dn_route.h
include/net/mip6.h
include/net/netlabel.h
include/net/nfc/hci.h
include/net/nfc/nfc.h
include/soc/at91/atmel_tcb.h [moved from include/linux/atmel_tc.h with 99% similarity]
include/sound/hdaudio.h
include/trace/define_trace.h
include/trace/events/host1x.h
include/trace/events/rcu.h
include/trace/events/sched.h
include/uapi/asm-generic/unistd.h
include/uapi/linux/kvm.h
include/uapi/linux/nfsd/cld.h
include/uapi/linux/tipc_config.h
include/uapi/rdma/rdma_netlink.h
include/video/mmp_disp.h
init/Kconfig
init/do_mounts.c
init/initramfs.c
init/main.c
init/version.c
ipc/ipc_sysctl.c
ipc/mqueue.c
ipc/msgutil.c
ipc/util.c
ipc/util.h
kernel/Kconfig.freezer
kernel/Kconfig.hz
kernel/Kconfig.locks
kernel/Kconfig.preempt
kernel/Makefile
kernel/bpf/tnum.c
kernel/cgroup/cgroup-v1.c
kernel/cgroup/cgroup.c
kernel/cgroup/rstat.c
kernel/compat.c
kernel/context_tracking.c
kernel/crash_dump.c
kernel/debug/Makefile
kernel/delayacct.c
kernel/dma/Kconfig
kernel/dma/swiotlb.c
kernel/exit.c
kernel/fork.c
kernel/freezer.c
kernel/gcov/Kconfig
kernel/gcov/Makefile
kernel/gcov/base.c
kernel/gcov/clang.c [new file with mode: 0644]
kernel/gcov/gcc_3_4.c
kernel/gcov/gcc_4_7.c
kernel/gcov/gcc_base.c [new file with mode: 0644]
kernel/gcov/gcov.h
kernel/hung_task.c
kernel/irq/Kconfig
kernel/irq/chip.c
kernel/irq/irqdomain.c
kernel/irq_work.c
kernel/jump_label.c
kernel/kallsyms.c
kernel/kthread.c
kernel/latencytop.c
kernel/livepatch/Kconfig
kernel/livepatch/Makefile
kernel/livepatch/core.c
kernel/livepatch/patch.c
kernel/livepatch/shadow.c
kernel/livepatch/transition.c
kernel/locking/lockdep.c
kernel/locking/mutex.c
kernel/locking/percpu-rwsem.c
kernel/locking/rtmutex.c
kernel/locking/rwsem-xadd.c
kernel/locking/test-ww_mutex.c
kernel/notifier.c
kernel/panic.c
kernel/pid.c
kernel/pid_namespace.c
kernel/power/Kconfig
kernel/power/qos.c
kernel/printk/Makefile
kernel/printk/internal.h
kernel/printk/printk.c
kernel/printk/printk_safe.c
kernel/profile.c
kernel/ptrace.c
kernel/rcu/Kconfig
kernel/rcu/Kconfig.debug
kernel/rcu/rcu.h
kernel/rcu/tree.c
kernel/reboot.c
kernel/resource.c
kernel/sched/clock.c
kernel/sched/core.c
kernel/sched/cputime.c
kernel/sched/idle.c
kernel/sched/isolation.c
kernel/sched/psi.c
kernel/sched/wait.c
kernel/sched/wait_bit.c
kernel/signal.c
kernel/smp.c
kernel/smpboot.c
kernel/stacktrace.c
kernel/sysctl.c
kernel/test_kprobes.c
kernel/time/Kconfig
kernel/time/ntp.c
kernel/trace/Kconfig
kernel/trace/ftrace.c
kernel/trace/ring_buffer.c
kernel/trace/ring_buffer_benchmark.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c
kernel/trace/trace_events_hist.c
kernel/trace/trace_events_trigger.c
kernel/trace/trace_kdb.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_probe.c
kernel/trace/trace_probe.h
kernel/trace/trace_probe_tmpl.h
kernel/trace/trace_selftest.c
kernel/trace/trace_uprobe.c
kernel/umh.c
kernel/up.c
kernel/user-return-notifier.c
kernel/user.c
kernel/workqueue.c
lib/842/Makefile
lib/Kconfig
lib/Kconfig.debug
lib/Kconfig.kasan
lib/Kconfig.kgdb
lib/Kconfig.ubsan
lib/Makefile
lib/bitmap.c
lib/bitrev.c
lib/debug_locks.c
lib/fault-inject.c
lib/fonts/Kconfig
lib/hweight.c
lib/idr.c
lib/interval_tree.c
lib/interval_tree_test.c
lib/iov_iter.c
lib/list_sort.c
lib/lz4/Makefile
lib/lzo/Makefile
lib/lzo/lzo1x_compress.c
lib/lzo/lzo1x_decompress_safe.c
lib/math/Kconfig [new file with mode: 0644]
lib/math/Makefile [new file with mode: 0644]
lib/math/cordic.c [moved from lib/cordic.c with 100% similarity]
lib/math/div64.c [moved from lib/div64.c with 99% similarity]
lib/math/gcd.c [moved from lib/gcd.c with 97% similarity]
lib/math/int_pow.c [new file with mode: 0644]
lib/math/int_sqrt.c [moved from lib/int_sqrt.c with 100% similarity]
lib/math/lcm.c [moved from lib/lcm.c with 91% similarity]
lib/math/prime_numbers.c [moved from lib/prime_numbers.c with 99% similarity]
lib/math/rational.c [moved from lib/rational.c with 100% similarity]
lib/math/reciprocal_div.c [moved from lib/reciprocal_div.c with 100% similarity]
lib/memory-notifier-error-inject.c
lib/netdev-notifier-error-inject.c
lib/notifier-error-inject.c
lib/of-reconfig-notifier-error-inject.c
lib/percpu-refcount.c
lib/percpu_test.c
lib/plist.c
lib/pm-notifier-error-inject.c
lib/rbtree_test.c
lib/reed_solomon/Makefile
lib/sg_pool.c
lib/sort.c
lib/string_helpers.c
lib/test_bitmap.c
lib/test_debug_virtual.c
lib/test_firmware.c
lib/test_hash.c
lib/test_list_sort.c
lib/test_module.c
lib/test_printf.c
lib/test_sort.c
lib/test_string.c
lib/test_sysctl.c
lib/test_vmalloc.c
lib/vsprintf.c
lib/xz/Kconfig
lib/xz/Makefile
lib/zlib_deflate/Makefile
lib/zlib_deflate/deflate_syms.c
lib/zlib_inflate/Makefile
lib/zlib_inflate/inflate_syms.c
lib/zstd/Makefile
mm/Kconfig
mm/Kconfig.debug
mm/Makefile
mm/backing-dev.c
mm/balloon_compaction.c
mm/compaction.c
mm/debug.c
mm/filemap.c
mm/gup.c
mm/hugetlb.c
mm/hwpoison-inject.c
mm/list_lru.c
mm/maccess.c
mm/memcontrol.c
mm/memory.c
mm/memory_hotplug.c
mm/mincore.c
mm/mm_init.c
mm/mmap.c
mm/nommu.c
mm/oom_kill.c
mm/page-writeback.c
mm/page_alloc.c
mm/readahead.c
mm/shuffle.c [new file with mode: 0644]
mm/shuffle.h [new file with mode: 0644]
mm/slab.c
mm/swap.c
mm/swapfile.c
mm/truncate.c
mm/util.c
mm/vmalloc.c
mm/vmscan.c
mm/vmstat.c
mm/workingset.c
mm/z3fold.c
mm/zbud.c
mm/zpool.c
net/6lowpan/Kconfig
net/802/Kconfig
net/8021q/Kconfig
net/8021q/vlan_dev.c
net/9p/Kconfig
net/Kconfig
net/appletalk/Makefile
net/atm/Kconfig
net/atm/br2684.c
net/atm/clip.c
net/atm/common.c
net/atm/lec.c
net/atm/mpc.c
net/ax25/Kconfig
net/bluetooth/Kconfig
net/bluetooth/bnep/Kconfig
net/bluetooth/bnep/Makefile
net/bluetooth/cmtp/Kconfig
net/bluetooth/cmtp/Makefile
net/bluetooth/hidp/Kconfig
net/bluetooth/hidp/Makefile
net/bluetooth/rfcomm/Kconfig
net/bluetooth/rfcomm/Makefile
net/bpf/Makefile
net/bpfilter/Kconfig
net/bpfilter/Makefile
net/bridge/Kconfig
net/bridge/br_vlan.c
net/bridge/netfilter/Kconfig
net/bridge/netfilter/ebt_802_3.c
net/bridge/netfilter/ebt_among.c
net/bridge/netfilter/ebt_arp.c
net/bridge/netfilter/ebt_arpreply.c
net/bridge/netfilter/ebt_dnat.c
net/bridge/netfilter/ebt_ip.c
net/bridge/netfilter/ebt_ip6.c
net/bridge/netfilter/ebt_limit.c
net/bridge/netfilter/ebt_log.c
net/bridge/netfilter/ebt_mark.c
net/bridge/netfilter/ebt_mark_m.c
net/bridge/netfilter/ebt_nflog.c
net/bridge/netfilter/ebt_pkttype.c
net/bridge/netfilter/ebt_redirect.c
net/bridge/netfilter/ebt_snat.c
net/bridge/netfilter/ebt_stp.c
net/bridge/netfilter/ebt_vlan.c
net/bridge/netfilter/ebtable_broute.c
net/bridge/netfilter/ebtable_filter.c
net/bridge/netfilter/ebtable_nat.c
net/caif/Kconfig
net/can/Kconfig
net/ceph/Kconfig
net/ceph/ceph_common.c
net/ceph/cls_lock_client.c
net/ceph/debugfs.c
net/ceph/messenger.c
net/ceph/mon_client.c
net/ceph/osd_client.c
net/compat.c
net/core/drop_monitor.c
net/core/dst.c
net/core/flow_dissector.c
net/core/net_namespace.c
net/core/netpoll.c
net/core/secure_seq.c
net/dcb/Kconfig
net/dcb/Makefile
net/dccp/Kconfig
net/dccp/ccids/Kconfig
net/decnet/Kconfig
net/decnet/af_decnet.c
net/decnet/dn_nsp_in.c
net/decnet/dn_nsp_out.c
net/decnet/dn_route.c
net/decnet/netfilter/Kconfig
net/decnet/netfilter/Makefile
net/dns_resolver/Kconfig
net/dns_resolver/Makefile
net/dns_resolver/dns_query.c
net/dsa/Kconfig
net/ethernet/Makefile
net/hsr/Kconfig
net/hsr/Makefile
net/hsr/hsr_framereg.c
net/ieee802154/6lowpan/Kconfig
net/ieee802154/6lowpan/Makefile
net/ieee802154/Kconfig
net/ife/Kconfig
net/ife/Makefile
net/ipv4/Kconfig
net/ipv4/ah4.c
net/ipv4/bpfilter/Makefile
net/ipv4/cipso_ipv4.c
net/ipv4/esp4.c
net/ipv4/fou.c
net/ipv4/igmp.c
net/ipv4/inet_timewait_sock.c
net/ipv4/ip_output.c
net/ipv4/metrics.c
net/ipv4/netfilter/Kconfig
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/arpt_mangle.c
net/ipv4/netfilter/arptable_filter.c
net/ipv4/netfilter/iptable_raw.c
net/ipv4/netfilter/nf_dup_ipv4.c
net/ipv4/netfilter/nf_flow_table_ipv4.c
net/ipv4/netfilter/nf_nat_pptp.c
net/ipv4/netfilter/nf_nat_snmp_basic_main.c
net/ipv4/netlink.c
net/ipv4/ping.c
net/ipv4/raw.c
net/ipv4/raw_diag.c
net/ipv4/tcp_bic.c
net/ipv4/tcp_cdg.c
net/ipv4/tcp_cong.c
net/ipv4/tcp_cubic.c
net/ipv4/tcp_highspeed.c
net/ipv4/tcp_htcp.c
net/ipv4/tcp_hybla.c
net/ipv4/tcp_illinois.c
net/ipv4/tcp_lp.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_nv.c
net/ipv4/tcp_output.c
net/ipv4/tcp_rate.c
net/ipv4/tcp_scalable.c
net/ipv4/tcp_timer.c
net/ipv4/tcp_ulp.c
net/ipv4/tcp_vegas.c
net/ipv4/tcp_veno.c
net/ipv4/tcp_westwood.c
net/ipv4/tcp_yeah.c
net/ipv4/tunnel4.c
net/ipv4/udp.c
net/ipv4/udp_tunnel.c
net/ipv4/xfrm4_tunnel.c
net/ipv6/Kconfig
net/ipv6/addrconf.c
net/ipv6/addrconf_core.c
net/ipv6/ah6.c
net/ipv6/calipso.c
net/ipv6/datagram.c
net/ipv6/esp6.c
net/ipv6/exthdrs_core.c
net/ipv6/fou6.c
net/ipv6/ila/Makefile
net/ipv6/ip6_udp_tunnel.c
net/ipv6/ipcomp6.c
net/ipv6/mip6.c
net/ipv6/netfilter/Kconfig
net/ipv6/netfilter/ip6table_raw.c
net/ipv6/netfilter/nf_dup_ipv6.c
net/ipv6/netfilter/nf_flow_table_ipv6.c
net/ipv6/netfilter/nf_tproxy_ipv6.c
net/ipv6/output_core.c
net/ipv6/raw.c
net/ipv6/route.c
net/ipv6/tunnel6.c
net/ipv6/xfrm6_tunnel.c
net/iucv/Kconfig
net/iucv/Makefile
net/iucv/af_iucv.c
net/kcm/Kconfig
net/kcm/Makefile
net/key/Makefile
net/l2tp/Kconfig
net/l3mdev/Kconfig
net/l3mdev/Makefile
net/lapb/Kconfig
net/lapb/Makefile
net/llc/Kconfig
net/mac80211/Kconfig
net/mac80211/chan.c
net/mac802154/Kconfig
net/mac802154/Makefile
net/mpls/Kconfig
net/mpls/Makefile
net/mpls/af_mpls.c
net/ncsi/Kconfig
net/ncsi/Makefile
net/netfilter/Kconfig
net/netfilter/core.c
net/netfilter/ipset/Kconfig
net/netfilter/ipset/pfxlen.c
net/netfilter/ipvs/Kconfig
net/netfilter/ipvs/ip_vs_pe.c
net/netfilter/ipvs/ip_vs_pe_sip.c
net/netfilter/nf_conncount.c
net/netfilter/nf_conntrack_pptp.c
net/netfilter/nf_conntrack_proto_gre.c
net/netfilter/nf_conntrack_seqadj.c
net/netfilter/nf_flow_table_core.c
net/netfilter/nf_flow_table_inet.c
net/netfilter/nf_flow_table_ip.c
net/netfilter/nf_log.c
net/netfilter/nfnetlink_osf.c
net/netfilter/nft_flow_offload.c
net/netfilter/nft_osf.c
net/netfilter/xt_TEE.c
net/netfilter/xt_TRACE.c
net/netfilter/xt_comment.c
net/netfilter/xt_connmark.c
net/netfilter/xt_hashlimit.c
net/netfilter/xt_ipvs.c
net/netfilter/xt_osf.c
net/netfilter/xt_quota.c
net/netfilter/xt_sctp.c
net/netfilter/xt_tcpudp.c
net/netfilter/xt_u32.c
net/netlabel/Kconfig
net/netlabel/netlabel_addrlist.c
net/netlabel/netlabel_addrlist.h
net/netlabel/netlabel_calipso.c
net/netlabel/netlabel_calipso.h
net/netlabel/netlabel_cipso_v4.c
net/netlabel/netlabel_cipso_v4.h
net/netlabel/netlabel_domainhash.c
net/netlabel/netlabel_domainhash.h
net/netlabel/netlabel_kapi.c
net/netlabel/netlabel_mgmt.c
net/netlabel/netlabel_mgmt.h
net/netlabel/netlabel_unlabeled.c
net/netlabel/netlabel_unlabeled.h
net/netlabel/netlabel_user.c
net/netlabel/netlabel_user.h
net/netlink/Kconfig
net/netlink/Makefile
net/netlink/af_netlink.c
net/netlink/diag.c
net/netrom/Makefile
net/nfc/Kconfig
net/nfc/af_nfc.c
net/nfc/core.c
net/nfc/hci/Kconfig
net/nfc/hci/Makefile
net/nfc/hci/command.c
net/nfc/hci/core.c
net/nfc/hci/hci.h
net/nfc/hci/hcp.c
net/nfc/llcp.h
net/nfc/llcp_commands.c
net/nfc/llcp_core.c
net/nfc/llcp_sock.c
net/nfc/nci/Kconfig
net/nfc/netlink.c
net/nfc/nfc.h
net/nfc/rawsock.c
net/nsh/Kconfig
net/nsh/Makefile
net/openvswitch/Kconfig
net/packet/Kconfig
net/packet/Makefile
net/packet/diag.c
net/phonet/Kconfig
net/phonet/socket.c
net/psample/Kconfig
net/psample/Makefile
net/qrtr/Kconfig
net/qrtr/Makefile
net/qrtr/qrtr.c
net/rds/Kconfig
net/rfkill/Kconfig
net/rfkill/Makefile
net/rfkill/core.c
net/rfkill/rfkill-gpio.c
net/rose/Makefile
net/rxrpc/Kconfig
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-internal.h
net/rxrpc/call_object.c
net/rxrpc/conn_client.c
net/rxrpc/sendmsg.c
net/sched/Kconfig
net/sched/cls_tcindex.c
net/sched/em_canid.c
net/sched/sch_atm.c
net/sched/sch_dsmark.c
net/sched/sch_hhf.c
net/sctp/Kconfig
net/smc/Kconfig
net/smc/Makefile
net/smc/af_smc.c
net/smc/smc_diag.c
net/socket.c
net/strparser/Kconfig
net/strparser/Makefile
net/sunrpc/Kconfig
net/sunrpc/addr.c
net/sunrpc/auth.c
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/cache.c
net/sunrpc/clnt.c
net/sunrpc/rpc_pipe.c
net/sunrpc/rpcb_clnt.c
net/sunrpc/sched.c
net/sunrpc/socklib.c
net/sunrpc/stats.c
net/sunrpc/sunrpc_syms.c
net/sunrpc/svc.c
net/sunrpc/svc_xprt.c
net/sunrpc/svcauth.c
net/sunrpc/svcauth_unix.c
net/sunrpc/svcsock.c
net/sunrpc/sysctl.c
net/sunrpc/timer.c
net/sunrpc/xdr.c
net/sunrpc/xprt.c
net/switchdev/Kconfig
net/switchdev/Makefile
net/sysctl_net.c
net/tipc/Kconfig
net/tipc/core.c
net/tipc/subscr.h
net/tipc/topsrv.c
net/tls/Kconfig
net/tls/Makefile
net/tls/tls_device.c
net/unix/Kconfig
net/unix/diag.c
net/vmw_vsock/Kconfig
net/wimax/Kconfig
net/wireless/Kconfig
net/wireless/core.c
net/wireless/lib80211.c
net/wireless/nl80211.c
net/wireless/wext-compat.h
net/x25/Kconfig
net/xdp/Kconfig
net/xdp/Makefile
net/xfrm/Kconfig
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
samples/Kconfig
samples/Makefile
samples/binderfs/Makefile
samples/configfs/Makefile
samples/hw_breakpoint/Makefile
samples/kdb/Makefile
samples/kfifo/Makefile
samples/kobject/Makefile
samples/kprobes/Makefile
samples/kprobes/kprobe_example.c
samples/kprobes/kretprobe_example.c
samples/livepatch/Makefile
samples/livepatch/livepatch-callbacks-busymod.c
samples/livepatch/livepatch-callbacks-demo.c
samples/livepatch/livepatch-callbacks-mod.c
samples/livepatch/livepatch-sample.c
samples/livepatch/livepatch-shadow-fix1.c
samples/livepatch/livepatch-shadow-fix2.c
samples/livepatch/livepatch-shadow-mod.c
samples/qmi/Makefile
samples/rpmsg/Makefile
samples/seccomp/Makefile
samples/trace_events/Makefile
samples/trace_events/trace-events-sample.c
samples/trace_printk/Makefile
samples/trace_printk/trace-printk.c
samples/uhid/Makefile
samples/v4l/Makefile
samples/vfio-mdev/Makefile
samples/vfs/Makefile
scripts/Kbuild.include
scripts/Kconfig.include
scripts/Makefile.extrawarn
scripts/Makefile.host
scripts/Makefile.kcov
scripts/Makefile.lib
scripts/basic/Makefile
scripts/dtc/Makefile
scripts/dtc/Makefile.dtc
scripts/dtc/libfdt/Makefile.libfdt
scripts/gcc-plugins/Kconfig
scripts/gdb/Makefile
scripts/gdb/linux/clk.py [new file with mode: 0644]
scripts/gdb/linux/config.py [new file with mode: 0644]
scripts/gdb/linux/constants.py.in
scripts/gdb/linux/cpus.py
scripts/gdb/linux/lists.py
scripts/gdb/linux/proc.py
scripts/gdb/linux/rbtree.py [new file with mode: 0644]
scripts/gdb/linux/symbols.py
scripts/gdb/linux/tasks.py
scripts/gdb/linux/timerlist.py [new file with mode: 0644]
scripts/gdb/linux/utils.py
scripts/gdb/vmlinux-gdb.py
scripts/genksyms/Makefile
scripts/genksyms/keywords.c
scripts/kconfig/Makefile
scripts/kconfig/confdata.c
scripts/kconfig/gconf.c
scripts/kconfig/lexer.l
scripts/kconfig/lkc.h
scripts/kconfig/lxdialog/BIG.FAT.WARNING
scripts/kconfig/mconf.c
scripts/kconfig/nconf-cfg.sh [changed mode: 0644->0755]
scripts/kconfig/nconf.c
scripts/kconfig/tests/err_recursive_inc/Kconfig
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc1
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc2
scripts/kconfig/tests/err_recursive_inc/Kconfig.inc3
scripts/modules-check.sh [new file with mode: 0755]
scripts/package/Makefile
scripts/selinux/Makefile
scripts/tags.sh
security/Kconfig
security/Kconfig.hardening
security/apparmor/Kconfig
security/integrity/Kconfig
security/integrity/evm/Kconfig
security/integrity/evm/Makefile
security/integrity/ima/Kconfig
security/keys/Kconfig
security/loadpin/Kconfig
security/loadpin/Makefile
security/safesetid/Kconfig
security/selinux/Kconfig
security/selinux/hooks.c
security/selinux/include/netlabel.h
security/selinux/netlabel.c
security/smack/Kconfig
security/smack/Makefile
security/tomoyo/Kconfig
security/yama/Kconfig
security/yama/Makefile
sound/Kconfig
sound/ac97/Kconfig
sound/ac97/Makefile
sound/aoa/Kconfig
sound/aoa/Makefile
sound/aoa/codecs/Kconfig
sound/aoa/fabrics/Kconfig
sound/aoa/fabrics/Makefile
sound/aoa/soundbus/Kconfig
sound/aoa/soundbus/Makefile
sound/aoa/soundbus/i2sbus/Makefile
sound/arm/Kconfig
sound/atmel/Kconfig
sound/atmel/Makefile
sound/core/Kconfig
sound/core/seq/Kconfig
sound/core/seq/oss/Makefile
sound/drivers/Kconfig
sound/drivers/mpu401/Makefile
sound/drivers/pcsp/Makefile
sound/drivers/pcsp/pcsp.c
sound/drivers/vx/Makefile
sound/firewire/Kconfig
sound/firewire/dice/Makefile
sound/firewire/digi00x/Makefile
sound/firewire/fireface/Makefile
sound/firewire/fireworks/Makefile
sound/firewire/oxfw/Makefile
sound/firewire/tascam/Makefile
sound/hda/Kconfig
sound/hda/array.c
sound/hda/ext/Makefile
sound/hda/hda_bus_type.c
sound/hda/hdac_bus.c
sound/hda/hdac_controller.c
sound/hda/hdac_device.c
sound/hda/hdac_regmap.c
sound/hda/hdac_stream.c
sound/hda/hdac_sysfs.c
sound/hda/hdmi_chmap.c
sound/isa/Kconfig
sound/isa/ad1816a/Makefile
sound/isa/ad1848/Makefile
sound/isa/adlib.c
sound/isa/cmi8328.c
sound/isa/cs423x/Makefile
sound/isa/es1688/Makefile
sound/isa/galaxy/Makefile
sound/isa/galaxy/azt1605.c
sound/isa/galaxy/azt2316.c
sound/isa/galaxy/galaxy.c
sound/isa/wavefront/Makefile
sound/isa/wss/Makefile
sound/mips/Kconfig
sound/mips/Makefile
sound/oss/dmasound/Kconfig
sound/oss/dmasound/Makefile
sound/oss/dmasound/dmasound_atari.c
sound/oss/dmasound/dmasound_paula.c
sound/oss/dmasound/dmasound_q40.c
sound/parisc/Kconfig
sound/parisc/Makefile
sound/pci/Kconfig
sound/pci/ac97/Makefile
sound/pci/ali5451/Makefile
sound/pci/asihpi/Makefile
sound/pci/au88x0/au88x0.c
sound/pci/aw2/Makefile
sound/pci/ca0106/Makefile
sound/pci/cs46xx/Makefile
sound/pci/cs5535audio/Makefile
sound/pci/ctxfi/Makefile
sound/pci/hda/Kconfig
sound/pci/hda/hda_bind.c
sound/pci/hda/hda_sysfs.c
sound/pci/hda/patch_realtek.c
sound/pci/korg1212/Makefile
sound/pci/lola/Makefile
sound/pci/lx6464es/Makefile
sound/pci/mixart/Makefile
sound/pci/nm256/Makefile
sound/pci/pcxhr/Makefile
sound/pci/riptide/Makefile
sound/pci/trident/Makefile
sound/pci/vx222/Makefile
sound/pci/ymfpci/Makefile
sound/pcmcia/Kconfig
sound/pcmcia/Makefile
sound/pcmcia/pdaudiocf/Makefile
sound/pcmcia/vx/Makefile
sound/ppc/Kconfig
sound/ppc/Makefile
sound/sh/Kconfig
sound/sh/Makefile
sound/soc/Kconfig
sound/soc/adi/Kconfig
sound/soc/adi/Makefile
sound/soc/amd/Kconfig
sound/soc/amd/Makefile
sound/soc/atmel/Kconfig
sound/soc/atmel/atmel-classd.c
sound/soc/atmel/atmel-pdmic.c
sound/soc/au1x/Kconfig
sound/soc/au1x/ac97c.c
sound/soc/au1x/db1000.c
sound/soc/au1x/db1200.c
sound/soc/au1x/dma.c
sound/soc/au1x/i2sc.c
sound/soc/bcm/Kconfig
sound/soc/bcm/Makefile
sound/soc/cirrus/Kconfig
sound/soc/cirrus/edb93xx.c
sound/soc/cirrus/ep93xx-ac97.c
sound/soc/cirrus/ep93xx-i2s.c
sound/soc/cirrus/simone.c
sound/soc/cirrus/snappercl15.c
sound/soc/codecs/Kconfig
sound/soc/codecs/inno_rk3036.c
sound/soc/codecs/mc13783.c
sound/soc/codecs/mc13783.h
sound/soc/codecs/sirf-audio-codec.c
sound/soc/codecs/sirf-audio-codec.h
sound/soc/codecs/tlv320aic26.c
sound/soc/codecs/tlv320aic32x4.c
sound/soc/dwc/Kconfig
sound/soc/dwc/Makefile
sound/soc/fsl/Kconfig
sound/soc/generic/Kconfig
sound/soc/hisilicon/Kconfig
sound/soc/hisilicon/Makefile
sound/soc/img/Kconfig
sound/soc/intel/Kconfig
sound/soc/intel/baytrail/Makefile
sound/soc/intel/boards/Kconfig
sound/soc/intel/haswell/Makefile
sound/soc/jz4740/Kconfig
sound/soc/jz4740/Makefile
sound/soc/kirkwood/Kconfig
sound/soc/kirkwood/Makefile
sound/soc/mediatek/Kconfig
sound/soc/meson/Kconfig
sound/soc/mxs/Kconfig
sound/soc/mxs/mxs-pcm.c
sound/soc/mxs/mxs-pcm.h
sound/soc/mxs/mxs-saif.c
sound/soc/mxs/mxs-saif.h
sound/soc/mxs/mxs-sgtl5000.c
sound/soc/nuc900/Kconfig
sound/soc/pxa/Kconfig
sound/soc/pxa/imote2.c
sound/soc/qcom/Kconfig
sound/soc/qcom/qdsp6/Makefile
sound/soc/rockchip/Kconfig
sound/soc/samsung/Kconfig
sound/soc/sirf/Kconfig
sound/soc/sirf/sirf-audio-port.c
sound/soc/sirf/sirf-audio.c
sound/soc/sirf/sirf-usp.c
sound/soc/sirf/sirf-usp.h
sound/soc/sof/Kconfig
sound/soc/sof/intel/Kconfig
sound/soc/sof/xtensa/Kconfig
sound/soc/spear/Kconfig
sound/soc/sprd/Kconfig
sound/soc/sti/Kconfig
sound/soc/sti/Makefile
sound/soc/stm/Kconfig
sound/soc/sunxi/Kconfig
sound/soc/tegra/Kconfig
sound/soc/ti/Kconfig
sound/soc/txx9/Kconfig
sound/soc/ux500/Kconfig
sound/soc/xilinx/Kconfig
sound/soc/xilinx/Makefile
sound/soc/xtensa/Kconfig
sound/soc/xtensa/Makefile
sound/soc/zte/Kconfig
sound/soc/zte/Makefile
sound/sparc/Kconfig
sound/sparc/amd7930.c
sound/sparc/cs4231.c
sound/sparc/dbri.c
sound/spi/Kconfig
sound/synth/Kconfig
sound/usb/6fire/Makefile
sound/usb/Kconfig
sound/usb/bcd2000/Makefile
sound/usb/caiaq/Makefile
sound/usb/hiface/Makefile
sound/usb/line6/Kconfig
sound/usb/misc/Makefile
sound/x86/Kconfig
sound/x86/Makefile
sound/xen/Kconfig
tools/arch/s390/include/uapi/asm/kvm.h
tools/arch/x86/include/uapi/asm/kvm.h
tools/arch/x86/include/uapi/asm/perf_regs.h
tools/arch/x86/lib/memcpy_64.S
tools/bpf/Makefile.helpers
tools/bpf/bpftool/Documentation/Makefile
tools/bpf/bpftool/Makefile
tools/build/Makefile.feature
tools/build/Makefile.include
tools/lib/traceevent/Documentation/Makefile [new file with mode: 0644]
tools/lib/traceevent/Documentation/asciidoc.conf [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-commands.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-cpus.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-event_find.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-event_get.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-event_list.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-field_find.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-field_get_val.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-field_print.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-field_read.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-fields.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-file_endian.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-filter.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-func_apis.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-func_find.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-handle.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-header_page.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-host_endian.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-long_size.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-page_size.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-parse_event.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-parse_head.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-record_parse.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-reg_event_handler.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-reg_print_func.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-set_flag.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-strerror.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent-tseq.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/libtraceevent.txt [new file with mode: 0644]
tools/lib/traceevent/Documentation/manpage-1.72.xsl [new file with mode: 0644]
tools/lib/traceevent/Documentation/manpage-base.xsl [new file with mode: 0644]
tools/lib/traceevent/Documentation/manpage-bold-literal.xsl [new file with mode: 0644]
tools/lib/traceevent/Documentation/manpage-normal.xsl [new file with mode: 0644]
tools/lib/traceevent/Documentation/manpage-suppress-sp.xsl [new file with mode: 0644]
tools/lib/traceevent/Makefile
tools/lib/traceevent/libtraceevent.pc.template
tools/objtool/Documentation/stack-validation.txt
tools/objtool/Makefile
tools/objtool/arch.h
tools/objtool/arch/x86/decode.c
tools/objtool/arch/x86/include/asm/orc_types.h
tools/objtool/builtin-check.c
tools/objtool/builtin-orc.c
tools/objtool/builtin.h
tools/objtool/cfi.h
tools/objtool/check.c
tools/objtool/check.h
tools/objtool/elf.c
tools/objtool/elf.h
tools/objtool/objtool.c
tools/objtool/orc.h
tools/objtool/orc_dump.c
tools/objtool/orc_gen.c
tools/objtool/special.c
tools/objtool/special.h
tools/objtool/warn.h
tools/pci/Makefile
tools/perf/Documentation/Makefile
tools/perf/Documentation/perf-list.txt
tools/perf/Documentation/perf-record.txt
tools/perf/Documentation/perf-stat.txt
tools/perf/Documentation/perf.data-file-format.txt
tools/perf/Documentation/perf.txt
tools/perf/Makefile.config
tools/perf/Makefile.perf
tools/perf/arch/arm/Makefile
tools/perf/arch/csky/Makefile
tools/perf/arch/s390/Makefile
tools/perf/arch/sh/Makefile
tools/perf/arch/sparc/Makefile
tools/perf/arch/x86/include/perf_regs.h
tools/perf/arch/x86/util/perf_regs.c
tools/perf/arch/xtensa/Makefile
tools/perf/builtin-annotate.c
tools/perf/builtin-inject.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-stat.c
tools/perf/perf.h
tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json [new file with mode: 0644]
tools/perf/pmu-events/arch/arm64/mapfile.csv
tools/perf/pmu-events/jevents.c
tools/perf/scripts/python/exported-sql-viewer.py
tools/perf/tests/dso-data.c
tools/perf/tests/make
tools/perf/tests/shell/record+zstd_comp_decomp.sh [new file with mode: 0755]
tools/perf/util/Build
tools/perf/util/annotate.c
tools/perf/util/compress.h
tools/perf/util/env.h
tools/perf/util/event.c
tools/perf/util/event.h
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/header.c
tools/perf/util/header.h
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
tools/perf/util/machine.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h
tools/perf/util/parse-events.l
tools/perf/util/parse-regs-options.c
tools/perf/util/parse-regs-options.h
tools/perf/util/perf_regs.c
tools/perf/util/perf_regs.h
tools/perf/util/session.c
tools/perf/util/session.h
tools/perf/util/stat-display.c
tools/perf/util/stat.c
tools/perf/util/thread.c
tools/perf/util/tool.h
tools/perf/util/unwind-libunwind-local.c
tools/perf/util/unwind-libunwind.c
tools/perf/util/zstd.c [new file with mode: 0644]
tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c
tools/spi/Makefile
tools/testing/ktest/ktest.pl
tools/testing/ktest/sample.conf
tools/testing/nvdimm/Kbuild
tools/testing/nvdimm/dax_pmem_compat_test.c [new file with mode: 0644]
tools/testing/nvdimm/dax_pmem_core_test.c [new file with mode: 0644]
tools/testing/nvdimm/dax_pmem_test.c [new file with mode: 0644]
tools/testing/nvdimm/test/nfit.c
tools/testing/nvdimm/watermark.h
tools/testing/scatterlist/Makefile
tools/testing/selftests/.gitignore
tools/testing/selftests/Makefile
tools/testing/selftests/android/Makefile
tools/testing/selftests/android/ion/Makefile
tools/testing/selftests/breakpoints/breakpoint_test.c
tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
tools/testing/selftests/breakpoints/step_after_suspend_test.c
tools/testing/selftests/capabilities/test_execve.c
tools/testing/selftests/drivers/.gitignore [new file with mode: 0644]
tools/testing/selftests/drivers/dma-buf/Makefile
tools/testing/selftests/efivarfs/Makefile
tools/testing/selftests/exec/.gitignore
tools/testing/selftests/exec/Makefile
tools/testing/selftests/exec/recursion-depth.c [new file with mode: 0644]
tools/testing/selftests/firmware/Makefile
tools/testing/selftests/ftrace/test.d/ftrace/tracing-error-log.tc [new file with mode: 0644]
tools/testing/selftests/ftrace/test.d/functions
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc [new file with mode: 0644]
tools/testing/selftests/ftrace/test.d/kprobe/uprobe_syntax_errors.tc [new file with mode: 0644]
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc [deleted file]
tools/testing/selftests/futex/functional/futex_requeue_pi.c
tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
tools/testing/selftests/futex/functional/futex_wait_timeout.c
tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
tools/testing/selftests/kcmp/Makefile
tools/testing/selftests/kexec/Makefile
tools/testing/selftests/kmod/Makefile
tools/testing/selftests/kselftest.h
tools/testing/selftests/kselftest/prefix.pl [new file with mode: 0755]
tools/testing/selftests/kselftest/runner.sh [new file with mode: 0644]
tools/testing/selftests/kvm/.gitignore
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/dirty_log_test.c
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c [new file with mode: 0644]
tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c [new file with mode: 0644]
tools/testing/selftests/lib.mk
tools/testing/selftests/lib/Makefile
tools/testing/selftests/membarrier/Makefile
tools/testing/selftests/membarrier/membarrier_test.c
tools/testing/selftests/net/fib_rule_tests.sh
tools/testing/selftests/netfilter/nft_nat.sh
tools/testing/selftests/nsfs/Makefile
tools/testing/selftests/ntb/ntb_test.sh
tools/testing/selftests/pidfd/.gitignore [new file with mode: 0644]
tools/testing/selftests/pidfd/Makefile
tools/testing/selftests/pidfd/pidfd_test.c
tools/testing/selftests/powerpc/alignment/Makefile
tools/testing/selftests/powerpc/primitives/Makefile
tools/testing/selftests/powerpc/syscalls/Makefile
tools/testing/selftests/powerpc/vphn/Makefile
tools/testing/selftests/proc/Makefile
tools/testing/selftests/ptp/testptp.c
tools/testing/selftests/ptrace/Makefile
tools/testing/selftests/rseq/Makefile
tools/testing/selftests/rseq/rseq-arm.h
tools/testing/selftests/rseq/rseq-arm64.h
tools/testing/selftests/rseq/rseq-mips.h
tools/testing/selftests/rseq/rseq-ppc.h
tools/testing/selftests/rseq/rseq-s390.h
tools/testing/selftests/rseq/rseq-x86.h
tools/testing/selftests/rseq/rseq.c
tools/testing/selftests/rseq/rseq.h
tools/testing/selftests/sigaltstack/Makefile
tools/testing/selftests/sigaltstack/sas.c
tools/testing/selftests/size/Makefile
tools/testing/selftests/static_keys/Makefile
tools/testing/selftests/sync/sync_test.c
tools/testing/selftests/sysctl/Makefile
tools/testing/selftests/sysctl/sysctl.sh
tools/testing/selftests/tmpfs/Makefile
tools/testing/selftests/user/Makefile
tools/testing/selftests/zram/zram01.sh
tools/testing/selftests/zram/zram02.sh
tools/testing/selftests/zram/zram_lib.sh
tools/testing/vsock/Makefile
tools/usb/ffs-aio-example/simple/host_app/Makefile
tools/usb/usbip/libsrc/usbip_device_driver.c
tools/usb/usbip/libsrc/usbip_device_driver.h
tools/usb/usbip/libsrc/usbip_host_common.c
tools/usb/usbip/libsrc/usbip_host_common.h
tools/usb/usbip/libsrc/usbip_host_driver.c
tools/usb/usbip/libsrc/usbip_host_driver.h
tools/usb/usbip/src/usbip.c
tools/usb/usbip/src/usbip.h
tools/usb/usbip/src/usbip_attach.c
tools/usb/usbip/src/usbip_bind.c
tools/usb/usbip/src/usbip_detach.c
tools/usb/usbip/src/usbip_list.c
tools/usb/usbip/src/usbip_network.c
tools/usb/usbip/src/usbip_unbind.c
tools/usb/usbip/src/usbipd.c
tools/usb/usbip/src/utils.c
tools/usb/usbip/src/utils.h
tools/virtio/vhost_test/Makefile
tools/wmi/Makefile
virt/Makefile
virt/kvm/Kconfig
virt/kvm/arm/arm.c
virt/kvm/kvm_main.c
virt/lib/Kconfig
virt/lib/Makefile

index cca6d87..a64d219 100644 (file)
@@ -1 +1,2 @@
 Christoph Hellwig <hch@lst.de>
+Marc Gonzalez <marc.w.gonzalez@free.fr>
index d263ca9..7587ef5 100644 (file)
@@ -81,12 +81,14 @@ modules.builtin
 /tar-install/
 
 #
-# git files that we don't want to ignore even if they are dot-files
+# We don't want to ignore the following even if they are dot-files
 #
+!.clang-format
+!.cocciconfig
+!.get_maintainer.ignore
+!.gitattributes
 !.gitignore
 !.mailmap
-!.cocciconfig
-!.clang-format
 
 #
 # Generated include files
index 5e23e22..b77e30b 100644 (file)
@@ -114,15 +114,60 @@ Description:
                Access: Read
                Valid values: Represented in microamps
 
+What:          /sys/class/power_supply/<supply_name>/charge_control_limit
+Date:          Oct 2012
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Maximum allowable charging current. Used for charge rate
+               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
+Date:          Oct 2012
+Contact:       linux-pm@vger.kernel.org
+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
+Date:          April 2019
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Represents a battery percentage level, below which charging will
+               begin.
+
+               Access: Read, Write
+               Valid values: 0 - 100 (percent)
+
+What:          /sys/class/power_supply/<supply_name>/charge_control_end_threshold
+Date:          April 2019
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Represents a battery percentage level, above which charging will
+               stop.
+
+               Access: Read, Write
+               Valid values: 0 - 100 (percent)
+
 What:          /sys/class/power_supply/<supply_name>/charge_type
 Date:          July 2009
 Contact:       linux-pm@vger.kernel.org
 Description:
                Represents the type of charging currently being applied to the
-               battery.
+               battery. "Trickle", "Fast", and "Standard" all mean different
+               charging speeds. "Adaptive" means that the charger uses some
+               algorithm to adjust the charge rate dynamically, without
+               any user configuration required. "Custom" means that the charger
+               uses the charge_control_* properties as configuration for some
+               different algorithm.
 
-               Access: Read
-               Valid values: "Unknown", "N/A", "Trickle", "Fast"
+               Access: Read, Write
+               Valid values: "Unknown", "N/A", "Trickle", "Fast", "Standard",
+                             "Adaptive", "Custom"
 
 What:          /sys/class/power_supply/<supply_name>/charge_term_current
 Date:          July 2014
index 7e71c9c..5cbe565 100644 (file)
@@ -63,6 +63,110 @@ as well as medium and long term trends. The total absolute stall time
 spikes which wouldn't necessarily make a dent in the time averages,
 or to average trends over custom time frames.
 
+Monitoring for pressure thresholds
+==================================
+
+Users can register triggers and use poll() to be woken up when resource
+pressure exceeds certain thresholds.
+
+A trigger describes the maximum cumulative stall time over a specific
+time window, e.g. 100ms of total stall time within any 500ms window to
+generate a wakeup event.
+
+To register a trigger user has to open psi interface file under
+/proc/pressure/ representing the resource to be monitored and write the
+desired threshold and time window. The open file descriptor should be
+used to wait for trigger events using select(), poll() or epoll().
+The following format is used:
+
+<some|full> <stall amount in us> <time window in us>
+
+For example writing "some 150000 1000000" into /proc/pressure/memory
+would add 150ms threshold for partial memory stall measured within
+1sec time window. Writing "full 50000 1000000" into /proc/pressure/io
+would add 50ms threshold for full io stall measured within 1sec time window.
+
+Triggers can be set on more than one psi metric and more than one trigger
+for the same psi metric can be specified. However for each trigger a separate
+file descriptor is required to be able to poll it separately from others,
+therefore for each trigger a separate open() syscall should be made even
+when opening the same psi interface file.
+
+Monitors activate only when system enters stall state for the monitored
+psi metric and deactivates upon exit from the stall state. While system is
+in the stall state psi signal growth is monitored at a rate of 10 times per
+tracking window.
+
+The kernel accepts window sizes ranging from 500ms to 10s, therefore min
+monitoring update interval is 50ms and max is 1s. Min limit is set to
+prevent overly frequent polling. Max limit is chosen as a high enough number
+after which monitors are most likely not needed and psi averages can be used
+instead.
+
+When activated, psi monitor stays active for at least the duration of one
+tracking window to avoid repeated activations/deactivations when system is
+bouncing in and out of the stall state.
+
+Notifications to the userspace are rate-limited to one per tracking window.
+
+The trigger will de-register when the file descriptor used to define the
+trigger  is closed.
+
+Userspace monitor usage example
+===============================
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <poll.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * Monitor memory partial stall with 1s tracking window size
+ * and 150ms threshold.
+ */
+int main() {
+       const char trig[] = "some 150000 1000000";
+       struct pollfd fds;
+       int n;
+
+       fds.fd = open("/proc/pressure/memory", O_RDWR | O_NONBLOCK);
+       if (fds.fd < 0) {
+               printf("/proc/pressure/memory open error: %s\n",
+                       strerror(errno));
+               return 1;
+       }
+       fds.events = POLLPRI;
+
+       if (write(fds.fd, trig, strlen(trig) + 1) < 0) {
+               printf("/proc/pressure/memory write error: %s\n",
+                       strerror(errno));
+               return 1;
+       }
+
+       printf("waiting for events...\n");
+       while (1) {
+               n = poll(&fds, 1, -1);
+               if (n < 0) {
+                       printf("poll error: %s\n", strerror(errno));
+                       return 1;
+               }
+               if (fds.revents & POLLERR) {
+                       printf("got POLLERR, event source is gone\n");
+                       return 0;
+               }
+               if (fds.revents & POLLPRI) {
+                       printf("event triggered!\n");
+               } else {
+                       printf("unknown event received: 0x%x\n", fds.revents);
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
 Cgroup2 interface
 =================
 
@@ -71,3 +175,6 @@ mounted, pressure stall information is also tracked for tasks grouped
 into cgroups. Each subdirectory in the cgroupfs mountpoint contains
 cpu.pressure, memory.pressure, and io.pressure files; the format is
 the same as the /proc/pressure/ files.
+
+Per-cgroup psi monitors can be specified and used the same way as
+system-wide ones.
index 4317634..138f666 100644 (file)
        ip=             [IP_PNP]
                        See Documentation/filesystems/nfs/nfsroot.txt.
 
+       ipcmni_extend   [KNL] Extend the maximum number of unique System V
+                       IPC identifiers from 32,768 to 16,777,216.
+
        irqaffinity=    [SMP] Set the default irq affinity mask
                        The argument is a cpu list, as described above.
 
                        This will also cause panics on machine check exceptions.
                        Useful together with panic=30 to trigger a reboot.
 
+       page_alloc.shuffle=
+                       [KNL] Boolean flag to control whether the page allocator
+                       should randomize its free lists. The randomization may
+                       be automatically enabled if the kernel detects it is
+                       running on a platform with a direct-mapped memory-side
+                       cache, and this parameter can be used to
+                       override/disable that behavior. The state of the flag
+                       can be read from sysfs at:
+                       /sys/module/page_alloc/parameters/shuffle.
+
        page_owner=     [KNL] Boot-time page_owner enabling option.
                        Storage of the information about who allocated
                        each page is disabled in default. With this switch,
                        bit 2: print timer info
                        bit 3: print locks info if CONFIG_LOCKDEP is on
                        bit 4: print ftrace buffer
+                       bit 5: print all printk messages in buffer
 
        panic_on_warn   panic() instead of WARN().  Useful to cause kdump
                        on a WARN().
                                [[,]s[mp]#### \
                                [[,]b[ios] | a[cpi] | k[bd] | t[riple] | e[fi] | p[ci]] \
                                [[,]f[orce]
-                       Where reboot_mode is one of warm (soft) or cold (hard) or gpio,
+                       Where reboot_mode is one of warm (soft) or cold (hard) or gpio
+                                       (prefix with 'panic_' to set mode for panic
+                                       reboot only),
                              reboot_type is one of bios, acpi, kbd, triple, efi, or pci,
                              reboot_force is either force or not specified,
                              reboot_cpu is s[mp]#### with #### being the processor
                        with /sys/devices/system/xen_memory/xen_memory0/scrub_pages.
                        Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT.
 
+       xen_timer_slop= [X86-64,XEN]
+                       Set the timer slop (in nanoseconds) for the virtual Xen
+                       timers (default is 100000). This adjusts the minimum
+                       delta of virtualized Xen timers, where lower values
+                       improve timer resolution at the expense of processing
+                       more timer interrupts.
+
        xirc2ps_cs=     [NET,PCMCIA]
                        Format:
                        <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
diff --git a/Documentation/arm64/perf.txt b/Documentation/arm64/perf.txt
new file mode 100644 (file)
index 0000000..0d6a7d8
--- /dev/null
@@ -0,0 +1,85 @@
+Perf Event Attributes
+=====================
+
+Author: Andrew Murray <andrew.murray@arm.com>
+Date: 2019-03-06
+
+exclude_user
+------------
+
+This attribute excludes userspace.
+
+Userspace always runs at EL0 and thus this attribute will exclude EL0.
+
+
+exclude_kernel
+--------------
+
+This attribute excludes the kernel.
+
+The kernel runs at EL2 with VHE and EL1 without. Guest kernels always run
+at EL1.
+
+For the host this attribute will exclude EL1 and additionally EL2 on a VHE
+system.
+
+For the guest this attribute will exclude EL1. Please note that EL2 is
+never counted within a guest.
+
+
+exclude_hv
+----------
+
+This attribute excludes the hypervisor.
+
+For a VHE host this attribute is ignored as we consider the host kernel to
+be the hypervisor.
+
+For a non-VHE host this attribute will exclude EL2 as we consider the
+hypervisor to be any code that runs at EL2 which is predominantly used for
+guest/host transitions.
+
+For the guest this attribute has no effect. Please note that EL2 is
+never counted within a guest.
+
+
+exclude_host / exclude_guest
+----------------------------
+
+These attributes exclude the KVM host and guest, respectively.
+
+The KVM host may run at EL0 (userspace), EL1 (non-VHE kernel) and EL2 (VHE
+kernel or non-VHE hypervisor).
+
+The KVM guest may run at EL0 (userspace) and EL1 (kernel).
+
+Due to the overlapping exception levels between host and guests we cannot
+exclusively rely on the PMU's hardware exception filtering - therefore we
+must enable/disable counting on the entry and exit to the guest. This is
+performed differently on VHE and non-VHE systems.
+
+For non-VHE systems we exclude EL2 for exclude_host - upon entering and
+exiting the guest we disable/enable the event as appropriate based on the
+exclude_host and exclude_guest attributes.
+
+For VHE systems we exclude EL1 for exclude_guest and exclude both EL0,EL2
+for exclude_host. Upon entering and exiting the guest we modify the event
+to include/exclude EL0 as appropriate based on the exclude_host and
+exclude_guest attributes.
+
+The statements above also apply when these attributes are used within a
+non-VHE guest however please note that EL2 is never counted within a guest.
+
+
+Accuracy
+--------
+
+On non-VHE hosts we enable/disable counters on the entry/exit of host/guest
+transition at EL2 - however there is a period of time between
+enabling/disabling the counters and entering/exiting the guest. We are
+able to eliminate counters counting host events on the boundaries of guest
+entry/exit when counting guest events by filtering out EL2 for
+exclude_host. However when using !exclude_hv there is a small blackout
+window at the guest entry/exit where host events are not captured.
+
+On VHE systems there are no blackout windows.
index 5baca42..fc71b33 100644 (file)
@@ -87,7 +87,21 @@ used to get and set the keys for a thread.
 Virtualization
 --------------
 
-Pointer authentication is not currently supported in KVM guests. KVM
-will mask the feature bits from ID_AA64ISAR1_EL1, and attempted use of
-the feature will result in an UNDEFINED exception being injected into
-the guest.
+Pointer authentication is enabled in KVM guest when each virtual cpu is
+initialised by passing flags KVM_ARM_VCPU_PTRAUTH_[ADDRESS/GENERIC] and
+requesting these two separate cpu features to be enabled. The current KVM
+guest implementation works by enabling both features together, so both
+these userspace flags are checked before enabling pointer authentication.
+The separate userspace flag will allow to have no userspace ABI changes
+if support is added in the future to allow these two features to be
+enabled independently of one another.
+
+As Arm Architecture specifies that Pointer Authentication feature is
+implemented along with the VHE feature so KVM arm64 ptrauth code relies
+on VHE mode to be present.
+
+Additionally, when these vcpu feature flags are not set then KVM will
+filter out the Pointer Authentication system key registers from
+KVM_GET/SET_REG_* ioctls and mask those features from cpufeature ID
+register. Any attempt to use the Pointer Authentication instructions will
+result in an UNDEFINED exception being injected into the guest.
index 71f5d2f..a29c99d 100644 (file)
@@ -147,10 +147,10 @@ Division Functions
 .. kernel-doc:: include/linux/math64.h
    :internal:
 
-.. kernel-doc:: lib/div64.c
+.. kernel-doc:: lib/math/div64.c
    :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
 
-.. kernel-doc:: lib/gcd.c
+.. kernel-doc:: lib/math/gcd.c
    :export:
 
 UUID/GUID
index 69a7d90..46aae52 100644 (file)
@@ -34,10 +34,6 @@ Configure the kernel with::
         CONFIG_DEBUG_FS=y
         CONFIG_GCOV_KERNEL=y
 
-select the gcc's gcov format, default is autodetect based on gcc version::
-
-        CONFIG_GCOV_FORMAT_AUTODETECT=y
-
 and to get coverage data for the entire kernel::
 
         CONFIG_GCOV_PROFILE_ALL=y
@@ -169,6 +165,20 @@ b) gcov is run on the BUILD machine
       [user@build] gcov -o /tmp/coverage/tmp/out/init main.c
 
 
+Note on compilers
+-----------------
+
+GCC and LLVM gcov tools are not necessarily compatible. Use gcov_ to work with
+GCC-generated .gcno and .gcda files, and use llvm-cov_ for Clang.
+
+.. _gcov: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
+.. _llvm-cov: https://llvm.org/docs/CommandGuide/llvm-cov.html
+
+Build differences between GCC and Clang gcov are handled by Kconfig. It
+automatically selects the appropriate gcov format depending on the detected
+toolchain.
+
+
 Troubleshooting
 ---------------
 
diff --git a/Documentation/device-mapper/dm-dust.txt b/Documentation/device-mapper/dm-dust.txt
new file mode 100644 (file)
index 0000000..954d402
--- /dev/null
@@ -0,0 +1,272 @@
+dm-dust
+=======
+
+This target emulates the behavior of bad sectors at arbitrary
+locations, and the ability to enable the emulation of the failures
+at an arbitrary time.
+
+This target behaves similarly to a linear target.  At a given time,
+the user can send a message to the target to start failing read
+requests on specific blocks (to emulate the behavior of a hard disk
+drive with bad sectors).
+
+When the failure behavior is enabled (i.e.: when the output of
+"dmsetup status" displays "fail_read_on_bad_block"), reads of blocks
+in the "bad block list" will fail with EIO ("Input/output error").
+
+Writes of blocks in the "bad block list will result in the following:
+
+1. Remove the block from the "bad block list".
+2. Successfully complete the write.
+
+This emulates the "remapped sector" behavior of a drive with bad
+sectors.
+
+Normally, a drive that is encountering bad sectors will most likely
+encounter more bad sectors, at an unknown time or location.
+With dm-dust, the user can use the "addbadblock" and "removebadblock"
+messages to add arbitrary bad blocks at new locations, and the
+"enable" and "disable" messages to modulate the state of whether the
+configured "bad blocks" will be treated as bad, or bypassed.
+This allows the pre-writing of test data and metadata prior to
+simulating a "failure" event where bad sectors start to appear.
+
+Table parameters:
+-----------------
+<device_path> <offset> <blksz>
+
+Mandatory parameters:
+    <device_path>: path to the block device.
+    <offset>: offset to data area from start of device_path
+    <blksz>: block size in bytes
+            (minimum 512, maximum 1073741824, must be a power of 2)
+
+Usage instructions:
+-------------------
+
+First, find the size (in 512-byte sectors) of the device to be used:
+
+$ sudo blockdev --getsz /dev/vdb1
+33552384
+
+Create the dm-dust device:
+(For a device with a block size of 512 bytes)
+$ sudo dmsetup create dust1 --table '0 33552384 dust /dev/vdb1 0 512'
+
+(For a device with a block size of 4096 bytes)
+$ sudo dmsetup create dust1 --table '0 33552384 dust /dev/vdb1 0 4096'
+
+Check the status of the read behavior ("bypass" indicates that all I/O
+will be passed through to the underlying device):
+$ sudo dmsetup status dust1
+0 33552384 dust 252:17 bypass
+
+$ sudo dd if=/dev/mapper/dust1 of=/dev/null bs=512 count=128 iflag=direct
+128+0 records in
+128+0 records out
+
+$ sudo dd if=/dev/zero of=/dev/mapper/dust1 bs=512 count=128 oflag=direct
+128+0 records in
+128+0 records out
+
+Adding and removing bad blocks:
+-------------------------------
+
+At any time (i.e.: whether the device has the "bad block" emulation
+enabled or disabled), bad blocks may be added or removed from the
+device via the "addbadblock" and "removebadblock" messages:
+
+$ sudo dmsetup message dust1 0 addbadblock 60
+kernel: device-mapper: dust: badblock added at block 60
+
+$ sudo dmsetup message dust1 0 addbadblock 67
+kernel: device-mapper: dust: badblock added at block 67
+
+$ sudo dmsetup message dust1 0 addbadblock 72
+kernel: device-mapper: dust: badblock added at block 72
+
+These bad blocks will be stored in the "bad block list".
+While the device is in "bypass" mode, reads and writes will succeed:
+
+$ sudo dmsetup status dust1
+0 33552384 dust 252:17 bypass
+
+Enabling block read failures:
+-----------------------------
+
+To enable the "fail read on bad block" behavior, send the "enable" message:
+
+$ sudo dmsetup message dust1 0 enable
+kernel: device-mapper: dust: enabling read failures on bad sectors
+
+$ sudo dmsetup status dust1
+0 33552384 dust 252:17 fail_read_on_bad_block
+
+With the device in "fail read on bad block" mode, attempting to read a
+block will encounter an "Input/output error":
+
+$ sudo dd if=/dev/mapper/dust1 of=/dev/null bs=512 count=1 skip=67 iflag=direct
+dd: error reading '/dev/mapper/dust1': Input/output error
+0+0 records in
+0+0 records out
+0 bytes copied, 0.00040651 s, 0.0 kB/s
+
+...and writing to the bad blocks will remove the blocks from the list,
+therefore emulating the "remap" behavior of hard disk drives:
+
+$ sudo dd if=/dev/zero of=/dev/mapper/dust1 bs=512 count=128 oflag=direct
+128+0 records in
+128+0 records out
+
+kernel: device-mapper: dust: block 60 removed from badblocklist by write
+kernel: device-mapper: dust: block 67 removed from badblocklist by write
+kernel: device-mapper: dust: block 72 removed from badblocklist by write
+kernel: device-mapper: dust: block 87 removed from badblocklist by write
+
+Bad block add/remove error handling:
+------------------------------------
+
+Attempting to add a bad block that already exists in the list will
+result in an "Invalid argument" error, as well as a helpful message:
+
+$ sudo dmsetup message dust1 0 addbadblock 88
+device-mapper: message ioctl on dust1  failed: Invalid argument
+kernel: device-mapper: dust: block 88 already in badblocklist
+
+Attempting to remove a bad block that doesn't exist in the list will
+result in an "Invalid argument" error, as well as a helpful message:
+
+$ sudo dmsetup message dust1 0 removebadblock 87
+device-mapper: message ioctl on dust1  failed: Invalid argument
+kernel: device-mapper: dust: block 87 not found in badblocklist
+
+Counting the number of bad blocks in the bad block list:
+--------------------------------------------------------
+
+To count the number of bad blocks configured in the device, run the
+following message command:
+
+$ sudo dmsetup message dust1 0 countbadblocks
+
+A message will print with the number of bad blocks currently
+configured on the device:
+
+kernel: device-mapper: dust: countbadblocks: 895 badblock(s) found
+
+Querying for specific bad blocks:
+---------------------------------
+
+To find out if a specific block is in the bad block list, run the
+following message command:
+
+$ sudo dmsetup message dust1 0 queryblock 72
+
+The following message will print if the block is in the list:
+device-mapper: dust: queryblock: block 72 found in badblocklist
+
+The following message will print if the block is in the list:
+device-mapper: dust: queryblock: block 72 not found in badblocklist
+
+The "queryblock" message command will work in both the "enabled"
+and "disabled" modes, allowing the verification of whether a block
+will be treated as "bad" without having to issue I/O to the device,
+or having to "enable" the bad block emulation.
+
+Clearing the bad block list:
+----------------------------
+
+To clear the bad block list (without needing to individually run
+a "removebadblock" message command for every block), run the
+following message command:
+
+$ sudo dmsetup message dust1 0 clearbadblocks
+
+After clearing the bad block list, the following message will appear:
+
+kernel: device-mapper: dust: clearbadblocks: badblocks cleared
+
+If there were no bad blocks to clear, the following message will
+appear:
+
+kernel: device-mapper: dust: clearbadblocks: no badblocks found
+
+Message commands list:
+----------------------
+
+Below is a list of the messages that can be sent to a dust device:
+
+Operations on blocks (requires a <blknum> argument):
+
+addbadblock <blknum>
+queryblock <blknum>
+removebadblock <blknum>
+
+...where <blknum> is a block number within range of the device
+  (corresponding to the block size of the device.)
+
+Single argument message commands:
+
+countbadblocks
+clearbadblocks
+disable
+enable
+quiet
+
+Device removal:
+---------------
+
+When finished, remove the device via the "dmsetup remove" command:
+
+$ sudo dmsetup remove dust1
+
+Quiet mode:
+-----------
+
+On test runs with many bad blocks, it may be desirable to avoid
+excessive logging (from bad blocks added, removed, or "remapped").
+This can be done by enabling "quiet mode" via the following message:
+
+$ sudo dmsetup message dust1 0 quiet
+
+This will suppress log messages from add / remove / removed by write
+operations.  Log messages from "countbadblocks" or "queryblock"
+message commands will still print in quiet mode.
+
+The status of quiet mode can be seen by running "dmsetup status":
+
+$ sudo dmsetup status dust1
+0 33552384 dust 252:17 fail_read_on_bad_block quiet
+
+To disable quiet mode, send the "quiet" message again:
+
+$ sudo dmsetup message dust1 0 quiet
+
+$ sudo dmsetup status dust1
+0 33552384 dust 252:17 fail_read_on_bad_block verbose
+
+(The presence of "verbose" indicates normal logging.)
+
+"Why not...?"
+-------------
+
+scsi_debug has a "medium error" mode that can fail reads on one
+specified sector (sector 0x1234, hardcoded in the source code), but
+it uses RAM for the persistent storage, which drastically decreases
+the potential device size.
+
+dm-flakey fails all I/O from all block locations at a specified time
+frequency, and not a given point in time.
+
+When a bad sector occurs on a hard disk drive, reads to that sector
+are failed by the device, usually resulting in an error code of EIO
+("I/O error") or ENODATA ("No data available").  However, a write to
+the sector may succeed, and result in the sector becoming readable
+after the device controller no longer experiences errors reading the
+sector (or after a reallocation of the sector).  However, there may
+be bad sectors that occur on the device in the future, in a different,
+unpredictable location.
+
+This target seeks to provide a device that can exhibit the behavior
+of a bad sector at a known sector location, at a known time, based
+on a large storage device (at least tens of gigabytes, not occupying
+system memory).
index 297251b..d63d78f 100644 (file)
@@ -21,6 +21,13 @@ mode it calculates and verifies the integrity tag internally. In this
 mode, the dm-integrity target can be used to detect silent data
 corruption on the disk or in the I/O path.
 
+There's an alternate mode of operation where dm-integrity uses bitmap
+instead of a journal. If a bit in the bitmap is 1, the corresponding
+region's data and integrity tags are not synchronized - if the machine
+crashes, the unsynchronized regions will be recalculated. The bitmap mode
+is faster than the journal mode, because we don't have to write the data
+twice, but it is also less reliable, because if data corruption happens
+when the machine crashes, it may not be detected.
 
 When loading the target for the first time, the kernel driver will format
 the device. But it will only format the device if the superblock contains
@@ -59,6 +66,10 @@ Target arguments:
                either both data and tag or none of them are written. The
                journaled mode degrades write throughput twice because the
                data have to be written twice.
+       B - bitmap mode - data and metadata are written without any
+               synchronization, the driver maintains a bitmap of dirty
+               regions where data and metadata don't match. This mode can
+               only be used with internal hash.
        R - recovery mode - in this mode, journal is not replayed,
                checksums are not checked and writes to the device are not
                allowed. This mode is useful for data recovery if the
@@ -79,6 +90,10 @@ interleave_sectors:number
        a power of two. If the device is already formatted, the value from
        the superblock is used.
 
+meta_device:device
+       Don't interleave the data and metadata on on device. Use a
+       separate device for metadata.
+
 buffer_sectors:number
        The number of sectors in one buffer. The value is rounded down to
        a power of two.
@@ -146,6 +161,15 @@ block_size:number
        Supported values are 512, 1024, 2048 and 4096 bytes.  If not
        specified the default block size is 512 bytes.
 
+sectors_per_bit:number
+       In the bitmap mode, this parameter specifies the number of
+       512-byte sectors that corresponds to one bitmap bit.
+
+bitmap_flush_interval:number
+       The bitmap flush interval in milliseconds. The metadata buffers
+       are synchronized when this interval expires.
+
+
 The journal mode (D/J), buffer_sectors, journal_watermark, commit_time can
 be changed when reloading the target (load an inactive table and swap the
 tables with suspend and resume). The other arguments should not be changed
@@ -167,7 +191,13 @@ The layout of the formatted block device:
          provides (i.e. the size of the device minus the size of all
          metadata and padding). The user of this target should not send
          bios that access data beyond the "provided data sectors" limit.
-       * flags - a flag is set if journal_mac is used
+       * flags
+         SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used
+         SB_FLAG_RECALCULATING - recalculating is in progress
+         SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty
+               blocks
+       * log2(sectors per block)
+       * a position where recalculating finished
 * journal
        The journal is divided into sections, each section contains:
        * metadata area (4kiB), it contains journal entries
index 7f40cb5..061f7b9 100644 (file)
@@ -110,6 +110,7 @@ Board compatible values (alphabetically, grouped by SoC):
 
   - "amlogic,u200" (Meson g12a s905d2)
   - "amediatech,x96-max" (Meson g12a s905x2)
+  - "seirobotics,sei510" (Meson g12a s905x2)
 
 Amlogic Meson Firmware registers Interface
 ------------------------------------------
index 4bf1b4d..99dee23 100644 (file)
@@ -25,6 +25,7 @@ compatible: must be one of:
     o "atmel,at91sam9n12"
     o "atmel,at91sam9rl"
     o "atmel,at91sam9xe"
+    o "microchip,sam9x60"
  * "atmel,sama5" for SoCs using a Cortex-A5, shall be extended with the specific
    SoC family:
     o "atmel,sama5d2" shall be extended with the specific SoC compatible:
index e61d00e..9fbde40 100644 (file)
@@ -84,7 +84,7 @@ SHDWC SAMA5D2-Compatible Shutdown Controller
 1) shdwc node
 
 required properties:
-- compatible: should be "atmel,sama5d2-shdwc".
+- compatible: should be "atmel,sama5d2-shdwc" or "microchip,sam9x60-shdwc".
 - reg: should contain registers location and length
 - clocks: phandle to input clock.
 - #address-cells: should be one. The cell is the wake-up input index.
@@ -96,6 +96,9 @@ optional properties:
   microseconds. It's usually a board-related property.
 - atmel,wakeup-rtc-timer: boolean to enable Real-Time Clock wake-up.
 
+optional microchip,sam9x60-shdwc properties:
+- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
+
 The node contains child nodes for each wake-up input that the platform uses.
 
 2) input nodes
index 72d481c..5d7dbab 100644 (file)
@@ -22,9 +22,11 @@ Required properties:
 -------------------
 - compatible:  should be "fsl,imx-scu".
 - mbox-names:  should include "tx0", "tx1", "tx2", "tx3",
-                              "rx0", "rx1", "rx2", "rx3".
-- mboxes:      List of phandle of 4 MU channels for tx and 4 MU channels
-               for rx. All 8 MU channels must be in the same MU instance.
+                              "rx0", "rx1", "rx2", "rx3";
+               include "gip3" if want to support general MU interrupt.
+- mboxes:      List of phandle of 4 MU channels for tx, 4 MU channels for
+               rx, and 1 optional MU channel for general interrupt.
+               All MU channels must be in the same MU instance.
                Cross instances are not allowed. The MU instance can only
                be one of LSIO MU0~M4 for imx8qxp and imx8qm. Users need
                to make sure use the one which is not conflict with other
@@ -34,6 +36,7 @@ Required properties:
                Channel 1 must be "tx1" or "rx1".
                Channel 2 must be "tx2" or "rx2".
                Channel 3 must be "tx3" or "rx3".
+               General interrupt rx channel must be "gip3".
                e.g.
                mboxes = <&lsio_mu1 0 0
                          &lsio_mu1 0 1
@@ -42,10 +45,18 @@ Required properties:
                          &lsio_mu1 1 0
                          &lsio_mu1 1 1
                          &lsio_mu1 1 2
-                         &lsio_mu1 1 3>;
+                         &lsio_mu1 1 3
+                         &lsio_mu1 3 3>;
                See Documentation/devicetree/bindings/mailbox/fsl,mu.txt
                for detailed mailbox binding.
 
+Note: Each mu which supports general interrupt should have an alias correctly
+numbered in "aliases" node.
+e.g.
+aliases {
+       mu1 = &lsio_mu1;
+};
+
 i.MX SCU Client Device Node:
 ============================================================
 
@@ -124,6 +135,10 @@ Required properties:
 
 Example (imx8qxp):
 -------------
+aliases {
+       mu1 = &lsio_mu1;
+};
+
 lsio_mu1: mailbox@5d1c0000 {
        ...
        #mbox-cells = <2>;
@@ -133,7 +148,8 @@ firmware {
        scu {
                compatible = "fsl,imx-scu";
                mbox-names = "tx0", "tx1", "tx2", "tx3",
-                            "rx0", "rx1", "rx2", "rx3";
+                            "rx0", "rx1", "rx2", "rx3",
+                            "gip3";
                mboxes = <&lsio_mu1 0 0
                          &lsio_mu1 0 1
                          &lsio_mu1 0 2
@@ -141,7 +157,8 @@ firmware {
                          &lsio_mu1 1 0
                          &lsio_mu1 1 1
                          &lsio_mu1 1 2
-                         &lsio_mu1 1 3>;
+                         &lsio_mu1 1 3
+                         &lsio_mu1 3 3>;
 
                clk: clk {
                        compatible = "fsl,imx8qxp-clk", "fsl,scu-clk";
index 7e2cd6a..407138e 100644 (file)
@@ -51,6 +51,13 @@ properties:
           - const: i2se,duckbill-2
           - const: fsl,imx28
 
+      - description: i.MX50 based Boards
+        items:
+          - enum:
+              - fsl,imx50-evk
+              - kobo,aura
+          - const: fsl,imx50
+
       - description: i.MX51 Babbage Board
         items:
           - enum:
@@ -67,6 +74,7 @@ properties:
               - fsl,imx53-evk
               - fsl,imx53-qsb
               - fsl,imx53-smd
+              - menlo,m53menlo
           - const: fsl,imx53
 
       - description: i.MX6Q based Boards
@@ -90,6 +98,7 @@ properties:
       - description: i.MX6DL based Boards
         items:
           - enum:
+              - eckelmann,imx6dl-ci4x10
               - fsl,imx6dl-sabreauto      # i.MX6 DualLite/Solo SABRE Automotive Board
               - fsl,imx6dl-sabresd        # i.MX6 DualLite SABRE Smart Device Board
               - technologic,imx6dl-ts4900
@@ -137,10 +146,18 @@ properties:
           - const: fsl,imx6ull # This seems odd. Should be last?
           - const: fsl,imx6ulz
 
+      - description: i.MX7S based Boards
+        items:
+          - enum:
+              - tq,imx7s-mba7             # i.MX7S TQ MBa7 with TQMa7S SoM
+          - const: fsl,imx7s
+
       - description: i.MX7D based Boards
         items:
           - enum:
               - fsl,imx7d-sdb             # i.MX7 SabreSD Board
+              - tq,imx7d-mba7             # i.MX7D TQ MBa7 with TQMa7D SoM
+              - zii,imx7d-rpu2            # ZII RPU2 Board
           - const: fsl,imx7d
 
       - description:
@@ -154,6 +171,12 @@ properties:
           - const: compulab,cl-som-imx7
           - const: fsl,imx7d
 
+      - description: i.MX8MM based Boards
+        items:
+          - enum:
+              - fsl,imx8mm-evk            # i.MX8MM EVK Board
+          - const: fsl,imx8mm
+
       - description: i.MX8QXP based Boards
         items:
           - enum:
@@ -176,6 +199,19 @@ properties:
               - fsl,vf610
               - fsl,vf610m4
 
+      - description: ZII's VF610 based Boards
+        items:
+          - enum:
+              - zii,vf610cfu1      # ZII VF610 CFU1 Board
+              - zii,vf610dev-c     # ZII VF610 Development Board, Rev C
+              - zii,vf610dev-b     # ZII VF610 Development Board, Rev B
+              - zii,vf610scu4-aib  # ZII VF610 SCU4 AIB
+              - zii,vf610dtu       # ZII VF610 SSMB DTU Board
+              - zii,vf610spu3      # ZII VF610 SSMB SPU3 Board
+              - zii,vf610spb4      # ZII VF610 SPB4 Board
+          - const: zii,vf610dev
+          - const: fsl,vf610
+
       - description: LS1012A based Boards
         items:
           - enum:
diff --git a/Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml b/Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
new file mode 100644 (file)
index 0000000..f4f7451
--- /dev/null
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/intel-ixp4xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Intel IXP4xx Device Tree Bindings
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - linksys,nslu2
+          - const: intel,ixp42x
+      - items:
+          - enum:
+              - gateworks,gw2358
+          - const: intel,ixp43x
index b56a02c..6f0cd31 100644 (file)
@@ -24,7 +24,8 @@ relationship between the TI-SCI parent node to the child node.
 
 Required properties:
 -------------------
-- compatible: should be "ti,k2g-sci"
+- compatible:  should be "ti,k2g-sci" for TI 66AK2G SoC
+               should be "ti,am654-sci" for for TI AM654 SoC
 - mbox-names:
        "rx" - Mailbox corresponding to receive path
        "tx" - Mailbox corresponding to transmit path
index 2ecc712..1c1e48f 100644 (file)
@@ -92,6 +92,9 @@ SoCs:
 - DRA718
   compatible = "ti,dra718", "ti,dra722", "ti,dra72", "ti,dra7"
 
+- AM5748
+  compatible = "ti,am5748", "ti,dra762", "ti,dra7"
+
 - AM5728
   compatible = "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7"
 
@@ -184,6 +187,9 @@ Boards:
 - AM57XX SBC-AM57x
   compatible = "compulab,sbc-am57x", "compulab,cl-som-am57x", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7"
 
+- AM5748 IDK
+  compatible = "ti,am5748-idk", "ti,am5748", "ti,dra762", "ti,dra7";
+
 - AM5728 IDK
   compatible = "ti,am5728-idk", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7"
 
index 061a03e..5c6bbf1 100644 (file)
@@ -97,6 +97,7 @@ properties:
           - enum:
               - friendlyarm,nanopc-t4
               - friendlyarm,nanopi-m4
+              - friendlyarm,nanopi-neo4
           - const: rockchip,rk3399
 
       - description: GeekBuying GeekBox
@@ -146,7 +147,7 @@ properties:
           - const: google,gru
           - const: rockchip,rk3399
 
-      - description: Google Jaq (Haier Chromebook 11 and more)
+      - description: Google Jaq (Haier Chromebook 11 and more w/ uSD)
         items:
           - const: google,veyron-jaq-rev5
           - const: google,veyron-jaq-rev4
@@ -159,6 +160,12 @@ properties:
 
       - description: Google Jerry (Hisense Chromebook C11 and more)
         items:
+          - const: google,veyron-jerry-rev15
+          - const: google,veyron-jerry-rev14
+          - const: google,veyron-jerry-rev13
+          - const: google,veyron-jerry-rev12
+          - const: google,veyron-jerry-rev11
+          - const: google,veyron-jerry-rev10
           - const: google,veyron-jerry-rev7
           - const: google,veyron-jerry-rev6
           - const: google,veyron-jerry-rev5
@@ -199,6 +206,17 @@ properties:
           - const: google,veyron
           - const: rockchip,rk3288
 
+      - description: Google Mighty (Haier Chromebook 11 and more w/ SD)
+        items:
+          - const: google,veyron-mighty-rev5
+          - const: google,veyron-mighty-rev4
+          - const: google,veyron-mighty-rev3
+          - const: google,veyron-mighty-rev2
+          - const: google,veyron-mighty-rev1
+          - const: google,veyron-mighty
+          - const: google,veyron
+          - const: rockchip,rk3288
+
       - description: Google Minnie (Asus Chromebook Flip C100P)
         items:
           - const: google,veyron-minnie-rev4
@@ -308,6 +326,11 @@ properties:
           - const: netxeon,r89
           - const: rockchip,rk3288
 
+      - description: Orange Pi RK3399 board
+        items:
+          - const: rockchip,rk3399-orangepi
+          - const: rockchip,rk3399
+
       - description: Phytec phyCORE-RK3288 Rapid Development Kit
         items:
           - const: phytec,rk3288-pcm-947
diff --git a/Documentation/devicetree/bindings/arm/sunxi.txt b/Documentation/devicetree/bindings/arm/sunxi.txt
deleted file mode 100644 (file)
index 9254cbe..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Allwinner sunXi Platforms Device Tree Bindings
-
-Each device tree must specify which Allwinner SoC it uses,
-using one of the following compatible strings:
-
-  allwinner,sun4i-a10
-  allwinner,sun5i-a10s
-  allwinner,sun5i-a13
-  allwinner,sun5i-r8
-  allwinner,sun6i-a31
-  allwinner,sun7i-a20
-  allwinner,sun8i-a23
-  allwinner,sun8i-a33
-  allwinner,sun8i-a83t
-  allwinner,sun8i-h2-plus
-  allwinner,sun8i-h3
-  allwinner,sun8i-r40
-  allwinner,sun8i-t3
-  allwinner,sun8i-v3s
-  allwinner,sun9i-a80
-  allwinner,sun50i-a64
-  allwinner,suniv-f1c100s
-  nextthing,gr8
diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml b/Documentation/devicetree/bindings/arm/sunxi.yaml
new file mode 100644 (file)
index 0000000..285f4fc
--- /dev/null
@@ -0,0 +1,807 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR X11)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/sunxi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner platforms device tree bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+  - Maxime Ripard <maxime.ripard@bootlin.com>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+
+      - description: Allwinner A23 Evaluation Board
+        items:
+          - const: allwinner,sun8i-a23-evb
+          - const: allwinner,sun8i-a23
+
+      - description: Allwinner A31 APP4 Evaluation Board
+        items:
+          - const: allwinner,app4-evb1
+          - const: allwinner,sun6i-a31
+
+      - description: Allwinner A83t Homlet Evaluation Board v2
+        items:
+          - const: allwinner,h8homlet-v2
+          - const: allwinner,sun8i-a83t
+
+      - description: Allwinner GA10H Quad Core Tablet v1.1
+        items:
+          - const: allwinner,ga10h-v1.1
+          - const: allwinner,sun8i-a33
+
+      - description: Allwinner GT90H Tablet v4
+        items:
+          - const: allwinner,gt90h-v4
+          - const: allwinner,sun8i-a23
+
+      - description: Allwinner R16 EVB (Parrot)
+        items:
+          - const: allwinner,parrot
+          - const: allwinner,sun8i-a33
+
+      - description: Amarula A64 Relic
+        items:
+          - const: amarula,a64-relic
+          - const: allwinner,sun50i-a64
+
+      - description: Auxtek T003 A10s HDMI TV Stick
+        items:
+          - const: allwinner,auxtek-t003
+          - const: allwinner,sun5i-a10s
+
+      - description: Auxtek T004 A10s HDMI TV Stick
+        items:
+          - const: allwinner,auxtek-t004
+          - const: allwinner,sun5i-a10s
+
+      - description: BA10 TV Box
+        items:
+          - const: allwinner,ba10-tvbox
+          - const: allwinner,sun4i-a10
+
+      - description: BananaPi
+        items:
+          - const: lemaker,bananapi
+          - const: allwinner,sun7i-a20
+
+      - description: BananaPi M1 Plus
+        items:
+          - const: sinovoip,bpi-m1-plus
+          - const: allwinner,sun7i-a20
+
+      - description: BananaPi M2
+        items:
+          - const: sinovoip,bpi-m2
+          - const: allwinner,sun6i-a31s
+
+      - description: BananaPi M2 Berry
+        items:
+          - const: sinovoip,bpi-m2-berry
+          - const: allwinner,sun8i-r40
+
+      - description: BananaPi M2 Plus
+        items:
+          - const: sinovoip,bpi-m2-plus
+          - const: allwinner,sun8i-h3
+
+      - description: BananaPi M2 Plus
+        items:
+          - const: sinovoip,bpi-m2-plus
+          - const: allwinner,sun50i-h5
+
+      - description: BananaPi M2 Plus v1.2
+        items:
+          - const: bananapi,bpi-m2-plus-v1.2
+          - const: allwinner,sun8i-h3
+
+      - description: BananaPi M2 Plus v1.2
+        items:
+          - const: bananapi,bpi-m2-plus-v1.2
+          - const: allwinner,sun50i-h5
+
+      - description: BananaPi M2 Magic
+        items:
+          - const: sinovoip,bananapi-m2m
+          - const: allwinner,sun8i-a33
+
+      - description: BananaPi M2 Ultra
+        items:
+          - const: sinovoip,bpi-m2-ultra
+          - const: allwinner,sun8i-r40
+
+      - description: BananaPi M2 Zero
+        items:
+          - const: sinovoip,bpi-m2-zero
+          - const: allwinner,sun8i-h2-plus
+
+      - description: BananaPi M3
+        items:
+          - const: sinovoip,bpi-m3
+          - const: allwinner,sun8i-a83t
+
+      - description: BananaPi M64
+        items:
+          - const: sinovoip,bananapi-m64
+          - const: allwinner,sun50i-a64
+
+      - description: BananaPro
+        items:
+          - const: lemaker,bananapro
+          - const: allwinner,sun7i-a20
+
+      - description: Beelink GS1
+        items:
+          - const: azw,beelink-gs1
+          - const: allwinner,sun50i-h6
+
+      - description: Beelink X2
+        items:
+          - const: roofull,beelink-x2
+          - const: allwinner,sun8i-h3
+
+      - description: Chuwi V7 CW0825
+        items:
+          - const: chuwi,v7-cw0825
+          - const: allwinner,sun4i-a10
+
+      - description: Colorfly E708 Q1 Tablet
+        items:
+          - const: colorfly,e708-q1
+          - const: allwinner,sun6i-a31s
+
+      - description: CSQ CS908 Set Top Box
+        items:
+          - const: csq,cs908
+          - const: allwinner,sun6i-a31s
+
+      - description: Cubietech Cubieboard
+        items:
+          - const: cubietech,a10-cubieboard
+          - const: allwinner,sun4i-a10
+
+      - description: Cubietech Cubieboard2
+        items:
+          - const: cubietech,cubieboard2
+          - const: allwinner,sun7i-a20
+
+      - description: Cubietech Cubieboard4
+        items:
+          - const: cubietech,a80-cubieboard4
+          - const: allwinner,sun9i-a80
+
+      - description: Cubietech Cubietruck
+        items:
+          - const: cubietech,cubietruck
+          - const: allwinner,sun7i-a20
+
+      - description: Cubietech Cubietruck Plus
+        items:
+          - const: cubietech,cubietruck-plus
+          - const: allwinner,sun8i-a83t
+
+      - description: Difrnce DIT4350
+        items:
+          - const: difrnce,dit4350
+          - const: allwinner,sun5i-a13
+
+      - description: Dserve DSRV9703C
+        items:
+          - const: dserve,dsrv9703c
+          - const: allwinner,sun4i-a10
+
+      - description: Empire Electronix D709 Tablet
+        items:
+          - const: empire-electronix,d709
+          - const: allwinner,sun5i-a13
+
+      - description: Empire Electronix M712 Tablet
+        items:
+          - const: empire-electronix,m712
+          - const: allwinner,sun5i-a13
+
+      - description: FriendlyARM NanoPi A64
+        items:
+          - const: friendlyarm,nanopi-a64
+          - const: allwinner,sun50i-a64
+
+      - description: FriendlyARM NanoPi M1
+        items:
+          - const: friendlyarm,nanopi-m1
+          - const: allwinner,sun8i-h3
+
+      - description: FriendlyARM NanoPi M1 Plus
+        items:
+          - const: friendlyarm,nanopi-m1-plus
+          - const: allwinner,sun8i-h3
+
+      - description: FriendlyARM NanoPi Neo
+        items:
+          - const: friendlyarm,nanopi-neo
+          - const: allwinner,sun8i-h3
+
+      - description: FriendlyARM NanoPi Neo 2
+        items:
+          - const: friendlyarm,nanopi-neo2
+          - const: allwinner,sun50i-h5
+
+      - description: FriendlyARM NanoPi Neo Air
+        items:
+          - const: friendlyarm,nanopi-neo-air
+          - const: allwinner,sun8i-h3
+
+      - description: FriendlyARM NanoPi Neo Plus2
+        items:
+          - const: friendlyarm,nanopi-neo-plus2
+          - const: allwinner,sun50i-h5
+
+      - description: Gemei G9 Tablet
+        items:
+          - const: gemei,g9
+          - const: allwinner,sun4i-a10
+
+      - description: Hyundai A7HD
+        items:
+          - const: hyundai,a7hd
+          - const: allwinner,sun4i-a10
+
+      - description: HSG H702
+        items:
+          - const: hsg,h702
+          - const: allwinner,sun5i-a13
+
+      - description: I12 TV Box
+        items:
+          - const: allwinner,i12-tvbox
+          - const: allwinner,sun7i-a20
+
+      - description: ICNova A20 SWAC
+        items:
+          - const: swac,icnova-a20-swac
+          - const: incircuit,icnova-a20
+          - const: allwinner,sun7i-a20
+
+      - description: INet-1
+        items:
+          - const: inet-tek,inet1
+          - const: allwinner,sun4i-a10
+
+      - description: iNet-86DZ Rev 01
+        items:
+          - const: primux,inet86dz
+          - const: allwinner,sun8i-a23
+
+      - description: iNet-9F Rev 03
+        items:
+          - const: inet-tek,inet9f-rev03
+          - const: allwinner,sun4i-a10
+
+      - description: iNet-97F Rev 02
+        items:
+          - const: primux,inet97fv2
+          - const: allwinner,sun4i-a10
+
+      - description: iNet-98V Rev 02
+        items:
+          - const: primux,inet98v-rev2
+          - const: allwinner,sun5i-a13
+
+      - description: iNet D978 Rev 02 Tablet
+        items:
+          - const: primux,inet-d978-rev2
+          - const: allwinner,sun8i-a33
+
+      - description: iNet Q972 Tablet
+        items:
+          - const: inet-tek,inet-q972
+          - const: allwinner,sun6i-a31s
+
+      - description: Itead Ibox A20
+        items:
+          - const: itead,itead-ibox-a20
+          - const: allwinner,sun7i-a20
+
+      - description: Itead Iteaduino Plus A10
+        items:
+          - const: itead,iteaduino-plus-a10
+          - const: allwinner,sun4i-a10
+
+      - description: Jesurun Q5
+        items:
+          - const: jesurun,q5
+          - const: allwinner,sun4i-a10
+
+      - description: Lamobo R1
+        items:
+          - const: lamobo,lamobo-r1
+          - const: allwinner,sun7i-a20
+
+      - description: Libre Computer Board ALL-H3-CC H2+
+        items:
+          - const: libretech,all-h3-cc-h2-plus
+          - const: allwinner,sun8i-h2-plus
+
+      - description: Libre Computer Board ALL-H3-CC H3
+        items:
+          - const: libretech,all-h3-cc-h3
+          - const: allwinner,sun8i-h3
+
+      - description: Libre Computer Board ALL-H3-CC H5
+        items:
+          - const: libretech,all-h3-cc-h5
+          - const: allwinner,sun50i-h5
+
+      - description: Lichee Pi One
+        items:
+          - const: licheepi,licheepi-one
+          - const: allwinner,sun5i-a13
+
+      - description: Lichee Pi Zero
+        items:
+          - const: licheepi,licheepi-zero
+          - const: allwinner,sun8i-v3s
+
+      - description: Lichee Pi Zero (with Dock)
+        items:
+          - const: licheepi,licheepi-zero-dock
+          - const: licheepi,licheepi-zero
+          - const: allwinner,sun8i-v3s
+
+      - description: Linksprite PCDuino
+        items:
+          - const: linksprite,a10-pcduino
+          - const: allwinner,sun4i-a10
+
+      - description: Linksprite PCDuino2
+        items:
+          - const: linksprite,a10-pcduino2
+          - const: allwinner,sun4i-a10
+
+      - description: Linksprite PCDuino3
+        items:
+          - const: linksprite,pcduino3
+          - const: allwinner,sun7i-a20
+
+      - description: Linksprite PCDuino3 Nano
+        items:
+          - const: linksprite,pcduino3-nano
+          - const: allwinner,sun7i-a20
+
+      - description: HAOYU Electronics Marsboard A10
+        items:
+          - const: haoyu,a10-marsboard
+          - const: allwinner,sun4i-a10
+
+      - description: MapleBoard MP130
+        items:
+          - const: mapleboard,mp130
+          - const: allwinner,sun8i-h3
+
+      - description: Mele A1000
+        items:
+          - const: mele,a1000
+          - const: allwinner,sun4i-a10
+
+      - description: Mele A1000G Quad Set Top Box
+        items:
+          - const: mele,a1000g-quad
+          - const: allwinner,sun6i-a31
+
+      - description: Mele I7 Quad Set Top Box
+        items:
+          - const: mele,i7
+          - const: allwinner,sun6i-a31
+
+      - description: Mele M3
+        items:
+          - const: mele,m3
+          - const: allwinner,sun7i-a20
+
+      - description: Mele M9 Set Top Box
+        items:
+          - const: mele,m9
+          - const: allwinner,sun6i-a31
+
+      - description: Merrii A20 Hummingboard
+        items:
+          - const: merrii,a20-hummingbird
+          - const: allwinner,sun7i-a20
+
+      - description: Merrii A31 Hummingboard
+        items:
+          - const: merrii,a31-hummingbird
+          - const: allwinner,sun6i-a31
+
+      - description: Merrii A80 Optimus
+        items:
+          - const: merrii,a80-optimus
+          - const: allwinner,sun9i-a80
+
+      - description: Miniand Hackberry
+        items:
+          - const: miniand,hackberry
+          - const: allwinner,sun4i-a10
+
+      - description: MK802
+        items:
+          - const: allwinner,mk802
+          - const: allwinner,sun4i-a10
+
+      - description: MK802-A10s
+        items:
+          - const: allwinner,a10s-mk802
+          - const: allwinner,sun5i-a10s
+
+      - description: MK802-II
+        items:
+          - const: allwinner,mk802ii
+          - const: allwinner,sun4i-a10
+
+      - description: MK808c
+        items:
+          - const: allwinner,mk808c
+          - const: allwinner,sun7i-a20
+
+      - description: MSI Primo81 Tablet
+        items:
+          - const: msi,primo81
+          - const: allwinner,sun6i-a31s
+
+      - description: Emlid Neutis N5 Developper Board
+        items:
+          - const: emlid,neutis-n5-devboard
+          - const: emlid,neutis-n5
+          - const: allwinner,sun50i-h5
+
+      - description: NextThing Co. CHIP
+        items:
+          - const: nextthing,chip
+          - const: allwinner,sun5i-r8
+          - const: allwinner,sun5i-a13
+
+      - description: NextThing Co. CHIP Pro
+        items:
+          - const: nextthing,chip-pro
+          - const: nextthing,gr8
+
+      - description: NextThing Co. GR8 Evaluation Board
+        items:
+          - const: nextthing,gr8-evb
+          - const: nextthing,gr8
+
+      - description: Nintendo NES Classic
+        items:
+          - const: nintendo,nes-classic
+          - const: allwinner,sun8i-r16
+          - const: allwinner,sun8i-a33
+
+      - description: Nintendo Super NES Classic
+        items:
+          - const: nintendo,super-nes-classic
+          - const: nintendo,nes-classic
+          - const: allwinner,sun8i-r16
+          - const: allwinner,sun8i-a33
+
+      - description: Oceanic 5inMFD (5205)
+        items:
+          - const: oceanic,5205-5inmfd
+          - const: allwinner,sun50i-a64
+
+      - description: Olimex A10-OlinuXino LIME
+        items:
+          - const: olimex,a10-olinuxino-lime
+          - const: allwinner,sun4i-a10
+
+      - description: Olimex A10s-OlinuXino Micro
+        items:
+          - const: olimex,a10s-olinuxino-micro
+          - const: allwinner,sun5i-a10s
+
+      - description: Olimex A13-OlinuXino
+        items:
+          - const: olimex,a13-olinuxino
+          - const: allwinner,sun5i-a13
+
+      - description: Olimex A13-OlinuXino Micro
+        items:
+          - const: olimex,a13-olinuxino-micro
+          - const: allwinner,sun5i-a13
+
+      - description: Olimex A20-Olimex SOM Evaluation Board
+        items:
+          - const: olimex,a20-olimex-som-evb
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-Olimex SOM Evaluation Board (with eMMC)
+        items:
+          - const: olimex,a20-olimex-som-evb-emmc
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-OlinuXino LIME
+        items:
+          - const: olimex,a20-olinuxino-lime
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-OlinuXino LIME2
+        items:
+          - const: olimex,a20-olinuxino-lime2
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-OlinuXino LIME2 (with eMMC)
+        items:
+          - const: olimex,a20-olinuxino-lime2-emmc
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-OlinuXino Micro
+        items:
+          - const: olimex,a20-olinuxino-micro
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-OlinuXino Micro (with eMMC)
+        items:
+          - const: olimex,a20-olinuxino-micro-emmc
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-SOM204 Evaluation Board
+        items:
+          - const: olimex,a20-olimex-som204-evb
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A20-SOM204 Evaluation Board (with eMMC)
+        items:
+          - const: olimex,a20-olimex-som204-evb-emmc
+          - const: allwinner,sun7i-a20
+
+      - description: Olimex A33-OlinuXino
+        items:
+          - const: olimex,a33-olinuxino
+          - const: allwinner,sun8i-a33
+
+      - description: Olimex A64-OlinuXino
+        items:
+          - const: olimex,a64-olinuxino
+          - const: allwinner,sun50i-a64
+
+      - description: Olimex A64 Teres-I
+        items:
+          - const: olimex,a64-teres-i
+          - const: allwinner,sun50i-a64
+
+      - description: Pine64
+        items:
+          - const: pine64,pine64
+          - const: allwinner,sun50i-a64
+
+      - description: Pine64+
+        items:
+          - const: pine64,pine64-plus
+          - const: allwinner,sun50i-a64
+
+      - description: Pine64 PineH64
+        items:
+          - const: pine64,pine-h64
+          - const: allwinner,sun50i-h6
+
+      - description: Pine64 LTS
+        items:
+          - const: pine64,pine64-lts
+          - const: allwinner,sun50i-r18
+          - const: allwinner,sun50i-a64
+
+      - description: Pine64 Pinebook
+        items:
+          - const: pine64,pinebook
+          - const: allwinner,sun50i-a64
+
+      - description: Pine64 SoPine Baseboard
+        items:
+          - const: pine64,sopine-baseboard
+          - const: pine64,sopine
+          - const: allwinner,sun50i-a64
+
+      - description: PineRiver Mini X-Plus
+        items:
+          - const: pineriver,mini-xplus
+          - const: allwinner,sun4i-a10
+
+      - description: Point of View Protab2-IPS9
+        items:
+          - const: pov,protab2-ips9
+          - const: allwinner,sun4i-a10
+
+      - description: Polaroid MID2407PXE03 Tablet
+        items:
+          - const: polaroid,mid2407pxe03
+          - const: allwinner,sun8i-a23
+
+      - description: Polaroid MID2809PXE04 Tablet
+        items:
+          - const: polaroid,mid2809pxe04
+          - const: allwinner,sun8i-a23
+
+      - description: Q8 A13 Tablet
+        items:
+          - const: allwinner,q8-a13
+          - const: allwinner,sun5i-a13
+
+      - description: Q8 A23 Tablet
+        items:
+          - const: allwinner,q8-a23
+          - const: allwinner,sun8i-a23
+
+      - description: Q8 A33 Tablet
+        items:
+          - const: allwinner,q8-a33
+          - const: allwinner,sun8i-a33
+
+      - description: Qihua CQA3T BV3
+        items:
+          - const: qihua,t3-cqa3t-bv3
+          - const: allwinner,sun8i-t3
+          - const: allwinner,sun8i-r40
+
+      - description: R7 A10s HDMI TV Stick
+        items:
+          - const: allwinner,r7-tv-dongle
+          - const: allwinner,sun5i-a10s
+
+      - description: RerVision H3-DVK
+        items:
+          - const: rervision,h3-dvk
+          - const: allwinner,sun8i-h3
+
+      - description: Sinlinx SinA31s Core Board
+        items:
+          - const: sinlinx,sina31s
+          - const: allwinner,sun6i-a31s
+
+      - description: Sinlinx SinA31s Development Board
+        items:
+          - const: sinlinx,sina31s-sdk
+          - const: allwinner,sun6i-a31s
+
+      - description: Sinlinx SinA33
+        items:
+          - const: sinlinx,sina33
+          - const: allwinner,sun8i-a33
+
+      - description: TBS A711 Tablet
+        items:
+          - const: tbs-biometrics,a711
+          - const: allwinner,sun8i-a83t
+
+      - description: Utoo P66
+        items:
+          - const: utoo,p66
+          - const: allwinner,sun5i-a13
+
+      - description: Wexler TAB7200
+        items:
+          - const: wexler,tab7200
+          - const: allwinner,sun7i-a20
+
+      - description: WITS A31 Colombus Evaluation Board
+        items:
+          - const: wits,colombus
+          - const: allwinner,sun6i-a31
+
+      - description: WITS Pro A20 DKT
+        items:
+          - const: wits,pro-a20-dkt
+          - const: allwinner,sun7i-a20
+
+      - description: Wobo i5
+        items:
+          - const: wobo,a10s-wobo-i5
+          - const: allwinner,sun5i-a10s
+
+      - description: Yones TopTech BS1078 v2 Tablet
+        items:
+          - const: yones-toptech,bs1078-v2
+          - const: allwinner,sun6i-a31s
+
+      - description: Xunlong OrangePi
+        items:
+          - const: xunlong,orangepi
+          - const: allwinner,sun7i-a20
+
+      - description: Xunlong OrangePi 2
+        items:
+          - const: xunlong,orangepi-2
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi 3
+        items:
+          - const: xunlong,orangepi-3
+          - const: allwinner,sun50i-h6
+
+      - description: Xunlong OrangePi Lite
+        items:
+          - const: xunlong,orangepi-lite
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi Lite2
+        items:
+          - const: xunlong,orangepi-lite2
+          - const: allwinner,sun50i-h6
+
+      - description: Xunlong OrangePi Mini
+        items:
+          - const: xunlong,orangepi-mini
+          - const: allwinner,sun7i-a20
+
+      - description: Xunlong OrangePi One
+        items:
+          - const: xunlong,orangepi-one
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi One Plus
+        items:
+          - const: xunlong,orangepi-one-plus
+          - const: allwinner,sun50i-h6
+
+      - description: Xunlong OrangePi PC
+        items:
+          - const: xunlong,orangepi-pc
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi PC 2
+        items:
+          - const: xunlong,orangepi-pc2
+          - const: allwinner,sun50i-h5
+
+      - description: Xunlong OrangePi PC Plus
+        items:
+          - const: xunlong,orangepi-pc-plus
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi Plus
+        items:
+          - const: xunlong,orangepi-plus
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi Plus 2E
+        items:
+          - const: xunlong,orangepi-plus2e
+          - const: allwinner,sun8i-h3
+
+      - description: Xunlong OrangePi Prime
+        items:
+          - const: xunlong,orangepi-prime
+          - const: allwinner,sun50i-h5
+
+      - description: Xunlong OrangePi R1
+        items:
+          - const: xunlong,orangepi-r1
+          - const: allwinner,sun8i-h2-plus
+
+      - description: Xunlong OrangePi Win
+        items:
+          - const: xunlong,orangepi-win
+          - const: allwinner,sun50i-a64
+
+      - description: Xunlong OrangePi Zero
+        items:
+          - const: xunlong,orangepi-zero
+          - const: allwinner,sun8i-h2-plus
+
+      - description: Xunlong OrangePi Zero Plus
+        items:
+          - const: xunlong,orangepi-zero-plus
+          - const: allwinner,sun50i-h5
+
+      - description: Xunlong OrangePi Zero Plus2
+        items:
+          - const: xunlong,orangepi-zero-plus2
+          - const: allwinner,sun50i-h5
+
+      - description: Xunlong OrangePi Zero Plus2
+        items:
+          - const: xunlong,orangepi-zero-plus2-h3
+          - const: allwinner,sun8i-h3
index 85a23f5..233eb82 100644 (file)
@@ -94,6 +94,8 @@ Optional properties:
 
 - ti,no-idle-on-init   interconnect target module should not be idled at init
 
+- ti,no-idle           interconnect target module should not be idled
+
 Example: Single instance of MUSB controller on omap4 using interconnect ranges
 using offsets from l4_cfg second segment (0x4a000000 + 0x80000 = 0x4a0ab000):
 
@@ -131,6 +133,6 @@ using offsets from l4_cfg second segment (0x4a000000 + 0x80000 = 0x4a0ab000):
                };
        };
 
-Note that other SoCs, such as am335x can have multipe child devices. On am335x
+Note that other SoCs, such as am335x can have multiple child devices. On am335x
 there are two MUSB instances, two USB PHY instances, and a single CPPI41 DMA
-instance as children of a single interconnet target module.
+instance as children of a single interconnect target module.
diff --git a/Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.txt b/Documentation/devicetree/bindings/clock/xlnx,zynqmp-clk.txt
new file mode 100644 (file)
index 0000000..391ee1a
--- /dev/null
@@ -0,0 +1,63 @@
+--------------------------------------------------------------------------
+Device Tree Clock bindings for the Zynq Ultrascale+ MPSoC controlled using
+Zynq MPSoC firmware interface
+--------------------------------------------------------------------------
+The clock controller is a h/w block of Zynq Ultrascale+ MPSoC clock
+tree. It reads required input clock frequencies from the devicetree and acts
+as clock provider for all clock consumers of PS clocks.
+
+See clock_bindings.txt for more information on the generic clock bindings.
+
+Required properties:
+ - #clock-cells:       Must be 1
+ - compatible:         Must contain:   "xlnx,zynqmp-clk"
+ - clocks:             List of clock specifiers which are external input
+                       clocks to the given clock controller. Please refer
+                       the next section to find the input clocks for a
+                       given controller.
+ - clock-names:                List of clock names which are exteral input clocks
+                       to the given clock controller. Please refer to the
+                       clock bindings for more details.
+
+Input clocks for zynqmp Ultrascale+ clock controller:
+
+The Zynq UltraScale+ MPSoC has one primary and four alternative reference clock
+inputs. These required clock inputs are:
+ - pss_ref_clk (PS reference clock)
+ - video_clk (reference clock for video system )
+ - pss_alt_ref_clk (alternative PS reference clock)
+ - aux_ref_clk
+ - gt_crx_ref_clk (transceiver reference clock)
+
+The following strings are optional parameters to the 'clock-names' property in
+order to provide an optional (E)MIO clock source:
+ - swdt0_ext_clk
+ - swdt1_ext_clk
+ - gem0_emio_clk
+ - gem1_emio_clk
+ - gem2_emio_clk
+ - gem3_emio_clk
+ - mio_clk_XX          # with XX = 00..77
+ - mio_clk_50_or_51    #for the mux clock to gem tsu from 50 or 51
+
+
+Output clocks are registered based on clock information received
+from firmware. Output clocks indexes are mentioned in
+include/dt-bindings/clock/xlnx-zynqmp-clk.h.
+
+-------
+Example
+-------
+
+firmware {
+       zynqmp_firmware: zynqmp-firmware {
+               compatible = "xlnx,zynqmp-firmware";
+               method = "smc";
+               zynqmp_clk: clock-controller {
+                       #clock-cells = <1>;
+                       compatible = "xlnx,zynqmp-clk";
+                       clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>, <&aux_ref_clk>, <&gt_crx_ref_clk>;
+                       clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk","aux_ref_clk", "gt_crx_ref_clk";
+               };
+       };
+};
index 3c9a57a..9d8bbac 100644 (file)
@@ -9,6 +9,7 @@ Required properties:
       "fsl,imx53-sdma"
       "fsl,imx6q-sdma"
       "fsl,imx7d-sdma"
+      "fsl,imx8mq-sdma"
   The -to variants should be preferred since they allow to determine the
   correct ROM script addresses needed for the driver to work without additional
   firmware.
diff --git a/Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml b/Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml
new file mode 100644 (file)
index 0000000..8cb136c
--- /dev/null
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/firmware/intel-ixp4xx-network-processing-engine.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx Network Processing Engine
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  On the IXP4xx SoCs, the Network Processing Engine (NPE) is a small
+  processor that can load a firmware to perform offloading of networking
+  and crypto tasks. It also manages the MDIO bus to the ethernet PHYs
+  on the IXP4xx platform. All IXP4xx platforms have three NPEs at
+  consecutive memory locations. They are all included in the same
+  device node since they are not independent of each other.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: intel,ixp4xx-network-processing-engine
+
+  reg:
+    minItems: 3
+    maxItems: 3
+    items:
+      - description: NPE0 register range
+      - description: NPE1 register range
+      - description: NPE2 register range
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    npe@c8006000 {
+         compatible = "intel,ixp4xx-network-processing-engine";
+         reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>;
+    };
index 614bac5..a4fe136 100644 (file)
@@ -17,53 +17,6 @@ Required properties:
                  - "smc" : SMC #0, following the SMCCC
                  - "hvc" : HVC #0, following the SMCCC
 
---------------------------------------------------------------------------
-Device Tree Clock bindings for the Zynq Ultrascale+ MPSoC controlled using
-Zynq MPSoC firmware interface
---------------------------------------------------------------------------
-The clock controller is a h/w block of Zynq Ultrascale+ MPSoC clock
-tree. It reads required input clock frequencies from the devicetree and acts
-as clock provider for all clock consumers of PS clocks.
-
-See clock_bindings.txt for more information on the generic clock bindings.
-
-Required properties:
- - #clock-cells:       Must be 1
- - compatible:         Must contain:   "xlnx,zynqmp-clk"
- - clocks:             List of clock specifiers which are external input
-                       clocks to the given clock controller. Please refer
-                       the next section to find the input clocks for a
-                       given controller.
- - clock-names:                List of clock names which are exteral input clocks
-                       to the given clock controller. Please refer to the
-                       clock bindings for more details.
-
-Input clocks for zynqmp Ultrascale+ clock controller:
-
-The Zynq UltraScale+ MPSoC has one primary and four alternative reference clock
-inputs. These required clock inputs are:
- - pss_ref_clk (PS reference clock)
- - video_clk (reference clock for video system )
- - pss_alt_ref_clk (alternative PS reference clock)
- - aux_ref_clk
- - gt_crx_ref_clk (transceiver reference clock)
-
-The following strings are optional parameters to the 'clock-names' property in
-order to provide an optional (E)MIO clock source:
- - swdt0_ext_clk
- - swdt1_ext_clk
- - gem0_emio_clk
- - gem1_emio_clk
- - gem2_emio_clk
- - gem3_emio_clk
- - mio_clk_XX          # with XX = 00..77
- - mio_clk_50_or_51    #for the mux clock to gem tsu from 50 or 51
-
-
-Output clocks are registered based on clock information received
-from firmware. Output clocks indexes are mentioned in
-include/dt-bindings/clock/xlnx,zynqmp-clk.h.
-
 -------
 Example
 -------
@@ -72,11 +25,6 @@ firmware {
        zynqmp_firmware: zynqmp-firmware {
                compatible = "xlnx,zynqmp-firmware";
                method = "smc";
-               zynqmp_clk: clock-controller {
-                       #clock-cells = <1>;
-                       compatible = "xlnx,zynqmp-clk";
-                       clocks = <&pss_ref_clk>, <&video_clk>, <&pss_alt_ref_clk>, <&aux_ref_clk>, <&gt_crx_ref_clk>;
-                       clock-names = "pss_ref_clk", "video_clk", "pss_alt_ref_clk","aux_ref_clk", "gt_crx_ref_clk";
-               };
+               ...
        };
 };
diff --git a/Documentation/devicetree/bindings/fpga/xlnx,zynqmp-pcap-fpga.txt b/Documentation/devicetree/bindings/fpga/xlnx,zynqmp-pcap-fpga.txt
new file mode 100644 (file)
index 0000000..3052bf6
--- /dev/null
@@ -0,0 +1,25 @@
+Devicetree bindings for Zynq Ultrascale MPSoC FPGA Manager.
+The ZynqMP SoC uses the PCAP (Processor configuration Port) to configure the
+Programmable Logic (PL). The configuration uses  the firmware interface.
+
+Required properties:
+- compatible: should contain "xlnx,zynqmp-pcap-fpga"
+
+Example for full FPGA configuration:
+
+       fpga-region0 {
+               compatible = "fpga-region";
+               fpga-mgr = <&zynqmp_pcap>;
+               #address-cells = <0x1>;
+               #size-cells = <0x1>;
+       };
+
+       firmware {
+               zynqmp_firmware: zynqmp-firmware {
+                       compatible = "xlnx,zynqmp-firmware";
+                       method = "smc";
+                       zynqmp_pcap: pcap {
+                               compatible = "xlnx,zynqmp-pcap-fpga";
+                       };
+               };
+       };
index 18a2cde..1b1a741 100644 (file)
@@ -37,6 +37,20 @@ Optional properties:
 - operating-points-v2 : Refer to Documentation/devicetree/bindings/opp/opp.txt
   for details.
 
+- resets : Phandle of the GPU reset line.
+
+Vendor-specific bindings
+------------------------
+
+The Mali GPU is integrated very differently from one SoC to
+another. In order to accomodate those differences, you have the option
+to specify one more vendor-specific compatible, among:
+
+- "amlogic,meson-gxm-mali"
+  Required properties:
+  - resets : Should contain phandles of :
+    + GPU reset line
+    + GPU APB glue reset line
 
 Example for a Mali-T760:
 
index 6ced829..41b7676 100644 (file)
@@ -21,8 +21,6 @@ Optional properties:
 Example:
        fan0: pwm-fan {
                compatible = "pwm-fan";
-               cooling-min-state = <0>;
-               cooling-max-state = <3>;
                #cooling-cells = <2>;
                pwms = <&pwm 0 10000 0>;
                cooling-levels = <0 102 170 230>;
index 5c184b9..f1f3a55 100644 (file)
@@ -10,6 +10,7 @@ Required properties:
 - clocks: The root clock of the ADC controller
 - clock-names: Must contain "adc", matching entry in the clocks property
 - vref-supply: The regulator supply ADC reference voltage
+- #io-channel-cells: Must be 1 as per ../iio-bindings.txt
 
 Example:
 adc1: adc@30610000 {
@@ -19,4 +20,5 @@ adc1: adc@30610000 {
        clocks = <&clks IMX7D_ADC_ROOT_CLK>;
        clock-names = "adc";
        vref-supply = <&reg_vcc_3v3_mcu>;
+       #io-channel-cells = <1>;
 };
index c81993f..c878768 100644 (file)
@@ -13,6 +13,7 @@ VADC node:
     Definition: Should contain "qcom,spmi-vadc".
                 Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
                 Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
+                Should contain "qcom,pms405-adc" for PMS405 PMIC
 
 - reg:
     Usage: required
diff --git a/Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml b/Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
new file mode 100644 (file)
index 0000000..bae10e2
--- /dev/null
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2018 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/interrupt/intel-ixp4xx-interrupt.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx XScale Networking Processors Interrupt Controller
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  This interrupt controller is found in the Intel IXP4xx processors.
+  Some processors have 32 interrupts, some have up to 64 interrupts.
+  The exact number of interrupts is determined from the compatible
+  string.
+
+  The distinct IXP4xx families with different interrupt controller
+  variations are IXP42x, IXP43x, IXP45x and IXP46x. Those four
+  families were the only ones to reach the developer and consumer
+  market.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - intel,ixp42x-interrupt
+        - intel,ixp43x-interrupt
+        - intel,ixp45x-interrupt
+        - intel,ixp46x-interrupt
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+examples:
+  - |
+    intcon: interrupt-controller@c8003000 {
+        compatible = "intel,ixp43x-interrupt";
+        reg = <0xc8003000 0x100>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+    };
index c5d5891..0e312fe 100644 (file)
@@ -1,15 +1,18 @@
-+Mediatek MT65xx/MT67xx/MT81xx sysirq
+MediaTek sysirq
 
-Mediatek SOCs sysirq support controllable irq inverter for each GIC SPI
+MediaTek SOCs sysirq support controllable irq inverter for each GIC SPI
 interrupt.
 
 Required properties:
 - compatible: should be
+       "mediatek,mt8516-sysirq", "mediatek,mt6577-sysirq": for MT8516
+       "mediatek,mt8183-sysirq", "mediatek,mt6577-sysirq": for MT8183
        "mediatek,mt8173-sysirq", "mediatek,mt6577-sysirq": for MT8173
        "mediatek,mt8135-sysirq", "mediatek,mt6577-sysirq": for MT8135
        "mediatek,mt8127-sysirq", "mediatek,mt6577-sysirq": for MT8127
        "mediatek,mt7622-sysirq", "mediatek,mt6577-sysirq": for MT7622
        "mediatek,mt7623-sysirq", "mediatek,mt6577-sysirq": for MT7623
+       "mediatek,mt7629-sysirq", "mediatek,mt6577-sysirq": for MT7629
        "mediatek,mt6795-sysirq", "mediatek,mt6577-sysirq": for MT6795
        "mediatek,mt6797-sysirq", "mediatek,mt6577-sysirq": for MT6797
        "mediatek,mt6765-sysirq", "mediatek,mt6577-sysirq": for MT6765
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
new file mode 100644 (file)
index 0000000..7841cb0
--- /dev/null
@@ -0,0 +1,66 @@
+Texas Instruments K3 Interrupt Aggregator
+=========================================
+
+The Interrupt Aggregator (INTA) provides a centralized machine
+which handles the termination of system events to that they can
+be coherently processed by the host(s) in the system. A maximum
+of 64 events can be mapped to a single interrupt.
+
+
+                              Interrupt Aggregator
+                     +-----------------------------------------+
+                     |      Intmap            VINT             |
+                     | +--------------+  +------------+        |
+            m ------>| | vint  | bit  |  | 0 |.....|63| vint0  |
+               .     | +--------------+  +------------+        |       +------+
+               .     |         .               .               |       | HOST |
+Globalevents  ------>|         .               .               |------>| IRQ  |
+               .     |         .               .               |       | CTRL |
+               .     |         .               .               |       +------+
+            n ------>| +--------------+  +------------+        |
+                     | | vint  | bit  |  | 0 |.....|63| vintx  |
+                     | +--------------+  +------------+        |
+                     |                                         |
+                     +-----------------------------------------+
+
+Configuration of these Intmap registers that maps global events to vint is done
+by a system controller (like the Device Memory and Security Controller on K3
+AM654 SoC). Driver should request the system controller to get the range
+of global events and vints assigned to the requesting host. Management
+of these requested resources should be handled by driver and requests
+system controller to map specific global event to vint, bit pair.
+
+Communication between the host processor running an OS and the system
+controller happens through a protocol called TI System Control Interface
+(TISCI protocol). For more details refer:
+Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
+
+TISCI Interrupt Aggregator Node:
+-------------------------------
+- compatible:          Must be "ti,sci-inta".
+- reg:                 Should contain registers location and length.
+- interrupt-controller:        Identifies the node as an interrupt controller
+- msi-controller:      Identifies the node as an MSI controller.
+- interrupt-parent:    phandle of irq parent.
+- ti,sci:              Phandle to TI-SCI compatible System controller node.
+- ti,sci-dev-id:       TISCI device ID of the Interrupt Aggregator.
+- ti,sci-rm-range-vint:        Array of TISCI subtype ids representing vints(inta
+                       outputs) range within this INTA, assigned to the
+                       requesting host context.
+- ti,sci-rm-range-global-event:        Array of TISCI subtype ids representing the
+                       global events range reaching this IA and are assigned
+                       to the requesting host context.
+
+Example:
+--------
+main_udmass_inta: interrupt-controller@33d00000 {
+       compatible = "ti,sci-inta";
+       reg = <0x0 0x33d00000 0x0 0x100000>;
+       interrupt-controller;
+       msi-controller;
+       interrupt-parent = <&main_navss_intr>;
+       ti,sci = <&dmsc>;
+       ti,sci-dev-id = <179>;
+       ti,sci-rm-range-vint = <0x0>;
+       ti,sci-rm-range-global-event = <0x1>;
+};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
new file mode 100644 (file)
index 0000000..1a8718f
--- /dev/null
@@ -0,0 +1,82 @@
+Texas Instruments K3 Interrupt Router
+=====================================
+
+The Interrupt Router (INTR) module provides a mechanism to mux M
+interrupt inputs to N interrupt outputs, where all M inputs are selectable
+to be driven per N output. An Interrupt Router can either handle edge triggered
+or level triggered interrupts and that is fixed in hardware.
+
+                                 Interrupt Router
+                             +----------------------+
+                             |  Inputs     Outputs  |
+        +-------+            | +------+    +-----+  |
+        | GPIO  |----------->| | irq0 |    |  0  |  |       Host IRQ
+        +-------+            | +------+    +-----+  |      controller
+                             |    .           .     |      +-------+
+        +-------+            |    .           .     |----->|  IRQ  |
+        | INTA  |----------->|    .           .     |      +-------+
+        +-------+            |    .        +-----+  |
+                             | +------+    |  N  |  |
+                             | | irqM |    +-----+  |
+                             | +------+             |
+                             |                      |
+                             +----------------------+
+
+There is one register per output (MUXCNTL_N) that controls the selection.
+Configuration of these MUXCNTL_N registers is done by a system controller
+(like the Device Memory and Security Controller on K3 AM654 SoC). System
+controller will keep track of the used and unused registers within the Router.
+Driver should request the system controller to get the range of GIC IRQs
+assigned to the requesting hosts. It is the drivers responsibility to keep
+track of Host IRQs.
+
+Communication between the host processor running an OS and the system
+controller happens through a protocol called TI System Control Interface
+(TISCI protocol). For more details refer:
+Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
+
+TISCI Interrupt Router Node:
+----------------------------
+Required Properties:
+- compatible:          Must be "ti,sci-intr".
+- ti,intr-trigger-type:        Should be one of the following:
+                       1: If intr supports edge triggered interrupts.
+                       4: If intr supports level triggered interrupts.
+- interrupt-controller:        Identifies the node as an interrupt controller
+- #interrupt-cells:    Specifies the number of cells needed to encode an
+                       interrupt source. The value should be 2.
+                       First cell should contain the TISCI device ID of source
+                       Second cell should contain the interrupt source offset
+                       within the device.
+- ti,sci:              Phandle to TI-SCI compatible System controller node.
+- ti,sci-dst-id:       TISCI device ID of the destination IRQ controller.
+- ti,sci-rm-range-girq:        Array of TISCI subtype ids representing the host irqs
+                       assigned to this interrupt router. Each subtype id
+                       corresponds to a range of host irqs.
+
+For more details on TISCI IRQ resource management refer:
+http://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/rm/rm_irq.html
+
+Example:
+--------
+The following example demonstrates both interrupt router node and the consumer
+node(main gpio) on the AM654 SoC:
+
+main_intr: interrupt-controller0 {
+       compatible = "ti,sci-intr";
+       ti,intr-trigger-type = <1>;
+       interrupt-controller;
+       interrupt-parent = <&gic500>;
+       #interrupt-cells = <2>;
+       ti,sci = <&dmsc>;
+       ti,sci-dst-id = <56>;
+       ti,sci-rm-range-girq = <0x1>;
+};
+
+main_gpio0: gpio@600000 {
+       ...
+       interrupt-parent = <&main_intr>;
+       interrupts = <57 256>, <57 257>, <57 258>,
+                    <57 259>, <57 260>, <57 261>;
+       ...
+};
diff --git a/Documentation/devicetree/bindings/memory-controllers/fsl/mmdc.txt b/Documentation/devicetree/bindings/memory-controllers/fsl/mmdc.txt
new file mode 100644 (file)
index 0000000..bcc36c5
--- /dev/null
@@ -0,0 +1,35 @@
+Freescale Multi Mode DDR controller (MMDC)
+
+Required properties :
+- compatible : should be one of following:
+       for i.MX6Q/i.MX6DL:
+       - "fsl,imx6q-mmdc";
+       for i.MX6QP:
+       - "fsl,imx6qp-mmdc", "fsl,imx6q-mmdc";
+       for i.MX6SL:
+       - "fsl,imx6sl-mmdc", "fsl,imx6q-mmdc";
+       for i.MX6SLL:
+       - "fsl,imx6sll-mmdc", "fsl,imx6q-mmdc";
+       for i.MX6SX:
+       - "fsl,imx6sx-mmdc", "fsl,imx6q-mmdc";
+       for i.MX6UL/i.MX6ULL/i.MX6ULZ:
+       - "fsl,imx6ul-mmdc", "fsl,imx6q-mmdc";
+       for i.MX7ULP:
+       - "fsl,imx7ulp-mmdc", "fsl,imx6q-mmdc";
+- reg : address and size of MMDC DDR controller registers
+
+Optional properties :
+- clocks : the clock provided by the SoC to access the MMDC registers
+
+Example :
+       mmdc0: memory-controller@21b0000 { /* MMDC0 */
+               compatible = "fsl,imx6q-mmdc";
+               reg = <0x021b0000 0x4000>;
+               clocks = <&clks IMX6QDL_CLK_MMDC_P0_IPG>;
+       };
+
+       mmdc1: memory-controller@21b4000 { /* MMDC1 */
+               compatible = "fsl,imx6q-mmdc";
+               reg = <0x021b4000 0x4000>;
+               status = "disabled";
+       };
diff --git a/Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml b/Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml
new file mode 100644 (file)
index 0000000..d2313b1
--- /dev/null
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/misc/intel-ixp4xx-ahb-queue-manager.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx AHB Queue Manager
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  The IXP4xx AHB Queue Manager maintains queues as circular buffers in
+  an 8KB embedded SRAM along with hardware pointers. It is used by both
+  the XScale processor and the NPEs (Network Processing Units) in the
+  IXP4xx for accelerating queues, especially for networking. Clients pick
+  queues from the queue manager with foo-queue = <&qmgr N> where the
+  &qmgr is a phandle to the queue manager and N is the queue resource
+  number. The queue resources available and their specific purpose
+  on a certain IXP4xx system will vary.
+
+properties:
+  compatible:
+    items:
+      - const: intel,ixp4xx-ahb-queue-manager
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: Interrupt for queues 0-31
+      - description: Interrupt for queues 32-63
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    qmgr: queue-manager@60000000 {
+         compatible = "intel,ixp4xx-ahb-queue-manager";
+         reg = <0x60000000 0x4000>;
+         interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>;
+    };
index 07242d1..36c4bea 100644 (file)
@@ -13,6 +13,8 @@ Required Properties:
 
 * compatible: should be one of the following.
   - "hisilicon,hi3660-dw-mshc": for controllers with hi3660 specific extensions.
+  - "hisilicon,hi3670-dw-mshc", "hisilicon,hi3660-dw-mshc": for controllers
+     with hi3670 specific extensions.
   - "hisilicon,hi4511-dw-mshc": for controllers with hi4511 specific extensions.
   - "hisilicon,hi6220-dw-mshc": for controllers with hi6220 specific extensions.
 
index 1cd050b..0fdc3dd 100644 (file)
@@ -16,7 +16,9 @@ Device Tree Bindings:
 ---------------------
 
 Required properties:
-- compatible: should be "amlogic,meson-gx-pwrc-vpu" for the Meson GX SoCs
+- compatible: should be one of the following :
+       - "amlogic,meson-gx-pwrc-vpu" for the Meson GX SoCs
+       - "amlogic,meson-g12a-pwrc-vpu" for the Meson G12A SoCs
 - #power-domain-cells: should be 0
 - amlogic,hhi-sysctrl: phandle to the HHI sysctrl node
 - resets: phandles to the reset lines needed for this power demain sequence
index 1190631..e23dea8 100644 (file)
@@ -3,13 +3,20 @@ Generic SYSCON mapped register reset driver
 This is a generic reset driver using syscon to map the reset register.
 The reset is generally performed with a write to the reset register
 defined by the register map pointed by syscon reference plus the offset
-with the mask defined in the reboot node.
+with the value and mask defined in the reboot node.
 
 Required properties:
 - compatible: should contain "syscon-reboot"
 - regmap: this is phandle to the register map node
 - offset: offset in the register map for the reboot register (in bytes)
-- mask: the reset value written to the reboot register (32 bit access)
+- value: the reset value written to the reboot register (32 bit access)
+
+Optional properties:
+- mask: update only the register bits defined by the mask (32 bit)
+
+Legacy usage:
+If a node doesn't contain a value property but contains a mask property, the
+mask property is used as the value.
 
 Default will be little endian mode, 32 bit access only.
 
index ba8d35f..b2d4968 100644 (file)
@@ -4,6 +4,7 @@ Required Properties:
 -compatible: One of: "x-powers,axp202-usb-power-supply"
                      "x-powers,axp221-usb-power-supply"
                      "x-powers,axp223-usb-power-supply"
+                    "x-powers,axp813-usb-power-supply"
 
 The AXP223 PMIC shares most of its behaviour with the AXP221 but has slight
 variations such as the former being able to set the VBUS power supply max
index adbb5dc..0fb33b2 100644 (file)
@@ -14,13 +14,17 @@ Required properties :
      usb-cdp (USB charging downstream port)
      usb-aca (USB accessory charger adapter)
 
+Optional properties:
+ - charge-status-gpios: GPIO indicating whether a battery is charging.
+
 Example:
 
        usb_charger: charger {
                compatible = "gpio-charger";
                charger-type = "usb-sdp";
-               gpios = <&gpf0 2 0 0 0>;
-       }
+               gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
+               charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
+       };
 
        battery {
                power-supplies = <&usb_charger>;
diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt b/Documentation/devicetree/bindings/power/supply/ingenic,battery.txt
new file mode 100644 (file)
index 0000000..66430bf
--- /dev/null
@@ -0,0 +1,31 @@
+* Ingenic JZ47xx battery bindings
+
+Required properties:
+
+- compatible: Must be "ingenic,jz4740-battery".
+- io-channels: phandle and IIO specifier pair to the IIO device.
+  Format described in iio-bindings.txt.
+- monitored-battery: phandle to a "simple-battery" compatible node.
+
+The "monitored-battery" property must be a phandle to a node using the format
+described in battery.txt, with the following properties being required:
+
+- voltage-min-design-microvolt: Drained battery voltage.
+- voltage-max-design-microvolt: Fully charged battery voltage.
+
+Example:
+
+#include <dt-bindings/iio/adc/ingenic,adc.h>
+
+simple_battery: battery {
+       compatible = "simple-battery";
+       voltage-min-design-microvolt = <3600000>;
+       voltage-max-design-microvolt = <4200000>;
+};
+
+ingenic_battery {
+       compatible = "ingenic,jz4740-battery";
+       io-channels = <&adc INGENIC_ADC_BATTERY>;
+       io-channel-names = "battery";
+       monitored-battery = <&simple_battery>;
+};
@@ -1,14 +1,16 @@
-ltc3651-charger
+Analog Devices LT3651 Charger Power Supply bindings: lt3651-charger
 
 Required properties:
- - compatible: "lltc,ltc3651-charger"
+- compatible: Should contain one of the following:
+ * "lltc,ltc3651-charger", (DEPRECATED: Use "lltc,lt3651-charger")
+ * "lltc,lt3651-charger"
  - lltc,acpr-gpios: Connect to ACPR output. See remark below.
 
 Optional properties:
  - lltc,fault-gpios: Connect to FAULT output. See remark below.
  - lltc,chrg-gpios: Connect to CHRG output. See remark below.
 
-The ltc3651 outputs are open-drain type and active low. The driver assumes the
+The lt3651 outputs are open-drain type and active low. The driver assumes the
 GPIO reports "active" when the output is asserted, so if the pins have been
 connected directly, the GPIO flags should be set to active low also.
 
@@ -20,7 +22,7 @@ attributes to detect changes.
 Example:
 
        charger: battery-charger {
-               compatible = "lltc,ltc3651-charger";
+               compatible = "lltc,lt3651-charger";
                lltc,acpr-gpios = <&gpio0 68 GPIO_ACTIVE_LOW>;
                lltc,fault-gpios = <&gpio0 64 GPIO_ACTIVE_LOW>;
                lltc,chrg-gpios = <&gpio0 63 GPIO_ACTIVE_LOW>;
diff --git a/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt b/Documentation/devicetree/bindings/power/supply/microchip,ucs1002.txt
new file mode 100644 (file)
index 0000000..1d284ad
--- /dev/null
@@ -0,0 +1,27 @@
+Microchip UCS1002 USB Port Power Controller
+
+Required properties:
+- compatible           : Should be "microchip,ucs1002";
+- reg                  : I2C slave address
+
+Optional properties:
+- interrupts           : A list of interrupts lines present (could be either
+                         corresponding to A_DET# pin, ALERT# pin, or both)
+- interrupt-names      : A list of interrupt names. Should contain (if
+                         present):
+                         - "a_det" for line connected to A_DET# pin
+                         - "alert" for line connected to ALERT# pin
+                         Both are expected to be IRQ_TYPE_EDGE_BOTH
+Example:
+
+&i2c3 {
+       charger@32 {
+               compatible = "microchip,ucs1002";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ucs1002_pins>;
+               reg = <0x32>;
+               interrupts-extended = <&gpio5 2 IRQ_TYPE_EDGE_BOTH>,
+                                     <&gpio3 21 IRQ_TYPE_EDGE_BOTH>;
+               interrupt-names = "a_det", "alert";
+       };
+};
index c8901b3..8d87d6b 100644 (file)
@@ -2,4 +2,4 @@ OLPC battery
 ~~~~~~~~~~~~
 
 Required properties:
-  - compatible : "olpc,xo1-battery"
+  - compatible : "olpc,xo1-battery" or "olpc,xo1.5-battery"
index 3683874..9012a2a 100644 (file)
@@ -7,6 +7,10 @@ Required properties:
 - compatible: should be "pps-gpio"
 - gpios: one PPS GPIO in the format described by ../gpio/gpio.txt
 
+Additional required properties for the PPS ECHO functionality:
+- echo-gpios: one PPS ECHO GPIO in the format described by ../gpio/gpio.txt
+- echo-active-ms: duration in ms of the active portion of the echo pulse
+
 Optional properties:
 - assert-falling-edge: when present, assert is indicated by a falling edge
                        (instead of by a rising edge)
@@ -19,5 +23,8 @@ Example:
                gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
                assert-falling-edge;
 
+               echo-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
+               echo-active-ms = <100>;
+
                compatible = "pps-gpio";
        };
index 2bf3344..2df4bdd 100644 (file)
@@ -5,11 +5,12 @@ Please also refer to reset.txt in this directory for common reset
 controller binding usage.
 
 The reset controller registers are part of the system-ctl block on
-hi3660 SoC.
+hi3660 and hi3670 SoCs.
 
 Required properties:
-- compatible: should be
-                "hisilicon,hi3660-reset"
+- compatible: should be one of the following:
+                "hisilicon,hi3660-reset" for HI3660
+                "hisilicon,hi3670-reset", "hisilicon,hi3660-reset" for HI3670
 - hisi,rst-syscon: phandle of the reset's syscon.
 - #reset-cells : Specifies the number of cells needed to encode a
   reset source.  The type shall be a <u32> and the value shall be 2.
diff --git a/Documentation/devicetree/bindings/riscv/sifive-l2-cache.txt b/Documentation/devicetree/bindings/riscv/sifive-l2-cache.txt
new file mode 100644 (file)
index 0000000..73d8f19
--- /dev/null
@@ -0,0 +1,51 @@
+SiFive L2 Cache Controller
+--------------------------
+The SiFive Level 2 Cache Controller is used to provide access to fast copies
+of memory for masters in a Core Complex. The Level 2 Cache Controller also
+acts as directory-based coherency manager.
+All the properties in ePAPR/DeviceTree specification applies for this platform
+
+Required Properties:
+--------------------
+- compatible: Should be "sifive,fu540-c000-ccache" and "cache"
+
+- cache-block-size: Specifies the block size in bytes of the cache.
+  Should be 64
+
+- cache-level: Should be set to 2 for a level 2 cache
+
+- cache-sets: Specifies the number of associativity sets of the cache.
+  Should be 1024
+
+- cache-size: Specifies the size in bytes of the cache. Should be 2097152
+
+- cache-unified: Specifies the cache is a unified cache
+
+- interrupts: Must contain 3 entries (DirError, DataError and DataFail signals)
+
+- reg: Physical base address and size of L2 cache controller registers map
+
+Optional Properties:
+--------------------
+- next-level-cache: phandle to the next level cache if present.
+
+- memory-region: reference to the reserved-memory for the L2 Loosely Integrated
+  Memory region. The reserved memory node should be defined as per the bindings
+  in reserved-memory.txt
+
+
+Example:
+
+       cache-controller@2010000 {
+               compatible = "sifive,fu540-c000-ccache", "cache";
+               cache-block-size = <64>;
+               cache-level = <2>;
+               cache-sets = <1024>;
+               cache-size = <2097152>;
+               cache-unified;
+               interrupt-parent = <&plic0>;
+               interrupts = <1 2 3>;
+               reg = <0x0 0x2010000 0x0 0x1000>;
+               next-level-cache = <&L25 &L40 &L36>;
+               memory-region = <&l2_lim>;
+       };
index bcfb131..c6b5262 100644 (file)
@@ -1,4 +1,4 @@
-* Mediatek Universal Asynchronous Receiver/Transmitter (UART)
+* MediaTek Universal Asynchronous Receiver/Transmitter (UART)
 
 Required properties:
 - compatible should contain:
@@ -13,10 +13,12 @@ Required properties:
   * "mediatek,mt6797-uart" for MT6797 compatible UARTS
   * "mediatek,mt7622-uart" for MT7622 compatible UARTS
   * "mediatek,mt7623-uart" for MT7623 compatible UARTS
+  * "mediatek,mt7629-uart" for MT7629 compatible UARTS
   * "mediatek,mt8127-uart" for MT8127 compatible UARTS
   * "mediatek,mt8135-uart" for MT8135 compatible UARTS
   * "mediatek,mt8173-uart" for MT8173 compatible UARTS
   * "mediatek,mt8183-uart", "mediatek,mt6577-uart" for MT8183 compatible UARTS
+  * "mediatek,mt8516-uart" for MT8516 compatible UARTS
   * "mediatek,mt6577-uart" for MT6577 and all of the above
 
 - reg: The base address of the UART register bank.
index 5a2ef17..7a32404 100644 (file)
@@ -25,6 +25,7 @@ Required properties in pwrap device node.
        "mediatek,mt8135-pwrap" for MT8135 SoCs
        "mediatek,mt8173-pwrap" for MT8173 SoCs
        "mediatek,mt8183-pwrap" for MT8183 SoCs
+       "mediatek,mt8516-pwrap" for MT8516 SoCs
 - interrupts: IRQ for pwrap in SOC
 - reg-names: Must include the following entries:
   "pwrap": Main registers base
index d6fe16f..876693a 100644 (file)
@@ -23,6 +23,7 @@ Required properties:
        - "mediatek,mt7622-scpsys"
        - "mediatek,mt7623-scpsys", "mediatek,mt2701-scpsys": For MT7623 SoC
        - "mediatek,mt7623a-scpsys": For MT7623A SoC
+       - "mediatek,mt7629-scpsys", "mediatek,mt7622-scpsys": For MT7629 SoC
        - "mediatek,mt8173-scpsys"
 - #power-domain-cells: Must be 1
 - reg: Address range of the SCPSYS unit
@@ -33,8 +34,8 @@ Required properties:
        Required clocks for MT2701 or MT7623: "mm", "mfg", "ethif"
        Required clocks for MT2712: "mm", "mfg", "venc", "jpgdec", "audio", "vdec"
        Required clocks for MT6797: "mm", "mfg", "vdec"
-       Required clocks for MT7622: "hif_sel"
-       Required clocks for MT7622A: "ethif"
+       Required clocks for MT7622 or MT7629: "hif_sel"
+       Required clocks for MT7623A: "ethif"
        Required clocks for MT8173: "mm", "mfg", "venc", "venc_lt"
 
 Optional properties:
diff --git a/Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt b/Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
new file mode 100644 (file)
index 0000000..703979d
--- /dev/null
@@ -0,0 +1,33 @@
+Amazon's Annapurna Labs Thermal Sensor
+
+Simple thermal device that allows temperature reading by a single MMIO
+transaction.
+
+Required properties:
+- compatible: "amazon,al-thermal".
+- reg: The physical base address and length of the sensor's registers.
+- #thermal-sensor-cells: Must be 1. See ./thermal.txt for a description.
+
+Example:
+       thermal: thermal {
+               compatible = "amazon,al-thermal";
+               reg = <0x0 0x05002860 0x0 0x1>;
+               #thermal-sensor-cells = <0x1>;
+       };
+
+       thermal-zones {
+               thermal-z0 {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+                       thermal-sensors = <&thermal 0>;
+                       trips {
+                               critical {
+                                       temperature = <105000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+               };
+       };
+
index b6c0ae5..f02f385 100644 (file)
@@ -52,13 +52,47 @@ Required properties :
         Must set as following values:
         TEGRA_SOCTHERM_THROT_LEVEL_LOW, TEGRA_SOCTHERM_THROT_LEVEL_MED
         TEGRA_SOCTHERM_THROT_LEVEL_HIGH, TEGRA_SOCTHERM_THROT_LEVEL_NONE
+      - nvidia,gpu-throt-level: This property is for Tegra124 and Tegra210.
+        It is the level of pulse skippers, which used to throttle clock
+        frequencies. It indicates gpu clock throttling depth and can be
+        programmed to any of the following values which represent a throttling
+        percentage:
+        TEGRA_SOCTHERM_THROT_LEVEL_NONE (0%)
+        TEGRA_SOCTHERM_THROT_LEVEL_LOW (50%),
+        TEGRA_SOCTHERM_THROT_LEVEL_MED (75%),
+        TEGRA_SOCTHERM_THROT_LEVEL_HIGH (85%).
       - #cooling-cells: Should be 1. This cooling device only support on/off state.
         See ./thermal.txt for a description of this property.
 
+      Optional properties: The following properties are T210 specific and
+      valid only for OCx throttle events.
+      - nvidia,count-threshold: Specifies the number of OC events that are
+        required for triggering an interrupt. Interrupts are not triggered if
+        the property is missing. A value of 0 will interrupt on every OC alarm.
+      - nvidia,polarity-active-low: Configures the polarity of the OC alaram
+        signal. If present, this means assert low, otherwise assert high.
+      - nvidia,alarm-filter: Number of clocks to filter event. When the filter
+        expires (which means the OC event has not occurred for a long time),
+        the counter is cleared and filter is rearmed. Default value is 0.
+      - nvidia,throttle-period-us: Specifies the number of uSec for which
+        throttling is engaged after the OC event is deasserted. Default value
+        is 0.
+
+Optional properties:
+- nvidia,thermtrips : When present, this property specifies the temperature at
+  which the soctherm hardware will assert the thermal trigger signal to the
+  Power Management IC, which can be configured to reset or shutdown the device.
+  It is an array of pairs where each pair represents a tsensor id followed by a
+  temperature in milli Celcius. In the absence of this property the critical
+  trip point will be used for thermtrip temperature.
+
 Note:
-- the "critical" type trip points will be set to SOC_THERM hardware as the
-shut down temperature. Once the temperature of this thermal zone is higher
-than it, the system will be shutdown or reset by hardware.
+- the "critical" type trip points will be used to set the temperature at which
+the SOC_THERM hardware will assert a thermal trigger if the "nvidia,thermtrips"
+property is missing. When the thermtrips property is present, the breach of a
+critical trip point is reported back to the thermal framework to implement
+software shutdown.
+
 - the "hot" type trip points will be set to SOC_THERM hardware as the throttle
 temperature. Once the the temperature of this thermal zone is higher
 than it, it will trigger the HW throttle event.
@@ -79,25 +113,32 @@ Example :
 
                #thermal-sensor-cells = <1>;
 
+               nvidia,thermtrips = <TEGRA124_SOCTHERM_SENSOR_CPU 102500
+                                    TEGRA124_SOCTHERM_SENSOR_GPU 103000>;
+
                throttle-cfgs {
                        /*
                         * When the "heavy" cooling device triggered,
-                        * the HW will skip cpu clock's pulse in 85% depth
+                        * the HW will skip cpu clock's pulse in 85% depth,
+                        * skip gpu clock's pulse in 85% level
                         */
                        throttle_heavy: heavy {
                                nvidia,priority = <100>;
                                nvidia,cpu-throt-percent = <85>;
+                               nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
 
                                #cooling-cells = <1>;
                        };
 
                        /*
                         * When the "light" cooling device triggered,
-                        * the HW will skip cpu clock's pulse in 50% depth
+                        * the HW will skip cpu clock's pulse in 50% depth,
+                        * skip gpu clock's pulse in 50% level
                         */
                        throttle_light: light {
                                nvidia,priority = <80>;
                                nvidia,cpu-throt-percent = <50>;
+                               nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_LOW>;
 
                                #cooling-cells = <1>;
                        };
@@ -107,6 +148,17 @@ Example :
                         * arbiter will select the highest priority as the final throttle
                         * settings to skip cpu pulse.
                         */
+
+                       throttle_oc1: oc1 {
+                               nvidia,priority = <50>;
+                               nvidia,polarity-active-low;
+                               nvidia,count-threshold = <100>;
+                               nvidia,alarm-filter = <5100000>;
+                               nvidia,throttle-period-us = <0>;
+                               nvidia,cpu-throt-percent = <75>;
+                               nvidia,gpu-throt-level =
+                                               <TEGRA_SOCTHERM_THROT_LEVEL_MED>;
+                        };
                };
        };
 
index 1d9e8cf..673cc18 100644 (file)
@@ -6,11 +6,14 @@ Required properties:
     - "qcom,msm8916-tsens" (MSM8916)
     - "qcom,msm8974-tsens" (MSM8974)
     - "qcom,msm8996-tsens" (MSM8996)
+    - "qcom,qcs404-tsens", "qcom,tsens-v1" (QCS404)
     - "qcom,msm8998-tsens", "qcom,tsens-v2" (MSM8998)
     - "qcom,sdm845-tsens", "qcom,tsens-v2" (SDM845)
   The generic "qcom,tsens-v2" property must be used as a fallback for any SoC
   with version 2 of the TSENS IP. MSM8996 is the only exception because the
   generic property did not exist when support was added.
+  Similarly, the generic "qcom,tsens-v1" property must be used as a fallback for
+  any SoC with version 1 of the TSENS IP.
 
 - reg: Address range of the thermal registers.
   New platforms containing v2.x.y of the TSENS IP must specify the SROT and TM
@@ -39,3 +42,14 @@ tsens0: thermal-sensor@c263000 {
                #qcom,sensors = <13>;
                #thermal-sensor-cells = <1>;
        };
+
+Example 3 (for any platform containing v1 of the TSENS IP):
+tsens: thermal-sensor@4a9000 {
+               compatible = "qcom,qcs404-tsens", "qcom,tsens-v1";
+               reg = <0x004a9000 0x1000>, /* TM */
+                     <0x004a8000 0x1000>; /* SROT */
+               nvmem-cells = <&tsens_caldata>;
+               nvmem-cell-names = "calib";
+               #qcom,sensors = <10>;
+               #thermal-sensor-cells = <1>;
+       };
index 43d744e..c6aac9b 100644 (file)
@@ -2,6 +2,7 @@
 
 Required properties:
 - compatible : should be "rockchip,<name>-tsadc"
+   "rockchip,px30-tsadc":   found on PX30 SoCs
    "rockchip,rv1108-tsadc": found on RV1108 SoCs
    "rockchip,rk3228-tsadc": found on RK3228 SoCs
    "rockchip,rk3288-tsadc": found on RK3288 SoCs
index d723555..691a09d 100644 (file)
@@ -8,16 +8,22 @@ temperature using voltage-temperature lookup table.
 Required properties:
 ===================
 - compatible:               Must be "generic-adc-thermal".
+- #thermal-sensor-cells:     Should be 1. See ./thermal.txt for a description
+                            of this property.
+Optional properties:
+===================
 - temperature-lookup-table:  Two dimensional array of Integer; lookup table
                             to map the relation between ADC value and
                             temperature. When ADC is read, the value is
                             looked up on the table to get the equivalent
                             temperature.
+
                             The first value of the each row of array is the
                             temperature in milliCelsius and second value of
                             the each row of array is the ADC read value.
-- #thermal-sensor-cells:     Should be 1. See ./thermal.txt for a description
-                            of this property.
+
+                            If not specified, driver assumes the ADC channel
+                            gives milliCelsius directly.
 
 Example :
 #include <dt-bindings/thermal/thermal.h>
index 5c2e235..3da9d51 100644 (file)
@@ -2,7 +2,9 @@ Allwinner A1X SoCs Timer Controller
 
 Required properties:
 
-- compatible : should be "allwinner,sun4i-a10-timer"
+- compatible : should be one of the following:
+              "allwinner,sun4i-a10-timer"
+              "allwinner,suniv-f1c100s-timer"
 - reg : Specifies base physical address and size of the registers.
 - interrupts : The interrupt of the first timer
 - clocks: phandle to the source clock (usually a 24 MHz fixed clock)
diff --git a/Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml b/Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
new file mode 100644 (file)
index 0000000..a36a074
--- /dev/null
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2018 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/timer/intel-ixp4xx-timer.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx XScale Networking Processors Timers
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: This timer is found in the Intel IXP4xx processors.
+
+properties:
+  compatible:
+    items:
+      - const: intel,ixp4xx-timer
+
+  reg:
+    description: Should contain registers location and length
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Timer 1 interrupt
+      - description: Timer 2 interrupt
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    timer@c8005000 {
+        compatible = "intel,ixp4xx-timer";
+        reg = <0xc8005000 0x100>;
+        interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+    };
index ff7c567..74c3ead 100644 (file)
@@ -17,6 +17,7 @@ Required properties:
        * "mediatek,mt8127-timer" for MT8127 compatible timers (GPT)
        * "mediatek,mt8135-timer" for MT8135 compatible timers (GPT)
        * "mediatek,mt8173-timer" for MT8173 compatible timers (GPT)
+       * "mediatek,mt8516-timer" for MT8516 compatible timers (GPT)
        * "mediatek,mt6577-timer" for MT6577 and all above compatible timers (GPT)
 
        For those SoCs that use SYST
index 56bccde..a747204 100644 (file)
@@ -11,6 +11,7 @@ Required properties:
                          the appropriate jedec string:
                            "qcom,msm8994-ufshc", "qcom,ufshc", "jedec,ufs-2.0"
                            "qcom,msm8996-ufshc", "qcom,ufshc", "jedec,ufs-2.0"
+                           "qcom,msm8998-ufshc", "qcom,ufshc", "jedec,ufs-2.0"
                            "qcom,sdm845-ufshc", "qcom,ufshc", "jedec,ufs-2.0"
 - interrupts        : <interrupt mapping for UFS host controller IRQ>
 - reg               : <registers mapping>
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
deleted file mode 100644 (file)
index e0e2160..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-Device tree binding vendor prefix registry.  Keep list in alphabetical order.
-
-This isn't an exhaustive list, but you should add new prefixes to it before
-using them to avoid name-space collisions.
-
-abilis Abilis Systems
-abracon        Abracon Corporation
-actions        Actions Semiconductor Co., Ltd.
-active-semi    Active-Semi International Inc
-ad     Avionic Design GmbH
-adafruit       Adafruit Industries, LLC
-adapteva       Adapteva, Inc.
-adaptrum       Adaptrum, Inc.
-adh    AD Holdings Plc.
-adi    Analog Devices, Inc.
-advantech      Advantech Corporation
-aeroflexgaisler        Aeroflex Gaisler AB
-al     Annapurna Labs
-allo   Allo.com
-allwinner      Allwinner Technology Co., Ltd.
-alphascale     AlphaScale Integrated Circuits Systems, Inc.
-altr   Altera Corp.
-amarula        Amarula Solutions
-amazon Amazon.com, Inc.
-amcc   Applied Micro Circuits Corporation (APM, formally AMCC)
-amd    Advanced Micro Devices (AMD), Inc.
-amediatech     Shenzhen Amediatech Technology Co., Ltd
-amlogic        Amlogic, Inc.
-ampire Ampire Co., Ltd.
-ams    AMS AG
-amstaos        AMS-Taos Inc.
-analogix       Analogix Semiconductor, Inc.
-andestech      Andes Technology Corporation
-apm    Applied Micro Circuits Corporation (APM)
-aptina Aptina Imaging
-arasan Arasan Chip Systems
-archermind ArcherMind Technology (Nanjing) Co., Ltd.
-arctic Arctic Sand
-arcx   arcx Inc. / Archronix Inc.
-aries  Aries Embedded GmbH
-arm    ARM Ltd.
-armadeus       ARMadeus Systems SARL
-arrow  Arrow Electronics
-artesyn        Artesyn Embedded Technologies Inc.
-asahi-kasei    Asahi Kasei Corp.
-aspeed ASPEED Technology Inc.
-asus   AsusTek Computer Inc.
-atlas  Atlas Scientific LLC
-atmel  Atmel Corporation
-auo    AU Optronics Corporation
-auvidea Auvidea GmbH
-avago  Avago Technologies
-avia   avia semiconductor
-avic   Shanghai AVIC Optoelectronics Co., Ltd.
-avnet  Avnet, Inc.
-axentia        Axentia Technologies AB
-axis   Axis Communications AB
-azoteq Azoteq (Pty) Ltd
-bananapi BIPAI KEJI LIMITED
-bhf    Beckhoff Automation GmbH & Co. KG
-bitmain        Bitmain Technologies
-boe    BOE Technology Group Co., Ltd.
-bosch  Bosch Sensortec GmbH
-boundary       Boundary Devices Inc.
-brcm   Broadcom Corporation
-buffalo        Buffalo, Inc.
-bticino Bticino International
-calxeda        Calxeda
-capella        Capella Microsystems, Inc
-cascoda        Cascoda, Ltd.
-catalyst       Catalyst Semiconductor, Inc.
-cavium Cavium, Inc.
-cdns   Cadence Design Systems Inc.
-cdtech CDTech(H.K.) Electronics Limited
-ceva   Ceva, Inc.
-chipidea       Chipidea, Inc
-chipone                ChipOne
-chipspark      ChipSPARK
-chrp   Common Hardware Reference Platform
-chunghwa       Chunghwa Picture Tubes Ltd.
-ciaa   Computadora Industrial Abierta Argentina
-cirrus Cirrus Logic, Inc.
-cloudengines   Cloud Engines, Inc.
-cnm    Chips&Media, Inc.
-cnxt   Conexant Systems, Inc.
-compulab       CompuLab Ltd.
-cortina        Cortina Systems, Inc.
-cosmic Cosmic Circuits
-crane  Crane Connectivity Solutions
-creative       Creative Technology Ltd
-crystalfontz   Crystalfontz America, Inc.
-csky   Hangzhou C-SKY Microsystems Co., Ltd
-cubietech      Cubietech, Ltd.
-cypress        Cypress Semiconductor Corporation
-cznic  CZ.NIC, z.s.p.o.
-dallas Maxim Integrated Products (formerly Dallas Semiconductor)
-dataimage      DataImage, Inc.
-davicom        DAVICOM Semiconductor, Inc.
-delta  Delta Electronics, Inc.
-denx   Denx Software Engineering
-devantech      Devantech, Ltd.
-dh     DH electronics GmbH
-digi   Digi International Inc.
-digilent       Diglent, Inc.
-dioo   Dioo Microcircuit Co., Ltd
-dlc    DLC Display Co., Ltd.
-dlg    Dialog Semiconductor
-dlink  D-Link Corporation
-dmo    Data Modul AG
-domintech      Domintech Co., Ltd.
-dongwoon       Dongwoon Anatech
-dptechnics     DPTechnics
-dragino        Dragino Technology Co., Limited
-ea     Embedded Artists AB
-ebs-systart EBS-SYSTART GmbH
-ebv    EBV Elektronik
-eckelmann      Eckelmann AG
-edt    Emerging Display Technologies
-eeti   eGalax_eMPIA Technology Inc
-elan   Elan Microelectronic Corp.
-elgin  Elgin S/A.
-embest Shenzhen Embest Technology Co., Ltd.
-emlid  Emlid, Ltd.
-emmicro        EM Microelectronic
-emtrion        emtrion GmbH
-endless        Endless Mobile, Inc.
-energymicro    Silicon Laboratories (formerly Energy Micro AS)
-engicam        Engicam S.r.l.
-epcos  EPCOS AG
-epfl   Ecole Polytechnique Fédérale de Lausanne
-epson  Seiko Epson Corp.
-est    ESTeem Wireless Modems
-ettus  NI Ettus Research
-eukrea  Eukréa Electromatique
-everest        Everest Semiconductor Co. Ltd.
-everspin       Everspin Technologies, Inc.
-exar   Exar Corporation
-excito Excito
-ezchip EZchip Semiconductor
-facebook       Facebook
-fairphone      Fairphone B.V.
-faraday        Faraday Technology Corporation
-fastrax        Fastrax Oy
-fcs    Fairchild Semiconductor
-feiyang        Shenzhen Fly Young Technology Co.,LTD.
-firefly        Firefly
-focaltech      FocalTech Systems Co.,Ltd
-friendlyarm    Guangzhou FriendlyARM Computer Tech Co., Ltd
-fsl    Freescale Semiconductor
-fujitsu        Fujitsu Ltd.
-gateworks      Gateworks Corporation
-gcw Game Consoles Worldwide
-ge     General Electric Company
-geekbuying     GeekBuying
-gef    GE Fanuc Intelligent Platforms Embedded Systems, Inc.
-GEFanuc        GE Fanuc Intelligent Platforms Embedded Systems, Inc.
-geniatech      Geniatech, Inc.
-giantec        Giantec Semiconductor, Inc.
-giantplus      Giantplus Technology Co., Ltd.
-globalscale    Globalscale Technologies, Inc.
-globaltop      GlobalTop Technology, Inc.
-gmt    Global Mixed-mode Technology, Inc.
-goodix Shenzhen Huiding Technology Co., Ltd.
-google Google, Inc.
-grinn  Grinn
-grmn   Garmin Limited
-gumstix        Gumstix, Inc.
-gw     Gateworks Corporation
-hannstar       HannStar Display Corporation
-haoyu  Haoyu Microelectronic Co. Ltd.
-hardkernel     Hardkernel Co., Ltd
-hideep HiDeep Inc.
-himax  Himax Technologies, Inc.
-hisilicon      Hisilicon Limited.
-hit    Hitachi Ltd.
-hitex  Hitex Development Tools
-holt   Holt Integrated Circuits, Inc.
-honeywell      Honeywell
-hp     Hewlett Packard
-holtek Holtek Semiconductor, Inc.
-hwacom HwaCom Systems Inc.
-i2se   I2SE GmbH
-ibm    International Business Machines (IBM)
-icplus IC Plus Corp.
-idt    Integrated Device Technologies, Inc.
-ifi    Ingenieurburo Fur Ic-Technologie (I/F/I)
-ilitek ILI Technology Corporation (ILITEK)
-img    Imagination Technologies Ltd.
-infineon Infineon Technologies
-inforce        Inforce Computing
-ingenic        Ingenic Semiconductor
-innolux        Innolux Corporation
-inside-secure  INSIDE Secure
-intel  Intel Corporation
-intercontrol   Inter Control Group
-invensense     InvenSense Inc.
-inversepath    Inverse Path
-iom    Iomega Corporation
-isee   ISEE 2007 S.L.
-isil   Intersil
-issi   Integrated Silicon Solutions Inc.
-itead  ITEAD Intelligent Systems Co.Ltd
-iwave  iWave Systems Technologies Pvt. Ltd.
-jdi    Japan Display Inc.
-jedec  JEDEC Solid State Technology Association
-jianda Jiandangjing Technology Co., Ltd.
-karo   Ka-Ro electronics GmbH
-keithkoep      Keith & Koep GmbH
-keymile        Keymile GmbH
-khadas Khadas
-kiebackpeter    Kieback & Peter GmbH
-kinetic Kinetic Technologies
-kingdisplay    King & Display Technology Co., Ltd.
-kingnovel      Kingnovel Technology Co., Ltd.
-kionix Kionix, Inc.
-koe    Kaohsiung Opto-Electronics Inc.
-kosagi Sutajio Ko-Usagi PTE Ltd.
-kyo    Kyocera Corporation
-lacie  LaCie
-laird  Laird PLC
-lantiq Lantiq Semiconductor
-lattice        Lattice Semiconductor
-lego   LEGO Systems A/S
-lemaker        Shenzhen LeMaker Technology Co., Ltd.
-lenovo Lenovo Group Ltd.
-lg     LG Corporation
-libretech      Shenzhen Libre Technology Co., Ltd
-licheepi       Lichee Pi
-linaro Linaro Limited
-linksys        Belkin International, Inc. (Linksys)
-linux  Linux-specific binding
-linx   Linx Technologies
-lltc   Linear Technology Corporation
-logicpd        Logic PD, Inc.
-lsi    LSI Corp. (LSI Logic)
-lwn    Liebherr-Werk Nenzing GmbH
-macnica        Macnica Americas
-marvell        Marvell Technology Group Ltd.
-maxbotix       MaxBotix Inc.
-maxim  Maxim Integrated Products
-mbvl   Mobiveil Inc.
-mcube  mCube
-meas   Measurement Specialties
-mediatek       MediaTek Inc.
-megachips      MegaChips
-mele   Shenzhen MeLE Digital Technology Ltd.
-melexis        Melexis N.V.
-melfas MELFAS Inc.
-mellanox       Mellanox Technologies
-memsic MEMSIC Inc.
-merrii Merrii Technology Co., Ltd.
-micrel Micrel Inc.
-microchip      Microchip Technology Inc.
-microcrystal   Micro Crystal AG
-micron Micron Technology Inc.
-mikroe         MikroElektronika d.o.o.
-minix  MINIX Technology Ltd.
-miramems       MiraMEMS Sensing Technology Co., Ltd.
-mitsubishi     Mitsubishi Electric Corporation
-mosaixtech     Mosaix Technologies, Inc.
-motorola       Motorola, Inc.
-moxa   Moxa Inc.
-mpl    MPL AG
-mqmaker        mqmaker Inc.
-mscc   Microsemi Corporation
-msi    Micro-Star International Co. Ltd.
-mti    Imagination Technologies Ltd. (formerly MIPS Technologies Inc.)
-multi-inno     Multi-Inno Technology Co.,Ltd
-mundoreader    Mundo Reader S.L.
-murata Murata Manufacturing Co., Ltd.
-mxicy  Macronix International Co., Ltd.
-myir   MYIR Tech Limited
-national       National Semiconductor
-nec    NEC LCD Technologies, Ltd.
-neonode                Neonode Inc.
-netgear        NETGEAR
-netlogic       Broadcom Corporation (formerly NetLogic Microsystems)
-netron-dy      Netron DY
-netxeon                Shenzhen Netxeon Technology CO., LTD
-nexbox Nexbox
-nextthing      Next Thing Co.
-newhaven       Newhaven Display International
-ni     National Instruments
-nintendo       Nintendo
-nlt    NLT Technologies, Ltd.
-nokia  Nokia
-nordic Nordic Semiconductor
-novtech NovTech, Inc.
-nutsboard      NutsBoard
-nuvoton        Nuvoton Technology Corporation
-nvd    New Vision Display
-nvidia NVIDIA
-nxp    NXP Semiconductors
-okaya  Okaya Electric America, Inc.
-oki    Oki Electric Industry Co., Ltd.
-olimex OLIMEX Ltd.
-olpc   One Laptop Per Child
-onion  Onion Corporation
-onnn   ON Semiconductor Corp.
-ontat  On Tat Industrial Company
-opalkelly      Opal Kelly Incorporated
-opencores      OpenCores.org
-openrisc       OpenRISC.io
-option Option NV
-oranth Shenzhen Oranth Technology Co., Ltd.
-ORCL   Oracle Corporation
-orisetech      Orise Technology
-ortustech      Ortus Technology Co., Ltd.
-osddisplays    OSD Displays
-ovti   OmniVision Technologies
-oxsemi Oxford Semiconductor, Ltd.
-panasonic      Panasonic Corporation
-parade Parade Technologies Inc.
-pda    Precision Design Associates, Inc.
-pericom        Pericom Technology Inc.
-pervasive      Pervasive Displays, Inc.
-phicomm PHICOMM Co., Ltd.
-phytec PHYTEC Messtechnik GmbH
-picochip       Picochip Ltd
-pine64 Pine64
-pixcir  PIXCIR MICROELECTRONICS Co., Ltd
-plantower Plantower Co., Ltd
-plathome       Plat'Home Co., Ltd.
-plda   PLDA
-plx    Broadcom Corporation (formerly PLX Technology)
-pni    PNI Sensor Corporation
-portwell       Portwell Inc.
-poslab Poslab Technology Co., Ltd.
-powervr        PowerVR (deprecated, use img)
-probox2        PROBOX2 (by W2COMP Co., Ltd.)
-pulsedlight    PulsedLight, Inc
-qca    Qualcomm Atheros, Inc.
-qcom   Qualcomm Technologies, Inc
-qemu   QEMU, a generic and open source machine emulator and virtualizer
-qi     Qi Hardware
-qiaodian       QiaoDian XianShi Corporation
-qnap   QNAP Systems, Inc.
-radxa  Radxa
-raidsonic      RaidSonic Technology GmbH
-ralink Mediatek/Ralink Technology Corp.
-ramtron        Ramtron International
-raspberrypi    Raspberry Pi Foundation
-raydium        Raydium Semiconductor Corp.
-rda    Unisoc Communications, Inc.
-realtek Realtek Semiconductor Corp.
-renesas        Renesas Electronics Corporation
-richtek        Richtek Technology Corporation
-ricoh  Ricoh Co. Ltd.
-rikomagic      Rikomagic Tech Corp. Ltd
-riscv  RISC-V Foundation
-rockchip       Fuzhou Rockchip Electronics Co., Ltd
-rocktech       ROCKTECH DISPLAYS LIMITED
-rohm   ROHM Semiconductor Co., Ltd
-ronbo   Ronbo Electronics
-roofull        Shenzhen Roofull Technology Co, Ltd
-samsung        Samsung Semiconductor
-samtec Samtec/Softing company
-sancloud       Sancloud Ltd
-sandisk        Sandisk Corporation
-sbs    Smart Battery System
-schindler      Schindler
-seagate        Seagate Technology PLC
-semtech        Semtech Corporation
-sensirion      Sensirion AG
-sff    Small Form Factor Committee
-sgd    Solomon Goldentek Display Corporation
-sgx    SGX Sensortech
-sharp  Sharp Corporation
-shimafuji      Shimafuji Electric, Inc.
-si-en  Si-En Technology Ltd.
-sifive SiFive, Inc.
-sigma  Sigma Designs, Inc.
-sii    Seiko Instruments, Inc.
-sil    Silicon Image
-silabs Silicon Laboratories
-silead Silead Inc.
-silergy        Silergy Corp.
-siliconmitus   Silicon Mitus, Inc.
-simtek
-sirf   SiRF Technology, Inc.
-sis    Silicon Integrated Systems Corp.
-sitronix       Sitronix Technology Corporation
-skyworks       Skyworks Solutions, Inc.
-smsc   Standard Microsystems Corporation
-snps   Synopsys, Inc.
-socionext      Socionext Inc.
-solidrun       SolidRun
-solomon        Solomon Systech Limited
-sony   Sony Corporation
-spansion       Spansion Inc.
-sprd   Spreadtrum Communications Inc.
-sst    Silicon Storage Technology, Inc.
-st     STMicroelectronics
-starry Starry Electronic Technology (ShenZhen) Co., LTD
-startek        Startek
-ste    ST-Ericsson
-stericsson     ST-Ericsson
-summit Summit microelectronics
-sunchip        Shenzhen Sunchip Technology Co., Ltd
-SUNW   Sun Microsystems, Inc
-swir   Sierra Wireless
-syna   Synaptics Inc.
-synology       Synology, Inc.
-tbs    TBS Technologies
-tbs-biometrics Touchless Biometric Systems AG
-tcg    Trusted Computing Group
-tcl    Toby Churchill Ltd.
-technexion     TechNexion
-technologic    Technologic Systems
-tempo  Tempo Semiconductor
-techstar       Shenzhen Techstar Electronics Co., Ltd.
-terasic        Terasic Inc.
-thine  THine Electronics, Inc.
-ti     Texas Instruments
-tianma Tianma Micro-electronics Co., Ltd.
-tlm    Trusted Logic Mobility
-tmt    Tecon Microprocessor Technologies, LLC.
-topeet  Topeet
-toradex        Toradex AG
-toshiba        Toshiba Corporation
-toumaz Toumaz
-tpk    TPK U.S.A. LLC
-tplink TP-LINK Technologies Co., Ltd.
-tpo    TPO
-tronfy Tronfy
-tronsmart      Tronsmart
-truly  Truly Semiconductors Limited
-tsd    Theobroma Systems Design und Consulting GmbH
-tyan   Tyan Computer Corporation
-u-blox u-blox
-ucrobotics     uCRobotics
-ubnt   Ubiquiti Networks
-udoo   Udoo
-uniwest        United Western Technologies Corp (UniWest)
-upisemi        uPI Semiconductor Corp.
-urt    United Radiant Technology Corporation
-usi    Universal Scientific Industrial Co., Ltd.
-v3     V3 Semiconductor
-vamrs  Vamrs Ltd.
-variscite      Variscite Ltd.
-via    VIA Technologies, Inc.
-virtio Virtual I/O Device Specification, developed by the OASIS consortium
-vishay Vishay Intertechnology, Inc
-vitesse        Vitesse Semiconductor Corporation
-vivante        Vivante Corporation
-vocore VoCore Studio
-voipac Voipac Technologies s.r.o.
-vot    Vision Optical Technology Co., Ltd.
-wd     Western Digital Corp.
-wetek  WeTek Electronics, limited.
-wexler Wexler
-whwave  Shenzhen whwave Electronics, Inc.
-wi2wi  Wi2Wi, Inc.
-winbond Winbond Electronics corp.
-winstar        Winstar Display Corp.
-wlf    Wolfson Microelectronics
-wm     Wondermedia Technologies, Inc.
-x-powers       X-Powers
-xes    Extreme Engineering Solutions (X-ES)
-xillybus       Xillybus Ltd.
-xlnx   Xilinx
-xunlong        Shenzhen Xunlong Software CO.,Limited
-ysoft  Y Soft Corporation a.s.
-zarlink        Zarlink Semiconductor
-zeitec ZEITEC Semiconductor Co., LTD.
-zidoo  Shenzhen Zidoo Technology Co., Ltd.
-zii    Zodiac Inflight Innovations
-zte    ZTE Corp.
-zyxel  ZyXEL Communications Corp.
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
new file mode 100644 (file)
index 0000000..33a65a4
--- /dev/null
@@ -0,0 +1,977 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/vendor-prefixes.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Devicetree Vendor Prefix Registry
+
+maintainers:
+  - Rob Herring <robh@kernel.org>
+
+select: true
+
+properties: {}
+
+patternProperties:
+  # Prefixes which are not vendors, but followed the pattern
+  # DO NOT ADD NEW PROPERTIES TO THIS LIST
+  "^(at25|devbus|dmacap|dsa|exynos|gpio-fan|gpio|gpmc|hdmi|i2c-gpio),.*": true
+  "^(keypad|m25p|max8952|max8997|max8998|mpmc),.*": true
+  "^(pinctrl-single|#pinctrl-single|PowerPC),.*": true
+  "^(pl022|pxa-mmc|rcar_sound|rotary-encoder|s5m8767|sdhci),.*": true
+  "^(simple-audio-card|simple-graph-card|st-plgpio|st-spics|ts),.*": true
+
+  # Keep list in alphabetical order.
+  "^abilis,.*":
+    description: Abilis Systems
+  "^abracon,.*":
+    description: Abracon Corporation
+  "^actions,.*":
+    description: Actions Semiconductor Co., Ltd.
+  "^active-semi,.*":
+    description: Active-Semi International Inc
+  "^ad,.*":
+    description: Avionic Design GmbH
+  "^adafruit,.*":
+    description: Adafruit Industries, LLC
+  "^adapteva,.*":
+    description: Adapteva, Inc.
+  "^adaptrum,.*":
+    description: Adaptrum, Inc.
+  "^adh,.*":
+    description: AD Holdings Plc.
+  "^adi,.*":
+    description: Analog Devices, Inc.
+  "^advantech,.*":
+    description: Advantech Corporation
+  "^aeroflexgaisler,.*":
+    description: Aeroflex Gaisler AB
+  "^al,.*":
+    description: Annapurna Labs
+  "^allo,.*":
+    description: Allo.com
+  "^allwinner,.*":
+    description: Allwinner Technology Co., Ltd.
+  "^alphascale,.*":
+    description: AlphaScale Integrated Circuits Systems, Inc.
+  "^altr,.*":
+    description: Altera Corp.
+  "^amarula,.*":
+    description: Amarula Solutions
+  "^amazon,.*":
+    description: Amazon.com, Inc.
+  "^amcc,.*":
+    description: Applied Micro Circuits Corporation (APM, formally AMCC)
+  "^amd,.*":
+    description: Advanced Micro Devices (AMD), Inc.
+  "^amediatech,.*":
+    description: Shenzhen Amediatech Technology Co., Ltd
+  "^amlogic,.*":
+    description: Amlogic, Inc.
+  "^ampire,.*":
+    description: Ampire Co., Ltd.
+  "^ams,.*":
+    description: AMS AG
+  "^amstaos,.*":
+    description: AMS-Taos Inc.
+  "^analogix,.*":
+    description: Analogix Semiconductor, Inc.
+  "^andestech,.*":
+    description: Andes Technology Corporation
+  "^apm,.*":
+    description: Applied Micro Circuits Corporation (APM)
+  "^aptina,.*":
+    description: Aptina Imaging
+  "^arasan,.*":
+    description: Arasan Chip Systems
+  "^archermind,.*":
+    description: ArcherMind Technology (Nanjing) Co., Ltd.
+  "^arctic,.*":
+    description: Arctic Sand
+  "^arcx,.*":
+    description: arcx Inc. / Archronix Inc.
+  "^aries,.*":
+    description: Aries Embedded GmbH
+  "^arm,.*":
+    description: ARM Ltd.
+  "^armadeus,.*":
+    description: ARMadeus Systems SARL
+  "^arrow,.*":
+    description: Arrow Electronics
+  "^artesyn,.*":
+    description: Artesyn Embedded Technologies Inc.
+  "^asahi-kasei,.*":
+    description: Asahi Kasei Corp.
+  "^aspeed,.*":
+    description: ASPEED Technology Inc.
+  "^asus,.*":
+    description: AsusTek Computer Inc.
+  "^atlas,.*":
+    description: Atlas Scientific LLC
+  "^atmel,.*":
+    description: Atmel Corporation
+  "^auo,.*":
+    description: AU Optronics Corporation
+  "^auvidea,.*":
+    description: Auvidea GmbH
+  "^avago,.*":
+    description: Avago Technologies
+  "^avia,.*":
+    description: avia semiconductor
+  "^avic,.*":
+    description: Shanghai AVIC Optoelectronics Co., Ltd.
+  "^avnet,.*":
+    description: Avnet, Inc.
+  "^axentia,.*":
+    description: Axentia Technologies AB
+  "^axis,.*":
+    description: Axis Communications AB
+  "^azoteq,.*":
+    description: Azoteq (Pty) Ltd
+  "^azw,.*":
+    description: Shenzhen AZW Technology Co., Ltd.
+  "^bananapi,.*":
+    description: BIPAI KEJI LIMITED
+  "^bhf,.*":
+    description: Beckhoff Automation GmbH & Co. KG
+  "^bitmain,.*":
+    description: Bitmain Technologies
+  "^boe,.*":
+    description: BOE Technology Group Co., Ltd.
+  "^bosch,.*":
+    description: Bosch Sensortec GmbH
+  "^boundary,.*":
+    description: Boundary Devices Inc.
+  "^brcm,.*":
+    description: Broadcom Corporation
+  "^buffalo,.*":
+    description: Buffalo, Inc.
+  "^bticino,.*":
+    description: Bticino International
+  "^calxeda,.*":
+    description: Calxeda
+  "^capella,.*":
+    description: Capella Microsystems, Inc
+  "^cascoda,.*":
+    description: Cascoda, Ltd.
+  "^catalyst,.*":
+    description: Catalyst Semiconductor, Inc.
+  "^cavium,.*":
+    description: Cavium, Inc.
+  "^cdns,.*":
+    description: Cadence Design Systems Inc.
+  "^cdtech,.*":
+    description: CDTech(H.K.) Electronics Limited
+  "^ceva,.*":
+    description: Ceva, Inc.
+  "^chipidea,.*":
+    description: Chipidea, Inc
+  "^chipone,.*":
+    description: ChipOne
+  "^chipspark,.*":
+    description: ChipSPARK
+  "^chrp,.*":
+    description: Common Hardware Reference Platform
+  "^chunghwa,.*":
+    description: Chunghwa Picture Tubes Ltd.
+  "^ciaa,.*":
+    description: Computadora Industrial Abierta Argentina
+  "^cirrus,.*":
+    description: Cirrus Logic, Inc.
+  "^cloudengines,.*":
+    description: Cloud Engines, Inc.
+  "^cnm,.*":
+    description: Chips&Media, Inc.
+  "^cnxt,.*":
+    description: Conexant Systems, Inc.
+  "^compulab,.*":
+    description: CompuLab Ltd.
+  "^cortina,.*":
+    description: Cortina Systems, Inc.
+  "^cosmic,.*":
+    description: Cosmic Circuits
+  "^crane,.*":
+    description: Crane Connectivity Solutions
+  "^creative,.*":
+    description: Creative Technology Ltd
+  "^crystalfontz,.*":
+    description: Crystalfontz America, Inc.
+  "^csky,.*":
+    description: Hangzhou C-SKY Microsystems Co., Ltd
+  "^cubietech,.*":
+    description: Cubietech, Ltd.
+  "^cypress,.*":
+    description: Cypress Semiconductor Corporation
+  "^cznic,.*":
+    description: CZ.NIC, z.s.p.o.
+  "^dallas,.*":
+    description: Maxim Integrated Products (formerly Dallas Semiconductor)
+  "^dataimage,.*":
+    description: DataImage, Inc.
+  "^davicom,.*":
+    description: DAVICOM Semiconductor, Inc.
+  "^delta,.*":
+    description: Delta Electronics, Inc.
+  "^denx,.*":
+    description: Denx Software Engineering
+  "^devantech,.*":
+    description: Devantech, Ltd.
+  "^dh,.*":
+    description: DH electronics GmbH
+  "^digi,.*":
+    description: Digi International Inc.
+  "^digilent,.*":
+    description: Diglent, Inc.
+  "^dioo,.*":
+    description: Dioo Microcircuit Co., Ltd
+  "^dlc,.*":
+    description: DLC Display Co., Ltd.
+  "^dlg,.*":
+    description: Dialog Semiconductor
+  "^dlink,.*":
+    description: D-Link Corporation
+  "^dmo,.*":
+    description: Data Modul AG
+  "^domintech,.*":
+    description: Domintech Co., Ltd.
+  "^dongwoon,.*":
+    description: Dongwoon Anatech
+  "^dptechnics,.*":
+    description: DPTechnics
+  "^dragino,.*":
+    description: Dragino Technology Co., Limited
+  "^ea,.*":
+    description: Embedded Artists AB
+  "^ebs-systart,.*":
+    description: EBS-SYSTART GmbH
+  "^ebv,.*":
+    description: EBV Elektronik
+  "^eckelmann,.*":
+    description: Eckelmann AG
+  "^edt,.*":
+    description: Emerging Display Technologies
+  "^eeti,.*":
+    description: eGalax_eMPIA Technology Inc
+  "^elan,.*":
+    description: Elan Microelectronic Corp.
+  "^elgin,.*":
+    description: Elgin S/A.
+  "^embest,.*":
+    description: Shenzhen Embest Technology Co., Ltd.
+  "^emlid,.*":
+    description: Emlid, Ltd.
+  "^emmicro,.*":
+    description: EM Microelectronic
+  "^emtrion,.*":
+    description: emtrion GmbH
+  "^endless,.*":
+    description: Endless Mobile, Inc.
+  "^energymicro,.*":
+    description: Silicon Laboratories (formerly Energy Micro AS)
+  "^engicam,.*":
+    description: Engicam S.r.l.
+  "^epcos,.*":
+    description: EPCOS AG
+  "^epfl,.*":
+    description: Ecole Polytechnique Fédérale de Lausanne
+  "^epson,.*":
+    description: Seiko Epson Corp.
+  "^est,.*":
+    description: ESTeem Wireless Modems
+  "^ettus,.*":
+    description: NI Ettus Research
+  "^eukrea,.*":
+    description: Eukréa Electromatique
+  "^everest,.*":
+    description: Everest Semiconductor Co. Ltd.
+  "^everspin,.*":
+    description: Everspin Technologies, Inc.
+  "^exar,.*":
+    description: Exar Corporation
+  "^excito,.*":
+    description: Excito
+  "^ezchip,.*":
+    description: EZchip Semiconductor
+  "^facebook,.*":
+    description: Facebook
+  "^fairphone,.*":
+    description: Fairphone B.V.
+  "^faraday,.*":
+    description: Faraday Technology Corporation
+  "^fastrax,.*":
+    description: Fastrax Oy
+  "^fcs,.*":
+    description: Fairchild Semiconductor
+  "^feiyang,.*":
+    description: Shenzhen Fly Young Technology Co.,LTD.
+  "^firefly,.*":
+    description: Firefly
+  "^focaltech,.*":
+    description: FocalTech Systems Co.,Ltd
+  "^friendlyarm,.*":
+    description: Guangzhou FriendlyARM Computer Tech Co., Ltd
+  "^fsl,.*":
+    description: Freescale Semiconductor
+  "^fujitsu,.*":
+    description: Fujitsu Ltd.
+  "^gateworks,.*":
+    description: Gateworks Corporation
+  "^gcw,.*":
+    description: Game Consoles Worldwide
+  "^ge,.*":
+    description: General Electric Company
+  "^geekbuying,.*":
+    description: GeekBuying
+  "^gef,.*":
+    description: GE Fanuc Intelligent Platforms Embedded Systems, Inc.
+  "^GEFanuc,.*":
+    description: GE Fanuc Intelligent Platforms Embedded Systems, Inc.
+  "^geniatech,.*":
+    description: Geniatech, Inc.
+  "^giantec,.*":
+    description: Giantec Semiconductor, Inc.
+  "^giantplus,.*":
+    description: Giantplus Technology Co., Ltd.
+  "^globalscale,.*":
+    description: Globalscale Technologies, Inc.
+  "^globaltop,.*":
+    description: GlobalTop Technology, Inc.
+  "^gmt,.*":
+    description: Global Mixed-mode Technology, Inc.
+  "^goodix,.*":
+    description: Shenzhen Huiding Technology Co., Ltd.
+  "^google,.*":
+    description: Google, Inc.
+  "^grinn,.*":
+    description: Grinn
+  "^grmn,.*":
+    description: Garmin Limited
+  "^gumstix,.*":
+    description: Gumstix, Inc.
+  "^gw,.*":
+    description: Gateworks Corporation
+  "^hannstar,.*":
+    description: HannStar Display Corporation
+  "^haoyu,.*":
+    description: Haoyu Microelectronic Co. Ltd.
+  "^hardkernel,.*":
+    description: Hardkernel Co., Ltd
+  "^hideep,.*":
+    description: HiDeep Inc.
+  "^himax,.*":
+    description: Himax Technologies, Inc.
+  "^hisilicon,.*":
+    description: Hisilicon Limited.
+  "^hit,.*":
+    description: Hitachi Ltd.
+  "^hitex,.*":
+    description: Hitex Development Tools
+  "^holt,.*":
+    description: Holt Integrated Circuits, Inc.
+  "^honeywell,.*":
+    description: Honeywell
+  "^hp,.*":
+    description: Hewlett Packard
+  "^holtek,.*":
+    description: Holtek Semiconductor, Inc.
+  "^hwacom,.*":
+    description: HwaCom Systems Inc.
+  "^i2se,.*":
+    description: I2SE GmbH
+  "^ibm,.*":
+    description: International Business Machines (IBM)
+  "^icplus,.*":
+    description: IC Plus Corp.
+  "^idt,.*":
+    description: Integrated Device Technologies, Inc.
+  "^ifi,.*":
+    description: Ingenieurburo Fur Ic-Technologie (I/F/I)
+  "^ilitek,.*":
+    description: ILI Technology Corporation (ILITEK)
+  "^img,.*":
+    description: Imagination Technologies Ltd.
+  "^infineon,.*":
+    description: Infineon Technologies
+  "^inforce,.*":
+    description: Inforce Computing
+  "^ingenic,.*":
+    description: Ingenic Semiconductor
+  "^innolux,.*":
+    description: Innolux Corporation
+  "^inside-secure,.*":
+    description: INSIDE Secure
+  "^intel,.*":
+    description: Intel Corporation
+  "^intercontrol,.*":
+    description: Inter Control Group
+  "^invensense,.*":
+    description: InvenSense Inc.
+  "^inversepath,.*":
+    description: Inverse Path
+  "^iom,.*":
+    description: Iomega Corporation
+  "^isee,.*":
+    description: ISEE 2007 S.L.
+  "^isil,.*":
+    description: Intersil
+  "^issi,.*":
+    description: Integrated Silicon Solutions Inc.
+  "^itead,.*":
+    description: ITEAD Intelligent Systems Co.Ltd
+  "^iwave,.*":
+    description: iWave Systems Technologies Pvt. Ltd.
+  "^jdi,.*":
+    description: Japan Display Inc.
+  "^jedec,.*":
+    description: JEDEC Solid State Technology Association
+  "^jianda,.*":
+    description: Jiandangjing Technology Co., Ltd.
+  "^karo,.*":
+    description: Ka-Ro electronics GmbH
+  "^keithkoep,.*":
+    description: Keith & Koep GmbH
+  "^keymile,.*":
+    description: Keymile GmbH
+  "^khadas,.*":
+    description: Khadas
+  "^kiebackpeter,.*":
+    description: Kieback & Peter GmbH
+  "^kinetic,.*":
+    description: Kinetic Technologies
+  "^kingdisplay,.*":
+    description: King & Display Technology Co., Ltd.
+  "^kingnovel,.*":
+    description: Kingnovel Technology Co., Ltd.
+  "^kionix,.*":
+    description: Kionix, Inc.
+  "^kobo,.*":
+    description: Rakuten Kobo Inc.
+  "^koe,.*":
+    description: Kaohsiung Opto-Electronics Inc.
+  "^kosagi,.*":
+    description: Sutajio Ko-Usagi PTE Ltd.
+  "^kyo,.*":
+    description: Kyocera Corporation
+  "^lacie,.*":
+    description: LaCie
+  "^laird,.*":
+    description: Laird PLC
+  "^lantiq,.*":
+    description: Lantiq Semiconductor
+  "^lattice,.*":
+    description: Lattice Semiconductor
+  "^lego,.*":
+    description: LEGO Systems A/S
+  "^lemaker,.*":
+    description: Shenzhen LeMaker Technology Co., Ltd.
+  "^lenovo,.*":
+    description: Lenovo Group Ltd.
+  "^lg,.*":
+    description: LG Corporation
+  "^libretech,.*":
+    description: Shenzhen Libre Technology Co., Ltd
+  "^licheepi,.*":
+    description: Lichee Pi
+  "^linaro,.*":
+    description: Linaro Limited
+  "^linksys,.*":
+    description: Belkin International, Inc. (Linksys)
+  "^linux,.*":
+    description: Linux-specific binding
+  "^linx,.*":
+    description: Linx Technologies
+  "^lltc,.*":
+    description: Linear Technology Corporation
+  "^logicpd,.*":
+    description: Logic PD, Inc.
+  "^lsi,.*":
+    description: LSI Corp. (LSI Logic)
+  "^lwn,.*":
+    description: Liebherr-Werk Nenzing GmbH
+  "^macnica,.*":
+    description: Macnica Americas
+  "^marvell,.*":
+    description: Marvell Technology Group Ltd.
+  "^maxbotix,.*":
+    description: MaxBotix Inc.
+  "^maxim,.*":
+    description: Maxim Integrated Products
+  "^mbvl,.*":
+    description: Mobiveil Inc.
+  "^mcube,.*":
+    description: mCube
+  "^meas,.*":
+    description: Measurement Specialties
+  "^mediatek,.*":
+    description: MediaTek Inc.
+  "^megachips,.*":
+    description: MegaChips
+  "^mele,.*":
+    description: Shenzhen MeLE Digital Technology Ltd.
+  "^melexis,.*":
+    description: Melexis N.V.
+  "^melfas,.*":
+    description: MELFAS Inc.
+  "^mellanox,.*":
+    description: Mellanox Technologies
+  "^memsic,.*":
+    description: MEMSIC Inc.
+  "^menlo,.*":
+    description: Menlo Systems GmbH
+  "^merrii,.*":
+    description: Merrii Technology Co., Ltd.
+  "^micrel,.*":
+    description: Micrel Inc.
+  "^microchip,.*":
+    description: Microchip Technology Inc.
+  "^microcrystal,.*":
+    description: Micro Crystal AG
+  "^micron,.*":
+    description: Micron Technology Inc.
+  "^mikroe,.*":
+    description: MikroElektronika d.o.o.
+  "^minix,.*":
+    description: MINIX Technology Ltd.
+  "^miramems,.*":
+    description: MiraMEMS Sensing Technology Co., Ltd.
+  "^mitsubishi,.*":
+    description: Mitsubishi Electric Corporation
+  "^mosaixtech,.*":
+    description: Mosaix Technologies, Inc.
+  "^motorola,.*":
+    description: Motorola, Inc.
+  "^moxa,.*":
+    description: Moxa Inc.
+  "^mpl,.*":
+    description: MPL AG
+  "^mqmaker,.*":
+    description: mqmaker Inc.
+  "^mscc,.*":
+    description: Microsemi Corporation
+  "^msi,.*":
+    description: Micro-Star International Co. Ltd.
+  "^mti,.*":
+    description: Imagination Technologies Ltd. (formerly MIPS Technologies Inc.)
+  "^multi-inno,.*":
+    description: Multi-Inno Technology Co.,Ltd
+  "^mundoreader,.*":
+    description: Mundo Reader S.L.
+  "^murata,.*":
+    description: Murata Manufacturing Co., Ltd.
+  "^mxicy,.*":
+    description: Macronix International Co., Ltd.
+  "^myir,.*":
+    description: MYIR Tech Limited
+  "^national,.*":
+    description: National Semiconductor
+  "^nec,.*":
+    description: NEC LCD Technologies, Ltd.
+  "^neonode,.*":
+    description: Neonode Inc.
+  "^netgear,.*":
+    description: NETGEAR
+  "^netlogic,.*":
+    description: Broadcom Corporation (formerly NetLogic Microsystems)
+  "^netron-dy,.*":
+    description: Netron DY
+  "^netxeon,.*":
+    description: Shenzhen Netxeon Technology CO., LTD
+  "^nexbox,.*":
+    description: Nexbox
+  "^nextthing,.*":
+    description: Next Thing Co.
+  "^newhaven,.*":
+    description: Newhaven Display International
+  "^ni,.*":
+    description: National Instruments
+  "^nintendo,.*":
+    description: Nintendo
+  "^nlt,.*":
+    description: NLT Technologies, Ltd.
+  "^nokia,.*":
+    description: Nokia
+  "^nordic,.*":
+    description: Nordic Semiconductor
+  "^novtech,.*":
+    description: NovTech, Inc.
+  "^nutsboard,.*":
+    description: NutsBoard
+  "^nuvoton,.*":
+    description: Nuvoton Technology Corporation
+  "^nvd,.*":
+    description: New Vision Display
+  "^nvidia,.*":
+    description: NVIDIA
+  "^nxp,.*":
+    description: NXP Semiconductors
+  "^oceanic,.*":
+    description: Oceanic Systems (UK) Ltd.
+  "^okaya,.*":
+    description: Okaya Electric America, Inc.
+  "^oki,.*":
+    description: Oki Electric Industry Co., Ltd.
+  "^olimex,.*":
+    description: OLIMEX Ltd.
+  "^olpc,.*":
+    description: One Laptop Per Child
+  "^onion,.*":
+    description: Onion Corporation
+  "^onnn,.*":
+    description: ON Semiconductor Corp.
+  "^ontat,.*":
+    description: On Tat Industrial Company
+  "^opalkelly,.*":
+    description: Opal Kelly Incorporated
+  "^opencores,.*":
+    description: OpenCores.org
+  "^openrisc,.*":
+    description: OpenRISC.io
+  "^option,.*":
+    description: Option NV
+  "^oranth,.*":
+    description: Shenzhen Oranth Technology Co., Ltd.
+  "^ORCL,.*":
+    description: Oracle Corporation
+  "^orisetech,.*":
+    description: Orise Technology
+  "^ortustech,.*":
+    description: Ortus Technology Co., Ltd.
+  "^osddisplays,.*":
+    description: OSD Displays
+  "^ovti,.*":
+    description: OmniVision Technologies
+  "^oxsemi,.*":
+    description: Oxford Semiconductor, Ltd.
+  "^panasonic,.*":
+    description: Panasonic Corporation
+  "^parade,.*":
+    description: Parade Technologies Inc.
+  "^pda,.*":
+    description: Precision Design Associates, Inc.
+  "^pericom,.*":
+    description: Pericom Technology Inc.
+  "^pervasive,.*":
+    description: Pervasive Displays, Inc.
+  "^phicomm,.*":
+    description: PHICOMM Co., Ltd.
+  "^phytec,.*":
+    description: PHYTEC Messtechnik GmbH
+  "^picochip,.*":
+    description: Picochip Ltd
+  "^pine64,.*":
+    description: Pine64
+  "^pixcir,.*":
+    description: PIXCIR MICROELECTRONICS Co., Ltd
+  "^plantower,.*":
+    description: Plantower Co., Ltd
+  "^plathome,.*":
+    description: Plat'Home Co., Ltd.
+  "^plda,.*":
+    description: PLDA
+  "^plx,.*":
+    description: Broadcom Corporation (formerly PLX Technology)
+  "^pni,.*":
+    description: PNI Sensor Corporation
+  "^portwell,.*":
+    description: Portwell Inc.
+  "^poslab,.*":
+    description: Poslab Technology Co., Ltd.
+  "^powervr,.*":
+    description: PowerVR (deprecated, use img)
+  "^probox2,.*":
+    description: PROBOX2 (by W2COMP Co., Ltd.)
+  "^pulsedlight,.*":
+    description: PulsedLight, Inc
+  "^qca,.*":
+    description: Qualcomm Atheros, Inc.
+  "^qcom,.*":
+    description: Qualcomm Technologies, Inc
+  "^qemu,.*":
+    description: QEMU, a generic and open source machine emulator and virtualizer
+  "^qi,.*":
+    description: Qi Hardware
+  "^qiaodian,.*":
+    description: QiaoDian XianShi Corporation
+  "^qnap,.*":
+    description: QNAP Systems, Inc.
+  "^radxa,.*":
+    description: Radxa
+  "^raidsonic,.*":
+    description: RaidSonic Technology GmbH
+  "^ralink,.*":
+    description: Mediatek/Ralink Technology Corp.
+  "^ramtron,.*":
+    description: Ramtron International
+  "^raspberrypi,.*":
+    description: Raspberry Pi Foundation
+  "^raydium,.*":
+    description: Raydium Semiconductor Corp.
+  "^rda,.*":
+    description: Unisoc Communications, Inc.
+  "^realtek,.*":
+    description: Realtek Semiconductor Corp.
+  "^renesas,.*":
+    description: Renesas Electronics Corporation
+  "^richtek,.*":
+    description: Richtek Technology Corporation
+  "^ricoh,.*":
+    description: Ricoh Co. Ltd.
+  "^rikomagic,.*":
+    description: Rikomagic Tech Corp. Ltd
+  "^riscv,.*":
+    description: RISC-V Foundation
+  "^rockchip,.*":
+    description: Fuzhou Rockchip Electronics Co., Ltd
+  "^rocktech,.*":
+    description: ROCKTECH DISPLAYS LIMITED
+  "^rohm,.*":
+    description: ROHM Semiconductor Co., Ltd
+  "^ronbo,.*":
+    description: Ronbo Electronics
+  "^roofull,.*":
+    description: Shenzhen Roofull Technology Co, Ltd
+  "^samsung,.*":
+    description: Samsung Semiconductor
+  "^samtec,.*":
+    description: Samtec/Softing company
+  "^sancloud,.*":
+    description: Sancloud Ltd
+  "^sandisk,.*":
+    description: Sandisk Corporation
+  "^sbs,.*":
+    description: Smart Battery System
+  "^schindler,.*":
+    description: Schindler
+  "^seagate,.*":
+    description: Seagate Technology PLC
+  "^seirobotics,.*":
+    description: Shenzhen SEI Robotics Co., Ltd
+  "^semtech,.*":
+    description: Semtech Corporation
+  "^sensirion,.*":
+    description: Sensirion AG
+  "^sff,.*":
+    description: Small Form Factor Committee
+  "^sgd,.*":
+    description: Solomon Goldentek Display Corporation
+  "^sgx,.*":
+    description: SGX Sensortech
+  "^sharp,.*":
+    description: Sharp Corporation
+  "^shimafuji,.*":
+    description: Shimafuji Electric, Inc.
+  "^si-en,.*":
+    description: Si-En Technology Ltd.
+  "^si-linux,.*":
+    description: Silicon Linux Corporation
+  "^sifive,.*":
+    description: SiFive, Inc.
+  "^sigma,.*":
+    description: Sigma Designs, Inc.
+  "^sii,.*":
+    description: Seiko Instruments, Inc.
+  "^sil,.*":
+    description: Silicon Image
+  "^silabs,.*":
+    description: Silicon Laboratories
+  "^silead,.*":
+    description: Silead Inc.
+  "^silergy,.*":
+    description: Silergy Corp.
+  "^siliconmitus,.*":
+    description: Silicon Mitus, Inc.
+  "^simte,.*":
+    description: k
+  "^sirf,.*":
+    description: SiRF Technology, Inc.
+  "^sis,.*":
+    description: Silicon Integrated Systems Corp.
+  "^sitronix,.*":
+    description: Sitronix Technology Corporation
+  "^skyworks,.*":
+    description: Skyworks Solutions, Inc.
+  "^smsc,.*":
+    description: Standard Microsystems Corporation
+  "^snps,.*":
+    description: Synopsys, Inc.
+  "^socionext,.*":
+    description: Socionext Inc.
+  "^solidrun,.*":
+    description: SolidRun
+  "^solomon,.*":
+    description: Solomon Systech Limited
+  "^sony,.*":
+    description: Sony Corporation
+  "^spansion,.*":
+    description: Spansion Inc.
+  "^sprd,.*":
+    description: Spreadtrum Communications Inc.
+  "^sst,.*":
+    description: Silicon Storage Technology, Inc.
+  "^st,.*":
+    description: STMicroelectronics
+  "^starry,.*":
+    description: Starry Electronic Technology (ShenZhen) Co., LTD
+  "^startek,.*":
+    description: Startek
+  "^ste,.*":
+    description: ST-Ericsson
+  "^stericsson,.*":
+    description: ST-Ericsson
+  "^summit,.*":
+    description: Summit microelectronics
+  "^sunchip,.*":
+    description: Shenzhen Sunchip Technology Co., Ltd
+  "^SUNW,.*":
+    description: Sun Microsystems, Inc
+  "^swir,.*":
+    description: Sierra Wireless
+  "^syna,.*":
+    description: Synaptics Inc.
+  "^synology,.*":
+    description: Synology, Inc.
+  "^tbs,.*":
+    description: TBS Technologies
+  "^tbs-biometrics,.*":
+    description: Touchless Biometric Systems AG
+  "^tcg,.*":
+    description: Trusted Computing Group
+  "^tcl,.*":
+    description: Toby Churchill Ltd.
+  "^technexion,.*":
+    description: TechNexion
+  "^technologic,.*":
+    description: Technologic Systems
+  "^tempo,.*":
+    description: Tempo Semiconductor
+  "^techstar,.*":
+    description: Shenzhen Techstar Electronics Co., Ltd.
+  "^terasic,.*":
+    description: Terasic Inc.
+  "^thine,.*":
+    description: THine Electronics, Inc.
+  "^ti,.*":
+    description: Texas Instruments
+  "^tianma,.*":
+    description: Tianma Micro-electronics Co., Ltd.
+  "^tlm,.*":
+    description: Trusted Logic Mobility
+  "^tmt,.*":
+    description: Tecon Microprocessor Technologies, LLC.
+  "^topeet,.*":
+    description: Topeet
+  "^toradex,.*":
+    description: Toradex AG
+  "^toshiba,.*":
+    description: Toshiba Corporation
+  "^toumaz,.*":
+    description: Toumaz
+  "^tpk,.*":
+    description: TPK U.S.A. LLC
+  "^tplink,.*":
+    description: TP-LINK Technologies Co., Ltd.
+  "^tpo,.*":
+    description: TPO
+  "^tq,.*":
+    description: TQ Systems GmbH
+  "^tronfy,.*":
+    description: Tronfy
+  "^tronsmart,.*":
+    description: Tronsmart
+  "^truly,.*":
+    description: Truly Semiconductors Limited
+  "^tsd,.*":
+    description: Theobroma Systems Design und Consulting GmbH
+  "^tyan,.*":
+    description: Tyan Computer Corporation
+  "^u-blox,.*":
+    description: u-blox
+  "^ucrobotics,.*":
+    description: uCRobotics
+  "^ubnt,.*":
+    description: Ubiquiti Networks
+  "^udoo,.*":
+    description: Udoo
+  "^uniwest,.*":
+    description: United Western Technologies Corp (UniWest)
+  "^upisemi,.*":
+    description: uPI Semiconductor Corp.
+  "^urt,.*":
+    description: United Radiant Technology Corporation
+  "^usi,.*":
+    description: Universal Scientific Industrial Co., Ltd.
+  "^v3,.*":
+    description: V3 Semiconductor
+  "^vamrs,.*":
+    description: Vamrs Ltd.
+  "^variscite,.*":
+    description: Variscite Ltd.
+  "^via,.*":
+    description: VIA Technologies, Inc.
+  "^virtio,.*":
+    description: Virtual I/O Device Specification, developed by the OASIS consortium
+  "^vishay,.*":
+    description: Vishay Intertechnology, Inc
+  "^vitesse,.*":
+    description: Vitesse Semiconductor Corporation
+  "^vivante,.*":
+    description: Vivante Corporation
+  "^vocore,.*":
+    description: VoCore Studio
+  "^voipac,.*":
+    description: Voipac Technologies s.r.o.
+  "^vot,.*":
+    description: Vision Optical Technology Co., Ltd.
+  "^wd,.*":
+    description: Western Digital Corp.
+  "^wetek,.*":
+    description: WeTek Electronics, limited.
+  "^wexler,.*":
+    description: Wexler
+  "^whwave,.*":
+    description: Shenzhen whwave Electronics, Inc.
+  "^wi2wi,.*":
+    description: Wi2Wi, Inc.
+  "^winbond,.*":
+    description: Winbond Electronics corp.
+  "^winstar,.*":
+    description: Winstar Display Corp.
+  "^wlf,.*":
+    description: Wolfson Microelectronics
+  "^wm,.*":
+    description: Wondermedia Technologies, Inc.
+  "^x-powers,.*":
+    description: X-Powers
+  "^xes,.*":
+    description: Extreme Engineering Solutions (X-ES)
+  "^xillybus,.*":
+    description: Xillybus Ltd.
+  "^xlnx,.*":
+    description: Xilinx
+  "^xunlong,.*":
+    description: Shenzhen Xunlong Software CO.,Limited
+  "^ysoft,.*":
+    description: Y Soft Corporation a.s.
+  "^zarlink,.*":
+    description: Zarlink Semiconductor
+  "^zeitec,.*":
+    description: ZEITEC Semiconductor Co., LTD.
+  "^zidoo,.*":
+    description: Shenzhen Zidoo Technology Co., Ltd.
+  "^zii,.*":
+    description: Zodiac Inflight Innovations
+  "^zte,.*":
+    description: ZTE Corp.
+  "^zyxel,.*":
+    description: ZyXEL Communications Corp.
+
+  # Normal property name match without a comma
+  # These should catch all node/property names without a prefix
+  "^[a-zA-Z0-9#][a-zA-Z0-9+\\-._@]{0,63}$": true
+  "^[a-zA-Z0-9+\\-._]*@[0-9a-zA-Z,]*$": true
+  "^#.*": true
+
+additionalProperties: false
+
+...
index 99994a4..69c7fa7 100644 (file)
@@ -271,6 +271,9 @@ GPIO
   devm_gpio_request_one()
   devm_gpio_free()
 
+I2C
+  devm_i2c_new_dummy_device()
+
 IIO
   devm_iio_device_alloc()
   devm_iio_device_free()
index 45edad6..acc02fc 100644 (file)
@@ -354,8 +354,10 @@ this ioctl is called until no further expire candidates are found.
 
 The call requires an initialized struct autofs_dev_ioctl with the
 ioctlfd field set to the descriptor obtained from the open call. In
-addition an immediate expire, independent of the mount timeout, can be
-requested by setting the how field of struct args_expire to 1. If no
+addition an immediate expire that's independent of the mount timeout,
+and a forced expire that's independent of whether the mount is busy,
+can be requested by setting the how field of struct args_expire to
+AUTOFS_EXP_IMMEDIATE or AUTOFS_EXP_FORCED, respectively . If no
 expire candidates can be found the ioctl returns -1 with errno set to
 EAGAIN.
 
index 373ad25..3af38c7 100644 (file)
@@ -116,7 +116,7 @@ that purpose there is another flag.
 **DCACHE_MANAGE_TRANSIT**
 
 If a dentry has DCACHE_MANAGE_TRANSIT set then two very different but
-related behaviors are invoked, both using the `d_op->d_manage()`
+related behaviours are invoked, both using the `d_op->d_manage()`
 dentry operation.
 
 Firstly, before checking to see if any filesystem is mounted on the
@@ -193,8 +193,8 @@ VFS remain in RCU-walk mode, but can only tell it to get out of
 RCU-walk mode by returning `-ECHILD`.
 
 So `d_manage()`, when called with `rcu_walk` set, should either return
--ECHILD if there is any reason to believe it is unsafe to end the
-mounted filesystem, and otherwise should return 0.
+-ECHILD if there is any reason to believe it is unsafe to enter the
+mounted filesystem, otherwise it should return 0.
 
 autofs will return `-ECHILD` if an expiry of the filesystem has been
 initiated or is being considered, otherwise it returns 0.
@@ -210,7 +210,7 @@ mounts that were created by `d_automount()` returning a filesystem to be
 mounted.  As autofs doesn't return such a filesystem but leaves the
 mounting to the automount daemon, it must involve the automount daemon
 in unmounting as well.  This also means that autofs has more control
-of expiry.
+over expiry.
 
 The VFS also supports "expiry" of mounts using the MNT_EXPIRE flag to
 the `umount` system call.  Unmounting with MNT_EXPIRE will fail unless
@@ -225,7 +225,7 @@ unmount any filesystems mounted on the autofs filesystem or remove any
 symbolic links or empty directories any time it likes.  If the unmount
 or removal is successful the filesystem will be returned to the state
 it was before the mount or creation, so that any access of the name
-will trigger normal auto-mount processing.  In particlar, `rmdir` and
+will trigger normal auto-mount processing.  In particular, `rmdir` and
 `unlink` do not leave negative entries in the dcache as a normal
 filesystem would, so an attempt to access a recently-removed object is
 passed to autofs for handling.
@@ -240,11 +240,18 @@ Normally the daemon only wants to remove entries which haven't been
 used for a while.  For this purpose autofs maintains a "`last_used`"
 time stamp on each directory or symlink.  For symlinks it genuinely
 does record the last time the symlink was "used" or followed to find
-out where it points to.  For directories the field is a slight
-misnomer.  It actually records the last time that autofs checked if
-the directory or one of its descendents was busy and found that it
-was.  This is just as useful and doesn't require updating the field so
-often.
+out where it points to.  For directories the field is used slightly
+differently.  The field is updated at mount time and during expire
+checks if it is found to be in use (ie. open file descriptor or
+process working directory) and during path walks. The update done
+during path walks prevents frequent expire and immediate mount of
+frequently accessed automounts. But in the case where a GUI continually
+access or an application frequently scans an autofs directory tree
+there can be an accumulation of mounts that aren't actually being
+used. To cater for this case the "`strictexpire`" autofs mount option
+can be used to avoid the "`last_used`" update on path walk thereby
+preventing this apparent inability to expire mounts that aren't
+really in use.
 
 The daemon is able to ask autofs if anything is due to be expired,
 using an `ioctl` as discussed later.  For a *direct* mount, autofs
@@ -255,8 +262,12 @@ up.
 
 There is an option with indirect mounts to consider each of the leaves
 that has been mounted on instead of considering the top-level names.
-This is intended for compatability with version 4 of autofs and should
-be considered as deprecated.
+This was originally intended for compatibility with version 4 of autofs
+and should be considered as deprecated for Sun Format automount maps.
+However, it may be used again for amd format mount maps (which are
+generally indirect maps) because the amd automounter allows for the
+setting of an expire timeout for individual mounts. But there are
+some difficulties in making the needed changes for this.
 
 When autofs considers a directory it checks the `last_used` time and
 compares it with the "timeout" value set when the filesystem was
@@ -273,7 +284,7 @@ mounts.  If it finds something in the root directory to expire it will
 return the name of that thing.  Once a name has been returned the
 automount daemon needs to unmount any filesystems mounted below the
 name normally.  As described above, this is unsafe for non-toplevel
-mounts in a version-5 autofs.  For this reason the current `automountd`
+mounts in a version-5 autofs.  For this reason the current `automount(8)`
 does not use this ioctl.
 
 The second mechanism uses either the **AUTOFS_DEV_IOCTL_EXPIRE_CMD** or
@@ -345,7 +356,7 @@ The `wait_queue_token` is a unique number which can identify a
 particular request to be acknowledged.  When a message is sent over
 the pipe the affected dentry is marked as either "active" or
 "expiring" and other accesses to it block until the message is
-acknowledged using one of the ioctls below and the relevant
+acknowledged using one of the ioctls below with the relevant
 `wait_queue_token`.
 
 Communicating with autofs: root directory ioctls
@@ -367,15 +378,14 @@ The available ioctl commands are:
     This mode is also entered if a write to the pipe fails.
 - **AUTOFS_IOC_PROTOVER**:  This returns the protocol version in use.
 - **AUTOFS_IOC_PROTOSUBVER**: Returns the protocol sub-version which
-    is really a version number for the implementation.  It is
-    currently 2.
+    is really a version number for the implementation.
 - **AUTOFS_IOC_SETTIMEOUT**:  This passes a pointer to an unsigned
     long.  The value is used to set the timeout for expiry, and
     the current timeout value is stored back through the pointer.
 - **AUTOFS_IOC_ASKUMOUNT**:  Returns, in the pointed-to `int`, 1 if
     the filesystem could be unmounted.  This is only a hint as
     the situation could change at any instant.  This call can be
-    use to avoid a more expensive full unmount attempt.
+    used to avoid a more expensive full unmount attempt.
 - **AUTOFS_IOC_EXPIRE**: as described above, this asks if there is
     anything suitable to expire.  A pointer to a packet:
 
@@ -400,6 +410,11 @@ The available ioctl commands are:
      **AUTOFS_EXP_IMMEDIATE** causes `last_used` time to be ignored
      and objects are expired if the are not in use.
 
+     **AUTOFS_EXP_FORCED** causes the in use status to be ignored
+     and objects are expired ieven if they are in use. This assumes
+     that the daemon has requested this because it is capable of
+     performing the umount.
+
      **AUTOFS_EXP_LEAVES** will select a leaf rather than a top-level
      name to expire.  This is only safe when *maxproto* is 4.
 
@@ -415,7 +430,7 @@ which can be used to communicate directly with the autofs filesystem.
 It requires CAP_SYS_ADMIN for access.
 
 The `ioctl`s that can be used on this device are described in a separate
-document `autofs-mount-control.txt`, and are summarized briefly here.
+document `autofs-mount-control.txt`, and are summarised briefly here.
 Each ioctl is passed a pointer to an `autofs_dev_ioctl` structure:
 
         struct autofs_dev_ioctl {
@@ -511,6 +526,21 @@ directories.
 Catatonic mode can only be left via the
 **AUTOFS_DEV_IOCTL_OPENMOUNT_CMD** ioctl on the `/dev/autofs`.
 
+The "ignore" mount option
+-------------------------
+
+The "ignore" mount option can be used to provide a generic indicator
+to applications that the mount entry should be ignored when displaying
+mount information.
+
+In other OSes that provide autofs and that provide a mount list to user
+space based on the kernel mount list a no-op mount option ("ignore" is
+the one use on the most common OSes) is allowed so that autofs file
+system users can optionally use it.
+
+This is intended to be used by user space programs to exclude autofs
+mounts from consideration when reading the mounts list.
+
 autofs, name spaces, and shared mounts
 --------------------------------------
 
index 1351984..febccbc 100644 (file)
@@ -45,8 +45,8 @@ the ANOD object which is also the final target node of the reference.
            Name (_DSD, Package () {
                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
                Package () {
-                   Package () { "node@0", NOD0 },
-                   Package () { "node@1", NOD1 },
+                   Package () { "node@0", "NOD0" },
+                   Package () { "node@1", "NOD1" },
                }
            })
            Name (NOD0, Package() {
@@ -58,7 +58,7 @@ the ANOD object which is also the final target node of the reference.
            Name (NOD1, Package() {
                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
                Package () {
-                   Package () { "anothernode", ANOD },
+                   Package () { "anothernode", "ANOD" },
                }
            })
            Name (ANOD, Package() {
index e0baed3..1a6ce7a 100644 (file)
@@ -45,7 +45,7 @@ with "port" and must be followed by the "@" character and the number of the
 port as its key. The target object it refers to should be called "PRTX", where
 "X" is the number of the port. An example of such a package would be::
 
-    Package() { "port@4", PRT4 }
+    Package() { "port@4", "PRT4" }
 
 Further on, endpoints are located under the port nodes. The hierarchical
 data extension key of the endpoint nodes must begin with
@@ -54,7 +54,7 @@ endpoint. The object it refers to should be called "EPXY", where "X" is the
 number of the port and "Y" is the number of the endpoint. An example of such a
 package would be::
 
-    Package() { "endpoint@0", EP40 }
+    Package() { "endpoint@0", "EP40" }
 
 Each port node contains a property extension key "port", the value of which is
 the number of the port. Each endpoint is similarly numbered with a property
@@ -82,68 +82,68 @@ A simple example of this is show below::
 
     Scope (\_SB.PCI0.I2C2)
     {
-        Device (CAM0)
-        {
-            Name (_DSD, Package () {
-                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package () {
-                    Package () { "compatible", Package () { "nokia,smia" } },
-                },
-                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
-                Package () {
-                    Package () { "port@0", PRT0 },
-                }
-            })
-            Name (PRT0, Package() {
-                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package () {
-                    Package () { "reg", 0 },
-                },
-                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
-                Package () {
-                    Package () { "endpoint@0", EP00 },
-                }
-            })
-            Name (EP00, Package() {
-                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package () {
-                    Package () { "reg", 0 },
-                    Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
-                }
-            })
-        }
+       Device (CAM0)
+       {
+           Name (_DSD, Package () {
+               ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+               Package () {
+                   Package () { "compatible", Package () { "nokia,smia" } },
+               },
+               ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
+               Package () {
+                   Package () { "port@0", "PRT0" },
+               }
+           })
+           Name (PRT0, Package() {
+               ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+               Package () {
+                   Package () { "reg", 0 },
+               },
+               ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
+               Package () {
+                   Package () { "endpoint@0", "EP00" },
+               }
+           })
+           Name (EP00, Package() {
+               ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+               Package () {
+                   Package () { "reg", 0 },
+                   Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
+               }
+           })
+       }
     }
 
     Scope (\_SB.PCI0)
     {
-        Device (ISP)
-        {
-            Name (_DSD, Package () {
-                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
-                Package () {
-                    Package () { "port@4", PRT4 },
-                }
-            })
-
-            Name (PRT4, Package() {
-                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package () {
-                    Package () { "reg", 4 }, /* CSI-2 port number */
-                },
-                ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
-                Package () {
-                    Package () { "endpoint@0", EP40 },
-                }
-            })
-
-            Name (EP40, Package() {
-                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package () {
-                    Package () { "reg", 0 },
-                    Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
-                }
-            })
-        }
+       Device (ISP)
+       {
+           Name (_DSD, Package () {
+               ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
+               Package () {
+                   Package () { "port@4", "PRT4" },
+               }
+           })
+
+           Name (PRT4, Package() {
+               ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+               Package () {
+                   Package () { "reg", 4 }, /* CSI-2 port number */
+               },
+               ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
+               Package () {
+                   Package () { "endpoint@0", "EP40" },
+               }
+           })
+
+           Name (EP40, Package() {
+               ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+               Package () {
+                   Package () { "reg", 0 },
+                   Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
+               }
+           })
+       }
     }
 
 Here, the port 0 of the "CAM0" device is connected to the port 4 of
index 03c0658..d65ad57 100644 (file)
@@ -437,20 +437,6 @@ more details, with real examples.
        The second argument is optional, and if supplied will be used
        if first argument is not supported.
 
-    cc-ldoption
-       cc-ldoption is used to check if $(CC) when used to link object files
-       supports the given option.  An optional second option may be
-       specified if first option are not supported.
-
-       Example:
-               #arch/x86/kernel/Makefile
-               vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
-
-       In the above example, vsyscall-flags will be assigned the option
-       -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
-       The second argument is optional, and if supplied will be used
-       if first argument is not supported.
-
     as-instr
        as-instr checks if the assembler reports a specific instruction
        and then outputs either option1 or option2
index 3fb473e..d640e92 100644 (file)
@@ -75,12 +75,11 @@ enum v4l2_field
 
     * - ``V4L2_FIELD_ANY``
       - 0
-      - Applications request this field order when any one of the
-       ``V4L2_FIELD_NONE``, ``V4L2_FIELD_TOP``, ``V4L2_FIELD_BOTTOM``, or
-       ``V4L2_FIELD_INTERLACED`` formats is acceptable. Drivers choose
-       depending on hardware capabilities or e. g. the requested image
-       size, and return the actual field order. Drivers must never return
-       ``V4L2_FIELD_ANY``. If multiple field orders are possible the
+      - Applications request this field order when any field format
+       is acceptable. Drivers choose depending on hardware capabilities or
+       e.g. the requested image size, and return the actual field order.
+       Drivers must never return ``V4L2_FIELD_ANY``.
+       If multiple field orders are possible the
        driver must choose one of the possible field orders during
        :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` or
        :ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>`. struct
@@ -88,9 +87,8 @@ enum v4l2_field
        ``V4L2_FIELD_ANY``.
     * - ``V4L2_FIELD_NONE``
       - 1
-      - Images are in progressive format, not interlaced. The driver may
-       also indicate this order when it cannot distinguish between
-       ``V4L2_FIELD_TOP`` and ``V4L2_FIELD_BOTTOM``.
+      - Images are in progressive (frame-based) format, not interlaced
+        (field-based).
     * - ``V4L2_FIELD_TOP``
       - 2
       - Images consist of the top (aka odd) field only.
diff --git a/Documentation/networking/device_drivers/index.rst b/Documentation/networking/device_drivers/index.rst
new file mode 100644 (file)
index 0000000..75fa537
--- /dev/null
@@ -0,0 +1,30 @@
+.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+Vendor Device Drivers
+=====================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   freescale/dpaa2/index
+   intel/e100
+   intel/e1000
+   intel/e1000e
+   intel/fm10k
+   intel/igb
+   intel/igbvf
+   intel/ixgb
+   intel/ixgbe
+   intel/ixgbevf
+   intel/i40e
+   intel/iavf
+   intel/ice
+
+.. only::  subproject
+
+   Indices
+   =======
+
+   * :ref:`genindex`
index f390fe3..a46fca2 100644 (file)
@@ -11,19 +11,7 @@ Contents:
    batman-adv
    can
    can_ucan_protocol
-   device_drivers/freescale/dpaa2/index
-   device_drivers/intel/e100
-   device_drivers/intel/e1000
-   device_drivers/intel/e1000e
-   device_drivers/intel/fm10k
-   device_drivers/intel/igb
-   device_drivers/intel/igbvf
-   device_drivers/intel/ixgb
-   device_drivers/intel/ixgbe
-   device_drivers/intel/ixgbevf
-   device_drivers/intel/i40e
-   device_drivers/intel/iavf
-   device_drivers/intel/ice
+   device_drivers/index
    dsa/index
    devlink-info-versions
    ieee802154
@@ -40,6 +28,8 @@ Contents:
    checksum-offloads
    segmentation-offloads
    scaling
+   tls
+   tls-offload
 
 .. only::  subproject
 
index 725b8be..14fe930 100644 (file)
@@ -560,10 +560,10 @@ tcp_comp_sack_delay_ns - LONG INTEGER
        Default : 1,000,000 ns (1 ms)
 
 tcp_comp_sack_nr - INTEGER
-       Max numer of SACK that can be compressed.
+       Max number of SACK that can be compressed.
        Using 0 disables SACK compression.
 
-       Detault : 44
+       Default : 44
 
 tcp_slow_start_after_idle - BOOLEAN
        If set, provide RFC2861 behavior and time out the congestion
index cd7303d..180e07d 100644 (file)
@@ -796,7 +796,9 @@ The kernel interface functions are as follows:
                                s64 tx_total_len,
                                gfp_t gfp,
                                rxrpc_notify_rx_t notify_rx,
-                               bool upgrade);
+                               bool upgrade,
+                               bool intr,
+                               unsigned int debug_id);
 
      This allocates the infrastructure to make a new RxRPC call and assigns
      call and connection numbers.  The call will be made on the UDP port that
@@ -824,6 +826,13 @@ The kernel interface functions are as follows:
      the server upgrade the service to a better one.  The resultant service ID
      is returned by rxrpc_kernel_recv_data().
 
+     intr should be set to true if the call should be interruptible.  If this
+     is not set, this function may not return until a channel has been
+     allocated; if it is set, the function may return -ERESTARTSYS.
+
+     debug_id is the call debugging ID to be used for tracing.  This can be
+     obtained by atomically incrementing rxrpc_debug_id.
+
      If this function is successful, an opaque reference to the RxRPC call is
      returned.  The caller now holds a reference on this and it must be
      properly ended.
@@ -1056,6 +1065,16 @@ The kernel interface functions are as follows:
      This value can be used to determine if the remote client has been
      restarted as it shouldn't change otherwise.
 
+ (*) Set the maxmimum lifespan on a call.
+
+       void rxrpc_kernel_set_max_life(struct socket *sock,
+                                      struct rxrpc_call *call,
+                                      unsigned long hard_timeout)
+
+     This sets the maximum lifespan on a call to hard_timeout (which is in
+     jiffies).  In the event of the timeout occurring, the call will be
+     aborted and -ETIME or -ETIMEDOUT will be returned.
+
 
 =======================
 CONFIGURABLE PARAMETERS
index 89d1ee9..085e8fa 100644 (file)
@@ -18,7 +18,7 @@ The following technologies are described:
  * Generic Segmentation Offload - GSO
  * Generic Receive Offload - GRO
  * Partial Generic Segmentation Offload - GSO_PARTIAL
- * SCTP accelleration with GSO - GSO_BY_FRAGS
+ * SCTP acceleration with GSO - GSO_BY_FRAGS
 
 
 TCP Segmentation Offload
@@ -148,7 +148,7 @@ that the IPv4 ID field is incremented in the case that a given header does
 not have the DF bit set.
 
 
-SCTP accelleration with GSO
+SCTP acceleration with GSO
 ===========================
 
 SCTP - despite the lack of hardware support - can still take advantage of
diff --git a/Documentation/networking/tls-offload-layers.svg b/Documentation/networking/tls-offload-layers.svg
new file mode 100644 (file)
index 0000000..cf72f05
--- /dev/null
@@ -0,0 +1 @@
+<svg version="1.1" viewBox="0.0 0.0 460.0 500.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m117.02887 0l72.28346 0l0 40.25197l-72.28346 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m117.02887 0l72.28346 0l0 40.25197l-72.28346 0z" fill-rule="evenodd"/><path fill="#000000" d="m135.71944 27.045982l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm12.853302 -3.109375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm15.453842 4.578125q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm10.469467 4.859375l0 -1.21875q-0.90625 1.4375 -2.703125 1.4375q-1.15625 0 -2.125 -0.640625q-0.96875 -0.640625 -1.5 -1.78125q-0.53125 -1.140625 -0.53125 -2.625q0 -1.453125 0.484375 -2.625q0.484375 -1.1875 1.4375 -1.8125q0.96875 -0.625 2.171875 -0.625q0.875 0 1.546875 0.375q0.6875 0.359375 1.109375 0.953125l0 -4.796875l1.640625 0l0 13.359375l-1.53125 0zm-5.171875 -4.828125q0 1.859375 0.78125 2.78125q0.78125 0.921875 1.84375 0.921875q1.078125 0 1.828125 -0.875q0.75 -0.890625 0.75 -2.6875q0 -1.984375 -0.765625 -2.90625q-0.765625 -0.9375 -1.890625 -0.9375q-1.078125 0 -1.8125 0.890625q-0.734375 0.890625 -0.734375 2.8125z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m309.02887 0l72.28348 0l0 40.25197l-72.28348 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m309.02887 0l72.28348 0l0 40.25197l-72.28348 0z" fill-rule="evenodd"/><path fill="#000000" d="m328.4915 27.045982l-2.96875 -9.671875l1.703125 0l1.53125 5.578125l0.578125 2.078125q0.046875 -0.15625 0.5 -2.0l1.546875 -5.65625l1.6875 0l1.4375 5.609375l0.484375 1.84375l0.5625 -1.859375l1.65625 -5.59375l1.59375 0l-3.03125 9.671875l-1.703125 0l-1.53125 -5.796875l-0.375 -1.640625l-1.953125 7.4375l-1.71875 0zm11.676086 0l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 -11.46875l0 -1.890625l1.640625 0l0 1.890625l-1.640625 0zm0 11.46875l0 -9.671875l1.640625 0l0 9.671875l-1.640625 0zm7.722931 -1.46875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm8.230194 -1.640625l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 101.46588l351.0551 0l0 53.70079l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 101.46588l351.0551 0l0 53.70079l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m215.67503 135.23627l0 -13.359367l1.640625 0l0 7.6249924l3.890625 -3.9374924l2.109375 0l-3.6875 3.5937424l4.0625 6.078125l-2.015625 0l-3.203125 -4.953125l-1.15625 1.125l0 3.828125l-1.640625 0zm12.90625 -1.46875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.5781174l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.6718674q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm1.5583038 1.46875l0 -13.359367l1.640625 0l0 13.359367l-1.640625 0zm3.5354462 -2.890625l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.6406174 0.296875 -1.1874924q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.4999924l-1.609375 0.21875q-0.109375 -0.7499924 -0.640625 -1.1718674q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.31249237 0.1875 0.5781174q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm24.136429 -10.468742l1.765625 0l0 7.7187424q0 2.015625 -0.453125 3.203125q-0.453125 1.1875 -1.640625 1.9375q-1.1875 0.734375 -3.125 0.734375q-1.875 0 -3.078125 -0.640625q-1.1875 -0.65625 -1.703125 -1.875q-0.5 -1.234375 -0.5 -3.359375l0 -7.7187424l1.765625 0l0 7.7187424q0 1.734375 0.3125 2.5625q0.328125 0.8125 1.109375 1.265625q0.796875 0.453125 1.9375 0.453125q1.953125 0 2.78125 -0.890625q0.828125 -0.890625 0.828125 -3.390625l0 -7.7187424zm4.629181 13.359367l0 -13.359367l1.78125 0l0 11.781242l6.5625 0l0 1.578125l-8.34375 0zm10.453857 0l0 -13.359367l5.046875 0q1.328125 0 2.03125 0.125q0.96875 0.171875 1.640625 0.640625q0.671875 0.453125 1.078125 1.28125q0.40625 0.828125 0.40625 1.828125q0 1.703125 -1.09375 2.8906174q-1.078125 1.171875 -3.921875 1.171875l-3.421875 0l0 5.421875l-1.765625 0zm1.765625 -7.0l3.453125 0q1.71875 0 2.4375 -0.6406174q0.71875 -0.640625 0.71875 -1.796875q0 -0.84375 -0.421875 -1.4375q-0.421875 -0.59375 -1.125 -0.78125q-0.4375 -0.125 -1.640625 -0.125l-3.421875 0l0 4.7812424z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 216.38058l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 216.38058l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m211.16338 250.15097l0 -11.78125l-4.40625 0l0 -1.578125l10.578125 0l0 1.578125l-4.40625 0l0 11.78125l-1.765625 0zm17.52098 -4.6875l1.765625 0.453125q-0.5625 2.171875 -2.0 3.328125q-1.4375 1.140625 -3.53125 1.140625q-2.15625 0 -3.515625 -0.875q-1.34375 -0.890625 -2.0625 -2.546875q-0.703125 -1.671875 -0.703125 -3.59375q0 -2.078125 0.796875 -3.625q0.796875 -1.5625 2.265625 -2.359375q1.484375 -0.8125 3.25 -0.8125q2.0 0 3.359375 1.015625q1.375 1.015625 1.90625 2.875l-1.734375 0.40625q-0.46875 -1.453125 -1.359375 -2.109375q-0.875 -0.671875 -2.203125 -0.671875q-1.546875 0 -2.578125 0.734375q-1.03125 0.734375 -1.453125 1.984375q-0.421875 1.234375 -0.421875 2.5625q0 1.703125 0.5 2.96875q0.5 1.265625 1.546875 1.90625q1.046875 0.625 2.265625 0.625q1.484375 0 2.515625 -0.859375q1.03125 -0.859375 1.390625 -2.546875zm3.9416962 4.6875l0 -13.359375l5.046875 0q1.328125 0 2.03125 0.125q0.96875 0.171875 1.640625 0.640625q0.671875 0.453125 1.078125 1.28125q0.40625 0.828125 0.40625 1.828125q0 1.703125 -1.09375 2.890625q-1.078125 1.171875 -3.921875 1.171875l-3.421875 0l0 5.421875l-1.765625 0zm1.765625 -7.0l3.453125 0q1.71875 0 2.4375 -0.640625q0.71875 -0.640625 0.71875 -1.796875q0 -0.84375 -0.421875 -1.4375q-0.421875 -0.59375 -1.125 -0.78125q-0.4375 -0.125 -1.640625 -0.125l-3.421875 0l0 4.78125zm14.664642 4.109375l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.2656097 0.890625q0.421875 0.5625 0.578125 1.5l-1.6093597 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.68748474 0.296875 1.0781097 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.3749847 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm13.562485 1.421875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm7.917694 0.28125q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm10.516327 1.3125l1.609375 0.21875q-0.265625 1.65625 -1.359375 2.609375q-1.078125 0.9375 -2.671875 0.9375q-1.984375 0 -3.1875 -1.296875q-1.203125 -1.296875 -1.203125 -3.71875q0 -1.578125 0.515625 -2.75q0.515625 -1.171875 1.578125 -1.75q1.0625 -0.59375 2.3125 -0.59375q1.578125 0 2.578125 0.796875q1.0 0.796875 1.28125 2.265625l-1.59375 0.234375q-0.234375 -0.96875 -0.8125 -1.453125q-0.578125 -0.5 -1.390625 -0.5q-1.234375 0 -2.015625 0.890625q-0.78125 0.890625 -0.78125 2.8125q0 1.953125 0.75 2.84375q0.75 0.875 1.953125 0.875q0.96875 0 1.609375 -0.59375q0.65625 -0.59375 0.828125 -1.828125zm3.015625 3.546875l0 -13.359375l1.640625 0l0 7.625l3.890625 -3.9375l2.109375 0l-3.6875 3.59375l4.0625 6.078125l-2.015625 0l-3.203125 -4.953125l-1.15625 1.125l0 3.828125l-1.640625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 331.2953l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 331.2953l351.0551 0l0 53.700775l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m225.73463 365.06567l0 -13.359375l4.609375 0q1.546875 0 2.375 0.203125q1.140625 0.25 1.953125 0.953125q1.0625 0.890625 1.578125 2.28125q0.53125 1.390625 0.53125 3.171875q0 1.515625 -0.359375 2.703125q-0.359375 1.171875 -0.921875 1.9375q-0.546875 0.765625 -1.203125 1.21875q-0.65625 0.4375 -1.59375 0.671875q-0.9375 0.21875 -2.140625 0.21875l-4.828125 0zm1.765625 -1.578125l2.859375 0q1.3125 0 2.0625 -0.234375q0.75 -0.25 1.203125 -0.703125q0.625 -0.625 0.96875 -1.6875q0.359375 -1.0625 0.359375 -2.578125q0 -2.09375 -0.6875 -3.21875q-0.6875 -1.125 -1.671875 -1.5q-0.703125 -0.28125 -2.28125 -0.28125l-2.8125 0l0 10.203125zm11.488571 1.578125l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 -11.46875l0 -1.890625l1.640625 0l0 1.890625l-1.640625 0zm0 11.46875l0 -9.671875l1.640625 0l0 9.671875l-1.640625 0zm6.832321 0l-3.6875 -9.671875l1.734375 0l2.078125 5.796875q0.328125 0.9375 0.625 1.9375q0.203125 -0.765625 0.609375 -1.828125l2.140625 -5.90625l1.6874847 0l-3.6562347 9.671875l-1.53125 0zm13.26561 -3.109375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm9.125732 5.765625l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m73.64304 446.20996l351.0551 0l0 53.700806l-351.0551 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m73.64304 446.20996l351.0551 0l0 53.700806l-351.0551 0z" fill-rule="evenodd"/><path fill="#000000" d="m222.09538 479.98038l0 -13.359375l4.609375 0q1.546875 0 2.375 0.203125q1.140625 0.25 1.953125 0.953125q1.0625 0.890625 1.578125 2.28125q0.53125 1.390625 0.53125 3.171875q0 1.515625 -0.359375 2.703125q-0.359375 1.171875 -0.921875 1.9375q-0.546875 0.765625 -1.203125 1.21875q-0.65625 0.4375 -1.59375 0.671875q-0.9375 0.21875 -2.140625 0.21875l-4.828125 0zm1.765625 -1.578125l2.859375 0q1.3125 0 2.0625 -0.234375q0.75 -0.25 1.203125 -0.703125q0.625 -0.625 0.96875 -1.6875q0.359375 -1.0625 0.359375 -2.578125q0 -2.09375 -0.6875 -3.21875q-0.6875 -1.125 -1.671875 -1.5q-0.703125 -0.28125 -2.28125 -0.28125l-2.8125 0l0 10.203125zm18.129196 -1.53125l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm11.828842 5.765625l-3.6875 -9.671875l1.734375 0l2.078125 5.796875q0.328125 0.9375 0.625 1.9375q0.203125 -0.765625 0.609375 -1.828125l2.140625 -5.90625l1.6875 0l-3.65625 9.671875l-1.53125 0zm6.640625 -11.46875l0 -1.890625l1.6406097 0l0 1.890625l-1.6406097 0zm0 11.46875l0 -9.671875l1.6406097 0l0 9.671875l-1.6406097 0zm10.457321 -3.546875l1.609375 0.21875q-0.265625 1.65625 -1.359375 2.609375q-1.078125 0.9375 -2.671875 0.9375q-1.984375 0 -3.1875 -1.296875q-1.203125 -1.296875 -1.203125 -3.71875q0 -1.578125 0.515625 -2.75q0.515625 -1.171875 1.578125 -1.75q1.0625 -0.59375 2.3125 -0.59375q1.578125 0 2.578125 0.796875q1.0 0.796875 1.28125 2.265625l-1.59375 0.234375q-0.234375 -0.96875 -0.8125 -1.453125q-0.578125 -0.5 -1.390625 -0.5q-1.234375 0 -2.015625 0.890625q-0.78125 0.890625 -0.78125 2.8125q0 1.953125 0.75 2.84375q0.75 0.875 1.953125 0.875q0.96875 0 1.609375 -0.59375q0.65625 -0.59375 0.828125 -1.828125zm9.640625 0.4375l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m153.17061 40.25197l0 0" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m153.17061 40.25197l0 0" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m48.435696 73.03937l402.67715 0" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m48.435696 73.03937l402.67715 0" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 71.49061l-12.393707 0l0 12.897636l-24.7874 0l0 -12.897636l-12.393692 0l24.7874 -12.89764z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 71.49061l-12.393707 0l0 12.897636l-24.7874 0l0 -12.897636l-12.393692 0l24.7874 -12.89764z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 71.49061l12.393707 0l0 -12.89764l24.787384 0l0 12.89764l12.393707 0l-24.787415 12.897636z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 71.49061l12.393707 0l0 -12.89764l24.787384 0l0 12.89764l12.393707 0l-24.787415 12.897636z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 188.3931l-12.393707 0l0 12.897629l-24.7874 0l0 -12.897629l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 188.3931l-12.393707 0l0 12.897629l-24.7874 0l0 -12.897629l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 188.3931l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897629z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 188.3931l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897629z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 301.4256l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 301.4256l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 301.4256l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 301.4256l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m177.95801 415.4906l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m177.95801 415.4906l-12.393707 0l0 12.897644l-24.7874 0l0 -12.897644l-12.393692 0l24.7874 -12.897644z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m320.3832 415.4906l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m320.3832 415.4906l12.393707 0l0 -12.897644l24.787384 0l0 12.897644l12.393707 0l-24.787415 12.897644z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 44.009186l109.44881 0l0 53.70079l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m224.98174 70.929184l2.78125 -13.359375l1.65625 0l-1.0 4.78125q0.78125 -0.71875 1.421875 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.703125 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59375 0.640625 1.484375 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.734375 0.6875 -1.234375 2.125q-0.375 1.0625 -0.375 1.78125zm14.531967 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.000717 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.183304 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm12.058319 -3.28125l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0zm6.368927 -3.3125l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 164.00919l109.44881 0l0 53.70079l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m211.6696 187.61668l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm15.84375 -0.21875l1.65625 0.171875q-0.625 1.8125 -1.765625 2.703125q-1.140625 0.875 -2.609375 0.875q-1.578125 0 -2.5625 -1.015625q-0.96875 -1.03125 -0.96875 -2.859375q0 -1.578125 0.625 -3.109375q0.640625 -1.53125 1.796875 -2.328125q1.171875 -0.796875 2.6875 -0.796875q1.546875 0 2.453125 0.875q0.921875 0.875 0.921875 2.328125l-1.625 0.109375q-0.015625 -0.921875 -0.546875 -1.4375q-0.515625 -0.515625 -1.359375 -0.515625q-1.0 0 -1.734375 0.625q-0.71875 0.625 -1.140625 1.90625q-0.40625 1.28125 -0.40625 2.46875q0 1.234375 0.546875 1.859375q0.546875 0.609375 1.34375 0.609375q0.796875 0 1.53125 -0.609375q0.734375 -0.609375 1.15625 -1.859375zm9.171875 2.328125q-0.859375 0.734375 -1.65625 1.078125q-0.78125 0.34375 -1.6875 0.34375q-1.34375 0 -2.171875 -0.78125q-0.8125 -0.796875 -0.8125 -2.03125q0 -0.796875 0.375 -1.421875q0.375 -0.625 0.984375 -1.0q0.609375 -0.390625 1.484375 -0.546875q0.5625 -0.109375 2.109375 -0.171875q1.5625 -0.0625 2.234375 -0.328125q0.1875 -0.671875 0.1875 -1.125q0 -0.578125 -0.421875 -0.90625q-0.5625 -0.453125 -1.671875 -0.453125q-1.03125 0 -1.703125 0.46875q-0.65625 0.453125 -0.953125 1.296875l-1.671875 -0.140625q0.515625 -1.4375 1.609375 -2.203125q1.109375 -0.765625 2.796875 -0.765625q1.796875 0 2.84375 0.859375q0.796875 0.625 0.796875 1.65625q0 0.765625 -0.21875 1.796875l-0.53125 2.40625q-0.265625 1.140625 -0.265625 1.859375q0 0.453125 0.203125 1.3125l-1.671875 0q-0.125 -0.46875 -0.1875 -1.203125zm0.609375 -3.703125q-0.34375 0.140625 -0.75 0.21875q-0.390625 0.0625 -1.3125 0.15625q-1.4375 0.125 -2.03125 0.328125q-0.59375 0.1875 -0.90625 0.625q-0.296875 0.421875 -0.296875 0.9375q0 0.6875 0.484375 1.140625q0.484375 0.4375 1.359375 0.4375q0.828125 0 1.578125 -0.421875q0.75 -0.4375 1.1875 -1.203125q0.4375 -0.78125 0.6875 -2.21875zm7.094467 3.5625l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm5.183304 0l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm8.433304 -1.9375l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0zm11.255371 0l2.796875 -13.359375l1.640625 0l-2.78125 13.359375l-1.65625 0zm6.613556 -11.484375l0.40625 -1.875l1.625 0l-0.390625 1.875l-1.640625 0zm-2.390625 11.484375l2.015625 -9.671875l1.65625 0l-2.03125 9.671875l-1.640625 0zm4.3635864 -3.3125l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm13.015625 1.96875l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m198.14961 280.1392l109.44881 0l0 53.700806l-109.44881 0z" fill-rule="evenodd"/><path fill="#000000" d="m223.58026 303.7467l1.640625 -0.09375q0 0.703125 0.21875 1.21875q0.21875 0.5 0.796875 0.8125q0.59375 0.3125 1.375 0.3125q1.09375 0 1.640625 -0.4375q0.546875 -0.4375 0.546875 -1.015625q0 -0.4375 -0.328125 -0.8125q-0.328125 -0.390625 -1.640625 -0.953125q-1.3125 -0.5625 -1.671875 -0.78125q-0.609375 -0.375 -0.921875 -0.875q-0.3125 -0.515625 -0.3125 -1.171875q0 -1.140625 0.90625 -1.953125q0.921875 -0.828125 2.5625 -0.828125q1.828125 0 2.765625 0.84375q0.953125 0.84375 1.0 2.21875l-1.609375 0.109375q-0.046875 -0.875 -0.625 -1.390625q-0.578125 -0.515625 -1.65625 -0.515625q-0.84375 0 -1.328125 0.40625q-0.46875 0.390625 -0.46875 0.84375q0 0.453125 0.40625 0.796875q0.28125 0.234375 1.421875 0.734375q1.890625 0.8125 2.375 1.28125q0.78125 0.765625 0.78125 1.84375q0 0.71875 -0.4375 1.421875q-0.4375 0.6875 -1.34375 1.109375q-0.90625 0.40625 -2.140625 0.40625q-1.671875 0 -2.84375 -0.828125q-1.1875 -0.828125 -1.109375 -2.703125zm9.1875 3.3125l2.796875 -13.359375l1.640625 0l-1.734375 8.28125l4.8125 -4.59375l2.171875 0l-4.125 3.609375l2.5 6.0625l-1.8125 0l-1.921875 -4.96875l-2.015625 1.734375l-0.671875 3.234375l-1.640625 0zm7.5 3.703125l0 -1.1875l10.875 0l0 1.1875l-10.875 0zm12.188217 -3.703125l2.78125 -13.359375l1.6562653 0l-1.0000153 4.78125q0.78126526 -0.71875 1.4218903 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.7031403 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59376526 0.640625 1.4843903 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.73439026 0.6875 -1.2343903 2.125q-0.375 1.0625 -0.375 1.78125zm14.531967 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.0007324 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.1832886 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0z" fill-rule="nonzero"/><path fill="#000000" fill-opacity="0.0" d="m163.81627 395.2362l178.11024 0l0 53.700806l-178.11024 0z" fill-rule="evenodd"/><path fill="#000000" d="m195.60925 418.62497l1.65625 0.171875q-0.625 1.8125 -1.765625 2.703125q-1.140625 0.875 -2.609375 0.875q-1.578125 0 -2.5625 -1.015625q-0.96875 -1.03125 -0.96875 -2.859375q0 -1.578125 0.625 -3.109375q0.640625 -1.53125 1.796875 -2.328125q1.171875 -0.796875 2.6875 -0.796875q1.546875 0 2.453125 0.875q0.921875 0.875 0.921875 2.328125l-1.625 0.109375q-0.015625 -0.921875 -0.546875 -1.4375q-0.515625 -0.515625 -1.359375 -0.515625q-1.0 0 -1.734375 0.625q-0.71875 0.625 -1.140625 1.90625q-0.40625 1.28125 -0.40625 2.46875q0 1.234375 0.546875 1.859375q0.546875 0.609375 1.34375 0.609375q0.796875 0 1.53125 -0.609375q0.734375 -0.609375 1.15625 -1.859375zm2.9375 -0.140625q0 -2.828125 1.671875 -4.6875q1.375 -1.53125 3.609375 -1.53125q1.75 0 2.8125 1.09375q1.078125 1.09375 1.078125 2.953125q0 1.65625 -0.671875 3.09375q-0.671875 1.4375 -1.921875 2.203125q-1.25 0.765625 -2.625 0.765625q-1.125 0 -2.046875 -0.484375q-0.921875 -0.484375 -1.421875 -1.359375q-0.484375 -0.890625 -0.484375 -2.046875zm1.65625 -0.15625q0 1.359375 0.65625 2.0625q0.65625 0.703125 1.65625 0.703125q0.53125 0 1.046875 -0.203125q0.53125 -0.21875 0.96875 -0.65625q0.453125 -0.4375 0.765625 -1.0q0.3125 -0.5625 0.5 -1.203125q0.28125 -0.90625 0.28125 -1.734375q0 -1.3125 -0.65625 -2.03125q-0.65625 -0.734375 -1.65625 -0.734375q-0.78125 0 -1.421875 0.375q-0.625 0.375 -1.140625 1.09375q-0.515625 0.703125 -0.765625 1.640625q-0.234375 0.9375 -0.234375 1.6875zm8.438217 3.828125l2.015625 -9.671875l1.5 0l-0.359375 1.6875q0.96875 -1.0 1.8125 -1.453125q0.859375 -0.453125 1.734375 -0.453125q1.1875 0 1.84375 0.640625q0.671875 0.625 0.671875 1.703125q0 0.53125 -0.234375 1.6875l-1.234375 5.859375l-1.640625 0l1.28125 -6.125q0.1875 -0.890625 0.1875 -1.328125q0 -0.484375 -0.328125 -0.78125q-0.328125 -0.296875 -0.953125 -0.296875q-1.28125 0 -2.265625 0.90625q-0.984375 0.90625 -1.453125 3.125l-0.9375 4.5l-1.640625 0zm14.219467 -1.34375l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm8.433304 -1.9375l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm7.406967 5.6875l4.21875 -4.90625l-2.421875 -4.765625l1.828125 0l0.8125 1.71875q0.453125 0.96875 0.828125 1.84375l2.78125 -3.5625l2.015625 0l-4.0625 4.890625l2.4375 4.78125l-1.8125 0l-0.96875 -1.96875q-0.3125 -0.625 -0.703125 -1.5625l-2.875 3.53125l-2.078125 0zm13.828125 -1.34375l-0.265625 1.359375q-0.59375 0.140625 -1.15625 0.140625q-0.984375 0 -1.5625 -0.46875q-0.4375 -0.375 -0.4375 -1.0q0 -0.3125 0.234375 -1.46875l1.171875 -5.625l-1.296875 0l0.265625 -1.265625l1.296875 0l0.5 -2.375l1.890625 -1.140625l-0.734375 3.515625l1.625 0l-0.28125 1.265625l-1.609375 0l-1.125 5.359375q-0.203125 1.015625 -0.203125 1.21875q0 0.28125 0.15625 0.4375q0.171875 0.15625 0.5625 0.15625q0.546875 0 0.96875 -0.109375zm11.210358 -0.8125l0 -3.671875l-3.640625 0l0 -1.515625l3.640625 0l0 -3.640625l1.546875 0l0 3.640625l3.640625 0l0 1.515625l-3.640625 0l0 3.671875l-1.546875 0zm11.390778 2.15625l2.78125 -13.359375l1.65625 0l-1.0 4.78125q0.78125 -0.71875 1.421875 -1.015625q0.640625 -0.296875 1.328125 -0.296875q1.359375 0 2.265625 1.015625q0.90625 1.0 0.90625 2.9375q0 1.28125 -0.375 2.359375q-0.359375 1.0625 -0.890625 1.78125q-0.53125 0.71875 -1.109375 1.15625q-0.578125 0.4375 -1.1875 0.640625q-0.59375 0.21875 -1.140625 0.21875q-0.96875 0 -1.703125 -0.5q-0.71875 -0.515625 -1.125 -1.546875l-0.390625 1.828125l-1.4375 0zm2.4375 -3.96875l-0.015625 0.3125q0 1.234375 0.59375 1.890625q0.59375 0.640625 1.484375 0.640625q0.859375 0 1.578125 -0.609375q0.734375 -0.609375 1.1875 -1.890625q0.46875 -1.28125 0.46875 -2.375q0 -1.21875 -0.59375 -1.890625q-0.578125 -0.671875 -1.4375 -0.671875q-0.90625 0 -1.65625 0.6875q-0.734375 0.6875 -1.234375 2.125q-0.375 1.0625 -0.375 1.78125zm14.531952 2.21875q-1.734375 1.96875 -3.5625 1.96875q-1.109375 0 -1.796875 -0.640625q-0.6875 -0.640625 -0.6875 -1.578125q0 -0.609375 0.296875 -2.09375l1.171875 -5.578125l1.65625 0l-1.296875 6.1875q-0.171875 0.765625 -0.171875 1.203125q0 0.546875 0.328125 0.859375q0.34375 0.296875 0.984375 0.296875q0.703125 0 1.359375 -0.328125q0.65625 -0.34375 1.125 -0.921875q0.484375 -0.578125 0.796875 -1.359375q0.1875 -0.5 0.453125 -1.765625l0.875 -4.171875l1.65625 0l-2.03125 9.671875l-1.515625 0l0.359375 -1.75zm4.0007324 1.75l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm5.1832886 0l1.765625 -8.40625l-1.484375 0l0.265625 -1.265625l1.484375 0l0.28125 -1.375q0.21875 -1.03125 0.4375 -1.484375q0.234375 -0.453125 0.75 -0.75q0.53125 -0.296875 1.4375 -0.296875q0.625 0 1.828125 0.265625l-0.296875 1.4375q-0.84375 -0.21875 -1.40625 -0.21875q-0.484375 0 -0.734375 0.25q-0.25 0.234375 -0.4375 1.125l-0.21875 1.046875l1.84375 0l-0.265625 1.265625l-1.84375 0l-1.75 8.40625l-1.65625 0zm12.058319 -3.28125l1.609375 0.15625q-0.34375 1.1875 -1.59375 2.265625q-1.234375 1.078125 -2.96875 1.078125q-1.0625 0 -1.96875 -0.5q-0.890625 -0.5 -1.359375 -1.4375q-0.46875 -0.953125 -0.46875 -2.15625q0 -1.59375 0.734375 -3.078125q0.734375 -1.484375 1.890625 -2.203125q1.171875 -0.734375 2.53125 -0.734375q1.734375 0 2.765625 1.078125q1.03125 1.0625 1.03125 2.921875q0 0.71875 -0.125 1.46875l-7.125 0q-0.046875 0.28125 -0.046875 0.5q0 1.359375 0.625 2.078125q0.625 0.71875 1.53125 0.71875q0.84375 0 1.65625 -0.546875q0.828125 -0.5625 1.28125 -1.609375zm-4.78125 -2.40625l5.421875 0q0.015625 -0.25 0.015625 -0.359375q0 -1.234375 -0.625 -1.890625q-0.625 -0.671875 -1.59375 -0.671875q-1.0625 0 -1.9375 0.734375q-0.859375 0.71875 -1.28125 2.1875zm8.063202 5.6875l2.015625 -9.671875l1.453125 0l-0.40625 1.96875q0.75 -1.109375 1.453125 -1.640625q0.71875 -0.546875 1.46875 -0.546875q0.5 0 1.21875 0.359375l-0.671875 1.53125q-0.4375 -0.3125 -0.9375 -0.3125q-0.875 0 -1.78125 0.96875q-0.90625 0.953125 -1.4375 3.46875l-0.8125 3.875l-1.5625 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m0 165.96588l118.74016 0l0 40.25197l-118.74016 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 165.96588l118.74016 0l0 40.25197l-118.74016 0z" fill-rule="evenodd"/><path fill="#000000" d="m23.145836 190.12123l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.5l-1.609375 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm13.5625 1.421875l0.234375 1.453125q-0.6875 0.140625 -1.234375 0.140625q-0.890625 0 -1.390625 -0.28125q-0.484375 -0.28125 -0.6875 -0.734375q-0.203125 -0.46875 -0.203125 -1.9375l0 -5.578125l-1.203125 0l0 -1.265625l1.203125 0l0 -2.390625l1.625 -0.984375l0 3.375l1.65625 0l0 1.265625l-1.65625 0l0 5.671875q0 0.6875 0.078125 0.890625q0.09375 0.203125 0.28125 0.328125q0.203125 0.109375 0.578125 0.109375q0.265625 0 0.71875 -0.0625zm1.5895538 1.46875l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm6.228302 3.703125l0 -13.375l1.484375 0l0 1.25q0.53125 -0.734375 1.1875 -1.09375q0.671875 -0.375 1.625 -0.375q1.234375 0 2.171875 0.640625q0.953125 0.625 1.4375 1.796875q0.484375 1.15625 0.484375 2.546875q0 1.484375 -0.53125 2.671875q-0.53125 1.1875 -1.546875 1.828125q-1.015625 0.625 -2.140625 0.625q-0.8125 0 -1.46875 -0.34375q-0.65625 -0.34375 -1.0625 -0.875l0 4.703125l-1.640625 0zm1.484375 -8.484375q0 1.859375 0.75 2.765625q0.765625 0.890625 1.828125 0.890625q1.09375 0 1.875 -0.921875q0.78125 -0.9375 0.78125 -2.875q0 -1.84375 -0.765625 -2.765625q-0.75 -0.921875 -1.8125 -0.921875q-1.046875 0 -1.859375 0.984375q-0.796875 0.96875 -0.796875 2.84375zm15.203842 3.59375q-0.921875 0.765625 -1.765625 1.09375q-0.828125 0.3125 -1.796875 0.3125q-1.59375 0 -2.453125 -0.78125q-0.859375 -0.78125 -0.859375 -1.984375q0 -0.71875 0.328125 -1.296875q0.328125 -0.59375 0.84375 -0.9375q0.53125 -0.359375 1.1875 -0.546875q0.46875 -0.125 1.453125 -0.25q1.984375 -0.234375 2.921875 -0.5625q0.015625 -0.34375 0.015625 -0.421875q0 -1.0 -0.46875 -1.421875q-0.625 -0.546875 -1.875 -0.546875q-1.15625 0 -1.703125 0.40625q-0.546875 0.40625 -0.8125 1.421875l-1.609375 -0.21875q0.21875 -1.015625 0.71875 -1.640625q0.5 -0.640625 1.453125 -0.984375q0.953125 -0.34375 2.1875 -0.34375q1.25 0 2.015625 0.296875q0.78125 0.28125 1.140625 0.734375q0.375 0.4375 0.515625 1.109375q0.078125 0.421875 0.078125 1.515625l0 2.1875q0 2.28125 0.109375 2.890625q0.109375 0.59375 0.40625 1.15625l-1.703125 0q-0.265625 -0.515625 -0.328125 -1.1875zm-0.140625 -3.671875q-0.890625 0.375 -2.671875 0.625q-1.015625 0.140625 -1.4375 0.328125q-0.421875 0.1875 -0.65625 0.53125q-0.21875 0.34375 -0.21875 0.78125q0 0.65625 0.5 1.09375q0.5 0.4375 1.453125 0.4375q0.9375 0 1.671875 -0.40625q0.75 -0.421875 1.09375 -1.140625q0.265625 -0.5625 0.265625 -1.640625l0 -0.609375zm4.188217 4.859375l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0zm5.572052 -2.890625l1.625 -0.25q0.125 0.96875 0.75 1.5q0.625 0.515625 1.75 0.515625q1.125 0 1.671875 -0.453125q0.546875 -0.46875 0.546875 -1.09375q0 -0.546875 -0.484375 -0.875q-0.328125 -0.21875 -1.671875 -0.546875q-1.8125 -0.46875 -2.515625 -0.796875q-0.6875 -0.328125 -1.046875 -0.90625q-0.359375 -0.59375 -0.359375 -1.3125q0 -0.640625 0.296875 -1.1875q0.296875 -0.5625 0.8125 -0.921875q0.375 -0.28125 1.03125 -0.46875q0.671875 -0.203125 1.421875 -0.203125q1.140625 0 2.0 0.328125q0.859375 0.328125 1.265625 0.890625q0.421875 0.5625 0.578125 1.5l-1.609375 0.21875q-0.109375 -0.75 -0.640625 -1.171875q-0.515625 -0.421875 -1.46875 -0.421875q-1.140625 0 -1.625 0.375q-0.46875 0.375 -0.46875 0.875q0 0.3125 0.1875 0.578125q0.203125 0.265625 0.640625 0.4375q0.234375 0.09375 1.4375 0.421875q1.75 0.453125 2.4375 0.75q0.6875 0.296875 1.078125 0.859375q0.390625 0.5625 0.390625 1.40625q0 0.828125 -0.484375 1.546875q-0.46875 0.71875 -1.375 1.125q-0.90625 0.390625 -2.046875 0.390625q-1.875 0 -2.875 -0.78125q-0.984375 -0.78125 -1.25 -2.328125zm16.609375 -0.21875l1.6875 0.203125q-0.40625 1.484375 -1.484375 2.3125q-1.078125 0.8125 -2.765625 0.8125q-2.125 0 -3.375 -1.296875q-1.234375 -1.3125 -1.234375 -3.671875q0 -2.453125 1.25 -3.796875q1.265625 -1.34375 3.265625 -1.34375q1.9375 0 3.15625 1.328125q1.234375 1.3125 1.234375 3.703125q0 0.15625 0 0.4375l-7.21875 0q0.09375 1.59375 0.90625 2.453125q0.8125 0.84375 2.015625 0.84375q0.90625 0 1.546875 -0.46875q0.640625 -0.484375 1.015625 -1.515625zm-5.390625 -2.65625l5.40625 0q-0.109375 -1.21875 -0.625 -1.828125q-0.78125 -0.953125 -2.03125 -0.953125q-1.125 0 -1.90625 0.765625q-0.765625 0.75 -0.84375 2.015625zm9.125717 5.765625l0 -9.671875l1.46875 0l0 1.46875q0.5625 -1.03125 1.03125 -1.359375q0.484375 -0.328125 1.0625 -0.328125q0.828125 0 1.6875 0.53125l-0.5625 1.515625q-0.609375 -0.359375 -1.203125 -0.359375q-0.546875 0 -0.96875 0.328125q-0.421875 0.328125 -0.609375 0.890625q-0.28125 0.875 -0.28125 1.921875l0 5.0625l-1.625 0z" fill-rule="nonzero"/></g></svg>
diff --git a/Documentation/networking/tls-offload-reorder-bad.svg b/Documentation/networking/tls-offload-reorder-bad.svg
new file mode 100644 (file)
index 0000000..d107aaf
--- /dev/null
@@ -0,0 +1 @@
+<svg version="1.1" viewBox="0.0 0.0 672.0 68.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#b6d7a8" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m15.953125 52.942722l-1.640625 0l0 -10.453125q-0.59375 0.5625 -1.5625 1.140625q-0.953125 0.5625 -1.71875 0.84375l0 -1.59375q1.375 -0.640625 2.40625 -1.5625q1.03125 -0.921875 1.453125 -1.78125l1.0625 0l0 13.40625z" fill-rule="nonzero"/><path fill="#c9daf8" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m355.73022 52.942722l0 -3.203125l-5.796875 0l0 -1.5l6.09375 -8.65625l1.34375 0l0 8.65625l1.796875 0l0 1.5l-1.796875 0l0 3.203125l-1.640625 0zm0 -4.703125l0 -6.015625l-4.1875 6.015625l4.1875 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m235.15652 49.411472l1.640625 -0.21875q0.28125 1.40625 0.953125 2.015625q0.6875 0.609375 1.65625 0.609375q1.15625 0 1.953125 -0.796875q0.796875 -0.796875 0.796875 -1.984375q0 -1.125 -0.734375 -1.859375q-0.734375 -0.734375 -1.875 -0.734375q-0.46875 0 -1.15625 0.171875l0.1875 -1.4375q0.15625 0.015625 0.265625 0.015625q1.046875 0 1.875 -0.546875q0.84375 -0.546875 0.84375 -1.671875q0 -0.90625 -0.609375 -1.5q-0.609375 -0.59375 -1.578125 -0.59375q-0.953125 0 -1.59375 0.609375q-0.640625 0.59375 -0.8125 1.796875l-1.640625 -0.296875q0.296875 -1.640625 1.359375 -2.546875q1.0625 -0.90625 2.65625 -0.90625q1.09375 0 2.0 0.46875q0.921875 0.46875 1.40625 1.28125q0.5 0.8125 0.5 1.71875q0 0.859375 -0.46875 1.578125q-0.46875 0.703125 -1.375 1.125q1.1875 0.28125 1.84375 1.140625q0.65625 0.859375 0.65625 2.15625q0 1.734375 -1.28125 2.953125q-1.265625 1.21875 -3.21875 1.21875q-1.765625 0 -2.921875 -1.046875q-1.15625 -1.046875 -1.328125 -2.71875z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m590.72015 51.364597l0 1.578125l-8.828125 0q-0.015625 -0.59375 0.1875 -1.140625q0.34375 -0.90625 1.078125 -1.78125q0.75 -0.875 2.15625 -2.015625q2.171875 -1.78125 2.9375 -2.828125q0.765625 -1.046875 0.765625 -1.96875q0 -0.984375 -0.703125 -1.640625q-0.6875 -0.671875 -1.8125 -0.671875q-1.1875 0 -1.90625 0.71875q-0.703125 0.703125 -0.703125 1.953125l-1.6875 -0.171875q0.171875 -1.890625 1.296875 -2.875q1.140625 -0.984375 3.03125 -0.984375q1.921875 0 3.046875 1.0625q1.125 1.0625 1.125 2.640625q0 0.796875 -0.328125 1.578125q-0.328125 0.78125 -1.09375 1.640625q-0.75 0.84375 -2.53125 2.34375q-1.46875 1.234375 -1.890625 1.6875q-0.421875 0.4375 -0.6875 0.875l6.546875 0z" fill-rule="nonzero"/><path fill="#e06666" d="m615.56793 24.999102l6.5512085 0l0 42.04725l-6.5512085 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m615.56793 24.999102l6.5512085 0l0 42.04725l-6.5512085 0z" fill-rule="evenodd"/><path fill="#c9daf8" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path fill="#000000" d="m466.2955 49.442722l1.71875 -0.140625q0.1875 1.25 0.875 1.890625q0.703125 0.625 1.6875 0.625q1.1875 0 2.0 -0.890625q0.828125 -0.890625 0.828125 -2.359375q0 -1.40625 -0.796875 -2.21875q-0.78125 -0.8125 -2.0625 -0.8125q-0.78125 0 -1.421875 0.359375q-0.640625 0.359375 -1.0 0.9375l-1.546875 -0.203125l1.296875 -6.859375l6.640625 0l0 1.5625l-5.328125 0l-0.71875 3.59375q1.203125 -0.84375 2.515625 -0.84375q1.75 0 2.953125 1.21875q1.203125 1.203125 1.203125 3.109375q0 1.8125 -1.046875 3.140625q-1.296875 1.625 -3.515625 1.625q-1.8125 0 -2.96875 -1.015625q-1.15625 -1.03125 -1.3125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m391.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m391.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m163.95024 24.999102c0 -12.5 114.47246 -25.007874 228.9449 -25.0c114.47241 0.007874016 228.94489 12.531496 228.94489 25.062992" fill-rule="evenodd"/><path stroke="#000000" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m163.95024 24.9991c0 -12.499998 114.47246 -25.007872 228.9449 -24.999998c57.236206 0.003937008 114.47244 3.136811 157.3996 7.835138c21.463562 2.3491635 39.349915 5.0896897 51.8703 8.026144c3.130127 0.7341137 5.9248657 1.4804726 8.356262 2.236023c0.30395508 0.09444237 0.6022339 0.1890316 0.89471436 0.28375435l0.37457275 0.12388611" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="2.0" stroke-linecap="butt" d="m609.98517 21.270555l9.406311 2.1936665l-5.7955933 -7.7266836z" fill-rule="evenodd"/><path fill="#e06666" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/></g></svg>
diff --git a/Documentation/networking/tls-offload-reorder-good.svg b/Documentation/networking/tls-offload-reorder-good.svg
new file mode 100644 (file)
index 0000000..10e17d9
--- /dev/null
@@ -0,0 +1 @@
+<svg version="1.1" viewBox="0.0 0.0 672.0 68.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><path d="m0 0l960.0 0l0 720.0l-960.0 0l0 -720.0z" clip-rule="nonzero"/></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l960.0 0l0 720.0l-960.0 0z" fill-rule="evenodd"/><path fill="#b6d7a8" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m0 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m15.953125 52.942722l-1.640625 0l0 -10.453125q-0.59375 0.5625 -1.5625 1.140625q-0.953125 0.5625 -1.71875 0.84375l0 -1.59375q1.375 -0.640625 2.40625 -1.5625q1.03125 -0.921875 1.453125 -1.78125l1.0625 0l0 13.40625z" fill-rule="nonzero"/><path fill="#b6d7a8" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m340.69897 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m355.73022 52.942722l0 -3.203125l-5.796875 0l0 -1.5l6.09375 -8.65625l1.34375 0l0 8.65625l1.796875 0l0 1.5l-1.796875 0l0 3.203125l-1.640625 0zm0 -4.703125l0 -6.015625l-4.1875 6.015625l4.1875 0z" fill-rule="nonzero"/><path fill="#cfe2f3" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m225.37527 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m235.15652 49.411472l1.640625 -0.21875q0.28125 1.40625 0.953125 2.015625q0.6875 0.609375 1.65625 0.609375q1.15625 0 1.953125 -0.796875q0.796875 -0.796875 0.796875 -1.984375q0 -1.125 -0.734375 -1.859375q-0.734375 -0.734375 -1.875 -0.734375q-0.46875 0 -1.15625 0.171875l0.1875 -1.4375q0.15625 0.015625 0.265625 0.015625q1.046875 0 1.875 -0.546875q0.84375 -0.546875 0.84375 -1.671875q0 -0.90625 -0.609375 -1.5q-0.609375 -0.59375 -1.578125 -0.59375q-0.953125 0 -1.59375 0.609375q-0.640625 0.59375 -0.8125 1.796875l-1.640625 -0.296875q0.296875 -1.640625 1.359375 -2.546875q1.0625 -0.90625 2.65625 -0.90625q1.09375 0 2.0 0.46875q0.921875 0.46875 1.40625 1.28125q0.5 0.8125 0.5 1.71875q0 0.859375 -0.46875 1.578125q-0.46875 0.703125 -1.375 1.125q1.1875 0.28125 1.84375 1.140625q0.65625 0.859375 0.65625 2.15625q0 1.734375 -1.28125 2.953125q-1.265625 1.21875 -3.21875 1.21875q-1.765625 0 -2.921875 -1.046875q-1.15625 -1.046875 -1.328125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m271.56793 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m271.56793 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#cfe2f3" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m572.3295 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" d="m590.72015 51.364597l0 1.578125l-8.828125 0q-0.015625 -0.59375 0.1875 -1.140625q0.34375 -0.90625 1.078125 -1.78125q0.75 -0.875 2.15625 -2.015625q2.171875 -1.78125 2.9375 -2.828125q0.765625 -1.046875 0.765625 -1.96875q0 -0.984375 -0.703125 -1.640625q-0.6875 -0.671875 -1.8125 -0.671875q-1.1875 0 -1.90625 0.71875q-0.703125 0.703125 -0.703125 1.953125l-1.6875 -0.171875q0.171875 -1.890625 1.296875 -2.875q1.140625 -0.984375 3.03125 -0.984375q1.921875 0 3.046875 1.0625q1.125 1.0625 1.125 2.640625q0 0.796875 -0.328125 1.578125q-0.328125 0.78125 -1.09375 1.640625q-0.75 0.84375 -2.53125 2.34375q-1.46875 1.234375 -1.890625 1.6875q-0.421875 0.4375 -0.6875 0.875l6.546875 0z" fill-rule="nonzero"/><path fill="#b6d7a8" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m456.51425 24.999102l99.02365 0l0 42.04725l-99.02365 0z" fill-rule="evenodd"/><path fill="#000000" d="m466.2955 49.442722l1.71875 -0.140625q0.1875 1.25 0.875 1.890625q0.703125 0.625 1.6875 0.625q1.1875 0 2.0 -0.890625q0.828125 -0.890625 0.828125 -2.359375q0 -1.40625 -0.796875 -2.21875q-0.78125 -0.8125 -2.0625 -0.8125q-0.78125 0 -1.421875 0.359375q-0.640625 0.359375 -1.0 0.9375l-1.546875 -0.203125l1.296875 -6.859375l6.640625 0l0 1.5625l-5.328125 0l-0.71875 3.59375q1.203125 -0.84375 2.515625 -0.84375q1.75 0 2.953125 1.21875q1.203125 1.203125 1.203125 3.109375q0 1.8125 -1.046875 3.140625q-1.296875 1.625 -3.515625 1.625q-1.8125 0 -2.96875 -1.015625q-1.15625 -1.03125 -1.3125 -2.71875z" fill-rule="nonzero"/><path fill="#e06666" d="m503.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m503.1985 24.999102l6.551178 0l0 42.04725l-6.551178 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="4.0,3.0" d="m114.43843 24.999102l99.02362 0l0 42.04725l-99.02362 0z" fill-rule="evenodd"/><path fill="#000000" fill-opacity="0.0" d="m163.95024 24.999102c0 -12.5 114.47246 -25.007874 228.9449 -25.0c114.47241 0.007874016 228.94489 12.531496 228.94489 25.062992" fill-rule="evenodd"/><path stroke="#000000" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="butt" d="m163.95024 24.9991c0 -12.499998 114.47246 -25.007872 228.9449 -24.999998c57.236206 0.003937008 114.47244 3.136811 157.3996 7.835138c21.463562 2.3491635 39.349915 5.0896897 51.8703 8.026144c3.130127 0.7341137 5.9248657 1.4804726 8.356262 2.236023c0.30395508 0.09444237 0.6022339 0.1890316 0.89471436 0.28375435l0.37457275 0.12388611" fill-rule="evenodd"/><path fill="#000000" stroke="#000000" stroke-width="2.0" stroke-linecap="butt" d="m609.98517 21.270555l9.406311 2.1936665l-5.7955933 -7.7266836z" fill-rule="evenodd"/><path fill="#e06666" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m47.56793 24.999102l6.551182 0l0 42.04725l-6.551182 0z" fill-rule="evenodd"/></g></svg>
diff --git a/Documentation/networking/tls-offload.rst b/Documentation/networking/tls-offload.rst
new file mode 100644 (file)
index 0000000..cb85af5
--- /dev/null
@@ -0,0 +1,482 @@
+.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+
+==================
+Kernel TLS offload
+==================
+
+Kernel TLS operation
+====================
+
+Linux kernel provides TLS connection offload infrastructure. Once a TCP
+connection is in ``ESTABLISHED`` state user space can enable the TLS Upper
+Layer Protocol (ULP) and install the cryptographic connection state.
+For details regarding the user-facing interface refer to the TLS
+documentation in :ref:`Documentation/networking/tls.rst <kernel_tls>`.
+
+``ktls`` can operate in three modes:
+
+ * Software crypto mode (``TLS_SW``) - CPU handles the cryptography.
+   In most basic cases only crypto operations synchronous with the CPU
+   can be used, but depending on calling context CPU may utilize
+   asynchronous crypto accelerators. The use of accelerators introduces extra
+   latency on socket reads (decryption only starts when a read syscall
+   is made) and additional I/O load on the system.
+ * Packet-based NIC offload mode (``TLS_HW``) - the NIC handles crypto
+   on a packet by packet basis, provided the packets arrive in order.
+   This mode integrates best with the kernel stack and is described in detail
+   in the remaining part of this document
+   (``ethtool`` flags ``tls-hw-tx-offload`` and ``tls-hw-rx-offload``).
+ * Full TCP NIC offload mode (``TLS_HW_RECORD``) - mode of operation where
+   NIC driver and firmware replace the kernel networking stack
+   with its own TCP handling, it is not usable in production environments
+   making use of the Linux networking stack for example any firewalling
+   abilities or QoS and packet scheduling (``ethtool`` flag ``tls-hw-record``).
+
+The operation mode is selected automatically based on device configuration,
+offload opt-in or opt-out on per-connection basis is not currently supported.
+
+TX
+--
+
+At a high level user write requests are turned into a scatter list, the TLS ULP
+intercepts them, inserts record framing, performs encryption (in ``TLS_SW``
+mode) and then hands the modified scatter list to the TCP layer. From this
+point on the TCP stack proceeds as normal.
+
+In ``TLS_HW`` mode the encryption is not performed in the TLS ULP.
+Instead packets reach a device driver, the driver will mark the packets
+for crypto offload based on the socket the packet is attached to,
+and send them to the device for encryption and transmission.
+
+RX
+--
+
+On the receive side if the device handled decryption and authentication
+successfully, the driver will set the decrypted bit in the associated
+:c:type:`struct sk_buff <sk_buff>`. The packets reach the TCP stack and
+are handled normally. ``ktls`` is informed when data is queued to the socket
+and the ``strparser`` mechanism is used to delineate the records. Upon read
+request, records are retrieved from the socket and passed to decryption routine.
+If device decrypted all the segments of the record the decryption is skipped,
+otherwise software path handles decryption.
+
+.. kernel-figure::  tls-offload-layers.svg
+   :alt:       TLS offload layers
+   :align:     center
+   :figwidth:  28em
+
+   Layers of Kernel TLS stack
+
+Device configuration
+====================
+
+During driver initialization device sets the ``NETIF_F_HW_TLS_RX`` and
+``NETIF_F_HW_TLS_TX`` features and installs its
+:c:type:`struct tlsdev_ops <tlsdev_ops>`
+pointer in the :c:member:`tlsdev_ops` member of the
+:c:type:`struct net_device <net_device>`.
+
+When TLS cryptographic connection state is installed on a ``ktls`` socket
+(note that it is done twice, once for RX and once for TX direction,
+and the two are completely independent), the kernel checks if the underlying
+network device is offload-capable and attempts the offload. In case offload
+fails the connection is handled entirely in software using the same mechanism
+as if the offload was never tried.
+
+Offload request is performed via the :c:member:`tls_dev_add` callback of
+:c:type:`struct tlsdev_ops <tlsdev_ops>`:
+
+.. code-block:: c
+
+       int (*tls_dev_add)(struct net_device *netdev, struct sock *sk,
+                          enum tls_offload_ctx_dir direction,
+                          struct tls_crypto_info *crypto_info,
+                          u32 start_offload_tcp_sn);
+
+``direction`` indicates whether the cryptographic information is for
+the received or transmitted packets. Driver uses the ``sk`` parameter
+to retrieve the connection 5-tuple and socket family (IPv4 vs IPv6).
+Cryptographic information in ``crypto_info`` includes the key, iv, salt
+as well as TLS record sequence number. ``start_offload_tcp_sn`` indicates
+which TCP sequence number corresponds to the beginning of the record with
+sequence number from ``crypto_info``. The driver can add its state
+at the end of kernel structures (see :c:member:`driver_state` members
+in ``include/net/tls.h``) to avoid additional allocations and pointer
+dereferences.
+
+TX
+--
+
+After TX state is installed, the stack guarantees that the first segment
+of the stream will start exactly at the ``start_offload_tcp_sn`` sequence
+number, simplifying TCP sequence number matching.
+
+TX offload being fully initialized does not imply that all segments passing
+through the driver and which belong to the offloaded socket will be after
+the expected sequence number and will have kernel record information.
+In particular, already encrypted data may have been queued to the socket
+before installing the connection state in the kernel.
+
+RX
+--
+
+In RX direction local networking stack has little control over the segmentation,
+so the initial records' TCP sequence number may be anywhere inside the segment.
+
+Normal operation
+================
+
+At the minimum the device maintains the following state for each connection, in
+each direction:
+
+ * crypto secrets (key, iv, salt)
+ * crypto processing state (partial blocks, partial authentication tag, etc.)
+ * record metadata (sequence number, processing offset and length)
+ * expected TCP sequence number
+
+There are no guarantees on record length or record segmentation. In particular
+segments may start at any point of a record and contain any number of records.
+Assuming segments are received in order, the device should be able to perform
+crypto operations and authentication regardless of segmentation. For this
+to be possible device has to keep small amount of segment-to-segment state.
+This includes at least:
+
+ * partial headers (if a segment carried only a part of the TLS header)
+ * partial data block
+ * partial authentication tag (all data had been seen but part of the
+   authentication tag has to be written or read from the subsequent segment)
+
+Record reassembly is not necessary for TLS offload. If the packets arrive
+in order the device should be able to handle them separately and make
+forward progress.
+
+TX
+--
+
+The kernel stack performs record framing reserving space for the authentication
+tag and populating all other TLS header and tailer fields.
+
+Both the device and the driver maintain expected TCP sequence numbers
+due to the possibility of retransmissions and the lack of software fallback
+once the packet reaches the device.
+For segments passed in order, the driver marks the packets with
+a connection identifier (note that a 5-tuple lookup is insufficient to identify
+packets requiring HW offload, see the :ref:`5tuple_problems` section)
+and hands them to the device. The device identifies the packet as requiring
+TLS handling and confirms the sequence number matches its expectation.
+The device performs encryption and authentication of the record data.
+It replaces the authentication tag and TCP checksum with correct values.
+
+RX
+--
+
+Before a packet is DMAed to the host (but after NIC's embedded switching
+and packet transformation functions) the device validates the Layer 4
+checksum and performs a 5-tuple lookup to find any TLS connection the packet
+may belong to (technically a 4-tuple
+lookup is sufficient - IP addresses and TCP port numbers, as the protocol
+is always TCP). If connection is matched device confirms if the TCP sequence
+number is the expected one and proceeds to TLS handling (record delineation,
+decryption, authentication for each record in the packet). The device leaves
+the record framing unmodified, the stack takes care of record decapsulation.
+Device indicates successful handling of TLS offload in the per-packet context
+(descriptor) passed to the host.
+
+Upon reception of a TLS offloaded packet, the driver sets
+the :c:member:`decrypted` mark in :c:type:`struct sk_buff <sk_buff>`
+corresponding to the segment. Networking stack makes sure decrypted
+and non-decrypted segments do not get coalesced (e.g. by GRO or socket layer)
+and takes care of partial decryption.
+
+Resync handling
+===============
+
+In presence of packet drops or network packet reordering, the device may lose
+synchronization with the TLS stream, and require a resync with the kernel's
+TCP stack.
+
+Note that resync is only attempted for connections which were successfully
+added to the device table and are in TLS_HW mode. For example,
+if the table was full when cryptographic state was installed in the kernel,
+such connection will never get offloaded. Therefore the resync request
+does not carry any cryptographic connection state.
+
+TX
+--
+
+Segments transmitted from an offloaded socket can get out of sync
+in similar ways to the receive side-retransmissions - local drops
+are possible, though network reorders are not.
+
+Whenever an out of order segment is transmitted the driver provides
+the device with enough information to perform cryptographic operations.
+This means most likely that the part of the record preceding the current
+segment has to be passed to the device as part of the packet context,
+together with its TCP sequence number and TLS record number. The device
+can then initialize its crypto state, process and discard the preceding
+data (to be able to insert the authentication tag) and move onto handling
+the actual packet.
+
+In this mode depending on the implementation the driver can either ask
+for a continuation with the crypto state and the new sequence number
+(next expected segment is the one after the out of order one), or continue
+with the previous stream state - assuming that the out of order segment
+was just a retransmission. The former is simpler, and does not require
+retransmission detection therefore it is the recommended method until
+such time it is proven inefficient.
+
+RX
+--
+
+A small amount of RX reorder events may not require a full resynchronization.
+In particular the device should not lose synchronization
+when record boundary can be recovered:
+
+.. kernel-figure::  tls-offload-reorder-good.svg
+   :alt:       reorder of non-header segment
+   :align:     center
+
+   Reorder of non-header segment
+
+Green segments are successfully decrypted, blue ones are passed
+as received on wire, red stripes mark start of new records.
+
+In above case segment 1 is received and decrypted successfully.
+Segment 2 was dropped so 3 arrives out of order. The device knows
+the next record starts inside 3, based on record length in segment 1.
+Segment 3 is passed untouched, because due to lack of data from segment 2
+the remainder of the previous record inside segment 3 cannot be handled.
+The device can, however, collect the authentication algorithm's state
+and partial block from the new record in segment 3 and when 4 and 5
+arrive continue decryption. Finally when 2 arrives it's completely outside
+of expected window of the device so it's passed as is without special
+handling. ``ktls`` software fallback handles the decryption of record
+spanning segments 1, 2 and 3. The device did not get out of sync,
+even though two segments did not get decrypted.
+
+Kernel synchronization may be necessary if the lost segment contained
+a record header and arrived after the next record header has already passed:
+
+.. kernel-figure::  tls-offload-reorder-bad.svg
+   :alt:       reorder of header segment
+   :align:     center
+
+   Reorder of segment with a TLS header
+
+In this example segment 2 gets dropped, and it contains a record header.
+Device can only detect that segment 4 also contains a TLS header
+if it knows the length of the previous record from segment 2. In this case
+the device will lose synchronization with the stream.
+
+When the device gets out of sync and the stream reaches TCP sequence
+numbers more than a max size record past the expected TCP sequence number,
+the device starts scanning for a known header pattern. For example
+for TLS 1.2 and TLS 1.3 subsequent bytes of value ``0x03 0x03`` occur
+in the SSL/TLS version field of the header. Once pattern is matched
+the device continues attempting parsing headers at expected locations
+(based on the length fields at guessed locations).
+Whenever the expected location does not contain a valid header the scan
+is restarted.
+
+When the header is matched the device sends a confirmation request
+to the kernel, asking if the guessed location is correct (if a TLS record
+really starts there), and which record sequence number the given header had.
+The kernel confirms the guessed location was correct and tells the device
+the record sequence number. Meanwhile, the device had been parsing
+and counting all records since the just-confirmed one, it adds the number
+of records it had seen to the record number provided by the kernel.
+At this point the device is in sync and can resume decryption at next
+segment boundary.
+
+In a pathological case the device may latch onto a sequence of matching
+headers and never hear back from the kernel (there is no negative
+confirmation from the kernel). The implementation may choose to periodically
+restart scan. Given how unlikely falsely-matching stream is, however,
+periodic restart is not deemed necessary.
+
+Special care has to be taken if the confirmation request is passed
+asynchronously to the packet stream and record may get processed
+by the kernel before the confirmation request.
+
+Error handling
+==============
+
+TX
+--
+
+Packets may be redirected or rerouted by the stack to a different
+device than the selected TLS offload device. The stack will handle
+such condition using the :c:func:`sk_validate_xmit_skb` helper
+(TLS offload code installs :c:func:`tls_validate_xmit_skb` at this hook).
+Offload maintains information about all records until the data is
+fully acknowledged, so if skbs reach the wrong device they can be handled
+by software fallback.
+
+Any device TLS offload handling error on the transmission side must result
+in the packet being dropped. For example if a packet got out of order
+due to a bug in the stack or the device, reached the device and can't
+be encrypted such packet must be dropped.
+
+RX
+--
+
+If the device encounters any problems with TLS offload on the receive
+side it should pass the packet to the host's networking stack as it was
+received on the wire.
+
+For example authentication failure for any record in the segment should
+result in passing the unmodified packet to the software fallback. This means
+packets should not be modified "in place". Splitting segments to handle partial
+decryption is not advised. In other words either all records in the packet
+had been handled successfully and authenticated or the packet has to be passed
+to the host's stack as it was on the wire (recovering original packet in the
+driver if device provides precise error is sufficient).
+
+The Linux networking stack does not provide a way of reporting per-packet
+decryption and authentication errors, packets with errors must simply not
+have the :c:member:`decrypted` mark set.
+
+A packet should also not be handled by the TLS offload if it contains
+incorrect checksums.
+
+Performance metrics
+===================
+
+TLS offload can be characterized by the following basic metrics:
+
+ * max connection count
+ * connection installation rate
+ * connection installation latency
+ * total cryptographic performance
+
+Note that each TCP connection requires a TLS session in both directions,
+the performance may be reported treating each direction separately.
+
+Max connection count
+--------------------
+
+The number of connections device can support can be exposed via
+``devlink resource`` API.
+
+Total cryptographic performance
+-------------------------------
+
+Offload performance may depend on segment and record size.
+
+Overload of the cryptographic subsystem of the device should not have
+significant performance impact on non-offloaded streams.
+
+Statistics
+==========
+
+Following minimum set of TLS-related statistics should be reported
+by the driver:
+
+ * ``rx_tls_decrypted`` - number of successfully decrypted TLS segments
+ * ``tx_tls_encrypted`` - number of in-order TLS segments passed to device
+   for encryption
+ * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream
+   but did not arrive in the expected order
+ * ``tx_tls_drop_no_sync_data`` - number of TX packets dropped because
+   they arrived out of order and associated record could not be found
+   (see also :ref:`pre_tls_data`)
+
+Notable corner cases, exceptions and additional requirements
+============================================================
+
+.. _5tuple_problems:
+
+5-tuple matching limitations
+----------------------------
+
+The device can only recognize received packets based on the 5-tuple
+of the socket. Current ``ktls`` implementation will not offload sockets
+routed through software interfaces such as those used for tunneling
+or virtual networking. However, many packet transformations performed
+by the networking stack (most notably any BPF logic) do not require
+any intermediate software device, therefore a 5-tuple match may
+consistently miss at the device level. In such cases the device
+should still be able to perform TX offload (encryption) and should
+fallback cleanly to software decryption (RX).
+
+Out of order
+------------
+
+Introducing extra processing in NICs should not cause packets to be
+transmitted or received out of order, for example pure ACK packets
+should not be reordered with respect to data segments.
+
+Ingress reorder
+---------------
+
+A device is permitted to perform packet reordering for consecutive
+TCP segments (i.e. placing packets in the correct order) but any form
+of additional buffering is disallowed.
+
+Coexistence with standard networking offload features
+-----------------------------------------------------
+
+Offloaded ``ktls`` sockets should support standard TCP stack features
+transparently. Enabling device TLS offload should not cause any difference
+in packets as seen on the wire.
+
+Transport layer transparency
+----------------------------
+
+The device should not modify any packet headers for the purpose
+of the simplifying TLS offload.
+
+The device should not depend on any packet headers beyond what is strictly
+necessary for TLS offload.
+
+Segment drops
+-------------
+
+Dropping packets is acceptable only in the event of catastrophic
+system errors and should never be used as an error handling mechanism
+in cases arising from normal operation. In other words, reliance
+on TCP retransmissions to handle corner cases is not acceptable.
+
+TLS device features
+-------------------
+
+Drivers should ignore the changes to TLS the device feature flags.
+These flags will be acted upon accordingly by the core ``ktls`` code.
+TLS device feature flags only control adding of new TLS connection
+offloads, old connections will remain active after flags are cleared.
+
+Known bugs
+==========
+
+skb_orphan() leaks clear text
+-----------------------------
+
+Currently drivers depend on the :c:member:`sk` member of
+:c:type:`struct sk_buff <sk_buff>` to identify segments requiring
+encryption. Any operation which removes or does not preserve the socket
+association such as :c:func:`skb_orphan` or :c:func:`skb_clone`
+will cause the driver to miss the packets and lead to clear text leaks.
+
+Redirects leak clear text
+-------------------------
+
+In the RX direction, if segment has already been decrypted by the device
+and it gets redirected or mirrored - clear text will be transmitted out.
+
+.. _pre_tls_data:
+
+Transmission of pre-TLS data
+----------------------------
+
+User can enqueue some already encrypted and framed records before enabling
+``ktls`` on the socket. Those records have to get sent as they are. This is
+perfectly easy to handle in the software case - such data will be waiting
+in the TCP layer, TLS ULP won't see it. In the offloaded case when pre-queued
+segment reaches transmission point it appears to be out of order (before the
+expected TCP sequence number) and the stack does not have a record information
+associated.
+
+All segments without record information cannot, however, be assumed to be
+pre-queued data, because a race condition exists between TCP stack queuing
+a retransmission, the driver seeing the retransmission and TCP ACK arriving
+for the retransmitted data.
similarity index 88%
rename from Documentation/networking/tls.txt
rename to Documentation/networking/tls.rst
index 58b5ef7..5bcbf75 100644 (file)
@@ -1,3 +1,9 @@
+.. _kernel_tls:
+
+==========
+Kernel TLS
+==========
+
 Overview
 ========
 
@@ -12,6 +18,8 @@ Creating a TLS connection
 
 First create a new TCP socket and set the TLS ULP.
 
+.. code-block:: c
+
   sock = socket(AF_INET, SOCK_STREAM, 0);
   setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls"));
 
@@ -21,6 +29,8 @@ handshake is complete, we have all the parameters required to move the
 data-path to the kernel. There is a separate socket option for moving
 the transmit and the receive into the kernel.
 
+.. code-block:: c
+
   /* From linux/tls.h */
   struct tls_crypto_info {
           unsigned short version;
@@ -58,6 +68,8 @@ After setting the TLS_TX socket option all application data sent over this
 socket is encrypted using TLS and the parameters provided in the socket option.
 For example, we can send an encrypted hello world record as follows:
 
+.. code-block:: c
+
   const char *msg = "hello world\n";
   send(sock, msg, strlen(msg));
 
@@ -67,6 +79,8 @@ to the encrypted kernel send buffer if possible.
 The sendfile system call will send the file's data over TLS records of maximum
 length (2^14).
 
+.. code-block:: c
+
   file = open(filename, O_RDONLY);
   fstat(file, &stat);
   sendfile(sock, file, &offset, stat.st_size);
@@ -89,6 +103,8 @@ After setting the TLS_RX socket option, all recv family socket calls
 are decrypted using TLS parameters provided.  A full TLS record must
 be received before decryption can happen.
 
+.. code-block:: c
+
   char buffer[16384];
   recv(sock, buffer, 16384);
 
@@ -97,12 +113,12 @@ large enough, and no additional allocations occur.  If the userspace
 buffer is too small, data is decrypted in the kernel and copied to
 userspace.
 
-EINVAL is returned if the TLS version in the received message does not
+``EINVAL`` is returned if the TLS version in the received message does not
 match the version passed in setsockopt.
 
-EMSGSIZE is returned if the received message is too big.
+``EMSGSIZE`` is returned if the received message is too big.
 
-EBADMSG is returned if decryption failed for any other reason.
+``EBADMSG`` is returned if decryption failed for any other reason.
 
 Send TLS control messages
 -------------------------
@@ -113,9 +129,11 @@ These messages can be sent over the socket by providing the TLS record type
 via a CMSG. For example the following function sends @data of @length bytes
 using a record of type @record_type.
 
-/* send TLS control message using record_type */
+.. code-block:: c
+
+  /* send TLS control message using record_type */
   static int klts_send_ctrl_message(int sock, unsigned char record_type,
-                                  void *data, size_t length)
+                                    void *data, size_t length)
   {
         struct msghdr msg = {0};
         int cmsg_len = sizeof(record_type);
@@ -151,6 +169,8 @@ type passed via cmsg.  If no cmsg buffer is provided, an error is
 returned if a control message is received.  Data messages may be
 received without a cmsg buffer set.
 
+.. code-block:: c
+
   char buffer[16384];
   char cmsg[CMSG_SPACE(sizeof(unsigned char))];
   struct msghdr msg = {0};
@@ -186,12 +206,10 @@ Integrating in to userspace TLS library
 At a high level, the kernel TLS ULP is a replacement for the record
 layer of a userspace TLS library.
 
-A patchset to OpenSSL to use ktls as the record layer is here:
-
-https://github.com/Mellanox/openssl/commits/tls_rx2
-
-An example of calling send directly after a handshake using
-gnutls.  Since it doesn't implement a full record layer, control
-messages are not supported:
+A patchset to OpenSSL to use ktls as the record layer is
+`here <https://github.com/Mellanox/openssl/commits/tls_rx2>`_.
 
-https://github.com/ktls/af_ktls-tool/commits/RX
+`An example <https://github.com/ktls/af_ktls-tool/commits/RX>`_
+of calling send directly after a handshake using gnutls.
+Since it doesn't implement a full record layer, control
+messages are not supported.
index c3b9bd2..f600792 100644 (file)
@@ -765,6 +765,37 @@ Here is the list of current tracers that may be configured.
        tracers from tracing simply echo "nop" into
        current_tracer.
 
+Error conditions
+----------------
+
+  For most ftrace commands, failure modes are obvious and communicated
+  using standard return codes.
+
+  For other more involved commands, extended error information may be
+  available via the tracing/error_log file.  For the commands that
+  support it, reading the tracing/error_log file after an error will
+  display more detailed information about what went wrong, if
+  information is available.  The tracing/error_log file is a circular
+  error log displaying a small number (currently, 8) of ftrace errors
+  for the last (8) failed commands.
+
+  The extended error information and usage takes the form shown in
+  this example::
+
+    # echo xxx > /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
+    echo: write error: Invalid argument
+
+    # cat /sys/kernel/debug/tracing/error_log
+    [ 5348.887237] location: error: Couldn't yyy: zzz
+      Command: xxx
+               ^
+    [ 7517.023364] location: error: Bad rrr: sss
+      Command: ppp qqq
+                   ^
+
+  To clear the error log, echo the empty string into it::
+
+    # echo > /sys/kernel/debug/tracing/error_log
 
 Examples of using the tracer
 ----------------------------
index ddbaffa..fb621a1 100644 (file)
@@ -199,20 +199,8 @@ Extended error information
 
   For some error conditions encountered when invoking a hist trigger
   command, extended error information is available via the
-  corresponding event's 'hist' file.  Reading the hist file after an
-  error will display more detailed information about what went wrong,
-  if information is available.  This extended error information will
-  be available until the next hist trigger command for that event.
-
-  If available for a given error condition, the extended error
-  information and usage takes the following form::
-
-    # echo xxx > /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
-    echo: write error: Invalid argument
-
-    # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist
-    ERROR: Couldn't yyy: zzz
-      Last command: xxx
+  tracing/error_log file.  See Error Conditions in
+  :file:`Documentation/trace/ftrace.rst` for details.
 
 6.2 'hist' trigger examples
 ---------------------------
index 64b38df..ba6c42c 100644 (file)
@@ -69,23 +69,6 @@ by and on behalf of the VM's process may not be freed/unaccounted when
 the VM is shut down.
 
 
-It is important to note that althought VM ioctls may only be issued from
-the process that created the VM, a VM's lifecycle is associated with its
-file descriptor, not its creator (process).  In other words, the VM and
-its resources, *including the associated address space*, are not freed
-until the last reference to the VM's file descriptor has been released.
-For example, if fork() is issued after ioctl(KVM_CREATE_VM), the VM will
-not be freed until both the parent (original) process and its child have
-put their references to the VM's file descriptor.
-
-Because a VM's resources are not freed until the last reference to its
-file descriptor is released, creating additional references to a VM via
-via fork(), dup(), etc... without careful consideration is strongly
-discouraged and may have unwanted side effects, e.g. memory allocated
-by and on behalf of the VM's process may not be freed/unaccounted when
-the VM is shut down.
-
-
 3. Extensions
 -------------
 
@@ -347,7 +330,7 @@ They must be less than the value that KVM_CHECK_EXTENSION returns for
 the KVM_CAP_MULTI_ADDRESS_SPACE capability.
 
 The bits in the dirty bitmap are cleared before the ioctl returns, unless
-KVM_CAP_MANUAL_DIRTY_LOG_PROTECT is enabled.  For more information,
+KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is enabled.  For more information,
 see the description of the capability.
 
 4.9 KVM_SET_MEMORY_ALIAS
@@ -1117,9 +1100,8 @@ struct kvm_userspace_memory_region {
 This ioctl allows the user to create, modify or delete a guest physical
 memory slot.  Bits 0-15 of "slot" specify the slot id and this value
 should be less than the maximum number of user memory slots supported per
-VM.  The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS,
-if this capability is supported by the architecture.  Slots may not
-overlap in guest physical address space.
+VM.  The maximum allowed slots can be queried using KVM_CAP_NR_MEMSLOTS.
+Slots may not overlap in guest physical address space.
 
 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
 specifies the address space which is being modified.  They must be
@@ -1901,6 +1883,12 @@ Architectures: all
 Type: vcpu ioctl
 Parameters: struct kvm_one_reg (in)
 Returns: 0 on success, negative value on failure
+Errors:
+  ENOENT:   no such register
+  EINVAL:   invalid register ID, or no such register
+  EPERM:    (arm64) register access not allowed before vcpu finalization
+(These error codes are indicative only: do not rely on a specific error
+code being returned in a specific situation.)
 
 struct kvm_one_reg {
        __u64 id;
@@ -1985,6 +1973,7 @@ registers, find a list below:
   PPC   | KVM_REG_PPC_TLB3PS            | 32
   PPC   | KVM_REG_PPC_EPTCFG            | 32
   PPC   | KVM_REG_PPC_ICP_STATE         | 64
+  PPC   | KVM_REG_PPC_VP_STATE          | 128
   PPC   | KVM_REG_PPC_TB_OFFSET         | 64
   PPC   | KVM_REG_PPC_SPMC1             | 32
   PPC   | KVM_REG_PPC_SPMC2             | 32
@@ -2137,6 +2126,37 @@ contains elements ranging from 32 to 128 bits. The index is a 32bit
 value in the kvm_regs structure seen as a 32bit array.
   0x60x0 0000 0010 <index into the kvm_regs struct:16>
 
+Specifically:
+    Encoding            Register  Bits  kvm_regs member
+----------------------------------------------------------------
+  0x6030 0000 0010 0000 X0          64  regs.regs[0]
+  0x6030 0000 0010 0002 X1          64  regs.regs[1]
+    ...
+  0x6030 0000 0010 003c X30         64  regs.regs[30]
+  0x6030 0000 0010 003e SP          64  regs.sp
+  0x6030 0000 0010 0040 PC          64  regs.pc
+  0x6030 0000 0010 0042 PSTATE      64  regs.pstate
+  0x6030 0000 0010 0044 SP_EL1      64  sp_el1
+  0x6030 0000 0010 0046 ELR_EL1     64  elr_el1
+  0x6030 0000 0010 0048 SPSR_EL1    64  spsr[KVM_SPSR_EL1] (alias SPSR_SVC)
+  0x6030 0000 0010 004a SPSR_ABT    64  spsr[KVM_SPSR_ABT]
+  0x6030 0000 0010 004c SPSR_UND    64  spsr[KVM_SPSR_UND]
+  0x6030 0000 0010 004e SPSR_IRQ    64  spsr[KVM_SPSR_IRQ]
+  0x6060 0000 0010 0050 SPSR_FIQ    64  spsr[KVM_SPSR_FIQ]
+  0x6040 0000 0010 0054 V0         128  fp_regs.vregs[0]    (*)
+  0x6040 0000 0010 0058 V1         128  fp_regs.vregs[1]    (*)
+    ...
+  0x6040 0000 0010 00d0 V31        128  fp_regs.vregs[31]   (*)
+  0x6020 0000 0010 00d4 FPSR        32  fp_regs.fpsr
+  0x6020 0000 0010 00d5 FPCR        32  fp_regs.fpcr
+
+(*) These encodings are not accepted for SVE-enabled vcpus.  See
+    KVM_ARM_VCPU_INIT.
+
+    The equivalent register content can be accessed via bits [127:0] of
+    the corresponding SVE Zn registers instead for vcpus that have SVE
+    enabled (see below).
+
 arm64 CCSIDR registers are demultiplexed by CSSELR value:
   0x6020 0000 0011 00 <csselr:8>
 
@@ -2146,6 +2166,64 @@ arm64 system registers have the following id bit patterns:
 arm64 firmware pseudo-registers have the following bit pattern:
   0x6030 0000 0014 <regno:16>
 
+arm64 SVE registers have the following bit patterns:
+  0x6080 0000 0015 00 <n:5> <slice:5>   Zn bits[2048*slice + 2047 : 2048*slice]
+  0x6050 0000 0015 04 <n:4> <slice:5>   Pn bits[256*slice + 255 : 256*slice]
+  0x6050 0000 0015 060 <slice:5>        FFR bits[256*slice + 255 : 256*slice]
+  0x6060 0000 0015 ffff                 KVM_REG_ARM64_SVE_VLS pseudo-register
+
+Access to register IDs where 2048 * slice >= 128 * max_vq will fail with
+ENOENT.  max_vq is the vcpu's maximum supported vector length in 128-bit
+quadwords: see (**) below.
+
+These registers are only accessible on vcpus for which SVE is enabled.
+See KVM_ARM_VCPU_INIT for details.
+
+In addition, except for KVM_REG_ARM64_SVE_VLS, these registers are not
+accessible until the vcpu's SVE configuration has been finalized
+using KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE).  See KVM_ARM_VCPU_INIT
+and KVM_ARM_VCPU_FINALIZE for more information about this procedure.
+
+KVM_REG_ARM64_SVE_VLS is a pseudo-register that allows the set of vector
+lengths supported by the vcpu to be discovered and configured by
+userspace.  When transferred to or from user memory via KVM_GET_ONE_REG
+or KVM_SET_ONE_REG, the value of this register is of type
+__u64[KVM_ARM64_SVE_VLS_WORDS], and encodes the set of vector lengths as
+follows:
+
+__u64 vector_lengths[KVM_ARM64_SVE_VLS_WORDS];
+
+if (vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX &&
+    ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >>
+               ((vq - KVM_ARM64_SVE_VQ_MIN) % 64)) & 1))
+       /* Vector length vq * 16 bytes supported */
+else
+       /* Vector length vq * 16 bytes not supported */
+
+(**) The maximum value vq for which the above condition is true is
+max_vq.  This is the maximum vector length available to the guest on
+this vcpu, and determines which register slices are visible through
+this ioctl interface.
+
+(See Documentation/arm64/sve.txt for an explanation of the "vq"
+nomenclature.)
+
+KVM_REG_ARM64_SVE_VLS is only accessible after KVM_ARM_VCPU_INIT.
+KVM_ARM_VCPU_INIT initialises it to the best set of vector lengths that
+the host supports.
+
+Userspace may subsequently modify it if desired until the vcpu's SVE
+configuration is finalized using KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE).
+
+Apart from simply removing all vector lengths from the host set that
+exceed some value, support for arbitrarily chosen sets of vector lengths
+is hardware-dependent and may not be available.  Attempting to configure
+an invalid set of vector lengths via KVM_SET_ONE_REG will fail with
+EINVAL.
+
+After the vcpu's SVE configuration is finalized, further attempts to
+write this register will fail with EPERM.
+
 
 MIPS registers are mapped using the lower 32 bits.  The upper 16 of that is
 the register group type:
@@ -2198,6 +2276,12 @@ Architectures: all
 Type: vcpu ioctl
 Parameters: struct kvm_one_reg (in and out)
 Returns: 0 on success, negative value on failure
+Errors include:
+  ENOENT:   no such register
+  EINVAL:   invalid register ID, or no such register
+  EPERM:    (arm64) register access not allowed before vcpu finalization
+(These error codes are indicative only: do not rely on a specific error
+code being returned in a specific situation.)
 
 This ioctl allows to receive the value of a single register implemented
 in a vcpu. The register to read is indicated by the "id" field of the
@@ -2690,6 +2774,49 @@ Possible features:
        - KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU.
          Depends on KVM_CAP_ARM_PMU_V3.
 
+       - KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication
+         for arm64 only.
+         Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS.
+         If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are
+         both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and
+         KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be
+         requested.
+
+       - KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication
+         for arm64 only.
+         Depends on KVM_CAP_ARM_PTRAUTH_GENERIC.
+         If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are
+         both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and
+         KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be
+         requested.
+
+       - KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only).
+         Depends on KVM_CAP_ARM_SVE.
+         Requires KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):
+
+          * After KVM_ARM_VCPU_INIT:
+
+             - KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the
+               initial value of this pseudo-register indicates the best set of
+               vector lengths possible for a vcpu on this host.
+
+          * Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):
+
+             - KVM_RUN and KVM_GET_REG_LIST are not available;
+
+             - KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access
+               the scalable archietctural SVE registers
+               KVM_REG_ARM64_SVE_ZREG(), KVM_REG_ARM64_SVE_PREG() or
+               KVM_REG_ARM64_SVE_FFR;
+
+             - KVM_REG_ARM64_SVE_VLS may optionally be written using
+               KVM_SET_ONE_REG, to modify the set of vector lengths available
+               for the vcpu.
+
+          * After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):
+
+             - the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can
+               no longer be written using KVM_SET_ONE_REG.
 
 4.83 KVM_ARM_PREFERRED_TARGET
 
@@ -3809,7 +3936,7 @@ to I/O ports.
 
 4.117 KVM_CLEAR_DIRTY_LOG (vm ioctl)
 
-Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT
+Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
 Architectures: x86, arm, arm64, mips
 Type: vm ioctl
 Parameters: struct kvm_dirty_log (in)
@@ -3842,10 +3969,10 @@ the address space for which you want to return the dirty bitmap.
 They must be less than the value that KVM_CHECK_EXTENSION returns for
 the KVM_CAP_MULTI_ADDRESS_SPACE capability.
 
-This ioctl is mostly useful when KVM_CAP_MANUAL_DIRTY_LOG_PROTECT
+This ioctl is mostly useful when KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
 is enabled; for more information, see the description of the capability.
 However, it can always be used as long as KVM_CHECK_EXTENSION confirms
-that KVM_CAP_MANUAL_DIRTY_LOG_PROTECT is present.
+that KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 is present.
 
 4.118 KVM_GET_SUPPORTED_HV_CPUID
 
@@ -3904,6 +4031,40 @@ number of valid entries in the 'entries' array, which is then filled.
 'index' and 'flags' fields in 'struct kvm_cpuid_entry2' are currently reserved,
 userspace should not expect to get any particular value there.
 
+4.119 KVM_ARM_VCPU_FINALIZE
+
+Architectures: arm, arm64
+Type: vcpu ioctl
+Parameters: int feature (in)
+Returns: 0 on success, -1 on error
+Errors:
+  EPERM:     feature not enabled, needs configuration, or already finalized
+  EINVAL:    feature unknown or not present
+
+Recognised values for feature:
+  arm64      KVM_ARM_VCPU_SVE (requires KVM_CAP_ARM_SVE)
+
+Finalizes the configuration of the specified vcpu feature.
+
+The vcpu must already have been initialised, enabling the affected feature, by
+means of a successful KVM_ARM_VCPU_INIT call with the appropriate flag set in
+features[].
+
+For affected vcpu features, this is a mandatory step that must be performed
+before the vcpu is fully usable.
+
+Between KVM_ARM_VCPU_INIT and KVM_ARM_VCPU_FINALIZE, the feature may be
+configured by use of ioctls such as KVM_SET_ONE_REG.  The exact configuration
+that should be performaned and how to do it are feature-dependent.
+
+Other calls that depend on a particular feature being finalized, such as
+KVM_RUN, KVM_GET_REG_LIST, KVM_GET_ONE_REG and KVM_SET_ONE_REG, will fail with
+-EPERM unless the feature has already been finalized by means of a
+KVM_ARM_VCPU_FINALIZE call.
+
+See KVM_ARM_VCPU_INIT for details of vcpu features that require finalization
+using this ioctl.
+
 5. The kvm_run structure
 ------------------------
 
@@ -4505,6 +4666,15 @@ struct kvm_sync_regs {
         struct kvm_vcpu_events events;
 };
 
+6.75 KVM_CAP_PPC_IRQ_XIVE
+
+Architectures: ppc
+Target: vcpu
+Parameters: args[0] is the XIVE device fd
+            args[1] is the XIVE CPU number (server ID) for this vcpu
+
+This capability connects the vcpu to an in-kernel XIVE device.
+
 7. Capabilities that can be enabled on VMs
 ------------------------------------------
 
@@ -4798,7 +4968,7 @@ and injected exceptions.
 * For the new DR6 bits, note that bit 16 is set iff the #DB exception
   will clear DR6.RTM.
 
-7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT
+7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
 
 Architectures: x86, arm, arm64, mips
 Parameters: args[0] whether feature should be enabled or not
@@ -4821,6 +4991,11 @@ while userspace can see false reports of dirty pages.  Manual reprotection
 helps reducing this time, improving guest performance and reducing the
 number of dirty log false positives.
 
+KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 was previously available under the name
+KVM_CAP_MANUAL_DIRTY_LOG_PROTECT, but the implementation had bugs that make
+it hard or impossible to use it correctly.  The availability of
+KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 signals that those bugs are fixed.
+Userspace should not try to use KVM_CAP_MANUAL_DIRTY_LOG_PROTECT.
 
 8. Other capabilities.
 ----------------------
index 95ca68d..4ffb82b 100644 (file)
@@ -141,7 +141,8 @@ struct kvm_s390_vm_cpu_subfunc {
        u8 pcc[16];           # valid with Message-Security-Assist-Extension 4
        u8 ppno[16];          # valid with Message-Security-Assist-Extension 5
        u8 kma[16];           # valid with Message-Security-Assist-Extension 8
-       u8 reserved[1808];    # reserved for future instructions
+       u8 kdsa[16];          # valid with Message-Security-Assist-Extension 9
+       u8 reserved[1792];    # reserved for future instructions
 };
 
 Parameters: address of a buffer to load the subfunction blocks from.
diff --git a/Documentation/virtual/kvm/devices/xive.txt b/Documentation/virtual/kvm/devices/xive.txt
new file mode 100644 (file)
index 0000000..9a24a45
--- /dev/null
@@ -0,0 +1,197 @@
+POWER9 eXternal Interrupt Virtualization Engine (XIVE Gen1)
+==========================================================
+
+Device types supported:
+  KVM_DEV_TYPE_XIVE     POWER9 XIVE Interrupt Controller generation 1
+
+This device acts as a VM interrupt controller. It provides the KVM
+interface to configure the interrupt sources of a VM in the underlying
+POWER9 XIVE interrupt controller.
+
+Only one XIVE instance may be instantiated. A guest XIVE device
+requires a POWER9 host and the guest OS should have support for the
+XIVE native exploitation interrupt mode. If not, it should run using
+the legacy interrupt mode, referred as XICS (POWER7/8).
+
+* Device Mappings
+
+  The KVM device exposes different MMIO ranges of the XIVE HW which
+  are required for interrupt management. These are exposed to the
+  guest in VMAs populated with a custom VM fault handler.
+
+  1. Thread Interrupt Management Area (TIMA)
+
+  Each thread has an associated Thread Interrupt Management context
+  composed of a set of registers. These registers let the thread
+  handle priority management and interrupt acknowledgment. The most
+  important are :
+
+      - Interrupt Pending Buffer     (IPB)
+      - Current Processor Priority   (CPPR)
+      - Notification Source Register (NSR)
+
+  They are exposed to software in four different pages each proposing
+  a view with a different privilege. The first page is for the
+  physical thread context and the second for the hypervisor. Only the
+  third (operating system) and the fourth (user level) are exposed the
+  guest.
+
+  2. Event State Buffer (ESB)
+
+  Each source is associated with an Event State Buffer (ESB) with
+  either a pair of even/odd pair of pages which provides commands to
+  manage the source: to trigger, to EOI, to turn off the source for
+  instance.
+
+  3. Device pass-through
+
+  When a device is passed-through into the guest, the source
+  interrupts are from a different HW controller (PHB4) and the ESB
+  pages exposed to the guest should accommadate this change.
+
+  The passthru_irq helpers, kvmppc_xive_set_mapped() and
+  kvmppc_xive_clr_mapped() are called when the device HW irqs are
+  mapped into or unmapped from the guest IRQ number space. The KVM
+  device extends these helpers to clear the ESB pages of the guest IRQ
+  number being mapped and then lets the VM fault handler repopulate.
+  The handler will insert the ESB page corresponding to the HW
+  interrupt of the device being passed-through or the initial IPI ESB
+  page if the device has being removed.
+
+  The ESB remapping is fully transparent to the guest and the OS
+  device driver. All handling is done within VFIO and the above
+  helpers in KVM-PPC.
+
+* Groups:
+
+  1. KVM_DEV_XIVE_GRP_CTRL
+  Provides global controls on the device
+  Attributes:
+    1.1 KVM_DEV_XIVE_RESET (write only)
+    Resets the interrupt controller configuration for sources and event
+    queues. To be used by kexec and kdump.
+    Errors: none
+
+    1.2 KVM_DEV_XIVE_EQ_SYNC (write only)
+    Sync all the sources and queues and mark the EQ pages dirty. This
+    to make sure that a consistent memory state is captured when
+    migrating the VM.
+    Errors: none
+
+  2. KVM_DEV_XIVE_GRP_SOURCE (write only)
+  Initializes a new source in the XIVE device and mask it.
+  Attributes:
+    Interrupt source number  (64-bit)
+  The kvm_device_attr.addr points to a __u64 value:
+  bits:     | 63   ....  2 |   1   |   0
+  values:   |    unused    | level | type
+  - type:  0:MSI 1:LSI
+  - level: assertion level in case of an LSI.
+  Errors:
+    -E2BIG:  Interrupt source number is out of range
+    -ENOMEM: Could not create a new source block
+    -EFAULT: Invalid user pointer for attr->addr.
+    -ENXIO:  Could not allocate underlying HW interrupt
+
+  3. KVM_DEV_XIVE_GRP_SOURCE_CONFIG (write only)
+  Configures source targeting
+  Attributes:
+    Interrupt source number  (64-bit)
+  The kvm_device_attr.addr points to a __u64 value:
+  bits:     | 63   ....  33 |  32  | 31 .. 3 |  2 .. 0
+  values:   |    eisn       | mask |  server | priority
+  - priority: 0-7 interrupt priority level
+  - server: CPU number chosen to handle the interrupt
+  - mask: mask flag (unused)
+  - eisn: Effective Interrupt Source Number
+  Errors:
+    -ENOENT: Unknown source number
+    -EINVAL: Not initialized source number
+    -EINVAL: Invalid priority
+    -EINVAL: Invalid CPU number.
+    -EFAULT: Invalid user pointer for attr->addr.
+    -ENXIO:  CPU event queues not configured or configuration of the
+             underlying HW interrupt failed
+    -EBUSY:  No CPU available to serve interrupt
+
+  4. KVM_DEV_XIVE_GRP_EQ_CONFIG (read-write)
+  Configures an event queue of a CPU
+  Attributes:
+    EQ descriptor identifier (64-bit)
+  The EQ descriptor identifier is a tuple (server, priority) :
+  bits:     | 63   ....  32 | 31 .. 3 |  2 .. 0
+  values:   |    unused     |  server | priority
+  The kvm_device_attr.addr points to :
+    struct kvm_ppc_xive_eq {
+       __u32 flags;
+       __u32 qshift;
+       __u64 qaddr;
+       __u32 qtoggle;
+       __u32 qindex;
+       __u8  pad[40];
+    };
+  - flags: queue flags
+    KVM_XIVE_EQ_ALWAYS_NOTIFY (required)
+       forces notification without using the coalescing mechanism
+       provided by the XIVE END ESBs.
+  - qshift: queue size (power of 2)
+  - qaddr: real address of queue
+  - qtoggle: current queue toggle bit
+  - qindex: current queue index
+  - pad: reserved for future use
+  Errors:
+    -ENOENT: Invalid CPU number
+    -EINVAL: Invalid priority
+    -EINVAL: Invalid flags
+    -EINVAL: Invalid queue size
+    -EINVAL: Invalid queue address
+    -EFAULT: Invalid user pointer for attr->addr.
+    -EIO:    Configuration of the underlying HW failed
+
+  5. KVM_DEV_XIVE_GRP_SOURCE_SYNC (write only)
+  Synchronize the source to flush event notifications
+  Attributes:
+    Interrupt source number  (64-bit)
+  Errors:
+    -ENOENT: Unknown source number
+    -EINVAL: Not initialized source number
+
+* VCPU state
+
+  The XIVE IC maintains VP interrupt state in an internal structure
+  called the NVT. When a VP is not dispatched on a HW processor
+  thread, this structure can be updated by HW if the VP is the target
+  of an event notification.
+
+  It is important for migration to capture the cached IPB from the NVT
+  as it synthesizes the priorities of the pending interrupts. We
+  capture a bit more to report debug information.
+
+  KVM_REG_PPC_VP_STATE (2 * 64bits)
+  bits:     |  63  ....  32  |  31  ....  0  |
+  values:   |   TIMA word0   |   TIMA word1  |
+  bits:     | 127       ..........       64  |
+  values:   |            unused              |
+
+* Migration:
+
+  Saving the state of a VM using the XIVE native exploitation mode
+  should follow a specific sequence. When the VM is stopped :
+
+  1. Mask all sources (PQ=01) to stop the flow of events.
+
+  2. Sync the XIVE device with the KVM control KVM_DEV_XIVE_EQ_SYNC to
+  flush any in-flight event notification and to stabilize the EQs. At
+  this stage, the EQ pages are marked dirty to make sure they are
+  transferred in the migration sequence.
+
+  3. Capture the state of the source targeting, the EQs configuration
+  and the state of thread interrupt context registers.
+
+  Restore is similar :
+
+  1. Restore the EQ configuration. As targeting depends on it.
+  2. Restore targeting
+  3. Restore the thread interrupt contexts
+  4. Restore the source states
+  5. Let the vCPU run
index 534e9ba..5d4330b 100644 (file)
@@ -142,45 +142,13 @@ Mitigation points
    mds_user_clear.
 
    The mitigation is invoked in prepare_exit_to_usermode() which covers
-   most of the kernel to user space transitions. There are a few exceptions
-   which are not invoking prepare_exit_to_usermode() on return to user
-   space. These exceptions use the paranoid exit code.
+   all but one of the kernel to user space transitions.  The exception
+   is when we return from a Non Maskable Interrupt (NMI), which is
+   handled directly in do_nmi().
 
-   - Non Maskable Interrupt (NMI):
-
-     Access to sensible data like keys, credentials in the NMI context is
-     mostly theoretical: The CPU can do prefetching or execute a
-     misspeculated code path and thereby fetching data which might end up
-     leaking through a buffer.
-
-     But for mounting other attacks the kernel stack address of the task is
-     already valuable information. So in full mitigation mode, the NMI is
-     mitigated on the return from do_nmi() to provide almost complete
-     coverage.
-
-   - Double fault (#DF):
-
-     A double fault is usually fatal, but the ESPFIX workaround, which can
-     be triggered from user space through modify_ldt(2) is a recoverable
-     double fault. #DF uses the paranoid exit path, so explicit mitigation
-     in the double fault handler is required.
-
-   - Machine Check Exception (#MC):
-
-     Another corner case is a #MC which hits between the CPU buffer clear
-     invocation and the actual return to user. As this still is in kernel
-     space it takes the paranoid exit path which does not clear the CPU
-     buffers. So the #MC handler repopulates the buffers to some
-     extent. Machine checks are not reliably controllable and the window is
-     extremly small so mitigation would just tick a checkbox that this
-     theoretical corner case is covered. To keep the amount of special
-     cases small, ignore #MC.
-
-   - Debug Exception (#DB):
-
-     This takes the paranoid exit path only when the INT1 breakpoint is in
-     kernel space. #DB on a user space address takes the regular exit path,
-     so no extra mitigation required.
+   (The reason that NMI is special is that prepare_exit_to_usermode() can
+    enable IRQs.  In NMI context, NMIs are blocked, and we don't want to
+    enable IRQs with NMIs blocked.)
 
 
 2. C-State transition
index 0ab686c..5f39b4f 100644 (file)
@@ -41,8 +41,8 @@ Example of EEMI ops usage:
        int ret;
 
        eemi_ops = zynqmp_pm_get_eemi_ops();
-       if (!eemi_ops)
-               return -ENXIO;
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
 
        ret = eemi_ops->query_data(qdata, ret_payload);
 
index 43c7014..0c55b0f 100644 (file)
@@ -742,6 +742,12 @@ F: drivers/tty/serial/altera_jtaguart.c
 F:     include/linux/altera_uart.h
 F:     include/linux/altera_jtaguart.h
 
+AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER
+M:     Talel Shenhar <talel@amazon.com>
+S:     Maintained
+F:     Documentation/devicetree/bindings/thermal/amazon,al-thermal.txt
+F:     drivers/thermal/thermal_mmio.c
+
 AMAZON ETHERNET DRIVERS
 M:     Netanel Belgazal <netanel@amazon.com>
 R:     Saeed Bishara <saeedb@amazon.com>
@@ -994,7 +1000,7 @@ F: include/linux/clk/analogbits*
 ANDES ARCHITECTURE
 M:     Greentime Hu <green.hu@gmail.com>
 M:     Vincent Chen <deanbo422@gmail.com>
-T:     git https://github.com/andestech/linux.git
+T:     git https://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux.git
 S:     Supported
 F:     arch/nds32/
 F:     Documentation/devicetree/bindings/interrupt-controller/andestech,ativic32.txt
@@ -1727,11 +1733,21 @@ L:      linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 
 ARM/INTEL IXP4XX ARM ARCHITECTURE
+M:     Linus Walleij <linusw@kernel.org>
 M:     Imre Kaloz <kaloz@openwrt.org>
 M:     Krzysztof Halasa <khalasa@piap.pl>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
+F:     Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
+F:     Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
+F:     Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
+F:     Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
 F:     arch/arm/mach-ixp4xx/
+F:     drivers/clocksource/timer-ixp4xx.c
+F:     drivers/gpio/gpio-ixp4xx.c
+F:     drivers/irqchip/irq-ixp4xx.c
+F:     include/linux/irqchip/irq-ixp4xx.h
+F:     include/linux/platform_data/timer-ixp4xx.h
 
 ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT
 M:     Jonathan Cameron <jic23@cam.ac.uk>
@@ -2027,7 +2043,7 @@ W:        http://www.armlinux.org.uk/
 S:     Maintained
 
 ARM/QUALCOMM SUPPORT
-M:     Andy Gross <andy.gross@linaro.org>
+M:     Andy Gross <agross@kernel.org>
 M:     David Brown <david.brown@linaro.org>
 L:     linux-arm-msm@vger.kernel.org
 S:     Maintained
@@ -2232,6 +2248,7 @@ F:        arch/arm/mach-socfpga/
 F:     arch/arm/boot/dts/socfpga*
 F:     arch/arm/configs/socfpga_defconfig
 F:     arch/arm64/boot/dts/altera/
+F:     arch/arm64/boot/dts/intel/
 W:     http://www.rocketboards.org
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
 
@@ -4133,7 +4150,9 @@ F:        Documentation/admin-guide/pm/intel_pstate.rst
 F:     Documentation/cpu-freq/
 F:     Documentation/devicetree/bindings/cpufreq/
 F:     drivers/cpufreq/
+F:     kernel/sched/cpufreq*.c
 F:     include/linux/cpufreq.h
+F:     include/linux/sched/cpufreq.h
 F:     tools/testing/selftests/cpufreq/
 
 CPU FREQUENCY DRIVERS - ARM BIG LITTLE
@@ -4316,7 +4335,7 @@ F:        drivers/infiniband/hw/cxgb3/
 F:     include/uapi/rdma/cxgb3-abi.h
 
 CXGB4 CRYPTO DRIVER (chcr)
-M:     Harsh Jain <harsh@chelsio.com>
+M:     Atul Gupta <atul.gupta@chelsio.com>
 L:     linux-crypto@vger.kernel.org
 W:     http://www.chelsio.com
 S:     Supported
@@ -7982,10 +8001,10 @@ F:      Documentation/media/v4l-drivers/ipu3.rst
 INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
 M:     Krzysztof Halasa <khalasa@piap.pl>
 S:     Maintained
-F:     arch/arm/mach-ixp4xx/include/mach/qmgr.h
-F:     arch/arm/mach-ixp4xx/include/mach/npe.h
-F:     arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
-F:     arch/arm/mach-ixp4xx/ixp4xx_npe.c
+F:     include/linux/soc/ixp4xx/qmgr.h
+F:     include/linux/soc/ixp4xx/npe.h
+F:     drivers/soc/ixp4xx/ixp4xx-qmgr.c
+F:     drivers/soc/ixp4xx/ixp4xx-npe.c
 F:     drivers/net/ethernet/xscale/ixp4xx_eth.c
 F:     drivers/net/wan/ixp4xx_hss.c
 
@@ -8523,6 +8542,7 @@ F:        scripts/Kbuild*
 F:     scripts/Makefile*
 F:     scripts/basic/
 F:     scripts/mk*
+F:     scripts/*vmlinux*
 F:     scripts/mod/
 F:     scripts/package/
 
@@ -15526,6 +15546,12 @@ F:     Documentation/devicetree/bindings/reset/ti,sci-reset.txt
 F:     Documentation/devicetree/bindings/clock/ti,sci-clk.txt
 F:     drivers/clk/keystone/sci-clk.c
 F:     drivers/reset/reset-ti-sci.c
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
+F:     drivers/irqchip/irq-ti-sci-intr.c
+F:     drivers/irqchip/irq-ti-sci-inta.c
+F:     include/linux/soc/ti/ti_sci_inta_msi.h
+F:     drivers/soc/ti/ti_sci_inta_msi.c
 
 Texas Instruments ASoC drivers
 M:     Peter Ujfalusi <peter.ujfalusi@ti.com>
@@ -15644,7 +15670,7 @@ F:      include/linux/clk/ti.h
 
 TI DAVINCI MACHINE SUPPORT
 M:     Sekhar Nori <nsekhar@ti.com>
-M:     Kevin Hilman <khilman@kernel.org>
+R:     Bartosz Golaszewski <bgolaszewski@baylibre.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git
 S:     Supported
index a61a95b..a45f84a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
-PATCHLEVEL = 1
+PATCHLEVEL = 2
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -rc1
 NAME = Shy Crocodile
 
 # *DOCUMENTATION*
@@ -537,7 +537,7 @@ endif
 # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
 # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
 # and from include/config/auto.conf.cmd to detect the compiler upgrade.
-CC_VERSION_TEXT = $(shell $(CC) --version | head -n 1)
+CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1)
 
 ifeq ($(config-targets),1)
 # ===========================================================================
@@ -651,7 +651,7 @@ ifeq ($(may-sync-config),1)
 # Read in dependencies to all Kconfig* files, make sure to run syncconfig if
 # changes are detected. This should be included after arch/$(SRCARCH)/Makefile
 # because some architectures define CROSS_COMPILE there.
--include include/config/auto.conf.cmd
+include include/config/auto.conf.cmd
 
 $(KCONFIG_CONFIG):
        @echo >&2 '***'
@@ -692,7 +692,6 @@ KBUILD_CFLAGS       += $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)
 KBUILD_CFLAGS  += $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS  += $(call cc-disable-warning, format-overflow)
-KBUILD_CFLAGS  += $(call cc-disable-warning, int-in-bool-context)
 KBUILD_CFLAGS  += $(call cc-disable-warning, address-of-packed-member)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
@@ -732,16 +731,15 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG)      := -fstack-protector-strong
 KBUILD_CFLAGS += $(stackp-flags-y)
 
 ifdef CONFIG_CC_IS_CLANG
-KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
-KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
-KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+KBUILD_CPPFLAGS += -Qunused-arguments
+KBUILD_CFLAGS += -Wno-format-invalid-specifier
+KBUILD_CFLAGS += -Wno-gnu
 # Quiet clang warning: comparison of unsigned expression < 0 is always false
-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
+KBUILD_CFLAGS += -Wno-tautological-compare
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
 # source of a reference will be _MergedGlobals and not on of the whitelisted names.
 # See modpost pattern 2
-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
-KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+KBUILD_CFLAGS += -mno-global-merge
 else
 
 # These warnings generated too much noise in a regular build.
@@ -842,7 +840,7 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 KBUILD_CFLAGS += -Wdeclaration-after-statement
 
 # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
-KBUILD_CFLAGS += $(call cc-option,-Wvla)
+KBUILD_CFLAGS += -Wvla
 
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += -Wno-pointer-sign
@@ -1018,7 +1016,7 @@ export KBUILD_VMLINUX_LIBS := $(libs-y1)
 export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds
 export LDFLAGS_vmlinux
 # used by scripts/package/Makefile
-export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch include scripts tools)
+export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)
 
 vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
 
@@ -1290,6 +1288,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
        $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
        @$(kecho) '  Building modules, stage 2.';
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
 
 modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
        $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
index f11f069..c47b328 100644 (file)
@@ -781,7 +781,7 @@ config COMPAT_OLD_SIGACTION
        bool
 
 config 64BIT_TIME
-       def_bool ARCH_HAS_64BIT_TIME
+       def_bool y
        help
          This should be selected by all architectures that need to support
          new system calls with a 64-bit time_t. This is relevant on all 32-bit
index 12dee59..b3314e0 100644 (file)
@@ -8,6 +8,8 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
+KBUILD_DEFCONFIG := defconfig
+
 NM := $(NM) -B
 
 LDFLAGS_vmlinux        := -static -N #-relax
diff --git a/arch/alpha/include/asm/segment.h b/arch/alpha/include/asm/segment.h
deleted file mode 100644 (file)
index 0453d97..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ALPHA_SEGMENT_H
-#define __ALPHA_SEGMENT_H
-
-/* Only here because we have some old header files that expect it.. */
-
-#endif
index 4dbd4e4..bbbd345 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
-#include <asm/segment.h>
 
 #if 0
 # define DBG_DEVS(args)         printk args
index 733f089..71cd7ac 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
-#include <asm/segment.h>
 
 #define SMC_DEBUG 0
 
index 165f268..9e7704e 100644 (file)
 535    common  io_uring_setup                  sys_io_uring_setup
 536    common  io_uring_enter                  sys_io_uring_enter
 537    common  io_uring_register               sys_io_uring_register
+538    common  open_tree                       sys_open_tree
+539    common  move_mount                      sys_move_mount
+540    common  fsopen                          sys_fsopen
+541    common  fsconfig                        sys_fsconfig
+542    common  fsmount                         sys_fsmount
+543    common  fspick                          sys_fspick
index 7f46719..6eda097 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the FPU instruction emulation.
 #
index 1c2d456..d568cd9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index 5a98079..08ac661 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux alpha-specific parts of the memory manager.
 #
index eabc3ef..5264185 100644 (file)
@@ -742,6 +742,7 @@ extern long arc_strnlen_user_noinline(const char __user *src, long n);
 
 #endif
 
+#include <asm/segment.h>
 #include <asm-generic/uaccess.h>
 
 #endif
index 8d43717..ebb9723 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 5fd344b..8869742 100644 (file)
@@ -426,12 +426,15 @@ config ARCH_IXP4XX
        depends on MMU
        select ARCH_HAS_DMA_SET_COHERENT_MASK
        select ARCH_SUPPORTS_BIG_ENDIAN
-       select CLKSRC_MMIO
        select CPU_XSCALE
        select DMABOUNCE if PCI
        select GENERIC_CLOCKEVENTS
+       select GENERIC_IRQ_MULTI_HANDLER
+       select GPIO_IXP4XX
        select GPIOLIB
        select HAVE_PCI
+       select IXP4XX_IRQ
+       select IXP4XX_TIMER
        select NEED_MACH_IO_H
        select USB_EHCI_BIG_ENDIAN_DESC
        select USB_EHCI_BIG_ENDIAN_MMIO
@@ -897,8 +900,6 @@ config PLAT_PXA
 config PLAT_VERSATILE
        bool
 
-source "arch/arm/firmware/Kconfig"
-
 source "arch/arm/mm/Kconfig"
 
 config IWMMXT
index e388af4..9a8862f 100644 (file)
@@ -1676,6 +1676,7 @@ config DEBUG_UART_PHYS
        default 0xe6e68000 if DEBUG_RCAR_GEN2_SCIF1
        default 0xe6ee0000 if DEBUG_RCAR_GEN2_SCIF4
        default 0xe8008000 if DEBUG_R7S72100_SCIF2
+       default 0xf0000000 if DEBUG_DIGICOLOR_UA0
        default 0xf0000be0 if ARCH_EBSA110
        default 0xf1012000 if DEBUG_MVEBU_UART0_ALTERNATE
        default 0xf1012100 if DEBUG_MVEBU_UART1_ALTERNATE
@@ -1727,6 +1728,7 @@ config DEBUG_UART_VIRT
        default 0xe0010fe0 if ARCH_RPC
        default 0xf0000be0 if ARCH_EBSA110
        default 0xf0010000 if DEBUG_ASM9260_UART
+       default 0xf0100000 if DEBUG_DIGICOLOR_UA0
        default 0xf01fb000 if DEBUG_NOMADIK_UART
        default 0xf0201000 if DEBUG_BCM2835 || DEBUG_BCM2836
        default 0xf1000300 if DEBUG_BCM_5301X
index 807a7d0..f863c69 100644 (file)
@@ -116,8 +116,7 @@ endif
 AFLAGS_NOWARN  :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
 
 ifeq ($(CONFIG_THUMB2_KERNEL),y)
-AFLAGS_AUTOIT  :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
-CFLAGS_ISA     :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
+CFLAGS_ISA     :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
 AFLAGS_ISA     :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
 # Work around buggy relocation from gas if requested:
 ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
@@ -290,7 +289,6 @@ core-y                              += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
 core-y                         += arch/arm/probes/
 core-y                         += arch/arm/net/
 core-y                         += arch/arm/crypto/
-core-y                         += arch/arm/firmware/
 core-y                         += $(machdirs) $(platdirs)
 
 drivers-$(CONFIG_OPROFILE)      += arch/arm/oprofile/
index f4f5aea..dab2914 100644 (file)
@@ -229,6 +229,9 @@ dtb-$(CONFIG_ARCH_HIX5HD2) += \
 dtb-$(CONFIG_ARCH_INTEGRATOR) += \
        integratorap.dtb \
        integratorcp.dtb
+dtb-$(CONFIG_ARCH_IXP4XX) += \
+       intel-ixp42x-linksys-nslu2.dtb \
+       intel-ixp43x-gateworks-gw2358.dtb
 dtb-$(CONFIG_ARCH_KEYSTONE) += \
        keystone-k2hk-evm.dtb \
        keystone-k2l-evm.dtb \
@@ -363,7 +366,8 @@ dtb-$(CONFIG_SOC_IMX35) += \
        imx35-eukrea-mbimxsd35-baseboard.dtb \
        imx35-pdk.dtb
 dtb-$(CONFIG_SOC_IMX50) += \
-       imx50-evk.dtb
+       imx50-evk.dtb \
+       imx50-kobo-aura.dtb
 dtb-$(CONFIG_SOC_IMX51) += \
        imx51-apf51.dtb \
        imx51-apf51dev.dtb \
@@ -380,6 +384,7 @@ dtb-$(CONFIG_SOC_IMX53) += \
        imx53-kp-ddc.dtb \
        imx53-kp-hsc.dtb \
        imx53-m53evk.dtb \
+       imx53-m53menlo.dtb \
        imx53-mba53.dtb \
        imx53-ppd.dtb \
        imx53-qsb.dtb \
@@ -400,6 +405,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
        imx6dl-cubox-i-emmc-som-v15.dtb \
        imx6dl-cubox-i-som-v15.dtb \
        imx6dl-dfi-fs700-m60.dtb \
+       imx6dl-eckelmann-ci4x10.dtb \
        imx6dl-emcon-avari.dtb \
        imx6dl-gw51xx.dtb \
        imx6dl-gw52xx.dtb \
@@ -579,6 +585,7 @@ dtb-$(CONFIG_SOC_IMX7D) += \
        imx7d-cl-som-imx7.dtb \
        imx7d-colibri-emmc-eval-v3.dtb \
        imx7d-colibri-eval-v3.dtb \
+       imx7d-mba7.dtb \
        imx7d-nitrogen7.dtb \
        imx7d-pico-hobbit.dtb \
        imx7d-pico-pi.dtb \
@@ -586,7 +593,9 @@ dtb-$(CONFIG_SOC_IMX7D) += \
        imx7d-sdb.dtb \
        imx7d-sdb-reva.dtb \
        imx7d-sdb-sht11.dtb \
+       imx7d-zii-rpu2.dtb \
        imx7s-colibri-eval-v3.dtb \
+       imx7s-mba7.dtb \
        imx7s-warp.dtb
 dtb-$(CONFIG_SOC_IMX7ULP) += \
        imx7ulp-evk.dtb
@@ -606,6 +615,7 @@ dtb-$(CONFIG_SOC_VF610) += \
        vf610-zii-dev-rev-b.dtb \
        vf610-zii-dev-rev-c.dtb \
        vf610-zii-scu4-aib.dtb \
+       vf610-zii-spb4.dtb \
        vf610-zii-ssmb-dtu.dtb \
        vf610-zii-ssmb-spu3.dtb
 dtb-$(CONFIG_ARCH_MXS) += \
@@ -909,6 +919,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \
        rk3288-veyron-jaq.dtb \
        rk3288-veyron-jerry.dtb \
        rk3288-veyron-mickey.dtb \
+       rk3288-veyron-mighty.dtb \
        rk3288-veyron-minnie.dtb \
        rk3288-veyron-pinky.dtb \
        rk3288-veyron-speedy.dtb \
@@ -964,6 +975,8 @@ dtb-$(CONFIG_ARCH_STM32) += \
        stm32746g-eval.dtb \
        stm32h743i-eval.dtb \
        stm32h743i-disco.dtb \
+       stm32mp157a-dk1.dtb \
+       stm32mp157c-dk2.dtb \
        stm32mp157c-ed1.dtb \
        stm32mp157c-ev1.dtb
 dtb-$(CONFIG_MACH_SUN4I) += \
@@ -1091,6 +1104,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
        sun8i-h3-orangepi-plus.dtb \
        sun8i-h3-orangepi-plus2e.dtb \
        sun8i-h3-orangepi-zero-plus2.dtb \
+       sun8i-h3-rervision-dvk.dtb \
        sun8i-r16-bananapi-m2m.dtb \
        sun8i-r16-nintendo-nes-classic.dtb \
        sun8i-r16-nintendo-super-nes-classic.dtb \
index 888bfcd..742fcf5 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * aks-cdu.dts - Device Tree file for AK signal CDU
  *
  * Copyright (C) 2012 AK signal Brno a.s.
  *               2012 Jiri Prchal <jiri.prchal@aksignal.cz>
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index 50dcf12..2f650a7 100644 (file)
 &am33xx_pinmux {
        uart1_pins: pinmux_uart1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE0)      /* uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE0)      /* uart1_txd */
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)      /* uart1_rtsn */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
                >;
        };
 };
index f3f1abd..1ba66d5 100644 (file)
 &am33xx_pinmux {
        tca6416_pins: pinmux_tca6416_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_INPUT_PULLUP | MUX_MODE7)      /* xdma_event_intr1.gpio0[20] tca6416 stuff */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_INPUT_PULLUP, MUX_MODE7)      /* xdma_event_intr1.gpio0[20] tca6416 stuff */
                >;
        };
 
        uart1_pins: pinmux_uart1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE0)      /* uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE0)      /* uart1_txd */
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)      /* uart1_rtsn */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
                >;
        };
 
        uart2_pins: pinmux_uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)      /* spi0_sclk.uart2_rxd_mux3 */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)      /* spi0_d0.uart2_txd_mux3 */
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLDOWN | MUX_MODE2)      /* i2c0_sda.uart2_ctsn_mux0 */
-                       AM33XX_IOPAD(0x98c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)      /* i2c0_scl.uart2_rtsn_mux0 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad12.gpio1[12] DTR */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad13.gpio1[13] DSR */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad14.gpio1[14] DCD */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad15.gpio1[15] RI */
-
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7)      /* mcasp0_aclkr.gpio3[18], INPUT_PULLDOWN | MODE7 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE1)      /* spi0_sclk.uart2_rxd_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT, MUX_MODE1)      /* spi0_d0.uart2_txd_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* i2c0_sda.uart2_ctsn_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* i2c0_scl.uart2_rtsn_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad12.gpio1[12] DTR */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad13.gpio1[13] DSR */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad14.gpio1[14] DCD */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad15.gpio1[15] RI */
+
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7)      /* mcasp0_aclkr.gpio3[18], INPUT_PULLDOWN | MODE7 */
                >;
        };
 };
index 42f473f..eed65fc 100644 (file)
 &am33xx_pinmux {
        tca6416_pins: pinmux_tca6416_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_INPUT_PULLUP | MUX_MODE7)      /* xdma_event_intr1.gpio0[20] tca6416 stuff */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_INPUT_PULLUP, MUX_MODE7)      /* xdma_event_intr1.gpio0[20] tca6416 stuff */
                >;
        };
 
 
        dcan1_pins: pinmux_dcan1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_OUTPUT | MUX_MODE2)      /* uart0_ctsn.dcan1_tx_mux0 */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE2)      /* uart0_rtsn.dcan1_rx_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT, MUX_MODE2)      /* uart0_ctsn.dcan1_tx_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT, MUX_MODE2)      /* uart0_rtsn.dcan1_rx_mux0 */
                >;
        };
 
        uart1_pins: pinmux_uart1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE0)      /* uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE0)      /* uart1_txd */
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)      /* uart1_rtsn */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* lcd_vsync.gpio2[22] DTR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_hsync.gpio2[23] DSR */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_pclk.gpio2[24] DCD */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* lcd_ac_bias_en.gpio2[25] RI */
                >;
        };
 
        uart2_pins: pinmux_uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)      /* spi0_sclk.uart2_rxd_mux3 */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)      /* spi0_d0.uart2_txd_mux3 */
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLDOWN | MUX_MODE2)      /* i2c0_sda.uart2_ctsn_mux0 */
-                       AM33XX_IOPAD(0x98c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)      /* i2c0_scl.uart2_rtsn_mux0 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad12.gpio1[12] DTR */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad13.gpio1[13] DSR */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLDOWN | MUX_MODE7)      /* gpmc_ad14.gpio1[14] DCD */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad15.gpio1[15] RI */
-
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7)      /* mcasp0_aclkr.gpio3[18], INPUT_PULLDOWN | MODE7 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE1)      /* spi0_sclk.uart2_rxd_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT, MUX_MODE1)      /* spi0_d0.uart2_txd_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* i2c0_sda.uart2_ctsn_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* i2c0_scl.uart2_rtsn_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad12.gpio1[12] DTR */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad13.gpio1[13] DSR */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad14.gpio1[14] DCD */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad15.gpio1[15] RI */
+
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7)      /* mcasp0_aclkr.gpio3[18], INPUT_PULLDOWN | MODE7 */
                >;
        };
 
index 3ab1767..fe75050 100644 (file)
@@ -42,9 +42,9 @@
 &am33xx_pinmux {
        user_leds: pinmux_user_leds {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x908, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_col.gpio3_0 PWR LED */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd3.gpio0_16 WLAN LED */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mii1_txd2.gpio0_17 APP LED */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_OUTPUT_PULLDOWN, MUX_MODE7)     /* mii1_col.gpio3_0 PWR LED */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* mii1_txd3.gpio0_16 WLAN LED */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* mii1_txd2.gpio0_17 APP LED */
                >;
        };
 };
index 8c6fc41..b572ad1 100644 (file)
 &am33xx_pinmux {
        mmc2_pins: pinmux_mmc2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_ad8.mmc1_dat0_mux0 */
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_ad9.mmc1_dat1_mux0 */
-                       AM33XX_IOPAD(0x828, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_ad10.mmc1_dat2_mux0 */
-                       AM33XX_IOPAD(0x82c, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_ad11.mmc1_dat3_mux0 */
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_csn1.mmc1_clk_mux0 */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)      /* gpmc_csn2.mmc1_cmd_mux0 */
-                       AM33XX_IOPAD(0x9e4, PIN_INPUT_PULLUP | MUX_MODE7)      /* emu0.gpio3[7] */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_ad8.mmc1_dat0_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_ad9.mmc1_dat1_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_ad10.mmc1_dat2_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_ad11.mmc1_dat3_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_csn1.mmc1_clk_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)      /* gpmc_csn2.mmc1_cmd_mux0 */
+                       AM33XX_PADCONF(AM335X_PIN_EMU0, PIN_INPUT_PULLUP, MUX_MODE7)      /* emu0.gpio3[7] */
                >;
        };
 
        wl12xx_gpio: pinmux_wl12xx_gpio {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9e8, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* emu1.gpio3[8] */
+                       AM33XX_PADCONF(AM335X_PIN_EMU1, PIN_OUTPUT_PULLUP, MUX_MODE7)      /* emu1.gpio3[8] */
                >;
        };
 
        tps65910_pins: pinmux_tps65910_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLUP | MUX_MODE7)      /* gpmc_ben1.gpio1[28] */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE7)      /* gpmc_ben1.gpio1[28] */
                >;
        };
 
        i2c1_pins: pinmux_i2c1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE2)      /* spi0_d1.i2c1_sda_mux3 */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT | MUX_MODE2)      /* spi0_cs0.i2c1_scl_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE2)      /* spi0_d1.i2c1_sda_mux3 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT, MUX_MODE2)      /* spi0_cs0.i2c1_scl_mux3 */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)            /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)       /* mii1_crs.rmii1_crs_dv */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE1)      /* mii1_tx_en.rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE1)      /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE1)      /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE1)      /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE1)      /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* rmii1_ref_clk.rmii1_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* mii1_crs.rmii1_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)      /* mii1_tx_en.rmii1_txen */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)      /* mii1_txd1.rmii1_txd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)      /* mii1_txd0.rmii1_txd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* mii1_rxd1.rmii1_rxd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* mii1_rxd0.rmii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)      /* rmii1_ref_clk.rmii1_refclk */
 
 
                        /* Slave 2 */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a0.rgmii2_tctl */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a1.rgmii2_rctl */
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a2.rgmii2_td3 */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a3.rgmii2_td2 */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a4.rgmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a5.rgmii2_td0 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a6.rgmii2_tclk */
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a7.rgmii2_rclk */
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a8.rgmii2_rd3 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a9.rgmii2_rd2 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a10.rgmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a11.rgmii2_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a0.rgmii2_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a1.rgmii2_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a2.rgmii2_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a3.rgmii2_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a4.rgmii2_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a5.rgmii2_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a6.rgmii2_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a7.rgmii2_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a8.rgmii2_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a9.rgmii2_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a10.rgmii2_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a11.rgmii2_rd0 */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
 
                        /* Slave 2 reset value*/
-                       AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)    /* mdio_data.mdio_data */
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)                    /* mdio_clk.mdio_clk */
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        nandflash_pins_s0: nandflash_pins_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_wpn.gpio0_30 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn0.gpmc_csn0  */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)             /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)             /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)             /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_be0n_cle.gpmc_be0n_cle */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad0.gpmc_ad0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad1.gpmc_ad1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad2.gpmc_ad2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad3.gpmc_ad3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad4.gpmc_ad4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad5.gpmc_ad5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad6.gpmc_ad6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)        /* gpmc_ad7.gpmc_ad7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)      /* gpmc_wait0.gpmc_wait0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE7)        /* gpmc_wpn.gpio0_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)             /* gpmc_csn0.gpmc_csn0  */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)         /* gpmc_advn_ale.gpmc_advn_ale */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)          /* gpmc_oen_ren.gpmc_oen_ren */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)              /* gpmc_wen.gpmc_wen */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)         /* gpmc_be0n_cle.gpmc_be0n_cle */
                >;
        };
 };
index 29782be..cbd5bd8 100644 (file)
 &am33xx_pinmux {
        nxp_hdmi_pins: pinmux_nxp_hdmi_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE3)     /* xdma_event_intr0.clkout1 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)     /* lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)     /* lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)     /* lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)     /* lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)     /* lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT, MUX_MODE3)      /* xdma_event_intr0.clkout1 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                >;
        };
        nxp_hdmi_off_pins: pinmux_nxp_hdmi_off_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE3)     /* xdma_event_intr0.clkout1 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT, MUX_MODE3)      /* xdma_event_intr0.clkout1 */
                >;
        };
 
        leds_base_pins: pinmux_leds_base_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a5.gpio1_21 */
-                       AM33XX_IOPAD(0x888, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_csn3.gpio2_0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* gpmc_csn3.gpio2_0 */
                >;
        };
 };
index 456eef5..42cfc3b 100644 (file)
 
        user_leds_s0: user_leds_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a5.gpio1_21 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a6.gpio1_22 */
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a7.gpio1_23 */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a8.gpio1_24 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a6.gpio1_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a7.gpio1_23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a8.gpio1_24 */
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)        /* i2c0_sda.i2c0_sda */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)        /* i2c0_scl.i2c0_scl */
                >;
        };
 
        i2c2_pins: pinmux_i2c2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_ctsn.i2c2_sda */
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_rtsn.i2c2_scl */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_ctsn.i2c2_sda */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_rtsn.i2c2_scl */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        clkout2_pin: pinmux_clkout2_pin {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxerr.mii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txen.mii1_txen */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxdv.mii1_rxdv */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd3.mii1_txd3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd2.mii1_txd2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd1.mii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd0.mii1_txd0 */
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_txclk.mii1_txclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxclk.mii1_rxclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd3.mii1_rxd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd2.mii1_rxd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd1.mii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd0.mii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* spio0_cs1.gpio0_6 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* spio0_cs1.gpio0_6 */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        emmc_pins: pinmux_emmc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
                >;
        };
 };
index e543c2b..283e288 100644 (file)
 &am33xx_pinmux {
        nxp_hdmi_bonelt_pins: nxp_hdmi_bonelt_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr0 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)             /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        nxp_hdmi_bonelt_off_pins: nxp_hdmi_bonelt_off_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr0 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)
                >;
        };
 
        mcasp0_pins: mcasp0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
-                       AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/
-                       AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */
-                       AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
-                       AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLUP, MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT_PULLDOWN, MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* gpmc_a11.GPIO1_27 */
                >;
        };
 };
index 83f49f6..5b275c9 100644 (file)
 &am33xx_pinmux {
        bt_pins: pinmux_bt_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gmii1_txd0.gpio0_28 - BT_EN */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLUP, MUX_MODE7)      /* gmii1_txd0.gpio0_28 - BT_EN */
                >;
        };
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE6 ) /* (L15) gmii1_rxd1.mmc2_clk */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLUP | MUX_MODE6 ) /* (J16) gmii1_txen.mmc2_cmd */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE5 ) /* (J17) gmii1_rxdv.mmc2_dat0 */
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLUP | MUX_MODE5 ) /* (J18) gmii1_txd3.mmc2_dat1 */
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLUP | MUX_MODE5 ) /* (K15) gmii1_txd2.mmc2_dat2 */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLUP | MUX_MODE5 ) /* (H16) gmii1_col.mmc2_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE6 ) /* (L15) gmii1_rxd1.mmc2_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLUP, MUX_MODE6 ) /* (J16) gmii1_txen.mmc2_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLUP, MUX_MODE5 ) /* (J17) gmii1_rxdv.mmc2_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLUP, MUX_MODE5 ) /* (J18) gmii1_txd3.mmc2_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLUP, MUX_MODE5 ) /* (K15) gmii1_txd2.mmc2_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLUP, MUX_MODE5 ) /* (H16) gmii1_col.mmc2_dat3 */
                >;
        };
 
        uart3_pins: pinmux_uart3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE1)       /* gmii1_rxd3.uart3_rxd */
-                       AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* gmii1_rxd2.uart3_txd */
-                       AM33XX_IOPAD(0x948, PIN_INPUT | MUX_MODE3)              /* mdio_data.uart3_ctsn */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* mdio_clk.uart3_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE1)       /* gmii1_rxd3.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* gmii1_rxd2.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT, MUX_MODE3)           /* mdio_data.uart3_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* mdio_clk.uart3_rtsn */
                >;
        };
 
        wl18xx_pins: pinmux_wl18xx_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gmii1_txclk.gpio3_9 WL_EN */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_refclk.gpio0_29 WL_IRQ */
-                       AM33XX_IOPAD(0x930, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gmii1_rxclk.gpio3_10 LS_BUF_EN */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE7)  /* gmii1_txclk.gpio3_9 WL_EN */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7) /* rmii1_refclk.gpio0_29 WL_IRQ */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_OUTPUT_PULLUP, MUX_MODE7)    /* gmii1_rxclk.gpio3_10 LS_BUF_EN */
                >;
        };
 };
index ccb147e..8d241c8 100644 (file)
 &am33xx_pinmux {
        user_leds_s0: user_leds_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7) /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7) /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7) /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7) /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE7) /* (A15) xdma_event_intr0.gpio0[19] - WIFI_LED */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE7) /* (R7) gpmc_advn_ale.gpio2[2] - P8.7, LED_RED, GP1_PIN_5 */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE7) /* (T7) gpmc_oen_ren.gpio2[3] - P8.8, LED_GREEN, GP1_PIN_6 */
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE7) /* (U12) gpmc_ad11.gpio0[27] - P8.17, BATT_LED_1 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE7) /* (T5) lcd_data15.gpio0[11] - P8.32, BATT_LED_2 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE7) /* (V6) gpmc_csn0.gpio1[29] - P8.26, BATT_LED_3 */
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE7) /* (T11) gpmc_ad10.gpio0[26] - P8.14, BATT_LED_4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE7) /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT, MUX_MODE7) /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT, MUX_MODE7) /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT, MUX_MODE7) /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT, MUX_MODE7) /* (A15) xdma_event_intr0.gpio0[19] - WIFI_LED */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE7) /* (R7) gpmc_advn_ale.gpio2[2] - P8.7, LED_RED, GP1_PIN_5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE7) /* (T7) gpmc_oen_ren.gpio2[3] - P8.8, LED_GREEN, GP1_PIN_6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE7) /* (U12) gpmc_ad11.gpio0[27] - P8.17, BATT_LED_1 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE7) /* (T5) lcd_data15.gpio0[11] - P8.32, BATT_LED_2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE7) /* (V6) gpmc_csn0.gpio1[29] - P8.26, BATT_LED_3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE7) /* (T11) gpmc_ad10.gpio0[26] - P8.14, BATT_LED_4 */
 
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* (C17) I2C0_SDA.I2C0_SDA */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* (C16) I2C0_SCL.I2C0_SCL */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)        /* (C17) I2C0_SDA.I2C0_SDA */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)        /* (C16) I2C0_SCL.I2C0_SCL */
                >;
        };
 
        i2c2_pins: pinmux_i2c2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)       /* (D18) uart1_ctsn.I2C2_SDA */
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)       /* (D17) uart1_rtsn.I2C2_SCL */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* (D18) uart1_ctsn.I2C2_SDA */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* (D17) uart1_rtsn.I2C2_SCL */
                >;
        };
 
        /* UT0 */
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* (E15) uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* (E16) uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        /* UT1 */
        uart1_pins: pinmux_uart1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* (D16) uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* (D15) uart1_txd.uart1_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        /* GPS */
        uart2_pins: pinmux_uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE1)       /* (A17) spi0_sclk.uart2_rxd */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* (B17) spi0_d0.uart2_txd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE1)       /* (A17) spi0_sclk.uart2_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)      /* (B17) spi0_d0.uart2_txd */
                >;
        };
 
        /* DSM2 */
        uart4_pins: pinmux_uart4_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6)       /* (T17) gpmc_wait0.uart4_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE6)      /* (T17) gpmc_wait0.uart4_rxd */
                >;
        };
 
        /* UT5 */
        uart5_pins: pinmux_uart5_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8C4, PIN_INPUT_PULLUP | MUX_MODE4)       /* (U2) lcd_data9.uart5_rxd */
-                       AM33XX_IOPAD(0x8C0, PIN_OUTPUT_PULLDOWN | MUX_MODE4)    /* (U1) lcd_data8.uart5_txd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_INPUT_PULLUP, MUX_MODE4)       /* (U2) lcd_data9.uart5_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT_PULLDOWN, MUX_MODE4)    /* (U1) lcd_data8.uart5_txd */
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* (C15) spi0_cs1.gpio0[6] */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* (C15) spi0_cs1.gpio0[6] */
                >;
        };
 
        mmc2_pins: pinmux_mmc2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)       /* (U9) gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)       /* (V9) gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)       /* (U7) gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)       /* (V7) gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)       /* (R8) gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)       /* (T8) gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1)       /* (U8) gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1)       /* (V8) gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1)       /* (R9) gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1)       /* (T9) gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)       /* (U9) gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)       /* (V9) gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)        /* (U7) gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)        /* (V7) gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)        /* (R8) gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)        /* (T8) gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1)        /* (U8) gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1)        /* (V8) gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1)        /* (R9) gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1)        /* (T9) gpmc_ad7.mmc1_dat7 */
                >;
        };
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE6)       /* (L15) gmii1_rxd1.mmc2_clk */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLUP | MUX_MODE6)       /* (J16) gmii1_txen.mmc2_cmd */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE5)       /* (J17) gmii1_rxdv.mmc2_dat0 */
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLUP | MUX_MODE5)       /* (J18) gmii1_txd3.mmc2_dat1 */
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLUP | MUX_MODE5)       /* (K15) gmii1_txd2.mmc2_dat2 */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLUP | MUX_MODE5)       /* (H16) gmii1_col.mmc2_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE6)       /* (L15) gmii1_rxd1.mmc2_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLUP, MUX_MODE6)      /* (J16) gmii1_txen.mmc2_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLUP, MUX_MODE5)      /* (J17) gmii1_rxdv.mmc2_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLUP, MUX_MODE5)       /* (J18) gmii1_txd3.mmc2_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLUP, MUX_MODE5)       /* (K15) gmii1_txd2.mmc2_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLUP, MUX_MODE5)        /* (H16) gmii1_col.mmc2_dat3 */
                >;
        };
 
        bt_pins: pinmux_bt_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* (K17) gmii1_txd0.gpio0[28] - BT_EN */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLUP, MUX_MODE7)      /* (K17) gmii1_txd0.gpio0[28] - BT_EN */
                >;
        };
 
        uart3_pins: pinmux_uart3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE1)       /* (L17) gmii1_rxd3.uart3_rxd */
-                       AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* (L16) gmii1_rxd2.uart3_txd */
-                       AM33XX_IOPAD(0x948, PIN_INPUT | MUX_MODE3)              /* (M17) mdio_data.uart3_ctsn */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* (M18) mdio_clk.uart3_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE1)       /* (L17) gmii1_rxd3.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* (L16) gmii1_rxd2.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT, MUX_MODE3)           /* (M17) mdio_data.uart3_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* (M18) mdio_clk.uart3_rtsn */
                >;
        };
 
        wl18xx_pins: pinmux_wl18xx_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* (K18) gmii1_txclk.gpio3[9] - WL_EN */
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* (K16) gmii1_txd1.gpio0[21] - WL_IRQ */
-                       AM33XX_IOPAD(0x930, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* (L18) gmii1_rxclk.gpio3[10] - LS_BUF_EN */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE7)  /* (K18) gmii1_txclk.gpio3[9] - WL_EN */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* (K16) gmii1_txd1.gpio0[21] - WL_IRQ */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_OUTPUT_PULLUP, MUX_MODE7)    /* (L18) gmii1_rxclk.gpio3[10] - LS_BUF_EN */
                >;
        };
 
        /* DCAN */
        dcan1_pins: pinmux_dcan1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE2)              /* (E17) uart0_rtsn.dcan1_rx */
-                       AM33XX_IOPAD(0x968, PIN_OUTPUT | MUX_MODE2)             /* (E18) uart0_ctsn.dcan1_tx */
-                       AM33XX_IOPAD(0x940, PIN_OUTPUT | MUX_MODE7)             /* (M16) gmii1_rxd0.gpio2[21] */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT, MUX_MODE2)             /* (E17) uart0_rtsn.dcan1_rx */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT, MUX_MODE2)            /* (E18) uart0_ctsn.dcan1_tx */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_OUTPUT, MUX_MODE7)             /* (M16) gmii1_rxd0.gpio2[21] */
                >;
        };
 };
index 853e6d3..71317e3 100644 (file)
@@ -27,8 +27,8 @@
 &am33xx_pinmux {
        uart2_pins: uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)      /* spi0_sclk.uart2_rxd */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)     /* spi0_d0.uart2_txd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE1)      /* spi0_sclk.uart2_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT, MUX_MODE1)       /* spi0_d0.uart2_txd */
                >;
        };
 };
index 57731f0..7db86a9 100644 (file)
 &am33xx_pinmux {
        bt_pins: pinmux_bt_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x878, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_ad12.gpio1_28 BT_EN */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_OUTPUT_PULLUP, MUX_MODE7)      /* gpmc_ad12.gpio1_28 BT_EN */
                >;
        };
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad12.mmc2_dat0 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad13.mmc2_dat1 */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad14.mmc2_dat2 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad15.mmc2_dat3 */
-                       AM33XX_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_csn3.mmc2_cmd */
-                       AM33XX_IOPAD(0x88c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_clk.mmc2_clk */
+                       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_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 */
                >;
        };
 
        uart3_pins: pinmux_uart3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE1)       /* gmii1_rxd3.uart3_rxd */
-                       AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* gmii1_rxd2.uart3_txd */
-                       AM33XX_IOPAD(0x948, PIN_INPUT | MUX_MODE3)              /* mdio_data.uart3_ctsn */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* mdio_clk.uart3_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE1)       /* gmii1_rxd3.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* gmii1_rxd2.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT, MUX_MODE3)           /* mdio_data.uart3_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLDOWN, MUX_MODE3)  /* mdio_clk.uart3_rtsn */
                >;
        };
 
        wl18xx_pins: pinmux_wl18xx_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_ad10.gpio0_26 WL_EN */
-                       AM33XX_IOPAD(0x82C, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ */
-                       AM33XX_IOPAD(0x87C, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_csn0.gpio1_29 LS_BUF_EN */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* gpmc_ad10.gpio0_26 WL_EN */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad11.gpio0_27 WL_IRQ */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT_PULLUP, MUX_MODE7)      /* gpmc_csn0.gpio1_29 LS_BUF_EN */
                >;
        };
 };
index bffa5dc..31da683 100644 (file)
 &am33xx_pinmux {
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)  /* mii1_crs.rmii1_crs */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxerr.rmii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txen.rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* rmii1_ref_clk.rmii_ref_clk */
+                       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)
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
                        /* mdio_clk.mdio_clk */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        usb1_drvvbus: usb1_drvvbus {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0xa34, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* usb1_drvvbus.usb1_drvvbus */
+                       AM33XX_PADCONF(AM335X_PIN_USB1_DRVVBUS, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        sd_pins: pinmux_sd_card {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT | MUX_MODE0) /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT | MUX_MODE0) /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT | MUX_MODE0) /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT | MUX_MODE0) /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT | MUX_MODE0) /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT | MUX_MODE0) /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7) /* spi0_cs1.gpio0_6 */
                >;
        };
 
        led_gpio_pins: led_gpio_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9e4, PIN_OUTPUT | MUX_MODE7) /* emu0.gpio3_7 */
-                       AM33XX_IOPAD(0x9e8, PIN_OUTPUT | MUX_MODE7) /* emu1.gpio3_8 */
+                       AM33XX_PADCONF(AM335X_PIN_EMU0, PIN_OUTPUT, MUX_MODE7) /* emu0.gpio3_7 */
+                       AM33XX_PADCONF(AM335X_PIN_EMU1, PIN_OUTPUT, MUX_MODE7) /* emu1.gpio3_8 */
                >;
        };
 };
index 1b43ebd..8b88bf6 100644 (file)
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        nandflash_pins: nandflash_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* gpmc_ad7.gpmc_ad7 */
-
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* gpmc_csn0.gpmc_csn0 */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT_PULLUP | MUX_MODE0)      /* gpmc_be0n_cle.gpmc_be0n_cle */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLDOWN, MUX_MODE0)
+
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 };
index 2c724bb..3b0bb88 100644 (file)
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* i2c0_scl.i2c0_scl */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)
+                       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 = <
                        /* uart0_ctsn.i2c1_sda */
-                       AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLUP, MUX_MODE2)
                        /* uart0_rtsn.i2c1_scl */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE2)
                >;
        };
 
        gpio_led_pins: pinmux_gpio_led_pins {
                pinctrl-single,pins = <
                        /* gpmc_csn3.gpio2_0 */
-                       AM33XX_IOPAD(0x888, PIN_OUTPUT | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_OUTPUT, MUX_MODE7)
                >;
        };
 
        nandflash_pins: pinmux_nandflash_pins {
                pinctrl-single,pins = <
-                       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
                        /* gpmc_wpn.gpio0_30 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7)
-                       /* gpmc_csn0.gpmc_csn0  */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)
-                       /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)
-                       /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)
-                       /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)
-                       /* gpmc_ben0_cle.gpmc_ben0_cle */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* uart0_txd.uart0_txd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+                       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 = <
-                       /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x978, PIN_INPUT | MUX_MODE0)
-                       /* uart1_rtsn.uart1_rtsn */
-                       AM33XX_IOPAD(0x97C, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
-                       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* uart1_txd.uart1_txd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
+                       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_PULLDOWN, MUX_MODE0)
                >;
        };
 
        dcan0_pins: pinmux_dcan0_pins {
                pinctrl-single,pins = <
                        /* uart1_ctsn.dcan0_tx */
-                       AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_OUTPUT, MUX_MODE2)
                        /* uart1_rtsn.dcan0_rx */
-                       AM33XX_IOPAD(0x97C, PIN_INPUT | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT, MUX_MODE2)
                >;
        };
 
        dcan1_pins: pinmux_dcan1_pins {
                pinctrl-single,pins = <
                        /* uart1_rxd.dcan1_tx */
-                       AM33XX_IOPAD(0x980, PIN_OUTPUT | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_OUTPUT, MUX_MODE2)
                        /* uart1_txd.dcan1_rx */
-                       AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT, MUX_MODE2)
                >;
        };
 
        ecap0_pins: pinmux_ecap0_pins {
                pinctrl-single,pins = <
-                       /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
-                       AM33XX_IOPAD(0x964, 0x0)
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, 0x0, MUX_MODE0)
                >;
        };
 
                pinctrl-single,pins = <
                        /* Slave 1 */
                        /* mii1_tx_en.rgmii1_tctl */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_txd3.rgmii1_td3 */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_txd2.rgmii1_td2 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_txd1.rgmii1_td1 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_txd0.rgmii1_td0 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_txclk.rgmii1_tclk */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxclk.rgmii1_rclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxd3.rgmii1_rd3 */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxd2.rgmii1_rd2 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxd1.rgmii1_rd1 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE2)
                        /* mii1_rxd0.rgmii1_rd0 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE2)
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
-                       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
-                       /* mdio_clk.mdio_clk */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)
-                       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)
+                       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)
                >;
        };
 
        spi0_pins: pinmux_spi0_pins {
                pinctrl-single,pins = <
-                       /* spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE0)
-                       /* spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)
-                       /* spi0_d1.spi0_d1 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT | MUX_MODE0)
-                       /* spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x95C, PIN_OUTPUT | MUX_MODE0)
-                       /* spi0_cs1.spi0_cs1 */
-                       AM33XX_IOPAD(0x960, PIN_OUTPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        bluetooth_pins: pinmux_bluetooth_pins {
                pinctrl-single,pins = <
                        /* XDMA_EVENT_INTR0.gpio0_19 - bluetooth enable */
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLUP | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLUP, MUX_MODE7)
                >;
        };
 
        mcasp1_pins: pinmux_mcasp1_pins {
                pinctrl-single,pins = <
                        /* MII1_CRS.mcasp1_aclkx */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE4)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE4)
                        /* MII1_RX_ER.mcasp1_fsx */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE4)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE4)
                        /* MII1_COL.mcasp1_axr2 */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE4)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE4)
                        /* RMII1_REF_CLK.mcasp1_axr3 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE4)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE4)
                >;
        };
 
        wifi_pins: pinmux_wifi_pins {
                pinctrl-single,pins = <
                        /* EMU1.gpio3_8 - WiFi IRQ */
-                       AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_EMU1, PIN_INPUT_PULLUP, MUX_MODE7)
                        /* XDMA_EVENT_INTR1.gpio0_20 - WiFi enable */
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT, MUX_MODE7)
                >;
        };
 };
index edcff79..55d4392 100644 (file)
 
        matrix_keypad_s0: matrix_keypad_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a5.gpio1_21 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a6.gpio1_22 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_a9.gpio1_25 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_a10.gpio1_26 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_a11.gpio1_27 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a6.gpio1_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* gpmc_a9.gpio1_25 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a10.gpio1_26 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a11.gpio1_27 */
                >;
        };
 
        volume_keys_s0: volume_keys_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* spi0_sclk.gpio0_2 */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* spi0_d0.gpio0_3 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* spi0_sclk.gpio0_2 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* spi0_d0.gpio0_3 */
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)        /* i2c0_sda.i2c0_sda */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)        /* i2c0_scl.i2c0_scl */
                >;
        };
 
        i2c1_pins: pinmux_i2c1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_d1.i2c1_sda */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_cs0.i2c1_scl */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE2) /* spi0_d1.i2c1_sda */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE2)        /* spi0_cs0.i2c1_scl */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       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_IOPAD(0x978, PIN_INPUT | MUX_MODE0)              /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97C, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_rtsn.uart1_rtsn */
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
+                       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_PULLDOWN, MUX_MODE0)
                >;
        };
 
        clkout2_pin: pinmux_clkout2_pin {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 
        nandflash_pins_s0: nandflash_pins_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_wpn.gpio0_30 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn0.gpmc_csn0  */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)             /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)             /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)             /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_be0n_cle.gpmc_be0n_cle */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE7)        /* gpmc_wpn.gpio0_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        ecap0_pins: backlight_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x964, MUX_MODE0)  /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, 0x0, MUX_MODE0)
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txclk.rgmii1_tclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxclk.rgmii1_rclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)   /* mii1_txen.rgmii1_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE2)    /* mii1_rxdv.rgmii1_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE2)  /* mii1_txclk.rgmii1_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE2)   /* mii1_rxclk.rgmii1_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* spi0_cs1.gpio0_6 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4)              /* mcasp0_aclkr.mmc0_sdwp */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* spi0_cs1.gpio0_6 */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT, MUX_MODE4)           /* mcasp0_aclkr.mmc0_sdwp */
                >;
        };
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a1.mmc2_dat0, INPUT_PULLUP | MODE3 */
-                       AM33XX_IOPAD(0x848, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a2.mmc2_dat1, INPUT_PULLUP | MODE3 */
-                       AM33XX_IOPAD(0x84c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a3.mmc2_dat2, INPUT_PULLUP | MODE3 */
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ben1.mmc2_dat3, INPUT_PULLUP | MODE3 */
-                       AM33XX_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_csn3.mmc2_cmd, INPUT_PULLUP | MODE3 */
-                       AM33XX_IOPAD(0x88c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_clk.mmc2_clk, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a1.mmc2_dat0, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a2.mmc2_dat1, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a3.mmc2_dat2, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ben1.mmc2_dat3, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_csn3.mmc2_cmd, INPUT_PULLUP | MODE3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CLK, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_clk.mmc2_clk, INPUT_PULLUP | MODE3 */
                >;
        };
 
        wlan_pins: pinmux_wlan_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a0.gpio1_16 */
-                       AM33XX_IOPAD(0x99c, PIN_INPUT | MUX_MODE7)              /* mcasp0_ahclkr.gpio3_17 */
-                       AM33XX_IOPAD(0x9ac, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* mcasp0_ahclkx.gpio3_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a0.gpio1_16 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_INPUT, MUX_MODE7)          /* mcasp0_ahclkr.gpio3_17 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE7)        /* mcasp0_ahclkx.gpio3_21 */
                >;
        };
 
        lcd_pins_s0: lcd_pins_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad8.lcd_data23 */
-                       AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad9.lcd_data22 */
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad10.lcd_data21 */
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad11.lcd_data20 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad12.lcd_data19 */
-                       AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad13.lcd_data18 */
-                       AM33XX_IOPAD(0x838, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad14.lcd_data17 */
-                       AM33XX_IOPAD(0x83c, PIN_OUTPUT | MUX_MODE1)             /* gpmc_ad15.lcd_data16 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)             /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)             /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)             /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)             /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)             /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT, MUX_MODE1)              /* gpmc_ad8.lcd_data23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT, MUX_MODE1)              /* gpmc_ad9.lcd_data22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad10.lcd_data21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad11.lcd_data20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad12.lcd_data19 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad13.lcd_data18 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad14.lcd_data17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_OUTPUT, MUX_MODE1)             /* gpmc_ad15.lcd_data16 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        mcasp1_pins: mcasp1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
-                       AM33XX_IOPAD(0x908, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_OUTPUT_PULLDOWN, MUX_MODE4) /* mii1_col.mcasp1_axr2 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
                >;
        };
 
        mcasp1_pins_sleep: mcasp1_pins_sleep {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        dcan1_pins_default: dcan1_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_OUTPUT | MUX_MODE2) /* uart0_ctsn.d_can1_tx */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLDOWN | MUX_MODE2) /* uart0_rtsn.d_can1_rx */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT, MUX_MODE2) /* uart0_ctsn.d_can1_tx */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLDOWN, MUX_MODE2) /* uart0_rtsn.d_can1_rx */
                >;
        };
 };
index 2c2d8b5..8fc8056 100644 (file)
 
        lcd_pins_default: lcd_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad8.lcd_data23 */
-                       AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad9.lcd_data22 */
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad10.lcd_data21 */
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad11.lcd_data20 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad12.lcd_data19 */
-                       AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad13.lcd_data18 */
-                       AM33XX_IOPAD(0x838, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad14.lcd_data17 */
-                       AM33XX_IOPAD(0x83c, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad15.lcd_data16 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)     /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)     /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)     /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)     /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)     /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT, MUX_MODE1)      /* gpmc_ad8.lcd_data23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT, MUX_MODE1)      /* gpmc_ad9.lcd_data22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad10.lcd_data21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad11.lcd_data20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad12.lcd_data19 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad13.lcd_data18 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad14.lcd_data17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad15.lcd_data16 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        lcd_pins_sleep: lcd_pins_sleep {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad8.lcd_data23 */
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad9.lcd_data22 */
-                       AM33XX_IOPAD(0x828, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad10.lcd_data21 */
-                       AM33XX_IOPAD(0x82c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad11.lcd_data20 */
-                       AM33XX_IOPAD(0x830, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad12.lcd_data19 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad13.lcd_data18 */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad14.lcd_data17 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ad15.lcd_data16 */
-                       AM33XX_IOPAD(0x8a0, PULL_DISABLE | MUX_MODE7)   /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PULL_DISABLE | MUX_MODE7)   /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PULL_DISABLE | MUX_MODE7)   /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PULL_DISABLE | MUX_MODE7)   /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PULL_DISABLE | MUX_MODE7)   /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PULL_DISABLE | MUX_MODE7)   /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PULL_DISABLE | MUX_MODE7)   /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PULL_DISABLE | MUX_MODE7)   /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PULL_DISABLE | MUX_MODE7)   /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PULL_DISABLE | MUX_MODE7)   /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PULL_DISABLE | MUX_MODE7)   /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PULL_DISABLE | MUX_MODE7)   /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PULL_DISABLE | MUX_MODE7)   /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PULL_DISABLE | MUX_MODE7)   /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PULL_DISABLE | MUX_MODE7)   /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PULL_DISABLE | MUX_MODE7)   /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad8.lcd_data23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_ad9.lcd_data22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad10.lcd_data21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad11.lcd_data20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad12.lcd_data19 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad13.lcd_data18 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad14.lcd_data17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad15.lcd_data16 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
 
        user_leds_s0: user_leds_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x810, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_ad4.gpio1_4 */
-                       AM33XX_IOPAD(0x814, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_ad5.gpio1_5 */
-                       AM33XX_IOPAD(0x818, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_ad6.gpio1_6 */
-                       AM33XX_IOPAD(0x81c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_ad7.gpio1_7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_OUTPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad4.gpio1_4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad5.gpio1_5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_OUTPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad6.gpio1_6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_OUTPUT_PULLDOWN, MUX_MODE7)     /* gpmc_ad7.gpio1_7 */
                >;
        };
 
        gpio_keys_s0: gpio_keys_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x894, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_oen_ren.gpio2_3 */
-                       AM33XX_IOPAD(0x890, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_advn_ale.gpio2_2 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_wait0.gpio0_30 */
-                       AM33XX_IOPAD(0x89c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_ben0_cle.gpio2_5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_INPUT_PULLDOWN, MUX_MODE7)  /* gpmc_oen_ren.gpio2_3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_INPUT_PULLDOWN, MUX_MODE7) /* gpmc_advn_ale.gpio2_2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLDOWN, MUX_MODE7)    /* gpmc_wait0.gpio0_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_INPUT_PULLDOWN, MUX_MODE7) /* gpmc_ben0_cle.gpio2_5 */
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        clkout2_pin: pinmux_clkout2_pin {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 
        ecap2_pins: backlight_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x99c, MUX_MODE4)  /* mcasp0_ahclkr.ecap2_in_pwm2_out */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, 0x0, MUX_MODE4)        /* mcasp0_ahclkr.ecap2_in_pwm2_out */
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txclk.rgmii1_tclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxclk.rgmii1_rclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)   /* mii1_txen.rgmii1_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE2)    /* mii1_rxdv.rgmii1_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE2)  /* mii1_txclk.rgmii1_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE2)   /* mii1_rxclk.rgmii1_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
 
                        /* Slave 2 */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a0.rgmii2_tctl */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a1.rgmii2_rctl */
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a2.rgmii2_td3 */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a3.rgmii2_td2 */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a4.rgmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a5.rgmii2_td0 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a6.rgmii2_tclk */
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a7.rgmii2_rclk */
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a8.rgmii2_rd3 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a9.rgmii2_rd2 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a10.rgmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a11.rgmii2_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a0.rgmii2_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a1.rgmii2_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a2.rgmii2_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a3.rgmii2_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a4.rgmii2_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a5.rgmii2_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a6.rgmii2_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a7.rgmii2_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a8.rgmii2_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a9.rgmii2_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a10.rgmii2_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a11.rgmii2_rd0 */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
 
                        /* Slave 2 reset value*/
-                       AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x848, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x84c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* spi0_cs1.gpio0_6 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4)              /* mcasp0_aclkr.mmc0_sdwp */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* spi0_cs1.gpio0_6 */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT, MUX_MODE4)           /* mcasp0_aclkr.mmc0_sdwp */
                >;
        };
 
        mcasp1_pins: mcasp1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
-                       AM33XX_IOPAD(0x908, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* mii1_col.mcasp1_axr2 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE4) /* mii1_crs.mcasp1_aclkx */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE4) /* mii1_rxerr.mcasp1_fsx */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_OUTPUT_PULLDOWN, MUX_MODE4) /* mii1_col.mcasp1_axr2 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE4) /* rmii1_ref_clk.mcasp1_axr3 */
                >;
        };
 
        mcasp1_pins_sleep: mcasp1_pins_sleep {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc2_pins: pinmux_mmc2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_31 */
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE7) /* gpmc_wpn.gpio0_31 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
                >;
        };
 
        wl12xx_gpio: pinmux_wl12xx_gpio {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_csn0.gpio1_29 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT_PULLUP, MUX_MODE7) /* gpmc_csn0.gpio1_29 */
                >;
        };
 };
index 9ac775c..4365684 100644 (file)
 &am33xx_pinmux {
        user_leds: user_leds {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT | MUX_MODE7) /* (J18) gmii1_txd3.gpio0[16] */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT | MUX_MODE7) /* (K15) gmii1_txd2.gpio0[17] */
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT | MUX_MODE7) /* (A15) xdma_event_intr0.gpio0[19] */
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT | MUX_MODE7) /* (D14) xdma_event_intr1.gpio0[20] */
-                       AM33XX_IOPAD(0x880, PIN_OUTPUT | MUX_MODE7) /* (U9) gpmc_csn1.gpio1[30] */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT | MUX_MODE7) /* (K18) gmii1_txclk.gpio3[9] */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT, MUX_MODE7) /* (J18) gmii1_txd3.gpio0[16] */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT, MUX_MODE7) /* (K15) gmii1_txd2.gpio0[17] */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT, MUX_MODE7) /* (A15) xdma_event_intr0.gpio0[19] */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT, MUX_MODE7) /* (D14) xdma_event_intr1.gpio0[20] */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_OUTPUT, MUX_MODE7) /* (U9) gpmc_csn1.gpio1[30] */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT, MUX_MODE7) /* (K18) gmii1_txclk.gpio3[9] */
                >;
        };
 
        mmc0_pins_default: mmc0_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* (F17) mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* (F18) mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* (G15) mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* (G16) mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* (G17) mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* (G18) mmc0_cmd.mmc0_cmd */
+                       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)
                >;
        };
 
        i2c0_pins_default: i2c0_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT | MUX_MODE0) /* (C17) I2C0_SDA.I2C0_SDA */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT | MUX_MODE0) /* (C16) I2C0_SCL.I2C0_SCL */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT, MUX_MODE0)
                >;
        };
 
        spi0_pins_default: spi0_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* (A17) spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* (B17) spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* (B16) spi0_d1.spi0_d1 */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* (A16) spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE0) /* (C15) spi0_cs1.spi0_cs1 */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7) /* (B12) mcasp0_aclkr.gpio3[18] */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, 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)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7) /* (B12) mcasp0_aclkr.gpio3[18] */
                >;
        };
 
        uart3_pins_default: uart3_pins_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE1) /* (L17) gmii1_rxd3.uart3_rxd */
-                       AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLUP | MUX_MODE1) /* (L16) gmii1_rxd2.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE1) /* (L17) gmii1_rxd3.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_OUTPUT_PULLUP, MUX_MODE1) /* (L16) gmii1_rxd2.uart3_txd */
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1, RMII mode */
-                       AM33XX_IOPAD(0x90c, (PIN_INPUT_PULLUP | MUX_MODE1))     /* mii1_crs.rmii1_crs_dv */
-                       AM33XX_IOPAD(0x944, (PIN_INPUT_PULLUP | MUX_MODE0))     /* rmii1_refclk.rmii1_refclk */
-                       AM33XX_IOPAD(0x940, (PIN_INPUT_PULLUP | MUX_MODE1))     /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x93c, (PIN_INPUT_PULLUP | MUX_MODE1))     /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x910, (PIN_INPUT_PULLUP | MUX_MODE1))     /* mii1_rxerr.rmii1_rxerr */
-                       AM33XX_IOPAD(0x928, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))  /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x924, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))  /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x914, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))  /* mii1_txen.rmii1_txen */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLUP, MUX_MODE1)        /* mii1_crs.rmii1_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE1)      /* mii1_rxerr.rmii1_rxerr */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* mii1_txd0.rmii1_txd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* mii1_txd1.rmii1_txd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)   /* mii1_txen.rmii1_txen */
                        /* Slave 2, RMII mode */
-                       AM33XX_IOPAD(0x870, (PIN_INPUT_PULLUP | MUX_MODE3))     /* gpmc_wait0.rmii2_crs_dv */
-                       AM33XX_IOPAD(0x908, (PIN_INPUT_PULLUP | MUX_MODE1))     /* mii1_col.rmii2_refclk */
-                       AM33XX_IOPAD(0x86c, (PIN_INPUT_PULLUP | MUX_MODE3))     /* gpmc_a11.rmii2_rxd0 */
-                       AM33XX_IOPAD(0x868, (PIN_INPUT_PULLUP | MUX_MODE3))     /* gpmc_a10.rmii2_rxd1 */
-                       AM33XX_IOPAD(0x874, (PIN_INPUT_PULLUP | MUX_MODE3))     /* gpmc_wpn.rmii2_rxerr */
-                       AM33XX_IOPAD(0x854, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))  /* gpmc_a5.rmii2_txd0 */
-                       AM33XX_IOPAD(0x850, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))  /* gpmc_a4.rmii2_txd1 */
-                       AM33XX_IOPAD(0x840, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))  /* gpmc_a0.rmii2_txen */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE3)      /* gpmc_wait0.rmii2_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLUP, MUX_MODE1)        /* mii1_col.rmii2_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_a11.rmii2_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_a10.rmii2_rxd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE3)        /* gpmc_wpn.rmii2_rxerr */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE3)      /* gpmc_a5.rmii2_txd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE3)      /* gpmc_a4.rmii2_txd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)      /* gpmc_a0.rmii2_txen */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x90c, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x944, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x940, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x93c, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x910, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x928, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x924, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x914, (PIN_INPUT_PULLDOWN | MUX_MODE7))
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
 
                        /* Slave 2 reset value */
-                       AM33XX_IOPAD(0x870, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x908, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x86c, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x868, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x874, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x854, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x850, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x840, (PIN_INPUT_PULLDOWN | MUX_MODE7))
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0))     /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, (PIN_OUTPUT_PULLUP | MUX_MODE0))                    /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, (PIN_INPUT_PULLDOWN | MUX_MODE7))
-                       AM33XX_IOPAD(0x94c, (PIN_INPUT_PULLDOWN | MUX_MODE7))
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 };
index cbd22f2..312deb6 100644 (file)
 &am33xx_pinmux {
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        nandflash_pins: pinmux_nandflash_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_wpn.gpio0_30 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn0.gpmc_csn0 */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)             /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)             /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)             /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_be0n_cle.gpmc_be0n_cle */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLUP, MUX_MODE7)        /* gpmc_wpn.gpio0_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        leds_pins: pinmux_leds_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a7.gpio1_23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a7.gpio1_23 */
                >;
        };
 };
index d0e8e72..aa4cd2b 100644 (file)
 &am33xx_pinmux {
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd */
+                       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)
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT | MUX_MODE0)      /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT | MUX_MODE0)      /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT, MUX_MODE0)
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_int */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* rmii1_crs_dv */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* rmii1_rxer */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* rmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* rmii1_td0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* rmii1_rd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* rmii1_rd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* rmii1_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* rmii1_int */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* rmii1_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE1)    /* rmii1_rxer */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)   /* rmii1_txen */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* rmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* rmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE1)     /* rmii1_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE1)     /* rmii1_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
 
                        /* Slave 2 */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* rmii2_txen */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* rmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* rmii2_td0 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE3)     /* rmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE3)     /* rmii2_rd0 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLDOWN | MUX_MODE3)     /* rmii2_crs_dv */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE3)     /* rmii2_rxer */
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_int */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* rmii2_refclk */
+                       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_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_BEN1, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii2_int */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* rmii2_refclk */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_int */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_crs_dv */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_rxer */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_td0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_rd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_rd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii1_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* rmii1_int */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* rmii1_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)    /* rmii1_rxer */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)    /* rmii1_txen */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii1_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii1_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7) /* rmii1_refclk */
 
                        /* Slave 2 reset value*/
-                       AM33XX_IOPAD(0x840, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_txen */
-                       AM33XX_IOPAD(0x850, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_td0 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_rd0 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_crs_dv */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_rxer */
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_int */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* rmii2_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* rmii2_txen */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* rmii2_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* rmii2_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* rmii2_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* rmii2_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLDOWN, MUX_MODE7)    /* rmii2_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* rmii2_rxer */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* rmii2_int */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* rmii2_refclk */
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        emmc_pins: pinmux_emmc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 };
index cb5913a..671d4a5 100644 (file)
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        push_button_pins: pinmux_push_button {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_hsync.gpio2_23 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)     /* lcd_hsync.gpio2_23 */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        mmc1_pins_default: pinmux_mmc1_pins {
                pinctrl-single,pins = <
                        /* eMMC */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad12.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad13.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad14.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad15.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad8.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad9.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad10.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad11.mmc1_dat7 */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad12.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad13.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad14.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad15.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad8.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad9.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad10.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad11.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
                >;
        };
 
        spi0_pins: pinmux_spi0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0)        /* spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0)        /* spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0)        /* spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0)        /* spi0_d1.spi0_d1 */
+                       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)
                >;
        };
 };
index 48aee6d..5923b6e 100644 (file)
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* mii1_crs.rmii1_crs_dv */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxerr.rmii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txen.rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mii1_refclk.rmii1_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* mii1_crs.rmii1_crs_dv */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE1)      /* mii1_rxerr.rmii1_rxerr */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE1)   /* mii1_txen.rmii1_txen */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* mii1_txd1.rmii1_txd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* mii1_txd0.rmii1_txd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE1)       /* mii1_rxd1.rmii1_rxd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE1)       /* mii1_rxd0.rmii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        spi1_pins: pinmux_spi1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE4)        /* ecap0_in_pwm0_out.spi1_sclk */
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE4)        /* uart1_ctsn.spi1_cs0 */
-                       AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE4)        /* uart0_ctsn.spi1_d0 */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE4)        /* uart0_rtsn.spi1_d1 */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_INPUT_PULLUP, MUX_MODE4)        /* ecap0_in_pwm0_out.spi1_sclk */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE4)       /* uart1_ctsn.spi1_cs0 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLUP, MUX_MODE4)       /* uart0_ctsn.spi1_d0 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE4)       /* uart0_rtsn.spi1_d1 */
                >;
        };
 };
index e562ce4..5a2fb4b 100644 (file)
 
        minipcie_pins: pinmux_minipcie {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_pclk.gpio2_24 */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_ac_bias_en.gpio2_25 */
-                       AM33XX_IOPAD(0x8e0, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* lcd_vsync.gpio2_22  Power off PIN*/
+                       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_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* mcasp0_ahcklx.gpio3_21 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLDOWN, MUX_MODE7) /* mcasp0_ahcklx.gpio3_21 */
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)    /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)    /* i2c0_scl.i2c0_scl */
+                       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_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart0_ctsn.i2c1_sda */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart0_rtsn.i2c1_scl */
+                       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_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       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_IOPAD(0x978, PIN_INPUT | MUX_MODE0)              /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97C, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart1_rtsn.uart1_rtsn */
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)    /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT | MUX_MODE0)             /* uart1_txd.uart1_txd */
+                       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_IOPAD(0x8d8, PIN_INPUT | MUX_MODE6)              /* lcd_data14.uart5_ctsn */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT_PULLDOWN | MUX_MODE6)  /* lcd_data15.uart5_rtsn */
-                       AM33XX_IOPAD(0x8c4, PIN_INPUT_PULLUP | MUX_MODE4)     /* lcd_data9.uart5_rxd */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE4)             /* lcd_data8.uart5_txd */
+                       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_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)  /* mii1_crs.rmii1_crs_dv */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE1)    /* mii1_rxerr.rmii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txen.rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE1)    /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE1)    /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mii1_refclk.rmii1_refclk */
+                       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_IOPAD(0x870, PIN_INPUT_PULLDOWN | MUX_MODE3)   /* rmii2_crs_dv */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE3)   /* rmii2_rxer */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE3)  /* rmii2_txen */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE3)  /* rmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE3)  /* rmii2_td0 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE3)   /* rmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE3)   /* rmii2_rd0 */
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE1)  /* rmii2_refclk */
+                       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_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       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_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd */
-                       AM33XX_IOPAD(0x990, PIN_INPUT_PULLUP | MUX_MODE7)       /* mcasp0_aclkx.gpio3_14 */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7)    /* mcasp0_aclkx.gpio3_18 */
+                       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_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad12.mmc2_dat0 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad13.mmc2_dat1 */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad14.mmc2_dat2 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad15.mmc2_dat3 */
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad8.mmc2_dat4 */
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad9.mmc2_dat5 */
-                       AM33XX_IOPAD(0x828, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad10.mmc2_dat6 */
-                       AM33XX_IOPAD(0x82c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ad11.mmc2_dat7 */
-                       AM33XX_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE3)     /* gpmc_csn3.mmc2_cmd */
-                       AM33XX_IOPAD(0x88c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_clk.mmc2_clk */
+                       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_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x95C, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_d1 */
+                       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)
                >;
        };
 
index 9c9143e..0052657 100644 (file)
 
        misc_pins: misc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x95c, PIN_OUTPUT | MUX_MODE7)     /* spi0_cs0.gpio0_5 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE7)      /* spi0_cs0.gpio0_5 */
                >;
        };
 
        gpmc_pins: gpmc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad8.gpmc_ad8 */
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad9.gpmc_ad9 */
-                       AM33XX_IOPAD(0x828, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad10.gpmc_ad10 */
-                       AM33XX_IOPAD(0x82c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad11.gpmc_ad11 */
-                       AM33XX_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad12.gpmc_ad12 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad13.gpmc_ad13 */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad14.gpmc_ad14 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad15.gpmc_ad15 */
-
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn0.gpmc_csn0 */
-                       AM33XX_IOPAD(0x880, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn1.gpmc_csn1 */
-                       AM33XX_IOPAD(0x884, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn2.gpmc_csn2 */
-                       AM33XX_IOPAD(0x888, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn3.gpmc_csn3 */
-
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)             /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)             /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)             /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_ben0_cle.gpmc_ben0_cle */
-
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE1)             /* lcd_data1.gpmc_a1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE1)             /* lcd_data2.gpmc_a2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE1)             /* lcd_data3.gpmc_a3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE1)             /* lcd_data4.gpmc_a4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE1)             /* lcd_data5.gpmc_a5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE1)             /* lcd_data6.gpmc_a6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE1)             /* lcd_data7.gpmc_a7 */
-
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE1)             /* lcd_vsync.gpmc_a8 */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE1)             /* lcd_hsync.gpmc_a9 */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE1)             /* lcd_pclk.gpmc_a10 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLUP, MUX_MODE0)
+
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_OUTPUT, MUX_MODE0)
+
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)
+
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE1)             /* lcd_data1.gpmc_a1 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE1)             /* lcd_data2.gpmc_a2 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE1)             /* lcd_data3.gpmc_a3 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE1)             /* lcd_data4.gpmc_a4 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE1)             /* lcd_data5.gpmc_a5 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE1)             /* lcd_data6.gpmc_a6 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE1)             /* lcd_data7.gpmc_a7 */
+
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE1)             /* lcd_vsync.gpmc_a8 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE1)             /* lcd_hsync.gpmc_a9 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE1)              /* lcd_pclk.gpmc_a10 */
                >;
        };
 
        i2c0_pins: i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        uart0_pins: uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT | MUX_MODE0)             /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart1_pins: uart1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE7)             /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT | MUX_MODE7)             /* uart1_rtsn.uart1_rtsn */
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT | MUX_MODE0)             /* uart1_txd.uart1_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart2_pins: uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8c0, PIN_INPUT_PULLUP | MUX_MODE7)       /* lcd_data8.gpio2[14] */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE7)             /* lcd_data9.gpio2[15] */
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)              /* spi0_sclk.uart2_rxd */
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)             /* spi0_d0.uart2_txd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_INPUT_PULLUP, MUX_MODE7)       /* lcd_data8.gpio2[14] */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE7)             /* lcd_data9.gpio2[15] */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE1)              /* spi0_sclk.uart2_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT, MUX_MODE1)               /* spi0_d0.uart2_txd */
                >;
        };
 
        uart3_pins: uart3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8c8, PIN_INPUT_PULLUP | MUX_MODE6)       /* lcd_data10.uart3_ctsn */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE6)             /* lcd_data11.uart3_rtsn */
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE1)              /* spi0_cs1.uart3_rxd */
-                       AM33XX_IOPAD(0x964, PIN_OUTPUT | MUX_MODE1)             /* ecap0_in_pwm0_out.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_INPUT_PULLUP, MUX_MODE6)      /* lcd_data10.uart3_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE6)            /* lcd_data11.uart3_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE1)               /* spi0_cs1.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_OUTPUT, MUX_MODE1)             /* ecap0_in_pwm0_out.uart3_txd */
                >;
        };
 
        uart4_pins: uart4_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8d0, PIN_INPUT_PULLUP | MUX_MODE6)       /* lcd_data12.uart4_ctsn */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE6)             /* lcd_data13.uart4_rtsn */
-                       AM33XX_IOPAD(0x968, PIN_INPUT | MUX_MODE1)              /* uart0_ctsn.uart4_rxd */
-                       AM33XX_IOPAD(0x96c, PIN_OUTPUT | MUX_MODE1)             /* uart0_rtsn.uart4_txd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_INPUT_PULLUP, MUX_MODE6)      /* lcd_data12.uart4_ctsn */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE6)            /* lcd_data13.uart4_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT, MUX_MODE1)             /* uart0_ctsn.uart4_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_OUTPUT, MUX_MODE1)            /* uart0_rtsn.uart4_txd */
                >;
        };
 
        uart5_pins: uart5_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8d8, PIN_INPUT | MUX_MODE4)              /* lcd_data14.uart5_rxd */
-                       AM33XX_IOPAD(0x944, PIN_OUTPUT | MUX_MODE3)             /* rmiii1_refclk.uart5_txd */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_INPUT, MUX_MODE4)             /* lcd_data14.uart5_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_OUTPUT, MUX_MODE3)         /* rmiii1_refclk.uart5_txd */
                >;
        };
 
        mmc1_pins: mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLUP | MUX_MODE7)       /* emu1.gpio3[8] */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLUP | MUX_MODE7)       /* mcasp0_aclkr.gpio3[18] */
+                       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)        /* mmc0_clk.mmc0_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)        /* mmc0_cmd.mmc0_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_EMU1, PIN_INPUT_PULLUP, MUX_MODE7)    /* emu1.gpio3[8] */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLUP, MUX_MODE7)    /* mcasp0_aclkr.gpio3[18] */
                >;
        };
 };
index 95d54cf..f47cc9f 100644 (file)
 &am33xx_pinmux {
        nxp_hdmi_bonelt_pins: nxp-hdmi-bonelt-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr0 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)             /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        nxp_hdmi_bonelt_off_pins: nxp-hdmi-bonelt-off-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr0 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_OUTPUT_PULLDOWN, MUX_MODE3)
                >;
        };
 
        mcasp0_pins: mcasp0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */
-                       AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/
-                       AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */
-                       AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */
-                       AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT_PULLDOWN, MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_OUTPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_OUTPUT_PULLDOWN, MUX_MODE7) /* gpmc_a11.GPIO1_27 */
                >;
        };
 
        flash_enable: flash-enable {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x944, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* rmii1_ref_clk.gpio0_29 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE7)        /* rmii1_ref_clk.gpio0_29 */
                >;
        };
 
        imu_interrupt: imu-interrupt {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)             /* mii1_rx_er.gpio3_2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)            /* mii1_rx_er.gpio3_2 */
                >;
        };
 
        ethernet_interrupt: ethernet-interrupt{
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x908, PIN_INPUT_PULLDOWN | MUX_MODE7)             /* mii1_col.gpio3_0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT_PULLDOWN, MUX_MODE7)              /* mii1_col.gpio3_0 */
                >;
        };
 };
 
        user_leds_s0: user-leds-s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a5.gpio1_21 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a6.gpio1_22 */
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_a7.gpio1_23 */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a8.gpio1_24 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a6.gpio1_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a7.gpio1_23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a8.gpio1_24 */
                >;
        };
 
        i2c2_pins: pinmux-i2c2-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_ctsn.i2c2_sda */
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_rtsn.i2c2_scl */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_ctsn.i2c2_sda */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_rtsn.i2c2_scl */
                >;
        };
 
        uart0_pins: pinmux-uart0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        clkout2_pin: pinmux-clkout2-pin {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 
        cpsw_default: cpsw-default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.rgmii1_txd3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.rgmii1_txd2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_txd0 */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txclk.rgmii1_txclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxclk.rgmii1_rxclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxd3.rgmii1_rxd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxd2.rgmii1_rxd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxd1.rgmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)             /* mii1_rxd0.rgmii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)   /* mii1_txen.rgmii1_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE2)            /* mii1_rxdv.rgmii1_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE2)
                >;
        };
 
        cpsw_sleep: cpsw-sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci-mdio-default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci-mdio-sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux-mmc1-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* (C15) spi0_cs1.gpio0[6] */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* (G16) mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* (G15) mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* (F18) mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* (F17) mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* (G18) mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* (G17) mmc0_clk.mmc0_clk */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7) /* (C15) spi0_cs1.gpio0[6] */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        emmc_pins: pinmux-emmc-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2) /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1) /* gpmc_ad7.mmc1_dat7 */
                >;
        };
 };
index f8ff473..a8b6842 100644 (file)
@@ -36,8 +36,8 @@
 &am33xx_pinmux {
        i2c0_pins: pinmux-i2c0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* (C17) I2C0_SDA.I2C0_SDA */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* (C16) I2C0_SCL.I2C0_SCL */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 };
index 1ec8e0d..baceaa7 100644 (file)
 &am33xx_pinmux {
        user_buttons_pins: pinmux_user_buttons {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9e4, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* emu0.gpio3_7 */
-                       AM33XX_IOPAD(0x9e8, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* emu1.gpio3_8 */
+                       AM33XX_PADCONF(AM335X_PIN_EMU0, PIN_INPUT_PULLDOWN, MUX_MODE7)  /* emu0.gpio3_7 */
+                       AM33XX_PADCONF(AM335X_PIN_EMU1, PIN_INPUT_PULLDOWN, MUX_MODE7)  /* emu1.gpio3_8 */
                >;
        };
 
        user_leds_pins: pinmux_user_leds {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_csn1.gpio1_30 */
-                       AM33XX_IOPAD(0x884, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpmc_csn2.gpio1_31 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* gpmc_csn1.gpio1_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_OUTPUT_PULLDOWN, MUX_MODE7)    /* gpmc_csn2.gpio1_31 */
                >;
        };
 };
@@ -96,8 +96,8 @@
 &am33xx_pinmux {
        dcan1_pins: pinmux_dcan1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_OUTPUT_PULLUP | MUX_MODE2)      /* uart1_rxd.dcan1_tx_mux2 */
-                       AM33XX_IOPAD(0x984, PIN_INPUT_PULLUP | MUX_MODE2)       /* uart1_txd.dcan1_rx_mux2 */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_OUTPUT_PULLUP, MUX_MODE2)      /* uart1_rxd.dcan1_tx_mux2 */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT_PULLUP, MUX_MODE2)       /* uart1_txd.dcan1_rx_mux2 */
                >;
        };
 };
 &am33xx_pinmux {
        ethernet1_pins: pinmux_ethernet1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a0.rgmii2_tctl */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a1.rgmii2_rctl */
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a2.rgmii2_td3 */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a3.rgmii2_td2 */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a4.rgmii2_td1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a5.rgmii2_td0 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* gpmc_a6.rgmii2_tclk */
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a7.rgmii2_rclk */
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a8.rgmii2_rd3 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a9.rgmii2_rd2 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a10.rgmii2_rd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* gpmc_a11.rgmii2_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a0.rgmii2_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a1.rgmii2_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a2.rgmii2_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a3.rgmii2_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a4.rgmii2_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a5.rgmii2_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a6.rgmii2_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a7.rgmii2_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a8.rgmii2_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE2)       /* gpmc_a9.rgmii2_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a10.rgmii2_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE2)      /* gpmc_a11.rgmii2_rd0 */
                >;
        };
 };
 
        cb_gpio_pins: pinmux_cb_gpio {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* uart0_ctsn.gpio1_8 */
-                       AM33XX_IOPAD(0x96c, PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* uart0_rtsn.gpio1_9 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE7)   /* uart0_ctsn.gpio1_8 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE7)   /* uart0_rtsn.gpio1_9 */
                >;
        };
 };
 &am33xx_pinmux {
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE7)       /* spi0_cs1.mmc0_sdcd */
+                       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_SPI0_CS1, PIN_INPUT_PULLUP, MUX_MODE7)        /* spi0_cs1.mmc0_sdcd */
                >;
        };
 };
 &am33xx_pinmux {
        uart0_pins: pinmux_uart0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       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 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
-                       AM33XX_IOPAD(0x978, PIN_INPUT | MUX_MODE0)              /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_rtsn.uart1_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        uart2_pins: pinmux_uart2 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_tx_clk.uart2_rxd */
-                       AM33XX_IOPAD(0x930, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_rx_clk.uart2_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE1)     /* mii1_tx_clk.uart2_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE1)  /* mii1_rx_clk.uart2_txd */
                >;
        };
 
        uart3_pins: pinmux_uart3 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE1)       /* mii1_rxd3.uart3_rxd */
-                       AM33XX_IOPAD(0x938, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* mii1_rxd2.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE1)       /* mii1_rxd3.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* mii1_rxd2.uart3_txd */
                >;
        };
 };
index ae43d61..3141255 100644 (file)
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       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_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_d1.i2c1_sda */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_cs0.i2c1_scl */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE2) /* spi0_d1.i2c1_sda */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE2)        /* spi0_cs0.i2c1_scl */
                >;
        };
 
        i2c2_pins: pinmux_i2c2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_clk.i2c2_sda */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE2)       /* spi0_d0.i2c2_scl */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE2)       /* spi0_clk.i2c2_sda */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE2) /* spi0_d0.i2c2_scl */
                >;
        };
 
        spi1_pins: pinmux_spi1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x990, PIN_OUTPUT | MUX_MODE3)             /* mcasp0_aclkx.spi1_sclk */
-                       AM33XX_IOPAD(0x994, PIN_OUTPUT | MUX_MODE3)             /* mcasp0_fsx.spi1_d0 */
-                       AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE3)     /* mcasp0_axr0.spi1_d1 */
-                       AM33XX_IOPAD(0x99C, PIN_OUTPUT | MUX_MODE3)             /* mcasp0_ahclkr.spi1_cs0 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT, MUX_MODE3)          /* mcasp0_aclkx.spi1_sclk */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_OUTPUT, MUX_MODE3)            /* mcasp0_fsx.spi1_d0 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR0, PIN_INPUT_PULLDOWN, MUX_MODE3)   /* mcasp0_axr0.spi1_d1 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT, MUX_MODE3)         /* mcasp0_ahclkr.spi1_cs0 */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x96C, PIN_OUTPUT | MUX_MODE7)             /* uart0_rtsn.gpio1_9 */
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_OUTPUT, MUX_MODE7)
+                       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_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        uart3_pins: pinmux_uart3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE1)       /* spi0_cs1.uart3_rxd */
-                       AM33XX_IOPAD(0x964, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* ecap0_in_pwm0_out.uart3_txd */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT_PULLUP, MUX_MODE1)        /* spi0_cs1.uart3_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_OUTPUT_PULLDOWN, MUX_MODE1)    /* ecap0_in_pwm0_out.uart3_txd */
                >;
        };
 
        clkout2_pin: pinmux_clkout2_pin {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Port 1 (emac0) */
-                       AM33XX_IOPAD(0x908, PIN_INPUT | MUX_MODE0)              /* mii1_col.mii1_col */
-                       AM33XX_IOPAD(0x90C, PIN_INPUT | MUX_MODE0)              /* mii1_crs.mii1_crs */
-                       AM33XX_IOPAD(0x910, PIN_INPUT | MUX_MODE0)              /* mii1_rxer.mii1_rxer */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT | MUX_MODE0)             /* mii1_txen.mii1_txen */
-                       AM33XX_IOPAD(0x918, PIN_INPUT | MUX_MODE0)              /* mii1_rxdv.mii1_rxdv */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT | MUX_MODE0)             /* mii1_txd3.mii1_txd3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT | MUX_MODE0)             /* mii1_txd2.mii1_txd2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT | MUX_MODE0)             /* mii1_txd1.mii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT | MUX_MODE0)             /* mii1_txd0.mii1_txd0 */
-                       AM33XX_IOPAD(0x92c, PIN_INPUT | MUX_MODE0)              /* mii1_txclk.mii1_txclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT | MUX_MODE0)              /* mii1_rxclk.mii1_rxclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT | MUX_MODE0)              /* mii1_rxd3.mii1_rxd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT | MUX_MODE0)              /* mii1_rxd2.mii1_rxd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT | MUX_MODE0)              /* mii1_rxd1.mii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT | MUX_MODE0)              /* mii1_rxd0.mii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT, MUX_MODE0)
 
                        /* Port 2 (emac1) */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT | MUX_MODE1)             /* mii2_txen.gpmc_a0 */
-                       AM33XX_IOPAD(0x844, PIN_INPUT | MUX_MODE1)              /* mii2_rxdv.gpmc_a1 */
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE1)             /* mii2_txd3.gpmc_a2 */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT | MUX_MODE1)             /* mii2_txd2.gpmc_a3 */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT | MUX_MODE1)             /* mii2_txd1.gpmc_a4 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE1)             /* mii2_txd0.gpmc_a5 */
-                       AM33XX_IOPAD(0x858, PIN_INPUT | MUX_MODE1)              /* mii2_txclk.gpmc_a6 */
-                       AM33XX_IOPAD(0x85c, PIN_INPUT | MUX_MODE1)              /* mii2_rxclk.gpmc_a7 */
-                       AM33XX_IOPAD(0x860, PIN_INPUT | MUX_MODE1)              /* mii2_rxd3.gpmc_a8 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT | MUX_MODE1)              /* mii2_rxd2.gpmc_a9 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT | MUX_MODE1)              /* mii2_rxd1.gpmc_a10 */
-                       AM33XX_IOPAD(0x86C, PIN_INPUT | MUX_MODE1)              /* mii2_rxd0.gpmc_a11 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT | MUX_MODE1)              /* mii2_crs.gpmc_wait0 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT | MUX_MODE1)              /* mii2_rxer.gpmc_wpn */
-                       AM33XX_IOPAD(0x878, PIN_INPUT | MUX_MODE1)              /* mii2_col.gpmc_ben1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT, MUX_MODE1)               /* mii2_txen.gpmc_a0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT, MUX_MODE1)                /* mii2_rxdv.gpmc_a1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT, MUX_MODE1)               /* mii2_txd3.gpmc_a2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT, MUX_MODE1)               /* mii2_txd2.gpmc_a3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT, MUX_MODE1)               /* mii2_txd1.gpmc_a4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE1)               /* mii2_txd0.gpmc_a5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_INPUT, MUX_MODE1)                /* mii2_txclk.gpmc_a6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT, MUX_MODE1)                /* mii2_rxclk.gpmc_a7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT, MUX_MODE1)                /* mii2_rxd3.gpmc_a8 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT, MUX_MODE1)                /* mii2_rxd2.gpmc_a9 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT, MUX_MODE1)               /* mii2_rxd1.gpmc_a10 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT, MUX_MODE1)               /* mii2_rxd0.gpmc_a11 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT, MUX_MODE1)             /* mii2_crs.gpmc_wait0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT, MUX_MODE1)               /* mii2_rxer.gpmc_wpn */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT, MUX_MODE1)              /* mii2_col.gpmc_ben1 */
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                /* eMMC */
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd */
+                       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)
                >;
        };
 
        mmc2_pins: pinmux_mmc2_pins {
                /* SD cardcage */
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
                        /* card change signal for frontpanel SD cardcage */
-                       AM33XX_IOPAD(0x890, PIN_INPUT | MUX_MODE7)              /* gpmc_advn_ale.gpio2_2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_INPUT, MUX_MODE7)          /* gpmc_advn_ale.gpio2_2 */
                >;
        };
 
        lcd_pins_s0: lcd_pins_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)             /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)             /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)             /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)             /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)             /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)             /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)             /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)             /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)             /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        dcan0_pins: pinmux_dcan0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_OUTPUT | MUX_MODE2)             /* uart1_ctsn.d_can0_tx */
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* uart1_rtsn.d_can0_rx */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_OUTPUT, MUX_MODE2)            /* uart1_ctsn.d_can0_tx */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLDOWN, MUX_MODE2)    /* uart1_rtsn.d_can0_rx */
                >;
        };
 };
index 6be79b8..5c3e49f 100644 (file)
 &am33xx_pinmux {
        i2c0_pins: pinmux_i2c0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       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 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90C, PIN_INPUT_PULLUP | MUX_MODE3)       /* mii1_crs,i2c1_sda */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE3)       /* mii1_rxerr,i2c1_scl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLUP, MUX_MODE3)        /* mii1_crs,i2c1_sda */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE3)      /* mii1_rxerr,i2c1_scl */
                >;
        };
 };
 &am33xx_pinmux {
        accel_pins: pinmux_accel {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x898, PIN_INPUT | MUX_MODE7)   /* gpmc_wen.gpio2_4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_INPUT, MUX_MODE7)   /* gpmc_wen.gpio2_4 */
                >;
        };
 };
 &am33xx_pinmux {
        audio_pins: pinmux_audio {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_ahcklx.mcasp0_ahclkx */
-                       AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_fsx.mcasp0_fsx */
-                       AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_aclkx.mcasp0_aclkx */
-                       AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_axr0.mcasp0_axr0 */
-                       AM33XX_IOPAD(0x9a8, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_axr1.mcasp0_axr1 */
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a0.gpio1_16 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR1, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a0.gpio1_16 */
                >;
        };
 };
 &am33xx_pinmux {
        lcd_pins: pinmux_lcd {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)     /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad8.lcd_data16 */
-                       AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad9.lcd_data17 */
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad10.lcd_data18 */
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad11.lcd_data19 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad12.lcd_data20 */
-                       AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad13.lcd_data21 */
-                       AM33XX_IOPAD(0x838, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad14.lcd_data22 */
-                       AM33XX_IOPAD(0x83c, PIN_OUTPUT | MUX_MODE1)     /* gpmc_ad15.lcd_data23 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)     /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)     /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)     /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)     /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT, MUX_MODE1)      /* gpmc_ad8.lcd_data16 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT, MUX_MODE1)      /* gpmc_ad9.lcd_data17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad10.lcd_data18 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad11.lcd_data19 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad12.lcd_data20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad13.lcd_data21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad14.lcd_data22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_OUTPUT, MUX_MODE1)     /* gpmc_ad15.lcd_data23 */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                        /* Display Enable */
-                       AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a11.gpio1_27 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_OUTPUT_PULLUP, MUX_MODE7)       /* gpmc_a11.gpio1_27 */
                >;
        };
 };
 &am33xx_pinmux {
        ethernet_pins: pinmux_ethernet {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_txclk.rgmii1_tclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxclk.rgmii1_rclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd3.rgmii1_rxd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd2.rgmii1_rxd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd1.rgmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE2)       /* mii1_rxd0.rgmii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)   /* mii1_txen.rgmii1_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLUP, MUX_MODE2)      /* mii1_rxdv.rgmii1_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE2)
                        /* ethernet interrupt */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLUP | MUX_MODE7)       /* rmii2_refclk.gpio0_29 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLUP, MUX_MODE7)   /* rmii2_refclk.gpio0_29 */
                        /* ethernet PHY nReset */
-                       AM33XX_IOPAD(0x908, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* mii1_col.gpio3_0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_COL, PIN_OUTPUT_PULLUP, MUX_MODE7)       /* mii1_col.gpio3_0 */
                >;
        };
 
        mdio_pins: pinmux_mdio {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 };
 &am33xx_pinmux {
        sd_pins: pinmux_sd_card {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* spi0_cs1.gpio0_6 */
+                       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_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* spi0_cs1.gpio0_6 */
                >;
        };
        emmc_pins: pinmux_emmc {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad7.mmc1_dat7 */
                        /* EMMC nReset */
-                       AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_wpn.gpio0_31 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT_PULLUP, MUX_MODE7)       /* gpmc_wpn.gpio0_31 */
                >;
        };
        wireless_pins: pinmux_wireless {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a1.mmc2_dat0 */
-                       AM33XX_IOPAD(0x848, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a2.mmc2_dat1 */
-                       AM33XX_IOPAD(0x84c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_a3.mmc2_dat2 */
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_ben1.mmc2_dat3 */
-                       AM33XX_IOPAD(0x888, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_csn3.mmc2_cmd */
-                       AM33XX_IOPAD(0x88c, PIN_INPUT_PULLUP | MUX_MODE3)       /* gpmc_clk.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a1.mmc2_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a2.mmc2_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_INPUT_PULLUP, MUX_MODE3) /* gpmc_a3.mmc2_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE3)       /* gpmc_ben1.mmc2_dat3 */
+                       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.mmc1_clk */
                        /* WLAN nReset */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a8.gpio1_24 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a8.gpio1_24 */
                        /* WLAN nPower down */
-                       AM33XX_IOPAD(0x870, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_wait0.gpio0_30 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_OUTPUT_PULLUP, MUX_MODE7)     /* gpmc_wait0.gpio0_30 */
                        /* 32kHz Clock */
-                       AM33XX_IOPAD(0x9b4, PIN_OUTPUT_PULLDOWN | MUX_MODE3)    /* xdma_event_intr1.clkout2 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)     /* xdma_event_intr1.clkout2 */
                >;
        };
 };
 &am33xx_pinmux {
        spi0_pins: pinmux_spi0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x95C, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* spi0_d1.spi0_d1 */
+                       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)
                >;
        };
 };
 &am33xx_pinmux {
        uart0_pins: pinmux_uart0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       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 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97C, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_rtsn.uart1_rtsn */
-                       AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, 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_PULLDOWN, MUX_MODE0)
                >;
        };
 };
        usb_pins: pinmux_usb {
                pinctrl-single,pins = <
                        /* USB0 Over-Current (active low) */
-                       AM33XX_IOPAD(0x864, PIN_INPUT | MUX_MODE7)      /* gpmc_a9.gpio1_25 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT, MUX_MODE7)        /* gpmc_a9.gpio1_25 */
                        /* USB1 Over-Current (active low) */
-                       AM33XX_IOPAD(0x868, PIN_INPUT | MUX_MODE7)      /* gpmc_a10.gpio1_26 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT, MUX_MODE7)       /* gpmc_a10.gpio1_26 */
                >;
        };
 };
 &am33xx_pinmux {
        user_leds_pins: pinmux_user_leds {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a4.gpio1_20 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a4.gpio1_20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a5.gpio1_21 */
                >;
        };
 
        user_buttons_pins: pinmux_user_buttons {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x858, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_a6.gpio1_22 */
-                       AM33XX_IOPAD(0x85C, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_a7.gpio1_21 */
-                       AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE7)       /* gpmc_a8.gpio0_7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_INPUT_PULLUP, MUX_MODE7) /* gpmc_a6.gpio1_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLUP, MUX_MODE7) /* gpmc_a7.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_INPUT_PULLUP, MUX_MODE7)       /* gpmc_a8.gpio0_7 */
                >;
        };
 };
index 015adb6..23c3039 100644 (file)
 &am33xx_pinmux {
        ethernet0_pins: pinmux_ethernet0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x90c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* mii1_crs.rmii1_crs_dv */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* mii1_rxerr.rmii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT | MUX_MODE1)             /* mii1_txen.rmii1_txen */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT | MUX_MODE1)             /* mii1_txd1.rmii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT | MUX_MODE1)             /* mii1_txd0.rmii1_txd0 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* mii1_rxd1.rmii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* mii1_rxd0.rmii1_rxd0 */
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* rmii1_refclk.rmii1_refclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_CRS, PIN_INPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        mdio_pins: pinmux_mdio {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 };
 &am33xx_pinmux {
        i2c0_pins: pinmux_i2c0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT | MUX_MODE0)      /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT | MUX_MODE0)      /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT, MUX_MODE0)
                >;
        };
 };
 &am33xx_pinmux {
                nandflash_pins: pinmux_nandflash {
                        pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad0.gpmc_ad0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad1.gpmc_ad1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad2.gpmc_ad2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad3.gpmc_ad3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad4.gpmc_ad4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad5.gpmc_ad5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad6.gpmc_ad6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_ad7.gpmc_ad7 */
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0)       /* gpmc_wait0.gpmc_wait0 */
-                       AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_csn0.gpmc_csn0 */
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0)             /* gpmc_advn_ale.gpmc_advn_ale */
-                       AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0)             /* gpmc_oen_ren.gpmc_oen_ren */
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0)             /* gpmc_wen.gpmc_wen */
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0)             /* gpmc_be0n_cle.gpmc_be0n_cle */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 };
 &am33xx_pinmux {
        spi0_pins: pinmux_spi0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* spi0_clk.spi0_clk */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0)       /* spi0_d1.spi0_d1 */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0)       /* spi0_cs0.spi0_cs0 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 };
index 62fe5ca..ff4f919 100644 (file)
 &am33xx_pinmux {
        i2c2_pins: pinmux-i2c2-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)       /* (D17) uart1_rtsn.I2C2_SCL */
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)       /* (D18) uart1_ctsn.I2C2_SDA */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* (D17) uart1_rtsn.I2C2_SCL */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* (D18) uart1_ctsn.I2C2_SDA */
                >;
        };
 
        ehrpwm0_pins: pinmux-ehrpwm0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE1)    /* (A13) mcasp0_aclkx.ehrpwm0A */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE1) /* (A13) mcasp0_aclkx.ehrpwm0A */
                >;
        };
 
        ehrpwm1_pins: pinmux-ehrpwm1-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6)    /* (U14) gpmc_a2.ehrpwm1A */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT_PULLDOWN, MUX_MODE6)      /* (U14) gpmc_a2.ehrpwm1A */
                >;
        };
 
        mmc0_pins: pinmux-mmc0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)              /* (C15) spi0_cs1.gpio0[6] */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* (G16) mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* (G15) mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* (F18) mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* (F17) mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* (G18) mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* (G17) mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4)              /* (B12) mcasp0_aclkr.mmc0_sdwp */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE7)               /* (C15) spi0_cs1.gpio0[6] */
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT0, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_DAT3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CMD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MMC0_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT, MUX_MODE4)           /* (B12) mcasp0_aclkr.mmc0_sdwp */
                >;
        };
 
        spi0_pins: pinmux-spi0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0)       /* (A17) spi0_sclk.spi0_sclk */
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0)       /* (B17) spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0)       /* (B16) spi0_d1.spi0_d1 */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0)       /* (A16) spi0_cs0.spi0_cs0 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, 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)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        spi1_pins: pinmux-spi1-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE4)       /* (C18) eCAP0_in_PWM0_out.spi1_sclk */
-                       AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE4)       /* (E18) uart0_ctsn.spi1_d0 */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE4)       /* (E17) uart0_rtsn.spi1_d1 */
-                       AM33XX_IOPAD(0x9b0, PIN_INPUT_PULLUP | MUX_MODE4)       /* (A15) xdma_event_intr0.spi1_cs1 */
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_INPUT_PULLUP, MUX_MODE4)       /* (C18) eCAP0_in_PWM0_out.spi1_sclk */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLUP, MUX_MODE4)      /* (E18) uart0_ctsn.spi1_d0 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE4)      /* (E17) uart0_rtsn.spi1_d1 */
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_INPUT_PULLUP, MUX_MODE4)        /* (A15) xdma_event_intr0.spi1_cs1 */
                >;
        };
 
        usr_leds_pins: pinmux-usr-leds-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7)             /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7)             /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7)             /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7)             /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE7)               /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT, MUX_MODE7)               /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT, MUX_MODE7)               /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT, MUX_MODE7)               /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
                >;
        };
 
        uart0_pins: pinmux-uart0-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* (E15) uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* (E16) uart0_txd.uart0_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        uart4_pins: pinmux-uart4-pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6)       /* (T17) gpmc_wait0.uart4_rxd */
-                       AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE6)    /* (U17) gpmc_wpn.uart4_txd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE6)      /* (T17) gpmc_wait0.uart4_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT_PULLDOWN, MUX_MODE6)     /* (U17) gpmc_wpn.uart4_txd */
                >;
        };
 };
index 35527fd..7ed27b5 100644 (file)
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txen.rgmii1_tctl */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxdv.rgmii1_rctl */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
-                       AM33XX_IOPAD(0x92c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mii1_txclk.rgmii1_tclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxclk.rgmii1_rclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE2)   /* mii1_txen.rgmii1_tctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE2)    /* mii1_rxdv.rgmii1_rctl */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd3.rgmii1_td3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd2.rgmii1_td2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd1.rgmii1_td1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE2)    /* mii1_txd0.rgmii1_td0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_OUTPUT_PULLDOWN, MUX_MODE2)  /* mii1_txclk.rgmii1_tclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE2)   /* mii1_rxclk.rgmii1_rclk */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd3.rgmii1_rd3 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd2.rgmii1_rd2 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd1.rgmii1_rd1 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE2)     /* mii1_rxd0.rgmii1_rd0 */
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        usb_hub_ctrl: usb_hub_ctrl {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x944, PIN_OUTPUT_PULLUP | MUX_MODE7)     /* rmii1_refclk.gpio0_29 */
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_OUTPUT_PULLUP, MUX_MODE7)     /* rmii1_refclk.gpio0_29 */
                >;
        };
 
        mpu6050_pins: pinmux_mpu6050_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_INPUT | MUX_MODE7)    /* uart0_ctsn.gpio1_8 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT, MUX_MODE7)    /* uart0_ctsn.gpio1_8 */
                >;
        };
 
        lps3331ap_pins: pinmux_lps3331ap_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x868, PIN_INPUT | MUX_MODE7)     /* gpmc_a10.gpio1_26 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT, MUX_MODE7)     /* gpmc_a10.gpio1_26 */
                >;
        };
 };
index 917d7cc..07c46a5 100644 (file)
        lcd_pins_default: lcd_pins_default {
                pinctrl-single,pins = <
                        /* gpmc_ad8.lcd_data23 */
-                       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad9.lcd_data22 */
-                       AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad10.lcd_data21 */
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad11.lcd_data20 */
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad12.lcd_data19 */
-                       AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad13.lcd_data18 */
-                       AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad14.lcd_data17 */
-                       AM33XX_IOPAD(0x838, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_OUTPUT, MUX_MODE1)
                        /* gpmc_ad15.lcd_data16 */
-                       AM33XX_IOPAD(0x83c, PIN_OUTPUT | MUX_MODE1)
-                       /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE0)
-                       /* lcd_ac_bias_en.lcd_ac_bias_en */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_OUTPUT, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        lcd_pins_sleep: lcd_pins_sleep {
                pinctrl-single,pins = <
                        /* gpmc_ad8.lcd_data23 */
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad9.lcd_data22 */
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad10.lcd_data21 */
-                       AM33XX_IOPAD(0x828, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad11.lcd_data20 */
-                       AM33XX_IOPAD(0x82c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad12.lcd_data19 */
-                       AM33XX_IOPAD(0x830, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad13.lcd_data18 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad14.lcd_data17 */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLDOWN, MUX_MODE7)
                        /* gpmc_ad15.lcd_data16 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a0, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a4, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8a8, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8ac, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b0, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b4, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8b8, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8bc, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c0, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c4, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8c8, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8cc, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d0, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d4, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8d8, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8dc, PULL_DISABLE | MUX_MODE7)
-                       /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e0, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e4, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8e8, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       /* lcd_ac_bias_en.lcd_ac_bias_en */
-                       AM33XX_IOPAD(0x8ec, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PULL_DISABLE, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 };
index bfbe27a..5b03685 100644 (file)
        clkout2_pin: pinmux_clkout2_pin {
                pinctrl-single,pins = <
                        /* xdma_event_intr1.clkout2 */
-                       AM33XX_IOPAD(0x9b4, PIN_INPUT | MUX_MODE6)
+                       AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_INPUT, MUX_MODE6)
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE0)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
-                       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)
-                       /* mdio_clk.mdio_clk */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        ehrpwm1_pins: pinmux_ehrpwm1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT | MUX_MODE6) /* gpmc_a3.gpio1_19 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT, MUX_MODE6) /* gpmc_a3.gpio1_19 */
                >;
        };
 
        emmc_pins: pinmux_emmc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT | MUX_MODE2)
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1)
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1)
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT | MUX_MODE0)
-                       AM33XX_IOPAD(0x98c, PIN_INPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT, MUX_MODE0)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE5)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT, MUX_MODE5)
                >;
        };
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x830, PIN_INPUT | MUX_MODE3)
-                       AM33XX_IOPAD(0x834, PIN_INPUT | MUX_MODE3)
-                       AM33XX_IOPAD(0x838, PIN_INPUT | MUX_MODE3)
-                       AM33XX_IOPAD(0x83c, PIN_INPUT | MUX_MODE3)
-                       AM33XX_IOPAD(0x888, PIN_INPUT | MUX_MODE3)
-                       AM33XX_IOPAD(0x88c, PIN_INPUT | MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN3, PIN_INPUT, MUX_MODE3)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CLK, PIN_INPUT, MUX_MODE3)
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x96c, PIN_OUTPUT | MUX_MODE0)
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RXD, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART0_TXD, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart1_pins: pinmux_uart1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLDOWN | MUX_MODE0)
-                       AM33XX_IOPAD(0x97C, PIN_OUTPUT | MUX_MODE0)
-                       AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE0)
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT | MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT, MUX_MODE0)
                >;
        };
 
        uart2_pins: pinmux_uart2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)
-                       AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT, MUX_MODE1)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_OUTPUT, MUX_MODE1)
                >;
        };
 
        uart4_pins: pinmux_uart4_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6)
-                       AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLUP | MUX_MODE6)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE6)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT_PULLUP, MUX_MODE6)
                >;
        };
 
        user_leds_s0: user_leds_s0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x820, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x824, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x82c, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x844, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT_PULLUP | MUX_MODE7)
-                       AM33XX_IOPAD(0x860, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x864, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x868, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x86c, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x878, PIN_OUTPUT_PULLUP | MUX_MODE7)
-                       AM33XX_IOPAD(0x87c, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x894, PIN_INPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x944, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x958, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x95c, PIN_OUTPUT | MUX_MODE7)
-                       AM33XX_IOPAD(0x964, PIN_OUTPUT_PULLUP | MUX_MODE7)
-                       AM33XX_IOPAD(0x9a0, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x9a8, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD11, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT_PULLUP, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_OUTPUT_PULLUP, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN0, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_ADVN_ALE, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_OEN_REN, PIN_INPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN0_CLE, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_RMII1_REF_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_OUTPUT, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_ECAP0_IN_PWM0_OUT, PIN_OUTPUT_PULLUP, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_OUTPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSR, PIN_OUTPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLUP, MUX_MODE7)
                >;
        };
 };
index 38d57b8..1ac0c8a 100644 (file)
 
        audio_pins: pinmux_audio_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_ahcklx.mcasp0_ahclkx */
-                       AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_fsx.mcasp0_fsx */
-                       AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_aclkx.mcasp0_aclkx */
-                       AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0)     /* mcasp0_axr0.mcasp0_axr0 */
-                       AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2)    /* mcasp0_ahclkr.mcasp0_axr2 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKR, PIN_OUTPUT_PULLDOWN, MUX_MODE2)
                >;
        };
 
        audio_pa_pins: pinmux_audio_pa_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9a0, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* SoundPA_en - mcasp0_aclkr.gpio3_18 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKR, PIN_INPUT_PULLDOWN, MUX_MODE7)  /* SoundPA_en - mcasp0_aclkr.gpio3_18 */
                >;
        };
 
        audio_mclk_pins: pinmux_audio_mclk_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* gpmc_a11.gpio1_27 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* gpmc_a11.gpio1_27 */
                >;
        };
 
        backlight0_pins: pinmux_backlight0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE7)     /* gpmc_wen.gpio2_4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WEN, PIN_OUTPUT, MUX_MODE7)      /* gpmc_wen.gpio2_4 */
                >;
        };
 
        backlight1_pins: pinmux_backlight1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x828, PIN_OUTPUT | MUX_MODE7)     /* gpmc_ad10.gpio0_26 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD10, PIN_OUTPUT, MUX_MODE7)     /* gpmc_ad10.gpio0_26 */
                >;
        };
 
        lcd_pins: pinmux_lcd_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data0.lcd_data0 */
-                       AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data1.lcd_data1 */
-                       AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data2.lcd_data2 */
-                       AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)     /* lcd_data3.lcd_data3 */
-                       AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data4.lcd_data4 */
-                       AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data5.lcd_data5 */
-                       AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data6.lcd_data6 */
-                       AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data7.lcd_data7 */
-                       AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data8.lcd_data8 */
-                       AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data9.lcd_data9 */
-                       AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data10.lcd_data10 */
-                       AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data11.lcd_data11 */
-                       AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)     /* lcd_data12.lcd_data12 */
-                       AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)     /* lcd_data13.lcd_data13 */
-                       AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)     /* lcd_data14.lcd_data14 */
-                       AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)     /* lcd_data15.lcd_data15 */
-                       AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_vsync.lcd_vsync */
-                       AM33XX_IOPAD(0x8e4, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_hsync.lcd_hsync */
-                       AM33XX_IOPAD(0x8e8, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_pclk.lcd_pclk */
-                       AM33XX_IOPAD(0x8ec, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_ac_bias_en.lcd_ac_bias_en */
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA0, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA1, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA2, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA3, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA4, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA5, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA6, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA7, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA8, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA9, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA10, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA11, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA12, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA13, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA14, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_DATA15, PIN_OUTPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_VSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_HSYNC, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_PCLK, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_LCD_AC_BIAS_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        led_pins: pinmux_led_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a5.gpio1_21 */
-                       AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a6.gpio1_22 */
-                       AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a7.gpio1_23 */
-                       AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7)     /* gpmc_a8.gpio1_24 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a5.gpio1_21 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a6.gpio1_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a7.gpio1_23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_OUTPUT, MUX_MODE7)       /* gpmc_a8.gpio1_24 */
                >;
        };
 
        uart0_pins: pinmux_uart0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart0_txd.uart0_txd */
+                       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_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 
        uart4_pins: pinmux_uart4_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6)       /* gpmc_wait0.uart4_rxd */
-                       AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE6)    /* gpmc_wpn.uart4_txd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WAIT0, PIN_INPUT_PULLUP, MUX_MODE6)      /* gpmc_wait0.uart4_rxd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_OUTPUT_PULLDOWN, MUX_MODE6)     /* gpmc_wpn.uart4_txd */
                >;
        };
 
        i2c0_pins: pinmux_i2c0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_sda.i2c0_sda */
-                       AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0)       /* i2c0_scl.i2c0_scl */
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SDA, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_I2C0_SCL, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        i2c2_pins: pinmux_i2c2_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_ctsn.i2c2_sda */
-                       AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)       /* uart1_rtsn.i2c2_scl */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_ctsn.i2c2_sda */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_INPUT_PULLUP, MUX_MODE3)      /* uart1_rtsn.i2c2_scl */
                >;
        };
 
        cpsw_default: cpsw_default {
                pinctrl-single,pins = <
                        /* Slave 1 */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxerr.mii1_rxerr */
-                       AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txen.mii1_txen */
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxdv.mii1_rxdv */
-                       AM33XX_IOPAD(0x91c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd3.mii1_txd3 */
-                       AM33XX_IOPAD(0x920, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd2.mii1_txd2 */
-                       AM33XX_IOPAD(0x924, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd1.mii1_txd1 */
-                       AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* mii1_txd0.mii1_txd0 */
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_txclk.mii1_txclk */
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxclk.mii1_rxclk */
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd3.mii1_rxd3 */
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd2.mii1_rxd2 */
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd1.mii1_rxd1 */
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLUP | MUX_MODE0)       /* mii1_rxd0.mii1_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLUP, MUX_MODE0)
                >;
        };
 
        cpsw_sleep: cpsw_sleep {
                pinctrl-single,pins = <
                        /* Slave 1 reset value */
-                       AM33XX_IOPAD(0x910, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x914, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x918, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x91c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x920, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x924, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x928, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x92c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x930, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x934, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x938, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x93c, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x940, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_ER, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_EN, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_DV, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_TX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RX_CLK, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD3, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD2, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD1, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MII1_RXD0, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        davinci_mdio_default: davinci_mdio_default {
                pinctrl-single,pins = <
                        /* MDIO */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)       /* mdio_data.mdio_data */
-                       AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)                      /* mdio_clk.mdio_clk */
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLUP | SLEWCTRL_FAST, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_OUTPUT_PULLUP, MUX_MODE0)
                        /* Ethernet */
-                       AM33XX_IOPAD(0x838, PIN_INPUT_PULLUP | MUX_MODE7)       /* Ethernet_nRST - gpmc_ad14.gpio1_14 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD14, PIN_INPUT_PULLUP, MUX_MODE7)       /* Ethernet_nRST - gpmc_ad14.gpio1_14 */
                >;
        };
 
        davinci_mdio_sleep: davinci_mdio_sleep {
                pinctrl-single,pins = <
                        /* MDIO reset value */
-                       AM33XX_IOPAD(0x948, PIN_INPUT_PULLDOWN | MUX_MODE7)
-                       AM33XX_IOPAD(0x94c, PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDIO, PIN_INPUT_PULLDOWN, MUX_MODE7)
+                       AM33XX_PADCONF(AM335X_PIN_MDC, PIN_INPUT_PULLDOWN, MUX_MODE7)
                >;
        };
 
        mmc1_pins: pinmux_mmc1_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x96c, PIN_INPUT | MUX_MODE7)              /* uart0_rtsn.gpio1_9 */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT, MUX_MODE7)             /* uart0_rtsn.gpio1_9 */
                >;
        };
 
        emmc_pwrseq_pins: pinmux_emmc_pwrseq_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT_PULLUP | MUX_MODE7)      /* gpmc_a4.gpio1_20 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT_PULLUP, MUX_MODE7)        /* gpmc_a4.gpio1_20 */
                >;
        };
 
        emmc_pins: pinmux_emmc_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x880, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
-                       AM33XX_IOPAD(0x884, PIN_INPUT_PULLUP | MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
-                       AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad0.mmc1_dat0 */
-                       AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad1.mmc1_dat1 */
-                       AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad2.mmc1_dat2 */
-                       AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad3.mmc1_dat3 */
-                       AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad4.mmc1_dat4 */
-                       AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad5.mmc1_dat5 */
-                       AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad6.mmc1_dat6 */
-                       AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE1)       /* gpmc_ad7.mmc1_dat7 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN1, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn1.mmc1_clk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_CSN2, PIN_INPUT_PULLUP, MUX_MODE2)       /* gpmc_csn2.mmc1_cmd */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD0, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad0.mmc1_dat0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD1, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad1.mmc1_dat1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD2, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad2.mmc1_dat2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD3, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad3.mmc1_dat3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD4, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad4.mmc1_dat4 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD5, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad5.mmc1_dat5 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD6, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad6.mmc1_dat6 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD7, PIN_INPUT_PULLUP, MUX_MODE1)        /* gpmc_ad7.mmc1_dat7 */
                >;
        };
 
        ehrpwm1_pins: pinmux_ehrpwm1a_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE6)     /* gpmc_a2.ehrpwm1a */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT | MUX_MODE6)     /* gpmc_a3.ehrpwm1b */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT, MUX_MODE6)       /* gpmc_a2.ehrpwm1a */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT, MUX_MODE6)       /* gpmc_a3.ehrpwm1b */
                >;
        };
 
        rtc0_irq_pins: pinmux_rtc0_irq_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x824, PIN_INPUT_PULLUP | MUX_MODE7)     /* gpmc_ad9.gpio0_23 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD9, PIN_INPUT_PULLUP, MUX_MODE7)     /* gpmc_ad9.gpio0_23 */
                >;
        };
 
        spi0_pins: pinmux_spi0_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0)       /* SPI0_MOSI - spi0_d0.spi0_d0 */
-                       AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0)       /* SPI0_MISO - spi0_d1.spi0_d1 */
-                       AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0)       /* SPI0_CLK  - spi0_clk.spi0_clk */
-                       AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0)       /* SPI0_CS0 (NBATTSS) - spi0_cs0.spi0_cs0 */
-                       AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE0)       /* SPI0_CS1 (FPGA_FLASH_NCS) - spi0_cs1.spi0_cs1 */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D0, PIN_INPUT_PULLUP, MUX_MODE0) /* SPI0_MOSI */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_D1, PIN_INPUT_PULLUP, MUX_MODE0) /* SPI0_MISO */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_SCLK, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS0, PIN_INPUT_PULLUP, MUX_MODE0)        /* SPI0_CS0 (NBATTSS) */
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1, PIN_INPUT_PULLUP, MUX_MODE0)        /* SPI0_CS1 (FPGA_FLASH_NCS) */
                >;
        };
 
        lwb_pins: pinmux_lwb_pins {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x830, PIN_INPUT_PULLUP | MUX_MODE7)       /* nKbdInt - gpmc_ad12.gpio1_12 */
-                       AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7)       /* nKbdReset - gpmc_ad13.gpio1_13 */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7)       /* USB1_enPower - gpmc_a1.gpio1_17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD12, PIN_INPUT_PULLUP, MUX_MODE7)       /* nKbdInt - gpmc_ad12.gpio1_12 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD13, PIN_INPUT_PULLUP, MUX_MODE7)       /* nKbdReset - gpmc_ad13.gpio1_13 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLUP, MUX_MODE7) /* USB1_enPower - gpmc_a1.gpio1_17 */
                        /* PDI Bus - Battery system */
-                       AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7)       /* nBattReset  gpmc_a0.gpio1_16 */
-                       AM33XX_IOPAD(0x83c, PIN_INPUT_PULLUP | MUX_MODE7)       /* BattPDIData gpmc_ad15.gpio1_15 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLUP, MUX_MODE7) /* nBattReset  gpmc_a0.gpio1_16 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD15, PIN_INPUT_PULLUP, MUX_MODE7)       /* BattPDIData gpmc_ad15.gpio1_15 */
                        /* FPGA */
-                       AM33XX_IOPAD(0x820, PIN_INPUT_PULLUP | MUX_MODE7)       /* FPGA_DONE - gpmc_ad8.gpio0_22 */
-                       AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7)       /* FPGA_NRST - gpmc_a0.gpio1_16 */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* FPGA_RUN - gpmc_a1.gpio1_17 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE7)       /* ENFPGA - gpmc_a9.gpio1_25 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE7)     /* FPGA_PROGRAM - gpmc_a10.gpio1_26 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_AD8, PIN_INPUT_PULLUP, MUX_MODE7)        /* FPGA_DONE - gpmc_ad8.gpio0_22 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_INPUT_PULLUP, MUX_MODE7) /* FPGA_NRST - gpmc_a0.gpio1_16 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE7)       /* FPGA_RUN - gpmc_a1.gpio1_17 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLUP, MUX_MODE7) /* ENFPGA - gpmc_a9.gpio1_25 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE7)      /* FPGA_PROGRAM - gpmc_a10.gpio1_26 */
                >;
        };
 };
index 8ce5417..b7d28a2 100644 (file)
 &am33xx_pinmux {
        mcasp0_pins: pinmux_mcasp0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x9AC, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_ahclkx.mcasp0_ahclkx */
-                       AM33XX_IOPAD(0x990, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_aclkx.mcasp0_aclkx */
-                       AM33XX_IOPAD(0x994, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_fsx.mcasp0_fsx */
-                       AM33XX_IOPAD(0x998, PIN_INPUT_PULLDOWN | MUX_MODE0)  /* mcasp0_axr0.mcasp0_axr0 */
-                       AM33XX_IOPAD(0x9A8, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_axr1.mcasp0_axr1 */
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AHCLKX, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_ACLKX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_FSX, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR0, PIN_INPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_MCASP0_AXR1, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 };
@@ -84,8 +84,8 @@
 &am33xx_pinmux {
        dcan1_pins: pinmux_dcan1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x968, PIN_OUTPUT_PULLUP | MUX_MODE2) /* uart0_ctsn.d_can1_tx */
-                       AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE2) /* uart0_rtsn.d_can1_rx */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_CTSN, PIN_OUTPUT_PULLUP, MUX_MODE2) /* uart0_ctsn.d_can1_tx */
+                       AM33XX_PADCONF(AM335X_PIN_UART0_RTSN, PIN_INPUT_PULLUP, MUX_MODE2) /* uart0_rtsn.d_can1_rx */
                >;
        };
 };
 &am33xx_pinmux {
        ethernet1_pins: pinmux_ethernet1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x840, PIN_OUTPUT | MUX_MODE1)             /* gpmc_a0.mii2_txen */
-                       AM33XX_IOPAD(0x844, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a1.mii2_rxdv */
-                       AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE1)             /* gpmc_a2.mii2_txd3 */
-                       AM33XX_IOPAD(0x84c, PIN_OUTPUT | MUX_MODE1)             /* gpmc_a3.mii2_txd2 */
-                       AM33XX_IOPAD(0x850, PIN_OUTPUT | MUX_MODE1)             /* gpmc_a4.mii2_txd1 */
-                       AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE1)             /* gpmc_a5.mii2_txd0 */
-                       AM33XX_IOPAD(0x858, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a6.mii2_txclk */
-                       AM33XX_IOPAD(0x85c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a7.mii2_rxclk */
-                       AM33XX_IOPAD(0x860, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a8.mii2_rxd3 */
-                       AM33XX_IOPAD(0x864, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a9.mii2_rxd2 */
-                       AM33XX_IOPAD(0x868, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a10.mii2_rxd1 */
-                       AM33XX_IOPAD(0x86c, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_a11.mii2_rxd0 */
-                       AM33XX_IOPAD(0x874, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_wpn.mii2_rxerr */
-                       AM33XX_IOPAD(0x878, PIN_INPUT_PULLDOWN | MUX_MODE1)     /* gpmc_ben1.mii2_col */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A0, PIN_OUTPUT, MUX_MODE1)               /* gpmc_a0.mii2_txen */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A1, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* gpmc_a1.mii2_rxdv */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A2, PIN_OUTPUT, MUX_MODE1)               /* gpmc_a2.mii2_txd3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A3, PIN_OUTPUT, MUX_MODE1)               /* gpmc_a3.mii2_txd2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A4, PIN_OUTPUT, MUX_MODE1)               /* gpmc_a4.mii2_txd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A5, PIN_OUTPUT, MUX_MODE1)               /* gpmc_a5.mii2_txd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A6, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* gpmc_a6.mii2_txclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A7, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* gpmc_a7.mii2_rxclk */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A8, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* gpmc_a8.mii2_rxd3 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A9, PIN_INPUT_PULLDOWN, MUX_MODE1)       /* gpmc_a9.mii2_rxd2 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A10, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* gpmc_a10.mii2_rxd1 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_A11, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* gpmc_a11.mii2_rxd0 */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_WPN, PIN_INPUT_PULLDOWN, MUX_MODE1)      /* gpmc_wpn.mii2_rxerr */
+                       AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLDOWN, MUX_MODE1)     /* gpmc_ben1.mii2_col */
                >;
        };
 };
 &am33xx_pinmux {
        mmc1_pins: pinmux_mmc1 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat3.mmc0_dat3 */
-                       AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat2.mmc0_dat2 */
-                       AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat1.mmc0_dat1 */
-                       AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_dat0.mmc0_dat0 */
-                       AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_clk.mmc0_clk */
-                       AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)       /* mmc0_cmd.mmc0_cmd */
-                       AM33XX_IOPAD(0x960, PIN_INPUT_PULLUP | MUX_MODE7)       /* spi0_cs1.mmc0_sdcd */
+                       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_SPI0_CS1, PIN_INPUT_PULLUP, MUX_MODE7)        /* spi0_cs1.mmc0_sdcd */
                >;
        };
 };
 &am33xx_pinmux {
        uart0_pins: pinmux_uart0 {
                pinctrl-single,pins = <
-                       AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0)    /* uart0_rxd.uart0_rxd */
-                       AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
+                       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_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)       /* uart1_rxd.uart1_rxd */
-                       AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_txd.uart1_txd */
-                       AM33XX_IOPAD(0x978, PIN_INPUT | MUX_MODE0)              /* uart1_ctsn.uart1_ctsn */
-                       AM33XX_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* uart1_rtsn.uart1_rtsn */
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RXD, PIN_INPUT_PULLUP, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_CTSN, PIN_INPUT, MUX_MODE0)
+                       AM33XX_PADCONF(AM335X_PIN_UART1_RTSN, PIN_OUTPUT_PULLDOWN, MUX_MODE0)
                >;
        };
 };
index 9dfd80e..9b8b132 100644 (file)
@@ -80,6 +80,7 @@
                pinctrl-names = "default", "sleep";
                pinctrl-0 = <&matrix_keypad_default>;
                pinctrl-1 = <&matrix_keypad_sleep>;
+               wakeup-source;
 
                row-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH         /* Bank0, pin12 */
                             &gpio0 13 GPIO_ACTIVE_HIGH         /* Bank0, pin13 */
                        regulator-name = "vdcdc3";
                        regulator-boot-on;
                        regulator-always-on;
+                       regulator-state-mem {
+                               regulator-on-in-suspend;
+                       };
+                       regulator-state-disk {
+                               regulator-off-in-suspend;
+                       };
                };
 
                dcdc4: regulator-dcdc4 {
                        regulator-name = "v1_0bat";
                        regulator-min-microvolt = <1000000>;
                        regulator-max-microvolt = <1000000>;
+                       regulator-boot-on;
+                       regulator-always-on;
                };
 
                dcdc6: regulator-dcdc6 {
                        regulator-name = "v1_8bat";
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <1800000>;
+                       regulator-boot-on;
+                       regulator-always-on;
                };
 
                ldo1: regulator-ldo1 {
diff --git a/arch/arm/boot/dts/am5718.dtsi b/arch/arm/boot/dts/am5718.dtsi
new file mode 100644 (file)
index 0000000..d51007c
--- /dev/null
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+#include "dra72x.dtsi"
+
+/ {
+       compatible = "ti,am5718", "ti,dra7";
+};
+
+/*
+ * These modules are not present on AM5718
+ *
+ * ATL
+ * VCP1, VCP2
+ * MLB
+ * ISS
+ * USB3, USB4
+ */
+
+&usb3_tm {
+       status = "disabled";
+};
+
+&usb4_tm {
+       status = "disabled";
+};
+
+&atl_tm {
+       status = "disabled";
+};
index 6432309..66116ad 100644 (file)
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-#include "dra72x.dtsi"
+#include "am5718.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include "dra7-mmc-iodelay.dtsi"
diff --git a/arch/arm/boot/dts/am5728.dtsi b/arch/arm/boot/dts/am5728.dtsi
new file mode 100644 (file)
index 0000000..82e5427
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+#include "dra74x.dtsi"
+
+/ {
+       compatible = "ti,am5728", "ti,dra7";
+};
+
+/*
+ * These modules are not present on AM5728
+ *
+ * EVE1, EVE2
+ * ATL
+ * VCP1, VCP2
+ * MLB
+ * ISS
+ * USB3, USB4
+ */
+
+&usb3_tm {
+       status = "disabled";
+};
+
+&usb4_tm {
+       status = "disabled";
+};
+
+&atl_tm {
+       status = "disabled";
+};
index b2fb6e0..4f83522 100644 (file)
@@ -8,15 +8,14 @@
 
 /dts-v1/;
 
-#include "dra74x.dtsi"
+#include "am5728.dtsi"
 #include "dra7-mmc-iodelay.dtsi"
 #include "dra74x-mmc-iodelay.dtsi"
 #include "am572x-idk-common.dtsi"
 
 / {
        model = "TI AM5728 IDK";
-       compatible = "ti,am5728-idk", "ti,am5728", "ti,dra742", "ti,dra74",
-                    "ti,dra7";
+       compatible = "ti,am5728-idk", "ti,am5728", "ti,dra7";
 };
 
 &mmc1 {
diff --git a/arch/arm/boot/dts/am5748.dtsi b/arch/arm/boot/dts/am5748.dtsi
new file mode 100644 (file)
index 0000000..5e12975
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+#include "dra76x.dtsi"
+
+/ {
+       compatible = "ti,am5748", "ti,dra762", "ti,dra7";
+};
+
+/*
+ * These modules are not present on AM5748
+ *
+ * EVE1, EVE2
+ * ATL
+ * VCP1, VCP2
+ * MLB
+ * ISS
+ * USB3, USB4
+ */
+
+&usb3_tm {
+       status = "disabled";
+};
+
+&usb4_tm {
+       status = "disabled";
+};
+
+&atl_tm {
+       status = "disabled";
+};
index 378dfa7..dc5141c 100644 (file)
@@ -6,14 +6,14 @@
 
 /dts-v1/;
 
-#include "dra76x.dtsi"
+#include "am5748.dtsi"
 #include "dra7-mmc-iodelay.dtsi"
 #include "dra76x-mmc-iodelay.dtsi"
 #include "am572x-idk-common.dtsi"
 
 / {
        model = "TI AM5748 IDK";
-       compatible = "ti,am5728-idk", "ti,dra762", "ti,dra7";
+       compatible = "ti,am5748-idk", "ti,am5748", "ti,dra762", "ti,dra7";
 };
 
 &qspi {
index 1e6620f..2341a56 100644 (file)
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-#include "dra74x.dtsi"
+#include "am5728.dtsi"
 #include "am57xx-commercial-grade.dtsi"
 #include "dra74x-mmc-iodelay.dtsi"
 #include <dt-bindings/gpio/gpio.h>
index 4748ce8..0460de0 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
-#include "dra74x.dtsi"
+#include "am5728.dtsi"
 
 / {
        model = "CompuLab CL-SOM-AM57x";
index 96c1870..3f4bb44 100644 (file)
                                reg = <0x20300 0x34>, <0x20704 0x4>, <0x18260 0x4>;
                                clocks = <&coreclk 2>, <&refclk>;
                                clock-names = "nbclk", "fixed";
+                               interrupts-extended = <&gic GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>,
+                                                     <&gic GIC_SPI  9 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        cpurst: cpurst@20800 {
index 2375449..556ed46 100644 (file)
 
        chosen {
                stdout-path = &uart5;
-               bootargs = "console=ttyS4,115200 earlyprintk";
+               bootargs = "console=tty0 console=ttyS4,115200 earlyprintk";
        };
 
        memory@80000000 {
                reg = <0x80000000 0x20000000>;
        };
+
+       reserved-memory {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               gfx_memory: framebuffer {
+                       size = <0x01000000>;
+                       alignment = <0x01000000>;
+                       compatible = "shared-dma-pool";
+                       reusable;
+               };
+       };
 };
 
 &fmc {
@@ -27,6 +40,7 @@
                status = "okay";
                m25p,fast-read;
                label = "bmc";
+#include "openbmc-flash-layout.dtsi"
        };
 };
 
 &uhci {
        status = "okay";
 };
+
+&gfx {
+     status = "okay";
+     memory-region = <&gfx_memory>;
+};
index 9f194b5..43aba40 100644 (file)
        memory@80000000 {
                reg = <0x80000000 0x20000000>;
        };
+
+       ast-adc-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
+                             <&adc 4>, <&adc 5>, <&adc 6>, <&adc 7>;
+       };
 };
 
 &pinctrl {
index 4c2dcac..c4521ed 100644 (file)
        status = "okay";
 };
 
+&vuart {
+       // VUART Host Console
+       status = "okay";
+};
+
 &uart1 {
        // Host Console
        status = "okay";
index b854ac0..b249da8 100644 (file)
@@ -32,9 +32,9 @@
                        no-map;
                };
 
-               flash_memory: region@98000000 {
+               flash_memory: region@5c000000 {
                        no-map;
-                       reg = <0x98000000 0x01000000>; /* 16MB */
+                       reg = <0x5C000000 0x02000000>; /* 32MB */
                };
        };
 
index 76fe994..418a198 100644 (file)
                        reg = <0x9ef00000 0x00100000>;
                        no-map;
                };
+
+               gfx_memory: framebuffer {
+                       size = <0x01000000>;
+                       alignment = <0x01000000>;
+                       compatible = "shared-dma-pool";
+                       reusable;
+               };
        };
 
        leds {
 
 &gfx {
        status = "okay";
+       memory-region = <&gfx_memory>;
 };
 
 &pinctrl {
index ad54117..f1356ca 100644 (file)
                        no-map;
                        reg = <0x98000000 0x04000000>; /* 64M */
                };
+
+               gfx_memory: framebuffer {
+                       size = <0x01000000>;
+                       alignment = <0x01000000>;
+                       compatible = "shared-dma-pool";
+                       reusable;
+               };
        };
 
        gpio-keys {
                status = "okay";
                label = "bmc";
                m25p,fast-read;
-#include "openbmc-flash-layout.dtsi"
+
+               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";
+               label = "alt-bmc";
                m25p,fast-read;
+
+               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";
+                       };
+               };
+
        };
 };
 
 
 &gfx {
        status = "okay";
+       memory-region = <&gfx_memory>;
 };
 
 &pinctrl {
 &adc {
        status = "okay";
 };
+
+&vhub {
+       status = "okay";
+};
index 9549f86..5d7050d 100644 (file)
                                clock-names = "PCLK";
                        };
 
+                       rtc: rtc@1e781000 {
+                               compatible = "aspeed,ast2400-rtc";
+                               reg = <0x1e781000 0x18>;
+                               status = "disabled";
+                       };
+
                        uart1: serial@1e783000 {
                                compatible = "ns16550a";
                                reg = <0x1e783000 0x20>;
index 85ed9db..4345c31 100644 (file)
                                compatible = "aspeed,ast2500-gfx", "syscon";
                                reg = <0x1e6e6000 0x1000>;
                                reg-io-width = <4>;
+                               clocks = <&syscon ASPEED_CLK_GATE_D1CLK>;
+                               resets = <&syscon ASPEED_RESET_CRT1>;
+                               status = "disabled";
+                               interrupts = <0x19>;
                        };
 
                        adc: adc@1e6e9000 {
                                status = "disabled";
                        };
 
+                       video: video@1e700000 {
+                               compatible = "aspeed,ast2500-video-engine";
+                               reg = <0x1e700000 0x1000>;
+                               clocks = <&syscon ASPEED_CLK_GATE_VCLK>,
+                                        <&syscon ASPEED_CLK_GATE_ECLK>;
+                               clock-names = "vclk", "eclk";
+                               interrupts = <7>;
+                               status = "disabled";
+                       };
+
                        sram: sram@1e720000 {
                                compatible = "mmio-sram";
                                reg = <0x1e720000 0x9000>;      // 36K
                                #interrupt-cells = <2>;
                        };
 
+                       rtc: rtc@1e781000 {
+                               compatible = "aspeed,ast2500-rtc";
+                               reg = <0x1e781000 0x18>;
+                               status = "disabled";
+                       };
+
                        timer: timer@1e782000 {
                                /* This timer is a Faraday FTTMR010 derivative */
                                compatible = "aspeed,ast2400-timer";
index e3e14b7..0d695c7 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-ariag25.dts - Device Tree file for Acme Systems Aria G25 (AT91SAM9G25 based)
  *
  * Copyright (C) 2013 Douglas Gilbert <dgilbert@interlog.com>,
  *                    Robert Nelson <robertcnelson@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g25.dtsi"
index 295a5a4..47721c9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-cosino.dtsi - Device Tree file for Cosino core module
  *
@@ -7,8 +8,6 @@
  * Derived from at91sam9x5ek.dtsi by:
  *     Copyright (C) 2012 Atmel,
  *     2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "at91sam9g35.dtsi"
index c452654..8fde06a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-cosino_mega2560.dts - Device Tree file for Cosino board with
  *                           Mega 2560 extension
@@ -8,8 +9,6 @@
  * Derived from at91sam9g35ek.dts by:
  *     Copyright (C) 2012 Atmel,
  *      2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index d413e2d..683b9e3 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-foxg20.dts - Device Tree file for Acme Systems FoxG20 board
  *
  * Based on DT files for at91sam9g20ek evaluation board (AT91SAM9G20 SoC)
  *
  * Copyright (C) 2013 Douglas Gilbert <dgilbert@interlog.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g20.dtsi"
index 1003846..90996ea 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-kizbox.dts - Device Tree file for Overkiz Kizbox board
  *
  * Copyright (C) 2012-2014 Boris BREZILLON <b.brezillon@overkiz.com>
  *               2014-2015 Gaël PORTAY <g.portay@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g20.dtsi"
index 30041e8..86d8218 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-kizbox2.dts - Device Tree file for Overkiz Kizbox 2 board
  *
  * Copyright (C) 2014 Gaël PORTAY <g.portay@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d31.dtsi"
index 15b0746..0620dcd 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-kizboxmini.dts - Device Tree file for Overkiz Kizbox mini board
  *
  * Copyright (C) 2014 Gaël PORTAY <g.portay@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g25.dtsi"
index c7b964e..41f1639 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-linea.dtsi - Device Tree Include file for the Axentia Linea Module.
  *
  * Copyright (C) 2017 Axentia Technologies AB
  *
  * Author: Peter Rosin <peda@axentia.se>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "sama5d31.dtsi"
index 70cb36f..954404e 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-sam9_l9260.dts - Device Tree file for Olimex SAM9-L9260 board
  *
  *  Copyright (C) 2016 Raashid Muhammed <raashidmuhammed@zilogic.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9260.dtsi"
index 33a159c..7788d5d 100644 (file)
@@ -1,47 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91-sama5d27_som1.dtsi - Device Tree file for SAMA5D27 SoM1 board
  *
  *  Copyright (c) 2017, Microchip Technology Inc.
  *                2017 Cristian Birsan <cristian.birsan@microchip.com>
  *                2017 Claudiu Beznea <claudiu.beznea@microchip.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "sama5d2.dtsi"
 #include "sama5d2-pinfunc.h"
index a481805..89f0c99 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91-sama5d27_som1_ek.dts - Device Tree file for SAMA5D27-SOM1-EK board
  *
@@ -5,44 +6,6 @@
  *                2016 Nicolas Ferre <nicolas.ferre@atmel.com>
  *                2017 Cristian Birsan <cristian.birsan@microchip.com>
  *                2017 Claudiu Beznea <claudiu.beznea@microchip.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "at91-sama5d27_som1.dtsi"
index fa54e88..808e399 100644 (file)
@@ -1,52 +1,16 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91-sama5d2_xplained.dts - Device Tree file for SAMA5D2 Xplained board
  *
  *  Copyright (C) 2015 Atmel,
  *                2015 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "sama5d2.dtsi"
 #include "sama5d2-pinfunc.h"
 #include <dt-bindings/mfd/atmel-flexcom.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/active-semi,8945a-regulator.h>
 
 / {
        model = "Atmel SAMA5D2 Xplained";
                                                        regulator-name = "VDD_1V35";
                                                        regulator-min-microvolt = <1350000>;
                                                        regulator-max-microvolt = <1350000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-on-in-suspend;
+                                                               regulator-suspend-min-microvolt=<1400000>;
+                                                               regulator-suspend-max-microvolt=<1400000>;
+                                                               regulator-changeable-in-suspend;
+                                                               regulator-mode=<ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       };
                                                };
 
                                                vdd_1v2_reg: REG_DCDC2 {
                                                        regulator-name = "VDD_1V2";
                                                        regulator-min-microvolt = <1100000>;
                                                        regulator-max-microvolt = <1300000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
 
                                                vdd_3v3_reg: REG_DCDC3 {
                                                        regulator-name = "VDD_3V3";
                                                        regulator-min-microvolt = <3300000>;
                                                        regulator-max-microvolt = <3300000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
 
                                                vdd_fuse_reg: REG_LDO1 {
                                                        regulator-name = "VDD_FUSE";
                                                        regulator-min-microvolt = <2500000>;
                                                        regulator-max-microvolt = <2500000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
 
                                                vdd_3v3_lp_reg: REG_LDO2 {
                                                        regulator-name = "VDD_3V3_LP";
                                                        regulator-min-microvolt = <3300000>;
                                                        regulator-max-microvolt = <3300000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
 
                                                vdd_led_reg: REG_LDO3 {
                                                        regulator-name = "VDD_LED";
                                                        regulator-min-microvolt = <3300000>;
                                                        regulator-max-microvolt = <3300000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
 
                                                vdd_sdhc_1v8_reg: REG_LDO4 {
                                                        regulator-name = "VDD_SDHC_1V8";
                                                        regulator-min-microvolt = <1800000>;
                                                        regulator-max-microvolt = <1800000>;
+                                                       regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
+                                                                                 <ACT8945A_REGULATOR_MODE_LOWPOWER>;
+                                                       regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
                                                        regulator-always-on;
+
+                                                       regulator-state-mem {
+                                                               regulator-off-in-suspend;
+                                                       };
                                                };
                                        };
 
index 322a744..61f068a 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-sama5d3_xplained.dts - Device Tree file for the SAMA5D3 Xplained board
  *
  *  Copyright (C) 2014 Atmel,
  *               2014 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d36.dtsi"
index 43aef56..fdfc37d 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91-sama5d4_xplained.dts - Device Tree file for SAMA5D4 Xplained board
  *
  *  Copyright (C) 2015 Atmel,
  *                2015 Josh Wu <josh.wu@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "sama5d4.dtsi"
index 12d5af9..0cc1cff 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91-sama5d4ek.dts - Device Tree file for SAMA5D4 Evaluation Kit
  *
  *  Copyright (C) 2014 Atmel,
  *                2014 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "sama5d4.dtsi"
index fe8876e..3ca97b4 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91-tse850-3.dts - Device Tree file for the Axentia TSE-850 3.0 board
  *
  * Copyright (C) 2017 Axentia Technologies AB
  *
  * Author: Peter Rosin <peda@axentia.se>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include <dt-bindings/pwm/pwm.h>
index 4302772..15050fd 100644 (file)
@@ -1,47 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Device Tree file for VInCo platform
  *
  *  Copyright (C) 2014 Atmel,
  *                2014 Nicolas Ferre <nicolas.ferre@atmel.com>
  *   2015 Gregory CLEMENT <gregory.clement@free-electrons.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "sama5d4.dtsi"
index 5a882a0..4438571 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91rm9200.dtsi - Device Tree Include file for AT91RM9200 family SoC
  *
@@ -6,8 +7,6 @@
  *                2012 Joachim Eastwood <manabian@gmail.com>
  *
  * Based on at91sam9260.dtsi
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/pinctrl/at91.h>
index 93ca66f..c3d4177 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91rm9200_pqfp.dtsi - Device Tree Include file for AT91RM9200 PQFP family SoC
  *
  * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "at91rm9200.dtsi"
index 3b58b94..dee9c0c 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9260.dtsi - Device Tree Include file for AT91SAM9260 family SoC
  *
  *  Copyright (C) 2011 Atmel,
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
  *                2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/pinctrl/at91.h>
index 07d1b57..81f808a 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Device Tree file for Atmel at91sam9260 Evaluation Kit
  *
  *  Copyright (C) 2016 Atmel,
  *               2016 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "at91sam9260.dtsi"
index d1d2b40..97100d2 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9g15ek.dts - Device Tree file for AT91SAM9G15-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g15.dtsi"
index ac73081..a02c6c7 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9g25ek.dts - Device Tree file for AT91SAM9G25-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g25.dtsi"
index 23ec8b1..449ec71 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9g35ek.dts - Device Tree file for AT91SAM9G35-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g35.dtsi"
index f368196..9483609 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9g45.dtsi - Device Tree Include file for AT91SAM9G45 family SoC
  *                    applies to AT91SAM9G45, AT91SAM9M10,
@@ -5,8 +6,6 @@
  *
  *  Copyright (C) 2011 Atmel,
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/dma/at91.h>
index 2588833..06d74ff 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9m10g45ek.dts - Device Tree file for AT91SAM9M10G45-EK board
  *
  *  Copyright (C) 2011 Atmel,
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9g45.dtsi"
index f71d65e..ea67517 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9n12.dtsi - Device Tree include file for AT91SAM9N12 SoC
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Hong Xu <hong.xu@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/dma/at91.h>
index c43095c..ea5cef0 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9n12ek.dts - Device Tree file for AT91SAM9N12-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Hong Xu <hong.xu@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9n12.dtsi"
index 6b5777f..e2d38ce 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9rl.dtsi - Device Tree Include file for AT91SAM9RL family SoC
  *
  *  Copyright (C) 2014 Microchip
  *  Alexandre Belloni <alexandre.belloni@free-electrons.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/pinctrl/at91.h>
index f705a31..4e1c3df 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x25ek.dts - Device Tree file for AT91SAM9X25-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9x25.dtsi"
index fcb6718..7646c68 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x35ek.dts - Device Tree file for AT91SAM9X35-EK board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9x35.dtsi"
index 79c4956..9b7ce6b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x5.dtsi - Device Tree Include file for AT91SAM9x5 family SoC
  *                   applies to AT91SAM9G15, AT91SAM9G25, AT91SAM9G35,
@@ -5,8 +6,6 @@
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/dma/at91.h>
index c4cc9cc..75d2f7f 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x5cm.dtsi - Device Tree Include file for AT91SAM9x5 CPU Module
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index 34c089f..b04ebf1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x5dm.dtsi - Device Tree file for SAM9x5 display module
  *
@@ -5,8 +6,6 @@
  *                2014 Free Electrons
  *
  *  Author: Boris Brezillon <boris.brezillon@free-electrons.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index 4a2e13c..2ad0a43 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * at91sam9x5ek.dtsi - Device Tree file for AT91SAM9x5CM Base board
  *
  *  Copyright (C) 2012 Atmel,
  *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "at91sam9x5cm.dtsi"
 
index 1304452..3f9d8ca 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * at91sam9xe.dtsi - Device Tree Include file for AT91SAM9XE family SoC
  *
  *  Copyright (C) 2015 Atmel,
  *                2015 Alexandre Belloni <alexandre.Belloni@free-electrons.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "at91sam9260.dtsi"
index 4088241..89e4303 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFatlas6 Evaluation Board
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index 5587b98..8ac5d15 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFatlas6 SoC
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index 900e03b..e0c0291 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFatlas7 Evaluation Board
  *
  * Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index f3de9af..99c9d9d 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFatlas7 SoC
  *
  * Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index bd83962..1dfeece 100644 (file)
                        status = "disabled";
                };
        };
+
+       usb_power_supply: usb-power-supply {
+               compatible = "x-powers,axp813-usb-power-supply";
+       };
 };
index 414f1cd..fe9f0bc 100644 (file)
                        ranges = <0x0 0x3a000 0x1000>;
                };
 
-               target-module@3c000 {                   /* 0x4843c000, ap 23 08.0 */
+               atl_tm: target-module@3c000 {           /* 0x4843c000, ap 23 08.0 */
                        compatible = "ti,sysc-omap4", "ti,sysc";
                        reg = <0x3c000 0x4>;
                        reg-names = "rev";
                        };
                };
 
-               target-module@100000 {                  /* 0x48900000, ap 85 04.0 */
+               usb3_tm: target-module@100000 {         /* 0x48900000, ap 85 04.0 */
                        compatible = "ti,sysc-omap4", "ti,sysc";
                        ti,hwmods = "usb_otg_ss3";
                        reg = <0x100000 0x4>,
                        };
                };
 
-               target-module@140000 {                  /* 0x48940000, ap 75 3c.0 */
+               usb4_tm: target-module@140000 {         /* 0x48940000, ap 75 3c.0 */
                        compatible = "ti,sysc-omap4", "ti,sysc";
                        ti,hwmods = "usb_otg_ss4";
                        reg = <0x140000 0x4>,
index 2bc9add..d87e932 100644 (file)
                                ti,hwmods = "pcie1";
                                phys = <&pcie1_phy>;
                                phy-names = "pcie-phy0";
+                               ti,syscon-lane-sel = <&scm_conf_pcie 0x18>;
                                interrupt-map-mask = <0 0 0 7>;
                                interrupt-map = <0 0 0 1 &pcie1_intc 1>,
                                                <0 0 0 2 &pcie1_intc 2>,
                                phys = <&pcie1_phy>;
                                phy-names = "pcie-phy0";
                                ti,syscon-unaligned-access = <&scm_conf1 0x14 1>;
+                               ti,syscon-lane-sel = <&scm_conf_pcie 0x18>;
                                status = "disabled";
                        };
                };
index 1bb8e5c..abfff54 100644 (file)
@@ -25,7 +25,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel root=/dev/nfs ip=dhcp";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial1:115200n8";
        };
 
index 0e74222..365931f 100644 (file)
@@ -1,8 +1,4 @@
-/*
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /dts-v1/;
 
index 3475c77..a0c270f 100644 (file)
@@ -1,8 +1,4 @@
-/*
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "ep7211.dtsi"
 #include <dt-bindings/gpio/gpio.h>
index e438f6d..32a4e12 100644 (file)
@@ -1,8 +1,4 @@
-/*
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "ep7209.dtsi"
 
index 20a4481..6d519d0 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * evk-pro3.dts - Device Tree file for Telit EVK-PRO3 with Telit GE863-PRO3
  *
  * Copyright (C) 2012 Telit,
  *               2012 Fabio Porcedda <fabio.porcedda@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index 5892a9f..8ce3a77 100644 (file)
                };
        };
 
-       soc: soc {
-               compatible = "simple-bus";
+       fixed-rate-clocks {
                #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-
-               fixed-rate-clocks {
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+               #size-cells = <0>;
 
-                       xusbxti: clock@0 {
-                               compatible = "fixed-clock";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               reg = <0>;
-                               clock-frequency = <0>;
-                               #clock-cells = <0>;
-                               clock-output-names = "xusbxti";
-                       };
+               xusbxti: clock@0 {
+                       compatible = "fixed-clock";
+                       reg = <0>;
+                       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";
+                       reg = <1>;
+                       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";
+                       reg = <2>;
+                       clock-frequency = <0>;
+                       #clock-cells = <0>;
+                       clock-output-names = "xtcxo";
                };
+       };
+
+       pmu {
+               compatible = "arm,cortex-a7-pmu";
+               interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       soc: soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
 
                sysram@2020000 {
                        compatible = "mmio-sram";
                        status = "disabled";
                };
 
-               pmu {
-                       compatible = "arm,cortex-a7-pmu";
-                       interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
-               };
-
                ppmu_dmc0: ppmu_dmc0@106a0000 {
                        compatible = "samsung,exynos-ppmu";
                        reg = <0x106a0000 0x2000>;
index 6085e92..36ccf22 100644 (file)
                serial3 = &serial_3;
        };
 
+       pmu: pmu {
+               compatible = "arm,cortex-a9-pmu";
+               interrupt-parent = <&combiner>;
+               interrupts = <2 2>, <3 2>;
+       };
+
        soc: soc {
                compatible = "simple-bus";
                #address-cells = <1>;
                        reg = <0x10440000 0x1000>;
                };
 
-               pmu: pmu {
-                       compatible = "arm,cortex-a9-pmu";
-                       interrupt-parent = <&combiner>;
-                       interrupts = <2 2>, <3 2>;
-               };
-
                sys_reg: syscon@10010000 {
                        compatible = "samsung,exynos4-sysreg", "syscon";
                        reg = <0x10010000 0x400>;
                        status = "disabled";
                };
 
-               amba {
+               amba: amba {
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "simple-bus";
index dd9ec05..36b1ede 100644 (file)
@@ -30,8 +30,8 @@
        };
 
        chosen {
-               bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
-               stdout-path = &serial_2;
+               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M init=/linuxrc";
+               stdout-path = "serial2:115200n8";
        };
 
        mmc_reg: voltage-regulator {
index 7a3e621..77fc11e 100644 (file)
@@ -26,8 +26,8 @@
        };
 
        chosen {
-               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc";
-               stdout-path = &serial_1;
+               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M init=/linuxrc";
+               stdout-path = "serial1:115200n8";
        };
 
        fixed-rate-clocks {
index 8dbc47d..6882480 100644 (file)
@@ -26,8 +26,8 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
-               stdout-path = &serial_2;
+               bootargs = "root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
+               stdout-path = "serial2:115200n8";
        };
 
        regulators {
index 5c3d986..bf092e9 100644 (file)
@@ -24,8 +24,8 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rw rootwait earlyprintk panic=5 maxcpus=1";
-               stdout-path = &serial_2;
+               bootargs = "root=/dev/mmcblk0p5 rw rootwait earlyprintk panic=5 maxcpus=1";
+               stdout-path = "serial2:115200n8";
        };
 
 
        };
 };
 
+&amba {
+       mdma0: mdma@12840000 {
+               compatible = "arm,pl330", "arm,primecell";
+               reg = <0x12840000 0x1000>;
+               interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&clock CLK_MDMA>;
+               clock-names = "apb_pclk";
+               #dma-cells = <1>;
+               #dma-channels = <8>;
+               #dma-requests = <1>;
+               power-domains = <&pd_lcd0>;
+       };
+};
+
 &camera {
        status = "okay";
 
 };
 
 &mdma1 {
-       reg = <0x12840000 0x1000>;
+       /* Use the secure mdma0 */
+       status = "disabled";
 };
 
 &mixer {
index 2bdf899..96d9988 100644 (file)
@@ -34,8 +34,6 @@
        fan0: pwm-fan {
                compatible = "pwm-fan";
                pwms = <&pwm 0 10000 0>;
-               cooling-min-state = <0>;
-               cooling-max-state = <3>;
                #cooling-cells = <2>;
                cooling-levels = <0 102 170 230>;
        };
        };
 };
 
+&adc {
+       vdd-supply = <&ldo10_reg>;
+       /* Nothing connected to ADC inputs, keep it disabled */
+};
+
 /* Supply for LAN9730/SMSC95xx */
 &buck8_reg {
        regulator-name = "BUCK8_P3V3";
index 346f719..698de43 100644 (file)
@@ -25,8 +25,7 @@
        };
 
        chosen {
-               bootargs ="console=ttySAC2,115200";
-               stdout-path = &serial_2;
+               stdout-path = "serial2:115200n8";
        };
 
        firmware@203f000 {
index 5c5c288..e70fb6e 100644 (file)
@@ -23,8 +23,8 @@
        };
 
        chosen {
-               bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc";
-               stdout-path = &serial_1;
+               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M init=/linuxrc";
+               stdout-path = "serial1:115200n8";
        };
 
        fixed-rate-clocks {
index 327ee98..aac5339 100644 (file)
@@ -22,6 +22,7 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
+               bootargs = "root=/dev/mmcblk0p5 rootwait earlyprintk panic=5";
+               stdout-path = "serial2:115200n8";
        };
 };
index 26ad6ab..e5c041e 100644 (file)
                };
 
                adc: adc@126c0000 {
-                       compatible = "samsung,exynos-adc-v1";
+                       compatible = "samsung,exynos4212-adc";
                        reg = <0x126C0000 0x100>;
                        interrupt-parent = <&combiner>;
                        interrupts = <10 3>;
index d5e6618..6dc9694 100644 (file)
@@ -24,7 +24,8 @@
        };
 
        chosen {
-               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
+               bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M init=/linuxrc";
+               stdout-path = "serial2:115200n8";
        };
 
        vdd: fixed-regulator-vdd {
index 80986b9..d5e0392 100644 (file)
                };
        };
 
+       pmu {
+               compatible = "arm,cortex-a15-pmu";
+               interrupt-parent = <&combiner>;
+               interrupts = <1 2>, <22 4>;
+       };
+
        soc: soc {
                sysram@2020000 {
                        compatible = "mmio-sram";
                        power-domains = <&pd_mau>;
                };
 
-               timer {
-                       compatible = "arm,armv7-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)>;
-                       /*
-                        * Unfortunately we need this since some versions
-                        * of U-Boot on Exynos don't set the CNTFRQ register,
-                        * so we need the value from DT.
-                        */
-                       clock-frequency = <24000000>;
-               };
-
                mct@101c0000 {
                        compatible = "samsung,exynos4210-mct";
                        reg = <0x101C0000 0x800>;
                        };
                };
 
-               pmu {
-                       compatible = "arm,cortex-a15-pmu";
-                       interrupt-parent = <&combiner>;
-                       interrupts = <1 2>, <22 4>;
-               };
-
                pinctrl_0: pinctrl@11400000 {
                        compatible = "samsung,exynos5250-pinctrl";
                        reg = <0x11400000 0x1000>;
                       };
                };
        };
+
+       timer {
+               compatible = "arm,armv7-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)>;
+               /*
+                * Unfortunately we need this since some versions
+                * of U-Boot on Exynos don't set the CNTFRQ register,
+                * so we need the value from DT.
+                */
+               clock-frequency = <24000000>;
+       };
 };
 
 &dp {
index b1edb20..17e2f3e 100644 (file)
                #gpio-cells = <2>;
 
                interrupt-controller;
+               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
                #interrupt-cells = <2>;
        };
 
                #gpio-cells = <2>;
 
                interrupt-controller;
+               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>,
+                            <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
                #interrupt-cells = <2>;
        };
 
index fa19c59..36a2b77 100644 (file)
@@ -19,7 +19,7 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200";
+               stdout-path = "serial2:115200n8";
        };
 
        fin_pll: xxti {
index 5516785..3581b57 100644 (file)
        #size-cells = <1>;
 
        aliases {
+               i2c0 = &hsi2c_0;
+               i2c1 = &hsi2c_1;
+               i2c2 = &hsi2c_2;
+               i2c3 = &hsi2c_3;
                pinctrl0 = &pinctrl_0;
                pinctrl1 = &pinctrl_1;
                pinctrl2 = &pinctrl_2;
                        wakeup-interrupt-controller {
                                compatible = "samsung,exynos4210-wakeup-eint";
                                interrupt-parent = <&gic>;
-                               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
                        };
                };
 
                        #size-cells = <0>;
                        clocks = <&clock_fsys FSYS_CLK_MMC0>, <&clock_top TOP_SCLK_MMC0>;
                        clock-names = "biu", "ciu";
+                       assigned-clocks =
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_A>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_B>,
+                               <&clock_top TOP_SCLK_MMC0>;
+                       assigned-clock-parents =
+                               <&clock_top TOP_MOUT_BUSTOP_PLL_USER>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_A>;
+                       assigned-clock-rates = <0>, <0>, <800000000>;
                        fifo-depth = <64>;
                        status = "disabled";
                };
                        #size-cells = <0>;
                        clocks = <&clock_fsys FSYS_CLK_MMC1>, <&clock_top TOP_SCLK_MMC1>;
                        clock-names = "biu", "ciu";
+                       assigned-clocks =
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_A>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_B>,
+                               <&clock_top TOP_SCLK_MMC1>;
+                       assigned-clock-parents =
+                               <&clock_top TOP_MOUT_BUSTOP_PLL_USER>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_A>;
+                       assigned-clock-rates = <0>, <0>, <800000000>;
                        fifo-depth = <64>;
                        status = "disabled";
                };
                        #size-cells = <0>;
                        clocks = <&clock_fsys FSYS_CLK_MMC2>, <&clock_top TOP_SCLK_MMC2>;
                        clock-names = "biu", "ciu";
+                       assigned-clocks =
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_A>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_B>,
+                               <&clock_top TOP_SCLK_MMC2>;
+                       assigned-clock-parents =
+                               <&clock_top TOP_MOUT_BUSTOP_PLL_USER>,
+                               <&clock_top TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_A>;
+                       assigned-clock-rates = <0>, <0>, <800000000>;
                        fifo-depth = <64>;
                        status = "disabled";
                };
+
+               hsi2c_0: hsi2c@12da0000 {
+                       compatible = "samsung,exynos5260-hsi2c";
+                       reg = <0x12DA0000 0x1000>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c0_hs_bus>;
+                       clocks = <&clock_peri PERI_CLK_HSIC0>;
+                       clock-names = "hsi2c";
+                       status = "disabled";
+               };
+
+               hsi2c_1: hsi2c@12db0000 {
+                       compatible = "samsung,exynos5260-hsi2c";
+                       reg = <0x12DB0000 0x1000>;
+                       interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c1_hs_bus>;
+                       clocks = <&clock_peri PERI_CLK_HSIC1>;
+                       clock-names = "hsi2c";
+                       status = "disabled";
+               };
+
+               hsi2c_2: hsi2c@12dc0000 {
+                       compatible = "samsung,exynos5260-hsi2c";
+                       reg = <0x12DC0000 0x1000>;
+                       interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c2_hs_bus>;
+                       clocks = <&clock_peri PERI_CLK_HSIC2>;
+                       clock-names = "hsi2c";
+                       status = "disabled";
+               };
+
+               hsi2c_3: hsi2c@12dd0000 {
+                       compatible = "samsung,exynos5260-hsi2c";
+                       reg = <0x12DD0000 0x1000>;
+                       interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c3_hs_bus>;
+                       clocks = <&clock_peri PERI_CLK_HSIC3>;
+                       clock-names = "hsi2c";
+                       status = "disabled";
+               };
        };
 };
 
index 434a759..8f9e08f 100644 (file)
@@ -38,8 +38,6 @@
        fan0: pwm-fan {
                compatible = "pwm-fan";
                pwms = <&pwm 0 20972 0>;
-               cooling-min-state = <0>;
-               cooling-max-state = <3>;
                #cooling-cells = <2>;
                cooling-levels = <0 130 170 230>;
        };
index 8fc8c84..dffa5e3 100644 (file)
@@ -19,7 +19,7 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200";
+               stdout-path = "serial2:115200n8";
        };
 
        fin_pll: xxti {
index 3447160..dbf0306 100644 (file)
@@ -24,7 +24,7 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC3,115200";
+               stdout-path = "serial3:115200n8";
        };
 
        firmware@2073000 {
        };
 };
 
+&adc {
+       vdd-supply = <&ldo4_reg>;
+       status = "okay";
+};
+
+&cci {
+       status = "disabled";
+};
+
 &cpu0 {
        cpu-supply = <&buck2_reg>;
 };
        cpu-supply = <&buck6_reg>;
 };
 
-&usbdrd_dwc3_1 {
-       dr_mode = "host";
+&cpu0_thermal {
+       trips {
+               cpu0_alert0: cpu-alert-0 {
+                       temperature = <60000>; /* millicelsius */
+                       hysteresis = <5000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu0_alert1: cpu-alert-1 {
+                       temperature = <80000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu0_alert2: cpu-alert-2 {
+                       temperature = <110000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu0_crit0: cpu-crit-0 {
+                       temperature = <120000>; /* millicelsius */
+                       hysteresis = <0>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cooling-maps {
+               /*
+                * Reduce the CPU speed by 2 steps, down to: 1600 MHz
+                * and 1100 MHz.
+                */
+               map0 {
+                       trip = <&cpu0_alert0>;
+                       cooling-device = <&cpu0 0 2>,
+                                        <&cpu1 0 2>,
+                                        <&cpu2 0 2>,
+                                        <&cpu3 0 2>,
+                                        <&cpu4 0 2>,
+                                        <&cpu5 0 2>,
+                                        <&cpu6 0 2>,
+                                        <&cpu7 0 2>;
+               };
+
+               /*
+                * Reduce the CPU speed down to 1200 MHz big (6 steps)
+                * and 800 MHz LITTLE (5 steps).
+                */
+               map1 {
+                       trip = <&cpu0_alert1>;
+                       cooling-device = <&cpu0 3 6>,
+                                        <&cpu1 3 6>,
+                                        <&cpu2 3 6>,
+                                        <&cpu3 3 6>,
+                                        <&cpu4 3 5>,
+                                        <&cpu5 3 5>,
+                                        <&cpu6 3 5>,
+                                        <&cpu7 3 5>;
+               };
+
+               /*
+                * Reduce the CPU speed as much as possible, down to 700 MHz
+                * big (11 steps) and 600 MHz LITTLE (7 steps).
+                */
+               map2 {
+                       trip = <&cpu0_alert2>;
+                       cooling-device = <&cpu0 6 11>,
+                                        <&cpu1 6 11>,
+                                        <&cpu2 6 11>,
+                                        <&cpu3 6 11>,
+                                        <&cpu4 5 7>,
+                                        <&cpu5 5 7>,
+                                        <&cpu6 5 7>,
+                                        <&cpu7 5 7>;
+               };
+       };
 };
 
-&cci {
-       status = "disabled";
+&cpu1_thermal {
+       trips {
+               cpu1_alert0: cpu-alert-0 {
+                       temperature = <60000>; /* millicelsius */
+                       hysteresis = <5000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu1_alert1: cpu-alert-1 {
+                       temperature = <80000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu1_alert2: cpu-alert-2 {
+                       temperature = <110000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu1_crit0: cpu-crit-0 {
+                       temperature = <120000>; /* millicelsius */
+                       hysteresis = <0>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cooling-maps {
+               map0 {
+                       trip = <&cpu1_alert0>;
+                       cooling-device = <&cpu0 0 2>,
+                                        <&cpu1 0 2>,
+                                        <&cpu2 0 2>,
+                                        <&cpu3 0 2>,
+                                        <&cpu4 0 2>,
+                                        <&cpu5 0 2>,
+                                        <&cpu6 0 2>,
+                                        <&cpu7 0 2>;
+               };
+
+               map1 {
+                       trip = <&cpu1_alert1>;
+                       cooling-device = <&cpu0 3 6>,
+                                        <&cpu1 3 6>,
+                                        <&cpu2 3 6>,
+                                        <&cpu3 3 6>,
+                                        <&cpu4 3 5>,
+                                        <&cpu5 3 5>,
+                                        <&cpu6 3 5>,
+                                        <&cpu7 3 5>;
+               };
+
+               map2 {
+                       trip = <&cpu1_alert2>;
+                       cooling-device = <&cpu0 6 11>,
+                                        <&cpu1 6 11>,
+                                        <&cpu2 6 11>,
+                                        <&cpu3 6 11>,
+                                        <&cpu4 5 7>,
+                                        <&cpu5 5 7>,
+                                        <&cpu6 5 7>,
+                                        <&cpu7 5 7>;
+               };
+       };
+};
+
+&cpu2_thermal {
+       trips {
+               cpu2_alert0: cpu-alert-0 {
+                       temperature = <60000>; /* millicelsius */
+                       hysteresis = <5000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu2_alert1: cpu-alert-1 {
+                       temperature = <80000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu2_alert2: cpu-alert-2 {
+                       temperature = <110000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu2_crit0: cpu-crit-0 {
+                       temperature = <120000>; /* millicelsius */
+                       hysteresis = <0>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cooling-maps {
+               map0 {
+                       trip = <&cpu2_alert0>;
+                       cooling-device = <&cpu0 0 2>,
+                                        <&cpu1 0 2>,
+                                        <&cpu2 0 2>,
+                                        <&cpu3 0 2>,
+                                        <&cpu4 0 2>,
+                                        <&cpu5 0 2>,
+                                        <&cpu6 0 2>,
+                                        <&cpu7 0 2>;
+               };
+
+               map1 {
+                       trip = <&cpu2_alert1>;
+                       cooling-device = <&cpu0 3 6>,
+                                        <&cpu1 3 6>,
+                                        <&cpu2 3 6>,
+                                        <&cpu3 3 6>,
+                                        <&cpu4 3 5>,
+                                        <&cpu5 3 5>,
+                                        <&cpu6 3 5>,
+                                        <&cpu7 3 5>;
+               };
+
+               map2 {
+                       trip = <&cpu2_alert2>;
+                       cooling-device = <&cpu0 6 11>,
+                                        <&cpu1 6 11>,
+                                        <&cpu2 6 11>,
+                                        <&cpu3 6 11>,
+                                        <&cpu4 6 7>,
+                                        <&cpu5 6 7>,
+                                        <&cpu6 6 7>,
+                                        <&cpu7 6 7>;
+               };
+       };
+};
+
+&cpu3_thermal {
+       trips {
+               cpu3_alert0: cpu-alert-0 {
+                       temperature = <60000>; /* millicelsius */
+                       hysteresis = <5000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu3_alert1: cpu-alert-1 {
+                       temperature = <80000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu3_alert2: cpu-alert-2 {
+                       temperature = <110000>; /* millicelsius */
+                       hysteresis = <10000>; /* millicelsius */
+                       type = "passive";
+               };
+               cpu3_crit0: cpu-crit-0 {
+                       temperature = <120000>; /* millicelsius */
+                       hysteresis = <0>; /* millicelsius */
+                       type = "critical";
+               };
+       };
+
+       cooling-maps {
+               map0 {
+                       trip = <&cpu3_alert0>;
+                       cooling-device = <&cpu0 0 2>,
+                                        <&cpu1 0 2>,
+                                        <&cpu2 0 2>,
+                                        <&cpu3 0 2>,
+                                        <&cpu4 0 2>,
+                                        <&cpu5 0 2>,
+                                        <&cpu6 0 2>,
+                                        <&cpu7 0 2>;
+               };
+
+               map1 {
+                       trip = <&cpu3_alert1>;
+                       cooling-device = <&cpu0 3 6>,
+                                        <&cpu1 3 6>,
+                                        <&cpu2 3 6>,
+                                        <&cpu3 3 6>,
+                                        <&cpu4 3 5>,
+                                        <&cpu5 3 5>,
+                                        <&cpu6 3 5>,
+                                        <&cpu7 3 5>;
+               };
+
+               map2 {
+                       trip = <&cpu3_alert2>;
+                       cooling-device = <&cpu0 6 11>,
+                                        <&cpu1 6 11>,
+                                        <&cpu2 6 11>,
+                                        <&cpu3 6 11>,
+                                        <&cpu4 5 7>,
+                                        <&cpu5 5 7>,
+                                        <&cpu6 5 7>,
+                                        <&cpu7 5 7>;
+               };
+       };
 };
 
 &hdmi {
                                regulator-name = "PVDD_APIO_1V8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
                        };
 
                        ldo3_reg: LDO3 {
                                regulator-name = "PVDD_APIO_MMCON_1V8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
+                               /*
+                                * Must be always on, even though there is
+                                * a consumer (mmc_0).  Otherwise the board
+                                * does not reboot with vendor U-Boot
+                                * (Linaro for Arndale Octa, v2012.07).
+                                */
                                regulator-always-on;
                        };
 
                                regulator-name = "PVDD_ABB_1V8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
                        };
 
                        ldo9_reg: LDO9 {
 
                        ldo13_reg: LDO13 {
                                regulator-name = "PVDD_APIO_MMCOFF_2V8";
-                               regulator-min-microvolt = <2800000>;
+                               regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <2800000>;
                        };
 
+                       ldo14_reg: LDO14 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO14";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo15_reg: LDO15 {
                                regulator-name = "PVDD_PERI_2V8";
                                regulator-min-microvolt = <3300000>;
                                regulator-max-microvolt = <2200000>;
                        };
 
+                       ldo17_reg: LDO17 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO17";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo18_reg: LDO18 {
                                regulator-name = "PVDD_EMMC_1V8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                        };
 
+                       ldo22_reg: LDO22 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO22";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2375000>;
+                       };
+
                        ldo23_reg: LDO23 {
                                regulator-name = "PVDD_MIFS_1V1";
-                               regulator-min-microvolt = <1200000>;
-                               regulator-max-microvolt = <1200000>;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1100000>;
                                regulator-always-on;
                        };
 
                                regulator-max-microvolt = <2800000>;
                        };
 
+                       ldo25_reg: LDO25 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO25";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo26_reg: LDO26 {
                                regulator-name = "PVDD_CAM0_AF_2V8";
                                regulator-min-microvolt = <3000000>;
 
                        ldo27_reg: LDO27 {
                                regulator-name = "PVDD_G3DS_1V0";
-                               regulator-min-microvolt = <1200000>;
-                               regulator-max-microvolt = <1200000>;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1100000>;
                        };
 
                        ldo28_reg: LDO28 {
                                regulator-max-microvolt = <1800000>;
                        };
 
+                       ldo30_reg: LDO30 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO30";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo31_reg: LDO31 {
                                regulator-name = "PVDD_PERI_1V8";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                        };
 
+                       ldo34_reg: LDO34 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO34";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo35_reg: LDO35 {
                                regulator-name = "PVDD_CAM0_DVDD_1V2";
                                regulator-min-microvolt = <1200000>;
                                regulator-max-microvolt = <1200000>;
                        };
 
+                       ldo36_reg: LDO36 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO36";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
+                       ldo37_reg: LDO37 {
+                               /* Unused */
+                               regulator-name = "PVDD_LDO37";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                       };
+
                        ldo38_reg: LDO38 {
                                regulator-name = "PVDD_CAM0_AVDD_2V8";
                                regulator-min-microvolt = <2800000>;
 
 &mmc_0 {
        status = "okay";
-       broken-cd;
+       non-removable;
        card-detect-delay = <200>;
        samsung,dw-mshc-ciu-div = <3>;
        samsung,dw-mshc-sdr-timing = <0 4>;
        pinctrl-names = "default";
        pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8>;
        vmmc-supply = <&ldo10_reg>;
+       vqmmc-supply = <&ldo3_reg>;
        bus-width = <8>;
        cap-mmc-highspeed;
+       mmc-hs200-1_8v;
 };
 
 &mmc_2 {
        status = "okay";
        card-detect-delay = <200>;
        samsung,dw-mshc-ciu-div = <3>;
-       samsung,dw-mshc-sdr-timing = <2 3>;
-       samsung,dw-mshc-ddr-timing = <1 2>;
+       samsung,dw-mshc-sdr-timing = <0 4>;
+       samsung,dw-mshc-ddr-timing = <0 2>;
        pinctrl-names = "default";
        pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus1 &sd2_bus4>;
        vmmc-supply = <&ldo19_reg>;
        vqmmc-supply = <&ldo13_reg>;
        bus-width = <4>;
        cap-sd-highspeed;
+       sd-uhs-sdr50;
+       sd-uhs-sdr104;
+       sd-uhs-ddr50;
 };
 
 &pinctrl_0 {
        clocks = <&clock CLK_RTC>, <&s2mps11_osc S2MPS11_CLK_AP>;
        clock-names = "rtc", "rtc_src";
 };
+
+&usbdrd_dwc3_1 {
+       dr_mode = "host";
+};
index 3cf9050..8240e51 100644 (file)
@@ -21,7 +21,8 @@
        };
 
        chosen {
-               bootargs = "console=ttySAC2,115200 init=/linuxrc";
+               bootargs = "init=/linuxrc";
+               stdout-path = "serial2:115200n8";
        };
 
        fixed-rate-clocks {
index aaff158..5fb2326 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
  *             http://www.samsung.com
  *
- * SAMSUNG EXYNOS54200 SoC device nodes are listed in this file.
+ * SAMSUNG EXYNOS5420 SoC device nodes are listed in this file.
  * EXYNOS5420 based board files can include this file and provide
  * values for board specfic bindings.
  */
index 51a843b..c3c2d85 100644 (file)
                        "Headphone Jack", "HPL",
                        "Headphone Jack", "HPR",
                        "Headphone Jack", "MICBIAS",
-                       "IN1", "Headphone Jack",
+                       "IN12", "Headphone Jack",
                        "Speakers", "SPKL",
                        "Speakers", "SPKR",
                        "I2S Playback", "Mixer DAI TX",
-                       "HiFi Playback", "Mixer DAI TX";
+                       "HiFi Playback", "Mixer DAI TX",
+                       "Mixer DAI RX", "HiFi Capture";
 
                assigned-clocks = <&clock CLK_MOUT_EPLL>,
                                <&clock CLK_MOUT_MAU_EPLL>,
index 5f195ad..93a48f2 100644 (file)
@@ -44,8 +44,6 @@
        fan0: pwm-fan {
                compatible = "pwm-fan";
                pwms = <&pwm 0 20972 0>;
-               cooling-min-state = <0>;
-               cooling-max-state = <3>;
                #cooling-cells = <2>;
                cooling-levels = <0 130 170 230>;
        };
index de26e5e..ae866bc 100644 (file)
                usbdrdphy1 = &usbdrd_phy1;
        };
 
-       soc: soc {
-               arm_a7_pmu: arm-a7-pmu {
-                       compatible = "arm,cortex-a7-pmu";
-                       interrupt-parent = <&gic>;
-                       interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>;
-                       status = "disabled";
-               };
+       arm_a7_pmu: arm-a7-pmu {
+               compatible = "arm,cortex-a7-pmu";
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
 
-               arm_a15_pmu: arm-a15-pmu {
-                       compatible = "arm,cortex-a15-pmu";
-                       interrupt-parent = <&combiner>;
-                       interrupts = <1 2>,
-                                    <7 0>,
-                                    <16 6>,
-                                    <19 2>;
-                       status = "disabled";
-               };
+       arm_a15_pmu: arm-a15-pmu {
+               compatible = "arm,cortex-a15-pmu";
+               interrupt-parent = <&combiner>;
+               interrupts = <1 2>,
+                            <7 0>,
+                            <16 6>,
+                            <19 2>;
+               status = "disabled";
+       };
 
+       soc: soc {
                sysram@2020000 {
                        compatible = "mmio-sram";
                        reg = <0x02020000 0x54000>;
index a7adbdc..dbba33e 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ge863_pro3.dtsi - Device Tree file for Telit GE863-PRO3
  *
  * Copyright (C) 2012 Telit,
  *               2012 Fabio Porcedda <fabio.porcedda@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "at91sam9260.dtsi"
index 592111c..cfbfbc9 100644 (file)
                        /* 32MB of flash */
                        reg = <0x30000000 0x02000000>;
 
-                       /*
-                        * This "RedBoot" is the Storlink derivative.
-                        */
-                       partition@0 {
-                               label = "RedBoot";
-                               reg = <0x00000000 0x00040000>;
-                               read-only;
-                       };
-                       /*
-                        * This firmware image contains the kernel catenated
-                        * with the squashfs root filesystem. For some reason
-                        * this is called "upgrade" on the vendor system.
-                        */
-                       partition@40000 {
-                               label = "upgrade";
-                               reg = <0x00040000 0x01f40000>;
-                               read-only;
-                       };
-                       /* RGDB, Residental Gateway Database? */
-                       partition@1f80000 {
-                               label = "rgdb";
-                               reg = <0x01f80000 0x00040000>;
-                               read-only;
-                       };
-                       /*
-                        * This partition contains MAC addresses for WAN,
-                        * WLAN and LAN, and the country code (for wireless
-                        * I guess).
-                        */
-                       partition@1fc0000 {
-                               label = "nvram";
-                               reg = <0x01fc0000 0x00020000>;
-                               read-only;
-                       };
-                       partition@1fe0000 {
-                               label = "LangPack";
-                               reg = <0x01fe0000 0x00020000>;
-                               read-only;
+                       partitions {
+                               compatible = "fixed-partitions";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               /*
+                                * This "RedBoot" is the Storlink derivative.
+                                */
+                               partition@0 {
+                                       label = "RedBoot";
+                                       reg = <0x00000000 0x00040000>;
+                                       read-only;
+                               };
+                               /*
+                                * This firmware image contains the kernel catenated
+                                * with the squashfs root filesystem. For some reason
+                                * this is called "upgrade" on the vendor system.
+                                */
+                               partition@40000 {
+                                       label = "upgrade";
+                                       reg = <0x00040000 0x01f40000>;
+                                       read-only;
+                               };
+                               /* RGDB, Residental Gateway Database? */
+                               partition@1f80000 {
+                                       label = "rgdb";
+                                       reg = <0x01f80000 0x00040000>;
+                                       read-only;
+                               };
+                               /*
+                                * This partition contains MAC addresses for WAN,
+                                * WLAN and LAN, and the country code (for wireless
+                                * I guess).
+                                */
+                               partition@1fc0000 {
+                                       label = "nvram";
+                                       reg = <0x01fc0000 0x00020000>;
+                                       read-only;
+                               };
+                               partition@1fe0000 {
+                                       label = "LangPack";
+                                       reg = <0x01fe0000 0x00020000>;
+                                       read-only;
+                               };
                        };
                };
 
index 6991ab6..64f8ed1 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 /dts-v1/;
index 5729ecf..410409a 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <dt-bindings/clock/hi3519-clock.h>
index 59cadee..9cbdc1a 100644 (file)
                gpio0 = &gpio1;
                gpio1 = &gpio2;
                gpio2 = &gpio3;
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               i2c2 = &i2c3;
+               mmc0 = &esdhc1;
+               mmc1 = &esdhc2;
+               mmc2 = &esdhc3;
                serial0 = &uart1;
                serial1 = &uart2;
                serial2 = &uart3;
diff --git a/arch/arm/boot/dts/imx50-kobo-aura.dts b/arch/arm/boot/dts/imx50-kobo-aura.dts
new file mode 100644 (file)
index 0000000..a0eaf86
--- /dev/null
@@ -0,0 +1,258 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright 2019 Jonathan Neuschäfer
+//
+// The Kobo Aura e-book reader, model N514. The mainboard is marked as E606F0B.
+
+/dts-v1/;
+#include "imx50.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Kobo Aura (N514)";
+       compatible = "kobo,aura", "fsl,imx50";
+
+       chosen {
+               stdout-path = "serial1:115200n8";
+       };
+
+       memory@70000000 {
+               device_type = "memory";
+               reg = <0x70000000 0x10000000>;
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_leds>;
+
+               on {
+                       label = "kobo_aura:orange:on";
+                       gpios = <&gpio6 24 GPIO_ACTIVE_LOW>;
+                       panic-indicator;
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpiokeys>;
+
+               power {
+                       label = "Power Button";
+                       gpios = <&gpio4 10 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+               };
+
+               hallsensor {
+                       label = "Hallsensor";
+                       gpios = <&gpio5 15 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESERVED>;
+                       linux,input-type = <EV_SW>;
+               };
+
+               frontlight {
+                       label = "Frontlight";
+                       gpios = <&gpio4 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_DISPLAYTOGGLE>;
+               };
+       };
+
+       sd2_pwrseq: pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_sd2_reset>;
+               reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
+       };
+
+       sd2_vmmc: gpio-regulator {
+               compatible = "regulator-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_sd2_vmmc>;
+               regulator-name = "vmmc";
+               states = <3300000 0>;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               enable-gpio = <&gpio4 12 GPIO_ACTIVE_LOW>;
+               startup-delay-us = <100000>;
+       };
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sd1>;
+       max-frequency = <50000000>;
+       bus-width = <4>;
+       cd-gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
+       disable-wp;
+       status = "okay";
+
+       /* External µSD card */
+};
+
+&esdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sd2>;
+       bus-width = <4>;
+       max-frequency = <50000000>;
+       disable-wp;
+       mmc-pwrseq = <&sd2_pwrseq>;
+       vmmc-supply = <&sd2_vmmc>;
+       status = "okay";
+
+       /* CyberTan WC121 SDIO WiFi (BCM43362) */
+};
+
+&esdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sd3>;
+       bus-width = <8>;
+       non-removable;
+       max-frequency = <50000000>;
+       disable-wp;
+       status = "okay";
+
+       /* Internal eMMC */
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       /* TODO: ektf2132 touch controller at 0x15 */
+};
+
+&i2c2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       /* TODO: TPS65185 PMIC for E Ink at 0x68 */
+};
+
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       /* TODO: embedded controller at 0x43 */
+};
+
+&iomuxc {
+       pinctrl_gpiokeys: gpiokeys {
+               fsl,pins = <
+                       MX50_PAD_CSPI_MISO__GPIO4_10            0x0
+                       MX50_PAD_SD2_D7__GPIO5_15               0x0
+                       MX50_PAD_KEY_ROW0__GPIO4_1              0x0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1 {
+               fsl,pins = <
+                       MX50_PAD_I2C1_SCL__I2C1_SCL             0x400001fd
+                       MX50_PAD_I2C1_SDA__I2C1_SDA             0x400001fd
+               >;
+       };
+
+       pinctrl_i2c2: i2c2 {
+               fsl,pins = <
+                       MX50_PAD_I2C2_SCL__I2C2_SCL             0x400001fd
+                       MX50_PAD_I2C2_SDA__I2C2_SDA             0x400001fd
+               >;
+       };
+
+       pinctrl_i2c3: i2c3 {
+               fsl,pins = <
+                       MX50_PAD_I2C3_SCL__I2C3_SCL             0x400001fd
+                       MX50_PAD_I2C3_SDA__I2C3_SDA             0x400001fd
+               >;
+       };
+
+       pinctrl_leds: leds {
+               fsl,pins = <
+                       MX50_PAD_PWM1__GPIO6_24                 0x0
+               >;
+       };
+
+       pinctrl_sd1: sd1 {
+               fsl,pins = <
+                       MX50_PAD_SD1_CMD__ESDHC1_CMD            0x1e4
+                       MX50_PAD_SD1_CLK__ESDHC1_CLK            0xd4
+                       MX50_PAD_SD1_D0__ESDHC1_DAT0            0x1d4
+                       MX50_PAD_SD1_D1__ESDHC1_DAT1            0x1d4
+                       MX50_PAD_SD1_D2__ESDHC1_DAT2            0x1d4
+                       MX50_PAD_SD1_D3__ESDHC1_DAT3            0x1d4
+
+                       MX50_PAD_SD2_CD__GPIO5_17               0x0
+               >;
+       };
+
+       pinctrl_sd2: sd2 {
+               fsl,pins = <
+                       MX50_PAD_SD2_CMD__ESDHC2_CMD            0x1e4
+                       MX50_PAD_SD2_CLK__ESDHC2_CLK            0xd4
+                       MX50_PAD_SD2_D0__ESDHC2_DAT0            0x1d4
+                       MX50_PAD_SD2_D1__ESDHC2_DAT1            0x1d4
+                       MX50_PAD_SD2_D2__ESDHC2_DAT2            0x1d4
+                       MX50_PAD_SD2_D3__ESDHC2_DAT3            0x1d4
+               >;
+       };
+
+       pinctrl_sd2_reset: sd2-reset {
+               fsl,pins = <
+                       MX50_PAD_ECSPI2_MOSI__GPIO4_17          0x0
+               >;
+       };
+
+       pinctrl_sd2_vmmc: sd2-vmmc {
+               fsl,pins = <
+                       MX50_PAD_ECSPI1_SCLK__GPIO4_12          0x0
+               >;
+       };
+
+       pinctrl_sd3: sd3 {
+               fsl,pins = <
+                       MX50_PAD_SD3_CMD__ESDHC3_CMD            0x1e4
+                       MX50_PAD_SD3_CLK__ESDHC3_CLK            0xd4
+                       MX50_PAD_SD3_D0__ESDHC3_DAT0            0x1d4
+                       MX50_PAD_SD3_D1__ESDHC3_DAT1            0x1d4
+                       MX50_PAD_SD3_D2__ESDHC3_DAT2            0x1d4
+                       MX50_PAD_SD3_D3__ESDHC3_DAT3            0x1d4
+                       MX50_PAD_SD3_D4__ESDHC3_DAT4            0x1d4
+                       MX50_PAD_SD3_D5__ESDHC3_DAT5            0x1d4
+                       MX50_PAD_SD3_D6__ESDHC3_DAT6            0x1d4
+                       MX50_PAD_SD3_D7__ESDHC3_DAT7            0x1d4
+               >;
+       };
+
+       pinctrl_uart2: uart2 {
+               fsl,pins = <
+                       MX50_PAD_UART2_TXD__UART2_TXD_MUX       0x1e4
+                       MX50_PAD_UART2_RXD__UART2_RXD_MUX       0x1e4
+               >;
+       };
+
+       pinctrl_usbphy: usbphy {
+               fsl,pins = <
+                       MX50_PAD_ECSPI2_SS0__GPIO4_19           0x0
+               >;
+       };
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usbotg {
+       phy_type = "utmi_wide";
+       dr_mode = "peripheral";
+       status = "okay";
+};
+
+&usbphy0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbphy>;
+       vbus-detect-gpio = <&gpio4 19 GPIO_ACTIVE_LOW>;
+};
index ee1e3e8..0bfe7c9 100644 (file)
                gpio3 = &gpio4;
                gpio4 = &gpio5;
                gpio5 = &gpio6;
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               i2c2 = &i2c3;
+               mmc0 = &esdhc1;
+               mmc1 = &esdhc2;
+               mmc2 = &esdhc3;
+               mmc3 = &esdhc4;
                serial0 = &uart1;
                serial1 = &uart2;
                serial2 = &uart3;
                serial3 = &uart4;
                serial4 = &uart5;
+               spi0 = &ecspi1;
+               spi1 = &ecspi2;
+               spi2 = &cspi;
        };
 
        cpus {
                };
        };
 
+       usbphy0: usbphy-0 {
+               compatible = "usb-nop-xceiv";
+               clocks = <&clks IMX5_CLK_USB_PHY1_GATE>;
+               clock-names = "main_clk";
+               #phy-cells = <0>;
+               status = "okay";
+       };
+
        soc {
                #address-cells = <1>;
                #size-cells = <1>;
                                compatible = "fsl,imx50-usb", "fsl,imx27-usb";
                                reg = <0x53f80000 0x0200>;
                                interrupts = <18>;
-                               clocks = <&clks IMX5_CLK_USB_PHY1_GATE>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
+                               fsl,usbphy = <&usbphy0>;
                                status = "disabled";
                        };
 
                                reg = <0x63fb0000 0x4000>;
                                interrupts = <6>;
                                clocks = <&clks IMX5_CLK_SDMA_GATE>,
-                                        <&clks IMX5_CLK_SDMA_GATE>;
+                                        <&clks IMX5_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx50.bin";
index 2e31253..c2a929b 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include "imx51.dtsi"
index e9e819f..b6d931e 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 /dts-v1/;
index a8220f0..3596060 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2017 Zodiac Inflight Innovations
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
index a5ee25c..0a4b9a5 100644 (file)
                                reg = <0x83fb0000 0x4000>;
                                interrupts = <6>;
                                clocks = <&clks IMX5_CLK_SDMA_GATE>,
-                                        <&clks IMX5_CLK_SDMA_GATE>;
+                                        <&clks IMX5_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin";
index db2e5bc..d1770e1 100644 (file)
@@ -52,7 +52,7 @@
        clock-frequency = <400000>;
        status = "okay";
 
-       stmpe610@41 {
+       touchscreen@41 {
                compatible = "st,stmpe610";
                reg = <0x41>;
                id = <0>;
diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts
new file mode 100644 (file)
index 0000000..f0a3fde
--- /dev/null
@@ -0,0 +1,311 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2019 Marek Vasut <marex@denx.de>
+ */
+
+/dts-v1/;
+#include "imx53-m53.dtsi"
+
+/ {
+       model = "MENLO M53 EMBEDDED DEVICE";
+       compatible = "menlo,m53menlo", "fsl,imx53";
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_led>;
+
+               user1 {
+                       label = "TestLed601";
+                       gpios = <&gpio6 1 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "mmc0";
+               };
+
+               user2 {
+                       label = "TestLed602";
+                       gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+
+               eth {
+                       label = "EthLedYe";
+                       gpios = <&gpio2 11 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "none";
+               };
+       };
+
+       panel {
+               compatible = "edt,etm070080dh6";
+               enable-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>;
+
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&lvds0_out>;
+                       };
+               };
+       };
+
+       reg_usbh1_vbus: regulator-usbh1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio1 2 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_can1>;
+       status = "okay";
+};
+
+&can2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_can2>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX5_CLK_CKO1_SEL>,
+                         <&clks IMX5_CLK_CKO1_PODF>,
+                         <&clks IMX5_CLK_CKO1>;
+       assigned-clock-parents = <&clks IMX5_CLK_AHB>;
+       assigned-clock-rates = <133333334>, <33333334>, <33333334>;
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc1>;
+       cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec>;
+       phy-mode = "rmii";
+       status = "okay";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       touchscreen@38 {
+               compatible = "edt,edt-ft5x06";
+               reg = <0x38>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_edt_ft5x06>;
+               interrupt-parent = <&gpio6>;
+               interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
+               reset-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
+               wake-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c64";
+               reg = <0x50>;
+               pagesize = <32>;
+       };
+
+       dac@60 {
+               compatible = "microchip,mcp4725";
+               reg = <0x60>;
+       };
+};
+
+&i2c2 {
+       touchscreen@41 {
+               status = "disabled";
+       };
+};
+
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx53-m53evk {
+               hoggrp {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK       0x1c4
+                               MX53_PAD_EIM_EB3__GPIO2_31              0x1d5
+                               MX53_PAD_PATA_DA_0__GPIO7_6             0x1d5
+                               MX53_PAD_GPIO_19__CCM_CLKO              0x1d5
+                               MX53_PAD_CSI0_MCLK__CCM_CSI0_MCLK       0x1d5
+                               MX53_PAD_CSI0_DAT4__GPIO5_22            0x1d5
+                               MX53_PAD_CSI0_DAT5__GPIO5_23            0x1d5
+                               MX53_PAD_CSI0_DAT6__GPIO5_24            0x1d5
+                               MX53_PAD_CSI0_DAT7__GPIO5_25            0x1d5
+                               MX53_PAD_CSI0_DAT8__GPIO5_26            0x1d5
+                               MX53_PAD_CSI0_DAT9__GPIO5_27            0x1d5
+                               MX53_PAD_CSI0_DAT10__GPIO5_28           0x1d5
+                               MX53_PAD_CSI0_DAT11__GPIO5_29           0x1d5
+                               MX53_PAD_CSI0_DAT14__GPIO6_0            0x1d5
+                       >;
+               };
+
+               pinctrl_led: ledgrp {
+                       fsl,pins = <
+                               MX53_PAD_CSI0_DAT15__GPIO6_1            0x1d5
+                               MX53_PAD_CSI0_DAT16__GPIO6_2            0x1d5
+                       >;
+               };
+
+               pinctrl_can1: can1grp {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_7__CAN1_TXCAN             0x1c4
+                               MX53_PAD_GPIO_8__CAN1_RXCAN             0x1c4
+                       >;
+               };
+
+               pinctrl_can2: can2grp {
+                       fsl,pins = <
+                               MX53_PAD_KEY_COL4__CAN2_TXCAN           0x1c4
+                               MX53_PAD_KEY_ROW4__CAN2_RXCAN           0x1c4
+                       >;
+               };
+
+               pinctrl_display_gpio: display-gpiogrp {
+                       fsl,pins = <
+                               MX53_PAD_CSI0_DAT12__GPIO5_30           0x1d5 /* Reset */
+                               MX53_PAD_CSI0_DAT13__GPIO5_31           0x1d5 /* Interrupt */
+                       >;
+               };
+
+               pinctrl_edt_ft5x06: edt-ft5x06grp {
+                       fsl,pins = <
+                               MX53_PAD_PATA_DATA9__GPIO2_9            0x1d5 /* Reset */
+                               MX53_PAD_CSI0_DAT19__GPIO6_5            0x1d5 /* Interrupt */
+                               MX53_PAD_PATA_DATA10__GPIO2_10          0x1d5 /* Wake */
+                       >;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <
+                               MX53_PAD_SD1_DATA0__ESDHC1_DAT0         0x1d5
+                               MX53_PAD_SD1_DATA1__ESDHC1_DAT1         0x1d5
+                               MX53_PAD_SD1_DATA2__ESDHC1_DAT2         0x1d5
+                               MX53_PAD_SD1_DATA3__ESDHC1_DAT3         0x1d5
+                               MX53_PAD_SD1_CMD__ESDHC1_CMD            0x1d5
+                               MX53_PAD_SD1_CLK__ESDHC1_CLK            0x1d5
+                       >;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <
+                               MX53_PAD_FEC_MDC__FEC_MDC               0x4
+                               MX53_PAD_FEC_MDIO__FEC_MDIO             0x1fc
+                               MX53_PAD_FEC_REF_CLK__FEC_TX_CLK        0x180
+                               MX53_PAD_FEC_RX_ER__FEC_RX_ER           0x180
+                               MX53_PAD_FEC_CRS_DV__FEC_RX_DV          0x180
+                               MX53_PAD_FEC_RXD1__FEC_RDATA_1          0x180
+                               MX53_PAD_FEC_RXD0__FEC_RDATA_0          0x180
+                               MX53_PAD_FEC_TX_EN__FEC_TX_EN           0x4
+                               MX53_PAD_FEC_TXD1__FEC_TDATA_1          0x4
+                               MX53_PAD_FEC_TXD0__FEC_TDATA_0          0x4
+                       >;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <
+                               MX53_PAD_EIM_D21__I2C1_SCL              0x400001e4
+                               MX53_PAD_EIM_D28__I2C1_SDA              0x400001e4
+                       >;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_6__I2C3_SDA               0x400001e4
+                               MX53_PAD_GPIO_5__I2C3_SCL               0x400001e4
+                       >;
+               };
+
+               pinctrl_lvds0: lvds0grp {
+                       /* LVDS pins only have pin mux configuration */
+                       fsl,pins = <
+                               MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK     0x80000000
+                               MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0     0x80000000
+                               MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1     0x80000000
+                               MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2     0x80000000
+                               MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3     0x80000000
+                       >;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <
+                               MX53_PAD_PATA_DIOW__UART1_TXD_MUX       0x1e4
+                               MX53_PAD_PATA_DMACK__UART1_RXD_MUX      0x1e4
+                       >;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <
+                               MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX  0x1e4
+                               MX53_PAD_PATA_DMARQ__UART2_TXD_MUX      0x1e4
+                       >;
+               };
+
+               pinctrl_usb: usbgrp {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_2__GPIO1_2                0x1d5
+                               MX53_PAD_GPIO_3__USBOH3_USBH1_OC        0x1d5
+                       >;
+               };
+       };
+};
+
+&ldb {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_lvds0>;
+       status = "okay";
+
+       lvds0: lvds-channel@0 {
+               reg = <0>;
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               port@2 {
+                       reg = <2>;
+
+                       lvds0_out: endpoint {
+                               remote-endpoint = <&panel_in>;
+                       };
+               };
+       };
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usbh1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usb>;
+       vbus-supply = <&reg_usbh1_vbus>;
+       phy_type = "utmi";
+       dr_mode = "peripheral";
+       status = "okay";
+};
+
+&usbotg {
+       dr_mode = "peripheral";
+       status = "okay";
+};
index b330030..9b672ed 100644 (file)
                                reg = <0x63fb0000 0x4000>;
                                interrupts = <6>;
                                clocks = <&clks IMX5_CLK_SDMA_GATE>,
-                                        <&clks IMX5_CLK_SDMA_GATE>;
+                                        <&clks IMX5_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
index fb01fa6..2a6ce87 100644 (file)
@@ -88,6 +88,7 @@
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                gpio = <&gpio7 12 GPIO_ACTIVE_HIGH>;
+               startup-delay-us = <70000>;
                enable-active-high;
        };
 
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               startup-delay-us = <70000>;
                enable-active-high;
                regulator-always-on;
        };
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-duration = <10>;
        phy-reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
        phy-supply = <&reg_enet>;
                gpio-cfg = <
                        0x0000 /* 0:Default */
                        0x0000 /* 1:Default */
-                       0x0013 /* 2:FN_DMICCLK */
+                       0x0000 /* 2:FN_DMICCLK */
                        0x0000 /* 3:Default */
-                       0x8014 /* 4:FN_DMICCDAT */
+                       0x0000 /* 4:FN_DMICCDAT */
                        0x0000 /* 5:Default */
                >;
        };
diff --git a/arch/arm/boot/dts/imx6dl-eckelmann-ci4x10.dts b/arch/arm/boot/dts/imx6dl-eckelmann-ci4x10.dts
new file mode 100644 (file)
index 0000000..9eb2b73
--- /dev/null
@@ -0,0 +1,381 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 Eckelmann AG.
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+#include "imx6dl.dtsi"
+
+/ {
+       model = "Eckelmann CI 4X10 Board";
+       compatible = "eckelmann,imx6dl-ci4x10", "fsl,imx6dl";
+
+       chosen {
+               stdout-path = &uart3;
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       rmii_clk: clock-rmii {
+               /* This clock is provided by the phy (KSZ8091RNB) */
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <50000000>;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usb_h1_vbus>;
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       siox {
+               compatible = "eckelmann,siox-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_siox>;
+               din-gpios = <&gpio6 11 GPIO_ACTIVE_HIGH>;
+               dout-gpios = <&gpio6 8 GPIO_ACTIVE_HIGH>;
+               dclk-gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>;
+               dld-gpios = <&gpio6 10 GPIO_ACTIVE_HIGH>;
+       };
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&can2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan2>;
+       status = "okay";
+};
+
+&ecspi2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi2>;
+       cs-gpios = <&gpio5 12 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+
+       flash@0 {
+               compatible = "everspin,mr25h256";
+               reg = <0>;
+               spi-max-frequency = <15000000>;
+       };
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio5 25 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+
+       tpm@0 {
+               compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+       };
+};
+
+&gpio2 {
+       gpio-line-names = "buzzer", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "";
+};
+
+&gpio4 {
+       gpio-line-names = "", "", "", "", "", "", "", "in2",
+                         "prio2", "prio1", "aux", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "";
+};
+
+&gpio6 {
+       gpio-line-names = "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "in1",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       temperature-sensor@49 {
+               compatible = "ad,ad7414";
+               reg = <0x49>;
+       };
+
+       rtc@51 {
+               compatible = "nxp,pcf2127";
+               reg = <0x51>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       pinctrl_hog: hog {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_D0__GPIO2_IO00         0x00000018 /* buzzer */
+                       MX6QDL_PAD_KEY_COL1__GPIO4_IO08         0x00000018 /* OUT_1 */
+                       MX6QDL_PAD_KEY_ROW1__GPIO4_IO09         0x00000018 /* OUT_2 */
+                       MX6QDL_PAD_KEY_COL2__GPIO4_IO10         0x00000018 /* OUT_3 */
+                       MX6QDL_PAD_NANDF_CS2__GPIO6_IO15        0x00000000 /* In1 */
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x00000000 /* In2 */
+                       MX6QDL_PAD_GPIO_9__GPIO1_IO09           0x00000018 /* unused watchdog pin */
+                       MX6QDL_PAD_SD1_DAT2__GPIO1_IO19         0x00000018 /* unused watchdog pin */
+
+               >;
+       };
+
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT4__ECSPI1_SCLK       0x000100a0
+                       MX6QDL_PAD_CSI0_DAT5__ECSPI1_MOSI       0x000100a0
+                       MX6QDL_PAD_CSI0_DAT6__ECSPI1_MISO       0x000100a0
+                       MX6QDL_PAD_CSI0_DAT7__GPIO5_IO25        0x000100a0
+               >;
+       };
+
+       pinctrl_ecspi2: ecspi2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT19__ECSPI2_SCLK     0x000100b1
+                       MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI         0x000100b1
+                       MX6QDL_PAD_EIM_OE__ECSPI2_MISO          0x000100b1
+                       MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12      0x000100b1
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x0001b098
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x0001b098
+                       MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0     0x0001b098
+                       MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1     0x0001b098
+                       MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN       0x0001b098
+                       MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER       0x0001b0b0
+                       MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0     0x0001b0b0
+                       MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1     0x0001b0b0
+                       MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN      0x0001b0b0
+                       MX6QDL_PAD_SD1_CMD__GPIO1_IO18          0x00000018
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_7__FLEXCAN1_TX          0x0001b020
+                       MX6QDL_PAD_GPIO_8__FLEXCAN1_RX          0x0001b0b0
+               >;
+       };
+
+       pinctrl_flexcan2: flexcan2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX        0x0001b020
+                       MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX        0x0001b0b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       /* without SION i2c doesn't detect bus busy */
+                       MX6QDL_PAD_CSI0_DAT9__I2C1_SCL          0x4001b820
+                       MX6QDL_PAD_CSI0_DAT8__I2C1_SDA          0x4001b820
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CLK__GPIO1_IO20          0x00000018
+               >;
+       };
+
+       pinctrl_reg_usb_h1_vbus: reg_usb_h1_vbusgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x0001b0b0
+               >;
+       };
+
+       pinctrl_siox: sioxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CS0__GPIO6_IO11        0x0001b010      /* DIN */
+                       MX6QDL_PAD_NANDF_ALE__GPIO6_IO08        0x0001b010      /* DOUT */
+                       MX6QDL_PAD_NANDF_WP_B__GPIO6_IO09       0x0001b010      /* DCLK */
+                       MX6QDL_PAD_NANDF_RB0__GPIO6_IO10        0x0001b010      /* DLD */
+               >;
+       };
+
+       pinctrl_uart1_dte: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT11__UART1_TX_DATA    0x0001b010
+                       MX6QDL_PAD_CSI0_DAT10__UART1_RX_DATA    0x0001b010
+                       MX6QDL_PAD_EIM_D19__UART1_RTS_B         0x0001b010
+                       MX6QDL_PAD_EIM_D20__UART1_CTS_B         0x0001b010
+                       MX6QDL_PAD_EIM_D23__GPIO3_IO23          0x0001b010      /* DCD */
+                       MX6QDL_PAD_EIM_D24__GPIO3_IO24          0x0001b010      /* DTR */
+                       MX6QDL_PAD_EIM_D25__GPIO3_IO25          0x0001b010      /* DSR */
+               >;
+       };
+
+       pinctrl_uart2_dte: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D27__UART2_TX_DATA       0x0001b010
+                       MX6QDL_PAD_EIM_D26__UART2_RX_DATA       0x0001b010
+                       MX6QDL_PAD_EIM_D28__UART2_RTS_B         0x0001b010
+                       MX6QDL_PAD_EIM_D29__UART2_CTS_B         0x0001b010
+                       MX6QDL_PAD_NANDF_D1__GPIO2_IO01         0x0001b010      /* DCD */
+                       MX6QDL_PAD_GPIO_18__GPIO7_IO13          0x0001b010      /* DTR */
+                       MX6QDL_PAD_NANDF_CS3__GPIO6_IO16        0x0001b010      /* DSR */
+               >;
+       };
+
+       pinctrl_uart3_dce: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_CLK__UART3_RX_DATA       0x0001b010
+                       MX6QDL_PAD_SD4_CMD__UART3_TX_DATA       0x0001b010
+               >;
+       };
+
+       pinctrl_uart4_dce: uart4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA    0x0001b010
+                       MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA    0x0001b010
+                       MX6QDL_PAD_CSI0_DAT17__GPIO6_IO03       0x0001b010
+               >;
+       };
+
+       pinctrl_uart5_dce: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT15__UART5_RX_DATA    0x0001b010
+                       MX6QDL_PAD_CSI0_DAT14__UART5_TX_DATA    0x0001b010
+                       MX6QDL_PAD_CSI0_DAT19__GPIO6_IO05       0x0001b010      /* RTS */
+               >;
+       };
+
+       pinctrl_usbh1: usbh1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__USB_H1_OC           0x0001b0b0
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x00017059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x00010059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x00017059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x00017059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x00017059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x00017059
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x00017059
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x00017059
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x00017059
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x00017059
+               >;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rmii";
+       phy-reset-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
+       phy-handle = <&phy>;
+       clocks = <&clks IMX6QDL_CLK_ENET>, <&clks IMX6QDL_CLK_ENET>, <&rmii_clk>;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy: ethernet-phy@1 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <1>;
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 20 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1_dte>;
+       uart-has-rtscts;
+       fsl,dte-mode;
+       dcd-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
+       dtr-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>;
+       dsr-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2_dte>;
+       uart-has-rtscts;
+       fsl,dte-mode;
+       dcd-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
+       dtr-gpios = <&gpio7 13 GPIO_ACTIVE_LOW>;
+       dsr-gpios = <&gpio6 16 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3_dce>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4_dce>;
+       rts-gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5_dce>;
+       rts-gpios = <&gpio6 5 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&usbh1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbh1>;
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usbotg {
+       dr_mode = "peripheral";
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       bus-width = <8>;
+       non-removable;
+       status = "okay";
+};
index 65c184b..d9de49e 100644 (file)
@@ -92,7 +92,7 @@
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
        interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
                              <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
index 660d52a..ff3283c 100644 (file)
        model = "Freescale i.MX6 DualLite/Solo SABRE Automotive Board";
        compatible = "fsl,imx6dl-sabreauto", "fsl,imx6dl";
 };
+
+&cpu0 {
+       operating-points = <
+               /* kHz    uV */
+               996000  1275000
+               792000  1175000
+               396000  1150000
+       >;
+       fsl,soc-operating-points = <
+               /* ARM kHz  SOC-PU uV */
+               996000  1200000
+               792000  1175000
+               396000  1175000
+       >;
+};
index adc9455..37c6340 100644 (file)
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        status = "okay";
 };
 
index 56e5b50..cb0a5f7 100644 (file)
 /dts-v1/;
 #include "imx6q.dtsi"
 #include "imx6qdl-gw54xx.dtsi"
+#include <dt-bindings/media/tda1997x.h>
 
 / {
        model = "Gateworks Ventana i.MX6 Dual/Quad GW54XX";
        compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q";
+
+       sound-digital {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "tda1997x-audio";
+
+               simple-audio-card,dai-link@0 {
+                       format = "i2s";
+
+                       cpu {
+                               sound-dai = <&ssi2>;
+                       };
+
+                       codec {
+                               bitclock-master;
+                               frame-master;
+                               sound-dai = <&hdmi_receiver>;
+                       };
+               };
+       };
 };
 
 &i2c3 {
                        };
                };
        };
+
+       hdmi_receiver: hdmi-receiver@48 {
+               compatible = "nxp,tda19971";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tda1997x>;
+               reg = <0x48>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+               DOVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&sw4_reg>;
+               DVDD-supply = <&sw4_reg>;
+               #sound-dai-cells = <0>;
+               nxp,audout-format = "i2s";
+               nxp,audout-layout = <0>;
+               nxp,audout-width = <16>;
+               nxp,audout-mclk-fs = <128>;
+               /*
+                * The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+                * and Y[11:4] across 16bits in the same cycle
+                * which we map to VP[15:08]<->CSI_DATA[19:12]
+                */
+               nxp,vidout-portcfg =
+                       /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+                       < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+                       /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+                       < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+                       /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+                       < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+                       /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+                       < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+               port {
+                       tda1997x_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <16>;
+                               hsync-active = <1>;
+                               vsync-active = <1>;
+                               data-active = <1>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <16>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&tda1997x_to_ipu1_csi0_mux>;
+       bus-width = <16>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
 };
 
 &ipu2_csi1_from_ipu2_csi1_mux {
                >;
        };
 
+       pinctrl_ipu1_csi0: ipu1_csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x1b0b0
+               >;
+       };
+
        pinctrl_ipu2_csi1: ipu2_csi1grp {
                fsl,pins = <
                        MX6QDL_PAD_EIM_EB2__IPU2_CSI1_DATA19    0x1b0b0
                        MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK    0x1b0b0
                >;
        };
+
+       pinctrl_tda1997x: tda1997xgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_7__GPIO1_IO07   0x1b0b0
+               >;
+       };
 };
index 45eb0b7..d96ae54 100644 (file)
@@ -21,6 +21,8 @@
 
        panel-lvds0 {
                compatible = "okaya,rs800480t-7x0gp";
+               power-supply = <&reg_lcd_reset>;
+               backlight = <&backlight>;
 
                port {
                        panel_in_lvds0: endpoint {
@@ -38,7 +40,6 @@
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio4 17 GPIO_ACTIVE_HIGH>;
                enable-active-high;
-               regulator-always-on;
                vin-supply = <&reg_3v3>;
                startup-delay-us = <500000>;
        };
@@ -52,7 +53,6 @@
                regulator-max-microvolt = <3300000>;
                gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
                enable-active-high;
-               regulator-always-on;
                vin-supply = <&reg_lcd>;
        };
 };
index d8ccb53..84b30bd 100644 (file)
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
index 2ce8399..bfff87c 100644 (file)
@@ -98,7 +98,7 @@
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
index 0f0743d..a1c5e69 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2016-2017 Zodiac Inflight Innovations
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
index 1ebf29f..4738c3c 100644 (file)
@@ -51,7 +51,7 @@
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-duration = <10>;
        phy-reset-gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
        status = "okay";
index 397e205..70d2661 100644 (file)
@@ -77,8 +77,6 @@
 
        pwm_fan: pwm-fan {
                compatible = "pwm-fan";
-               cooling-min-state = <0>;
-               cooling-max-state = <4>;
                #cooling-cells = <2>;
                pwms = <&pwm4 0 50000>;
                cooling-levels = <0 64 127 191 255>;
index 81b2fcf..e4d1c52 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                };
        };
 
-       sound {
+       sound-analog {
                compatible = "fsl,imx6q-ventana-sgtl5000",
                             "fsl,imx-audio-sgtl5000";
                model = "sgtl5000-audio";
                ssi-controller = <&ssi1>;
-               audio-codec = <&codec>;
+               audio-codec = <&sgtl5000>;
                audio-routing =
                        "MIC_IN", "Mic Jack",
                        "Mic Jack", "Mic Bias",
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_audmux>; /* AUD4<->sgtl5000 */
        status = "okay";
+
+       ssi2 {
+               fsl,audmux-port = <1>;
+               fsl,port-config = <
+                       (IMX_AUDMUX_V2_PTCR_TFSDIR |
+                       IMX_AUDMUX_V2_PTCR_TFSEL(4+8) | /* RXFS */
+                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
+                       IMX_AUDMUX_V2_PTCR_TCSEL(4+8) | /* RXC */
+                       IMX_AUDMUX_V2_PTCR_SYN)
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(4)
+               >;
+       };
+
+       aud5 {
+               fsl,audmux-port = <4>;
+               fsl,port-config = <
+                       IMX_AUDMUX_V2_PTCR_SYN
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(1)>;
+       };
 };
 
 &can1 {
        pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 
-       codec: sgtl5000@a {
+       sgtl5000: audio-codec@a {
                compatible = "fsl,sgtl5000";
                reg = <0x0a>;
                clocks = <&clks IMX6QDL_CLK_CKO>;
                        MX6QDL_PAD_SD2_DAT2__AUD4_TXD           0x110b0
                        MX6QDL_PAD_SD2_DAT1__AUD4_TXFS          0x130b0
                        MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* AUD4_MCK */
+                       MX6QDL_PAD_EIM_D25__AUD5_RXC            0x130b0
+                       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD        0x130b0
+                       MX6QDL_PAD_EIM_D24__AUD5_RXFS           0x130b0
                >;
        };
 
index 8e46a80..c23ba22 100644 (file)
@@ -46,6 +46,8 @@
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/media/tda1997x.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
 
 / {
        /* these are used by bootloader for disabling nodes */
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
        };
+
+       sound-digital {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "tda1997x-audio";
+
+               simple-audio-card,dai-link@0 {
+                       format = "i2s";
+
+                       cpu {
+                               sound-dai = <&ssi2>;
+                       };
+
+                       codec {
+                               bitclock-master;
+                               frame-master;
+                               sound-dai = <&hdmi_receiver>;
+                       };
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>; /* AUD5<->tda1997x */
+       status = "okay";
+
+       ssi1 {
+               fsl,audmux-port = <0>;
+               fsl,port-config = <
+                       (IMX_AUDMUX_V2_PTCR_TFSDIR |
+                       IMX_AUDMUX_V2_PTCR_TFSEL(4+8) | /* RXFS */
+                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
+                       IMX_AUDMUX_V2_PTCR_TCSEL(4+8) | /* RXC */
+                       IMX_AUDMUX_V2_PTCR_SYN)
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(4)
+               >;
+       };
+
+       aud5 {
+               fsl,audmux-port = <4>;
+               fsl,port-config = <
+                       IMX_AUDMUX_V2_PTCR_SYN
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(0)>;
+       };
 };
 
 &can1 {
                #gpio-cells = <2>;
        };
 
+       hdmi_receiver: hdmi-receiver@48 {
+               compatible = "nxp,tda19971";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tda1997x>;
+               reg = <0x48>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+               DOVDD-supply = <&reg_3p3>;
+               AVDD-supply = <&reg_1p8b>;
+               DVDD-supply = <&reg_1p8a>;
+               #sound-dai-cells = <0>;
+               nxp,audout-format = "i2s";
+               nxp,audout-layout = <0>;
+               nxp,audout-width = <16>;
+               nxp,audout-mclk-fs = <128>;
+               /*
+                * The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+                * and Y[11:4] across 16bits in the same cycle
+                * which we map to VP[15:08]<->CSI_DATA[19:12]
+                */
+               nxp,vidout-portcfg =
+                       /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+                       < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+                       /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+                       < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+                       /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+                       < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+                       /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+                       < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+               port {
+                       tda1997x_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <16>;
+                               hsync-active = <1>;
+                               vsync-active = <1>;
+                               data-active = <1>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <16>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&tda1997x_to_ipu1_csi0_mux>;
+       bus-width = <16>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
 };
 
 &pcie {
 };
 
 &iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD        0x130b0
+                       MX6QDL_PAD_DISP0_DAT14__AUD5_RXC        0x130b0
+                       MX6QDL_PAD_DISP0_DAT13__AUD5_RXFS       0x130b0
+               >;
+       };
+
        pinctrl_flexcan1: flexcan1grp {
                fsl,pins = <
                        MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
                >;
        };
 
+       pinctrl_ipu1_csi0: ipu1_csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x1b0b0
+               >;
+       };
+
        pinctrl_pcie: pciegrp {
                fsl,pins = <
                        MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0 /* PCIE RST */
                >;
        };
 
+       pinctrl_tda1997x: tda1997xgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_7__GPIO1_IO07           0x1b0b0
+               >;
+       };
+
        pinctrl_uart2: uart2grp {
                fsl,pins = <
                        MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
index 9cb9a74..aee9221 100644 (file)
        tlv320aic3105: codec@18 {
                compatible = "ti,tlv320aic3x";
                reg = <0x18>;
-               gpio-reset = <&gpio5 17 GPIO_ACTIVE_LOW>;
+               reset-gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
                clocks = <&clks IMX6QDL_CLK_CKO>;
                ai3x-micbias-vg = <2>; /* MICBIAS_2_5V */
                /* Regulators */
index 027df06..7e53ac6 100644 (file)
@@ -79,7 +79,7 @@
        status = "okay";
        cs-gpios = <&gpio4 24 0>;
 
-       flash@0 {
+       som_flash: flash@0 {
                compatible = "m25p80", "jedec,spi-nor";
                spi-max-frequency = <20000000>;
                reg = <0>;
        pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
-       eeprom@50 {
+       som_eeprom: eeprom@50 {
                compatible = "atmel,24c32";
                reg = <0x50>;
        };
index 1280de5..f3404dd 100644 (file)
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
                              <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
        fsl,err006687-workaround-present;
index a070506..185fb17 100644 (file)
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
index 4ccb7af..6d7f6b9 100644 (file)
@@ -53,7 +53,7 @@
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-duration = <2>;
        phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
        status = "okay";
index 8752a49..c41cac5 100644 (file)
                IOVDD-supply = <&reg_3p3v>;
                DVDD-supply = <&reg_3p3v>;
                ai3x-ocmv = <0>;
-               gpio-reset = <&gpio5 5 GPIO_ACTIVE_LOW>;
+               reset-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>;
        };
 };
 
index b7d5fb4..50d9a98 100644 (file)
 &fec {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio3 29 GPIO_ACTIVE_LOW>;
        interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
                              <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
index 69942c7..93be00a 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2016-2017 Zodiac Inflight Innovations
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include <dt-bindings/gpio/gpio.h>
 
        panel {
                power-supply = <&reg_3p3v_display>;
+               backlight = <&sp_backlight>;
                status = "disabled";
 
                port {
                        compatible = "zii,rave-sp-watchdog";
                };
 
-               backlight {
+               sp_backlight: backlight {
                        compatible = "zii,rave-sp-backlight";
                };
 
                AVDD-supply = <&reg_3p3v>;
                IOVDD-supply = <&reg_3p3v>;
                DVDD-supply = <&vgen4_reg>;
-               gpio-reset = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+               reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
        };
 
        accel@1c {
                };
        };
 
+       watchdog@38 {
+               compatible = "zii,rave-wdt";
+               reg = <0x38>;
+       };
+
        temp-sense@48 {
                compatible = "national,lm75";
                reg = <0x48>;
                AVDD-supply = <&reg_3p3v>;
                IOVDD-supply = <&reg_3p3v>;
                DVDD-supply = <&vgen4_reg>;
-               gpio-reset = <&gpio1 0 GPIO_ACTIVE_HIGH>;
+               reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
        };
 
        touchscreen@20 {
index fe17a34..b3a77bc 100644 (file)
@@ -4,6 +4,7 @@
 // Copyright 2011 Linaro Ltd.
 
 #include <dt-bindings/clock/imx6qdl-clock.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 / {
                        ranges = <0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
                                  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
                        num-lanes = <1>;
+                       num-viewport = <4>;
                        interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "msi";
                        #interrupt-cells = <1>;
                                        status = "disabled";
                                };
 
+                               snvs_pwrkey: snvs-powerkey {
+                                       compatible = "fsl,sec-v4.0-pwrkey";
+                                       regmap = <&snvs>;
+                                       interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+                                       linux,keycode = <KEY_POWER>;
+                                       wakeup-source;
+                               };
+
                                snvs_lpgpr: snvs-lpgpr {
                                        compatible = "fsl,imx6q-snvs-lpgpr";
                                };
                                compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma";
                                reg = <0x020ec000 0x4000>;
                                interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&clks IMX6QDL_CLK_SDMA>,
+                               clocks = <&clks IMX6QDL_CLK_IPG>,
                                         <&clks IMX6QDL_CLK_SDMA>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                reg = <0x021ac000 0x4000>;
                        };
 
-                       mmdc0: mmdc@21b0000 { /* MMDC0 */
+                       mmdc0: memory-controller@21b0000 { /* MMDC0 */
                                compatible = "fsl,imx6q-mmdc";
                                reg = <0x021b0000 0x4000>;
                                clocks = <&clks IMX6QDL_CLK_MMDC_P0_IPG>;
                        };
 
-                       mmdc1: mmdc@21b4000 { /* MMDC1 */
+                       mmdc1: memory-controller@21b4000 { /* MMDC1 */
+                               compatible = "fsl,imx6q-mmdc";
                                reg = <0x021b4000 0x4000>;
+                               status = "disabled";
                        };
 
                        weim: weim@21b8000 {
index 98bf7a6..57de447 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2016-2017 Zodiac Inflight Innovations
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
index 4b4813f..9ddbeea 100644 (file)
                gpio2 = &gpio3;
                gpio3 = &gpio4;
                gpio4 = &gpio5;
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               i2c2 = &i2c3;
+               mmc0 = &usdhc1;
+               mmc1 = &usdhc2;
+               mmc2 = &usdhc3;
+               mmc3 = &usdhc4;
                serial0 = &uart1;
                serial1 = &uart2;
                serial2 = &uart3;
                                reg = <0x020ec000 0x4000>;
                                interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_SDMA>,
-                                        <&clks IMX6SL_CLK_SDMA>;
+                                        <&clks IMX6SL_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                /* imx6sl reuses imx6q sdma firmware */
                                status = "disabled";
                        };
 
-                       mmdc: mmdc@21b0000 {
+                       memory-controller@21b0000 {
                                compatible = "fsl,imx6sl-mmdc", "fsl,imx6q-mmdc";
                                reg = <0x021b0000 0x4000>;
                                clocks = <&clks IMX6SL_CLK_MMDC_P0_IPG>;
index 62847c6..1b4899f 100644 (file)
@@ -64,6 +64,7 @@
                                198000          1175000
                        >;
                        clock-latency = <61036>; /* two CLK32 periods */
+                       #cooling-cells = <2>;
                        clocks = <&clks IMX6SLL_CLK_ARM>,
                                 <&clks IMX6SLL_CLK_PLL2_PFD2>,
                                 <&clks IMX6SLL_CLK_STEP>,
                                compatible = "fsl,imx6sll-sdma", "fsl,imx35-sdma";
                                reg = <0x020ec000 0x4000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&clks IMX6SLL_CLK_SDMA>,
+                               clocks = <&clks IMX6SLL_CLK_IPG>,
                                         <&clks IMX6SLL_CLK_SDMA>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
index b0ee324..315044c 100644 (file)
@@ -75,7 +75,7 @@
 &fec1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet1>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-handle = <&ethphy1>;
        fsl,magic-packet;
        status = "okay";
index 08ede56..f6972de 100644 (file)
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet1>;
        phy-supply = <&reg_enet_3v3>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-handle = <&ethphy1>;
        phy-reset-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
        status = "okay";
index 5b16e65..b16a123 100644 (file)
                                compatible = "fsl,imx6sx-sdma", "fsl,imx6q-sdma";
                                reg = <0x020ec000 0x4000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&clks IMX6SX_CLK_SDMA>,
+                               clocks = <&clks IMX6SX_CLK_IPG>,
                                         <&clks IMX6SX_CLK_SDMA>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                status = "disabled";
                        };
 
-                       mmdc: mmdc@21b0000 {
+                       memory-controller@21b0000 {
                                compatible = "fsl,imx6sx-mmdc", "fsl,imx6q-mmdc";
                                reg = <0x021b0000 0x4000>;
                                clocks = <&clks IMX6SX_CLK_MMDC_P0_IPG>;
index 62ed30c..bbf010c 100644 (file)
                                             "fsl,imx35-sdma";
                                reg = <0x020ec000 0x4000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&clks IMX6UL_CLK_SDMA>,
+                               clocks = <&clks IMX6UL_CLK_IPG>,
                                         <&clks IMX6UL_CLK_SDMA>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                status = "disabled";
                        };
 
-                       mmdc: mmdc@21b0000 {
+                       memory-controller@21b0000 {
                                compatible = "fsl,imx6ul-mmdc", "fsl,imx6q-mmdc";
                                reg = <0x021b0000 0x4000>;
                                clocks = <&clks IMX6UL_CLK_MMDC_P0_IPG>;
diff --git a/arch/arm/boot/dts/imx7-mba7.dtsi b/arch/arm/boot/dts/imx7-mba7.dtsi
new file mode 100644 (file)
index 0000000..50abf18
--- /dev/null
@@ -0,0 +1,550 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Include file for TQ Systems MBa7 carrier board.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ *
+ * Note: This file does not include nodes for all peripheral devices.
+ * As device driver coverage increases additional nodes can be added.
+ */
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/net/ti-dp83867.h>
+
+/ {
+       beeper {
+               compatible = "gpio-beeper";
+               gpios = <&pca9555 0 GPIO_ACTIVE_HIGH>;
+       };
+
+       chosen {
+               stdout-path = &uart6;
+       };
+
+       gpio_buttons: gpio-keys {
+               compatible = "gpio-keys";
+
+               button-0 {
+                       /* #SWITCH_A */
+                       label = "S11";
+                       linux,code = <KEY_1>;
+                       gpios = <&pca9555 13 GPIO_ACTIVE_LOW>;
+               };
+
+               button-1 {
+                       /* #SWITCH_B */
+                       label = "S12";
+                       linux,code = <KEY_2>;
+                       gpios = <&pca9555 14 GPIO_ACTIVE_LOW>;
+               };
+
+               button-2 {
+                       /* #SWITCH_C */
+                       label = "S13";
+                       linux,code = <KEY_3>;
+                       gpios = <&pca9555 15 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               led1 {
+                       label = "led1";
+                       gpios = <&pca9555 8 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "default-on";
+               };
+
+               led2 {
+                       label = "led2";
+                       gpios = <&pca9555 9 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       reg_sd1_vmmc: regulator-sd1-vmmc {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC3V3_SD1";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_fec1_pwdn: regulator-fec1-pwdn {
+               compatible = "regulator-fixed";
+               regulator-name = "PWDN_FEC1";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_fec2_pwdn: regulator-fec2-pwdn {
+               compatible = "regulator-fixed";
+               regulator-name = "PWDN_FEC2";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+               gpio = <&gpio2 31 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_usb_otg1_vbus: regulator-usb-otg1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "VBUS_USBOTG1";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "VBUS_USBOTG2";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_mpcie_1v5: regulator-mpcie-1v5 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC1V5_MPCIE";
+               regulator-min-microvolt = <1500000>;
+               regulator-max-microvolt = <1500000>;
+               gpio = <&pca9555 12 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               regulator-always-on;
+       };
+
+       reg_mpcie_3v3: regulator-mpcie-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC3V3_MPCIE";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&pca9555 10 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               regulator-always-on;
+       };
+
+       reg_mba_12v0: regulator-mba-12v0 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC12V0_MBA7";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               gpio = <&pca9555 11 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_lvds_transmitter: regulator-lvds-transmitter {
+               compatible = "regulator-fixed";
+               regulator-name = "#SHTDN_LVDS";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&pca9555 1 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_vref_1v8: regulator-vref-1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC1V8_REF";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+               vin-supply = <&sw2_reg>;
+       };
+
+       reg_audio_3v3: regulator-audio-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC3V3_AUDIO";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+};
+
+&adc1 {
+       vref-supply = <&reg_vref_1v8>;
+       status = "okay";
+};
+
+&adc2 {
+       vref-supply = <&reg_vref_1v8>;
+       status = "okay";
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       num-chipselects = <3>;
+       cs-gpios = <&gpio4 0 GPIO_ACTIVE_LOW>, <&gpio4 1 GPIO_ACTIVE_LOW>,
+                  <&gpio4 2 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&ecspi2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi2>;
+       num-chipselects = <1>;
+       status = "okay";
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet1>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>;
+       phy-reset-duration = <1>;
+       phy-reset-delay = <1>;
+       phy-supply = <&reg_fec1_pwdn>;
+       phy-handle = <&ethphy1_0>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy1_0: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <0>;
+                       ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_50_NS>;
+                       ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_50_NS>;
+                       ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+                       /* LED1: Link/Activity, LED2: Error */
+                       ti,led-function = <0x0db0>;
+                       /* Active low, LED1 and LED2 driven by phy */
+                       ti,led-ctrl = <0x1001>;
+               };
+       };
+};
+
+&flexcan1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&flexcan2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan2>;
+       status = "okay";
+};
+
+&i2c1 {
+       lm75: temperature-sensor@49 {
+               compatible = "national,lm75";
+               reg = <0x49>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       tlv320aic32x4: audio-codec@18 {
+               compatible = "ti,tlv320aic32x4";
+               reg = <0x18>;
+               clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
+               clock-names = "mclk";
+               ldoin-supply = <&reg_audio_3v3>;
+               iov-supply = <&reg_audio_3v3>;
+       };
+
+       pca9555: gpio-expander@20 {
+               compatible = "nxp,pca9555";
+               reg = <0x20>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pca9555>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog_mba7_1>;
+
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX7D_PAD_ECSPI1_MISO__ECSPI1_MISO               0x7c
+                       MX7D_PAD_ECSPI1_MOSI__ECSPI1_MOSI               0x74
+                       MX7D_PAD_ECSPI1_SCLK__ECSPI1_SCLK               0x74
+                       MX7D_PAD_UART1_RX_DATA__GPIO4_IO0               0x74
+                       MX7D_PAD_UART1_TX_DATA__GPIO4_IO1               0x74
+                       MX7D_PAD_UART2_RX_DATA__GPIO4_IO2               0x74
+               >;
+       };
+
+       pinctrl_ecspi2: ecspi2grp {
+               fsl,pins = <
+                       MX7D_PAD_ECSPI2_MISO__ECSPI2_MISO               0x7c
+                       MX7D_PAD_ECSPI2_MOSI__ECSPI2_MOSI               0x74
+                       MX7D_PAD_ECSPI2_SCLK__ECSPI2_SCLK               0x74
+                       MX7D_PAD_ECSPI2_SS0__ECSPI2_SS0                 0x74
+               >;
+       };
+
+       pinctrl_enet1: enet1grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO10__ENET1_MDIO                 0x02
+                       MX7D_PAD_GPIO1_IO11__ENET1_MDC                  0x00
+                       MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC       0x71
+                       MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0       0x71
+                       MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1       0x71
+                       MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2       0x71
+                       MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3       0x71
+                       MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x71
+                       MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC       0x79
+                       MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0       0x79
+                       MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1       0x79
+                       MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2       0x79
+                       MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3       0x79
+                       MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x79
+                       /* Reset: SION, 100kPU, SRE_FAST, DSE_X1 */
+                       MX7D_PAD_ENET1_COL__GPIO7_IO15          0x40000070
+                       /* INT/PWDN: SION, 100kPU, HYS, SRE_FAST, DSE_X1 */
+                       MX7D_PAD_GPIO1_IO09__GPIO1_IO9          0x40000078
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO12__FLEXCAN1_RX        0x5a
+                       MX7D_PAD_GPIO1_IO13__FLEXCAN1_TX        0x52
+               >;
+       };
+
+       pinctrl_flexcan2: flexcan2grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX        0x5a
+                       MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX        0x52
+               >;
+       };
+
+       pinctrl_hog_mba7_1: hogmba71grp {
+               fsl,pins = <
+                       /* Limitation: WDOG2_B / WDOG2_RESET not usable */
+                       MX7D_PAD_ENET1_RX_CLK__GPIO7_IO13       0x4000007c
+                       MX7D_PAD_ENET1_CRS__GPIO7_IO14          0x40000074
+                       /* #BOOT_EN */
+                       MX7D_PAD_UART2_TX_DATA__GPIO4_IO3       0x40000010
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C2_SCL__I2C2_SCL             0x40000078
+                       MX7D_PAD_I2C2_SDA__I2C2_SDA             0x40000078
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C3_SCL__I2C3_SCL             0x40000078
+                       MX7D_PAD_I2C3_SDA__I2C3_SDA             0x40000078
+               >;
+       };
+
+
+       pinctrl_pca9555: pca95550grp {
+               fsl,pins = <
+                       MX7D_PAD_ENET1_TX_CLK__GPIO7_IO12       0x78
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX7D_PAD_UART3_RX_DATA__UART3_DCE_RX    0x7e
+                       MX7D_PAD_UART3_TX_DATA__UART3_DCE_TX    0x76
+                       MX7D_PAD_UART3_CTS_B__UART3_DCE_CTS     0x76
+                       MX7D_PAD_UART3_RTS_B__UART3_DCE_RTS     0x7e
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX7D_PAD_SAI2_TX_SYNC__UART4_DCE_RX     0x7e
+                       MX7D_PAD_SAI2_TX_BCLK__UART4_DCE_TX     0x76
+                       MX7D_PAD_SAI2_RX_DATA__UART4_DCE_CTS    0x76
+                       MX7D_PAD_SAI2_TX_DATA__UART4_DCE_RTS    0x7e
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C4_SCL__UART5_DCE_RX         0x7e
+                       MX7D_PAD_I2C4_SDA__UART5_DCE_TX         0x76
+               >;
+       };
+
+       pinctrl_uart6: uart6grp {
+               fsl,pins = <
+                       MX7D_PAD_EPDC_DATA08__UART6_DCE_RX      0x7d
+                       MX7D_PAD_EPDC_DATA09__UART6_DCE_TX      0x75
+                       MX7D_PAD_EPDC_DATA11__UART6_DCE_CTS     0x75
+                       MX7D_PAD_EPDC_DATA10__UART6_DCE_RTS     0x7d
+               >;
+       };
+
+       pinctrl_uart7: uart7grp {
+               fsl,pins = <
+                       MX7D_PAD_EPDC_DATA12__UART7_DCE_RX      0x7e
+                       MX7D_PAD_EPDC_DATA13__UART7_DCE_TX      0x76
+                       MX7D_PAD_EPDC_DATA15__UART7_DCE_CTS     0x76
+                       /* Limitation: RTS is not connected */
+                       MX7D_PAD_EPDC_DATA14__UART7_DCE_RTS     0x7e
+               >;
+       };
+
+       pinctrl_usdhc1_gpio: usdhc1grp_gpio {
+               fsl,pins = <
+                       /* WP */
+                       MX7D_PAD_SD1_WP__GPIO5_IO1              0x7c
+                       /* CD */
+                       MX7D_PAD_SD1_CD_B__GPIO5_IO0            0x7c
+                       /* VSELECT */
+                       MX7D_PAD_GPIO1_IO08__SD1_VSELECT        0x59
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX7D_PAD_SD1_CMD__SD1_CMD               0x5e
+                       MX7D_PAD_SD1_CLK__SD1_CLK               0x57
+                       MX7D_PAD_SD1_DATA0__SD1_DATA0           0x5e
+                       MX7D_PAD_SD1_DATA1__SD1_DATA1           0x5e
+                       MX7D_PAD_SD1_DATA2__SD1_DATA2           0x5e
+                       MX7D_PAD_SD1_DATA3__SD1_DATA3           0x5e
+               >;
+       };
+
+       pinctrl_usdhc1_100mhz: usdhc1grp_100mhz {
+               fsl,pins = <
+                       MX7D_PAD_SD1_CMD__SD1_CMD               0x5a
+                       MX7D_PAD_SD1_CLK__SD1_CLK               0x57
+                       MX7D_PAD_SD1_DATA0__SD1_DATA0           0x5a
+                       MX7D_PAD_SD1_DATA1__SD1_DATA1           0x5a
+                       MX7D_PAD_SD1_DATA2__SD1_DATA2           0x5a
+                       MX7D_PAD_SD1_DATA3__SD1_DATA3           0x5a
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1grp_200mhz {
+               fsl,pins = <
+                       MX7D_PAD_SD1_CMD__SD1_CMD               0x5b
+                       MX7D_PAD_SD1_CLK__SD1_CLK               0x57
+                       MX7D_PAD_SD1_DATA0__SD1_DATA0           0x5b
+                       MX7D_PAD_SD1_DATA1__SD1_DATA1           0x5b
+                       MX7D_PAD_SD1_DATA2__SD1_DATA2           0x5b
+                       MX7D_PAD_SD1_DATA3__SD1_DATA3           0x5b
+               >;
+       };
+};
+
+&iomuxc_lpsr {
+       pinctrl_pwm1: pwm1grp {
+               fsl,pins = <
+                       /* LCD_CONTRAST */
+                       MX7D_PAD_LPSR_GPIO1_IO01__PWM1_OUT      0x50
+               >;
+       };
+
+       pinctrl_usbotg1: usbotg1grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO04__USB_OTG1_OC   0x5c
+                       MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5     0x59
+               >;
+       };
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       assigned-clocks = <&clks IMX7D_UART3_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       assigned-clocks = <&clks IMX7D_UART5_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       status = "okay";
+};
+
+&uart6 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart6>;
+       assigned-clocks = <&clks IMX7D_UART6_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       status = "okay";
+};
+
+&uart7 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart7>;
+       assigned-clocks = <&clks IMX7D_UART7_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+&usbh {
+       status = "okay";
+};
+
+&usbotg1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg1>;
+       vbus-supply = <&reg_usb_otg1_vbus>;
+       srp-disable;
+       hnp-disable;
+       adp-disable;
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usdhc1 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>, <&pinctrl_usdhc1_gpio>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>, <&pinctrl_usdhc1_gpio>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>, <&pinctrl_usdhc1_gpio>;
+       cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
+       vmmc-supply = <&reg_sd1_vmmc>;
+       bus-width = <4>;
+       no-1-8-v;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx7-tqma7.dtsi b/arch/arm/boot/dts/imx7-tqma7.dtsi
new file mode 100644 (file)
index 0000000..9aaed85
--- /dev/null
@@ -0,0 +1,249 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Include file for TQ Systems TQMa7x boards with full mounted PCB.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ */
+
+/ {
+       memory@80000000 {
+               device_type = "memory";
+               /* 512 MB - default configuration */
+               reg = <0x80000000 0x20000000>;
+       };
+};
+
+&cpu0 {
+       arm-supply = <&sw1a_reg>;
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       clock-frequency = <100000>;
+       status = "okay";
+
+       pfuze3000: pmic@8 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic1>;
+               compatible = "fsl,pfuze3000";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1a {
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       /* use sw1c_reg to align with pfuze100/pfuze200 */
+                       sw1c_reg: sw1b {
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1475000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1850000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3 {
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1650000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vldo1 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen2_reg: vldo2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                               regulator-always-on;
+                       };
+
+                       vgen3_reg: vccsd {
+                               regulator-min-microvolt = <2850000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen4_reg: v33 {
+                               regulator-min-microvolt = <2850000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vldo3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vldo4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       /* NXP SE97BTP with temperature sensor + eeprom */
+       se97b: temperature-sensor-eeprom@1e {
+               compatible = "nxp,se97b", "jedec,jc-42.4-temp";
+               reg = <0x1e>;
+               status = "okay";
+       };
+
+       /* ST M24C64 */
+       m24c64: eeprom@50 {
+               compatible = "atmel,24c64";
+               reg = <0x50>;
+               pagesize = <32>;
+               status = "okay";
+       };
+
+       at24c02: eeprom@56 {
+               compatible = "atmel,24c02";
+               reg = <0x56>;
+               pagesize = <16>;
+               status = "okay";
+       };
+
+       ds1339: rtc@68 {
+               compatible = "dallas,ds1339";
+               reg = <0x68>;
+       };
+};
+
+&iomuxc {
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C1_SDA__I2C1_SDA     0x40000078
+                       MX7D_PAD_I2C1_SCL__I2C1_SCL     0x40000078
+               >;
+       };
+
+       pinctrl_pmic1: pmic1grp {
+               fsl,pins = <
+                       MX7D_PAD_SD2_RESET_B__GPIO5_IO11        0x4000005C
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX7D_PAD_SD3_CMD__SD3_CMD               0x59
+                       MX7D_PAD_SD3_CLK__SD3_CLK               0x56
+                       MX7D_PAD_SD3_DATA0__SD3_DATA0           0x59
+                       MX7D_PAD_SD3_DATA1__SD3_DATA1           0x59
+                       MX7D_PAD_SD3_DATA2__SD3_DATA2           0x59
+                       MX7D_PAD_SD3_DATA3__SD3_DATA3           0x59
+                       MX7D_PAD_SD3_DATA4__SD3_DATA4           0x59
+                       MX7D_PAD_SD3_DATA5__SD3_DATA5           0x59
+                       MX7D_PAD_SD3_DATA6__SD3_DATA6           0x59
+                       MX7D_PAD_SD3_DATA7__SD3_DATA7           0x59
+                       MX7D_PAD_SD3_STROBE__SD3_STROBE         0x19
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp_100mhz {
+               fsl,pins = <
+                       MX7D_PAD_SD3_CMD__SD3_CMD               0x5a
+                       MX7D_PAD_SD3_CLK__SD3_CLK               0x51
+                       MX7D_PAD_SD3_DATA0__SD3_DATA0           0x5a
+                       MX7D_PAD_SD3_DATA1__SD3_DATA1           0x5a
+                       MX7D_PAD_SD3_DATA2__SD3_DATA2           0x5a
+                       MX7D_PAD_SD3_DATA3__SD3_DATA3           0x5a
+                       MX7D_PAD_SD3_DATA4__SD3_DATA4           0x5a
+                       MX7D_PAD_SD3_DATA5__SD3_DATA5           0x5a
+                       MX7D_PAD_SD3_DATA6__SD3_DATA6           0x5a
+                       MX7D_PAD_SD3_DATA7__SD3_DATA7           0x5a
+                       MX7D_PAD_SD3_STROBE__SD3_STROBE         0x1a
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp_200mhz {
+               fsl,pins = <
+                       MX7D_PAD_SD3_CMD__SD3_CMD               0x5b
+                       MX7D_PAD_SD3_CLK__SD3_CLK               0x51
+                       MX7D_PAD_SD3_DATA0__SD3_DATA0           0x5b
+                       MX7D_PAD_SD3_DATA1__SD3_DATA1           0x5b
+                       MX7D_PAD_SD3_DATA2__SD3_DATA2           0x5b
+                       MX7D_PAD_SD3_DATA3__SD3_DATA3           0x5b
+                       MX7D_PAD_SD3_DATA4__SD3_DATA4           0x5b
+                       MX7D_PAD_SD3_DATA5__SD3_DATA5           0x5b
+                       MX7D_PAD_SD3_DATA6__SD3_DATA6           0x5b
+                       MX7D_PAD_SD3_DATA7__SD3_DATA7           0x5b
+                       MX7D_PAD_SD3_STROBE__SD3_STROBE         0x1b
+               >;
+       };
+};
+
+&iomuxc_lpsr {
+       pinctrl_wdog1: wdog1grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO00__WDOG1_WDOG_B  0x30
+               >;
+       };
+};
+
+&sdma {
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       assigned-clocks = <&clks IMX7D_USDHC3_ROOT_CLK>;
+       assigned-clock-rates = <400000000>;
+       bus-width = <8>;
+       non-removable;
+       vmmc-supply = <&vgen4_reg>;
+       vqmmc-supply = <&sw2_reg>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog1>;
+       /*
+        * Errata e10574:
+        * WDOG reset needs to run with WDOG_RESET_B signal enabled.
+        * X1-51 (WDOG1#) signal needs carrier board handling to reset
+        * TQMa7 on X1-22 (RESET_IN#).
+        */
+       fsl,ext-reset-output;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx7d-mba7.dts b/arch/arm/boot/dts/imx7d-mba7.dts
new file mode 100644 (file)
index 0000000..221274c
--- /dev/null
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Source for TQ Systems TQMa7D board on MBa7 carrier board.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "imx7d-tqma7.dtsi"
+#include "imx7-mba7.dtsi"
+
+/ {
+       model = "TQ Systems TQMa7D board on MBa7 carrier board";
+       compatible = "tq,imx7d-mba7", "fsl,imx7d";
+};
+
+&fec2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet2>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio2 28 GPIO_ACTIVE_LOW>;
+       phy-reset-duration = <1>;
+       phy-reset-delay = <1>;
+       phy-supply = <&reg_fec2_pwdn>;
+       phy-handle = <&ethphy2_0>;
+       fsl,magic-packet;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy2_0: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <0>;
+                       ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_50_NS>;
+                       ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_50_NS>;
+                       ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+                       /* LED1: Link/Activity, LED2: error */
+                       ti,led-function = <0x0db0>;
+                       /* active low, LED1/2 driven by phy */
+                       ti,led-ctrl = <0x1001>;
+               };
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog_mba7_1>;
+
+       pinctrl_enet2: enet2grp {
+               fsl,pins = <
+                       MX7D_PAD_SD2_CD_B__ENET2_MDIO                   0x02
+                       MX7D_PAD_SD2_WP__ENET2_MDC                      0x00
+                       MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC             0x71
+                       MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0            0x71
+                       MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1            0x71
+                       MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2            0x71
+                       MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3             0x71
+                       MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL          0x71
+                       MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC            0x79
+                       MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0            0x79
+                       MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1             0x79
+                       MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2             0x79
+                       MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3            0x79
+                       MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL         0x79
+                       /* Reset: SION, 100kPU, SRE_FAST, DSE_X1 */
+                       MX7D_PAD_EPDC_BDR0__GPIO2_IO28          0x40000070
+                       /* INT/PWDN: SION, 100kPU, HYS, SRE_FAST, DSE_X1 */
+                       MX7D_PAD_EPDC_PWR_STAT__GPIO2_IO31      0x40000078
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       /* #pcie_wake */
+                       MX7D_PAD_EPDC_PWR_COM__GPIO2_IO30               0x70
+                       /* #pcie_rst */
+                       MX7D_PAD_SD2_CLK__GPIO5_IO12                    0x70
+                       /* #pcie_dis */
+                       MX7D_PAD_EPDC_BDR1__GPIO2_IO29                  0x70
+               >;
+       };
+};
+
+&iomuxc_lpsr {
+       pinctrl_usbotg2: usbotg2grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO06__USB_OTG2_OC   0x5c
+                       MX7D_PAD_LPSR_GPIO1_IO07__GPIO1_IO7     0x59
+               >;
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       /* 1.5V logically from 3.3V */
+       /* probe deferral not supported */
+       /* pcie-bus-supply = <&reg_mpcie_1v5>; */
+       reset-gpio = <&gpio5 12 GPIO_ACTIVE_LOW>;
+       disable-gpio = <&gpio2 29 GPIO_ACTIVE_LOW>;
+       power-on-gpio = <&gpio2 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&usbotg2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg2>;
+       vbus-supply = <&reg_usb_otg2_vbus>;
+       srp-disable;
+       hnp-disable;
+       adp-disable;
+       dr_mode = "host";
+       status = "okay";
+};
index 3fd595a..6f50ebf 100644 (file)
@@ -92,7 +92,7 @@
                          <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
        assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
        assigned-clock-rates = <0>, <100000000>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-handle = <&ethphy0>;
        fsl,magic-packet;
        phy-reset-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm/boot/dts/imx7d-tqma7.dtsi b/arch/arm/boot/dts/imx7d-tqma7.dtsi
new file mode 100644 (file)
index 0000000..8ad3048
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Include file for TQ Systems TQMa7D board with NXP i.MX7Dual SoC.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ */
+
+#include "imx7d.dtsi"
+#include "imx7-tqma7.dtsi"
diff --git a/arch/arm/boot/dts/imx7d-zii-rpu2.dts b/arch/arm/boot/dts/imx7d-zii-rpu2.dts
new file mode 100644 (file)
index 0000000..3e467a9
--- /dev/null
@@ -0,0 +1,941 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Device tree file for ZII's RPU2 board
+ *
+ * RPU - Remote Peripheral Unit
+ *
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+
+/dts-v1/;
+#include <dt-bindings/thermal/thermal.h>
+#include "imx7d.dtsi"
+
+/ {
+       model = "ZII RPU2 Board";
+       compatible = "zii,imx7d-rpu2", "fsl,imx7d";
+
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       cs2000_ref: oscillator {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <24576000>;
+       };
+
+       cs2000_in_dummy: dummy-oscillator {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <0>;
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pinctrl_leds_debug>;
+               pinctrl-names = "default";
+
+               debug {
+                       label = "zii:green:debug1";
+                       gpios = <&gpio2 8 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       iio-hwmon {
+               compatible = "iio-hwmon";
+               io-channels = <&adc1 0>, <&adc1 1>, <&adc1 2>, <&adc1 3>,
+                             <&adc2 1>;
+       };
+
+       reg_can1_stby: regulator-can1-stby {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_flexcan1_stby>;
+               regulator-name = "can1-3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_can2_stby: regulator-can2-stby {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_flexcan2_stby>;
+               regulator-name = "can2-3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_vref_1v8: regulator-vref-1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "vref-1v8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "GEN_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v_main: regulator-5p0v-main {
+               compatible = "regulator-fixed";
+               regulator-name = "5V_MAIN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       sound1 {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "Audio Output 1";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sound1_codec>;
+               simple-audio-card,frame-master = <&sound1_codec>;
+               simple-audio-card,widgets =
+                       "Headphone", "Headphone Jack";
+               simple-audio-card,routing =
+                       "Headphone Jack", "HPLEFT",
+                       "Headphone Jack", "HPRIGHT",
+                       "LEFTIN", "HPL",
+                       "RIGHTIN", "HPR";
+               simple-audio-card,aux-devs = <&hpa1>;
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai1>;
+               };
+
+               sound1_codec: simple-audio-card,codec {
+                       sound-dai = <&codec1>;
+                       clocks = <&cs2000>;
+               };
+       };
+
+       sound2 {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "Audio Output 2";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sound2_codec>;
+               simple-audio-card,frame-master = <&sound2_codec>;
+               simple-audio-card,widgets =
+                       "Headphone", "Headphone Jack";
+               simple-audio-card,routing =
+                       "Headphone Jack", "HPLEFT",
+                       "Headphone Jack", "HPRIGHT",
+                       "LEFTIN", "HPL",
+                       "RIGHTIN", "HPR";
+               simple-audio-card,aux-devs = <&hpa2>;
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai2>;
+               };
+
+               sound2_codec: simple-audio-card,codec {
+                       sound-dai = <&codec2>;
+                       clocks = <&cs2000>;
+               };
+       };
+
+       sound3 {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "Audio Output 3";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sound3_codec>;
+               simple-audio-card,frame-master = <&sound3_codec>;
+               simple-audio-card,widgets =
+                       "Headphone", "Headphone Jack";
+               simple-audio-card,routing =
+                       "Headphone Jack", "HPLEFT",
+                       "Headphone Jack", "HPRIGHT",
+                       "LEFTIN", "HPL",
+                       "RIGHTIN", "HPR";
+               simple-audio-card,aux-devs = <&hpa3>;
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai3>;
+               };
+
+               sound3_codec: simple-audio-card,codec {
+                       sound-dai = <&codec3>;
+                       clocks = <&cs2000>;
+               };
+       };
+};
+
+&adc1 {
+       vref-supply = <&reg_vref_1v8>;
+       status = "okay";
+};
+
+&adc2 {
+       vref-supply = <&reg_vref_1v8>;
+       status = "okay";
+};
+
+&cpu0 {
+       arm-supply = <&sw1a_reg>;
+};
+
+&clks {
+       assigned-clocks = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <884736000>;
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio4 19 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <20000000>;
+               reg = <0>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet1>;
+       assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>,
+                         <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+       assigned-clock-rates = <0>, <100000000>;
+       phy-mode = "rgmii";
+       status = "okay";
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+
+       mdio1: mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               status = "okay";
+
+               switch: switch@0 {
+                       compatible = "marvell,mv88e6085";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_switch>;
+                       reg = <0>;
+                       eeprom-length = <512>;
+                       interrupt-parent = <&gpio1>;
+                       interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       label = "eth_cu_1000_1";
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       label = "eth_cu_1000_2";
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       label = "pic";
+
+                                       fixed-link {
+                                               speed = <100>;
+                                               full-duplex;
+                                       };
+                               };
+
+                               port@5 {
+                                       reg = <5>;
+                                       label = "cpu";
+                                       ethernet = <&fec1>;
+                                       phy-mode = "rgmii-id";
+
+                                       fixed-link {
+                                               speed = <1000>;
+                                               full-duplex;
+                                       };
+                               };
+
+                               port@6 {
+                                       reg = <6>;
+                                       label = "gigabit_proc";
+                                       ethernet = <&fec2>;
+                                       phy-mode = "rgmii-id";
+
+                                       fixed-link {
+                                               speed = <1000>;
+                                               full-duplex;
+                                       };
+                               };
+                       };
+               };
+       };
+};
+
+&fec2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet2>;
+       assigned-clocks = <&clks IMX7D_ENET2_TIME_ROOT_SRC>,
+                         <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+       assigned-clock-rates = <0>, <100000000>;
+       phy-mode = "rgmii";
+       fsl,magic-packet;
+       status = "okay";
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+};
+
+&flexcan1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       xceiver-supply = <&reg_can1_stby>;
+       status = "okay";
+};
+
+&flexcan2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan2>;
+       xceiver-supply = <&reg_can2_stby>;
+       status = "okay";
+};
+
+&gpio1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpio1>;
+
+       gpio-line-names = "", "", "", "", "", "", "", "",
+                         "", "",
+                         "usb_1_en_b",
+                         "usb_2_en_b",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "";
+};
+
+&gpio2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpio2>;
+
+       gpio-line-names = "12v_out_en_1",
+                         "12v_out_en_2",
+                         "12v_out_en_3",
+                         "28v_out_en_5",
+                         "28v_out_en_1",
+                         "28v_out_en_2",
+                         "28v_out_en_3",
+                         "28v_out_en_4",
+                         "", "",
+                         "usb_3_en_b",
+                         "usb_4_en_b",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "", "", "", "", "",
+                         "", "", "", "";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic: pmic@8 {
+               compatible = "fsl,pfuze3000";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1a {
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw1c_reg: sw1b {
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1475000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1850000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3 {
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1650000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vldo1 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen2_reg: vldo2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                               regulator-always-on;
+                       };
+
+                       vgen3_reg: vccsd {
+                               regulator-min-microvolt = <2850000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen4_reg: v33 {
+                               regulator-min-microvolt = <2850000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vldo3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vldo4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       cs2000: clkgen@4e {
+               compatible = "cirrus,cs2000-cp";
+               reg = <0x4e>;
+               #clock-cells = <0>;
+               clock-names = "clk_in", "ref_clk";
+               clocks = <&cs2000_in_dummy>, <&cs2000_ref>;
+               assigned-clocks = <&cs2000>;
+               assigned-clock-rates = <24000000>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c04";
+               reg = <0x50>;
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c04";
+               reg = <0x52>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       codec2: codec@18 {
+               compatible = "ti,tlv320dac3100";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_codec2>;
+               reg = <0x18>;
+               #sound-dai-cells = <0>;
+               HPVDD-supply = <&reg_3p3v>;
+               SPRVDD-supply = <&reg_3p3v>;
+               SPLVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&reg_3p3v>;
+               IOVDD-supply = <&reg_3p3v>;
+               DVDD-supply = <&vgen4_reg>;
+               gpio-reset = <&gpio1 6 GPIO_ACTIVE_LOW>;
+       };
+
+       hpa2: amp@60 {
+               compatible = "ti,tpa6130a2";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tpa2>;
+               reg = <0x60>;
+               power-gpio = <&gpio3 27 GPIO_ACTIVE_HIGH>;
+               Vdd-supply = <&reg_5p0v_main>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       codec3: codec@18 {
+               compatible = "ti,tlv320dac3100";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_codec3>;
+               reg = <0x18>;
+               #sound-dai-cells = <0>;
+               HPVDD-supply = <&reg_3p3v>;
+               SPRVDD-supply = <&reg_3p3v>;
+               SPLVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&reg_3p3v>;
+               IOVDD-supply = <&reg_3p3v>;
+               DVDD-supply = <&vgen4_reg>;
+               gpio-reset = <&gpio1 7 GPIO_ACTIVE_LOW>;
+       };
+
+       hpa3: amp@60 {
+               compatible = "ti,tpa6130a2";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tpa3>;
+               reg = <0x60>;
+               power-gpio = <&gpio3 28 GPIO_ACTIVE_HIGH>;
+               Vdd-supply = <&reg_5p0v_main>;
+       };
+};
+
+&i2c4 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c4>;
+       status = "okay";
+
+       codec1: codec@18 {
+               compatible = "ti,tlv320dac3100";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_codec1>;
+               reg = <0x18>;
+               #sound-dai-cells = <0>;
+               HPVDD-supply = <&reg_3p3v>;
+               SPRVDD-supply = <&reg_3p3v>;
+               SPLVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&reg_3p3v>;
+               IOVDD-supply = <&reg_3p3v>;
+               DVDD-supply = <&vgen4_reg>;
+               gpio-reset = <&gpio1 5 GPIO_ACTIVE_LOW>;
+       };
+
+       hpa1: amp@60 {
+               compatible = "ti,tpa6130a2";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tpa1>;
+               reg = <0x60>;
+               power-gpio = <&gpio3 26 GPIO_ACTIVE_HIGH>;
+               Vdd-supply = <&reg_5p0v_main>;
+       };
+};
+
+&sai1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai1>;
+       assigned-clocks = <&clks IMX7D_SAI1_ROOT_SRC>,
+                         <&clks IMX7D_SAI1_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <0>, <36864000>;
+       status = "okay";
+};
+
+&sai2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai2>;
+       assigned-clocks = <&clks IMX7D_SAI2_ROOT_SRC>,
+                         <&clks IMX7D_SAI2_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <0>, <36864000>;
+       status = "okay";
+};
+
+&sai3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai3>;
+       assigned-clocks = <&clks IMX7D_SAI3_ROOT_SRC>,
+                         <&clks IMX7D_SAI3_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
+       assigned-clock-rates = <0>, <36864000>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       assigned-clocks = <&clks IMX7D_UART2_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
+       assigned-clock-parents = <&clks IMX7D_PLL_SYS_MAIN_240M_CLK>;
+       status = "okay";
+
+       rave-sp {
+               compatible = "zii,rave-sp-rdu2";
+               current-speed = <1000000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               watchdog {
+                       compatible = "zii,rave-sp-watchdog";
+               };
+
+               eeprom@a3 {
+                       compatible = "zii,rave-sp-eeprom";
+                       reg = <0xa3 0x4000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       zii,eeprom-name = "main-eeprom";
+               };
+       };
+};
+
+&usbotg1 {
+       dr_mode = "host";
+       disable-over-current;
+       status = "okay";
+};
+
+&usbotg2 {
+       dr_mode = "host";
+       disable-over-current;
+       status = "okay";
+};
+
+&usdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       bus-width = <4>;
+       no-1-8-v;
+       no-sdio;
+       keep-power-in-suspend;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       bus-width = <8>;
+       no-1-8-v;
+       non-removable;
+       no-sdio;
+       no-sd;
+       keep-power-in-suspend;
+       status = "okay";
+};
+
+&wdog1 {
+       status = "disabled";
+};
+
+&snvs_rtc {
+       status = "disabled";
+};
+
+&snvs_pwrkey {
+       status = "disabled";
+};
+
+&iomuxc {
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX7D_PAD_ECSPI1_SCLK__ECSPI1_SCLK       0x2
+                       MX7D_PAD_ECSPI1_MOSI__ECSPI1_MOSI       0x2
+                       MX7D_PAD_ECSPI1_MISO__ECSPI1_MISO       0x2
+                       MX7D_PAD_ECSPI1_SS0__GPIO4_IO19         0x59
+               >;
+       };
+
+       pinctrl_enet1: enet1grp {
+               fsl,pins = <
+                       MX7D_PAD_SD2_CD_B__ENET1_MDIO                           0x3
+                       MX7D_PAD_SD2_WP__ENET1_MDC                              0x3
+                       MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC               0x1
+                       MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0               0x1
+                       MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1               0x1
+                       MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2               0x1
+                       MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3               0x1
+                       MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL         0x1
+                       MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC               0x1
+                       MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0               0x1
+                       MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1               0x1
+                       MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2               0x1
+                       MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3               0x1
+                       MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL         0x1
+               >;
+       };
+
+       pinctrl_enet2: enet2grp {
+               fsl,pins = <
+                       MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC                     0x1
+                       MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0                    0x1
+                       MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1                    0x1
+                       MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2                    0x1
+                       MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3                     0x1
+                       MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL                  0x1
+                       MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC                    0x1
+                       MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0                    0x1
+                       MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1                     0x1
+                       MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2                     0x1
+                       MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3                    0x1
+                       MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL                 0x1
+                       MX7D_PAD_UART1_TX_DATA__ENET2_1588_EVENT0_OUT           0x1
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO12__FLEXCAN1_RX        0x59
+                       MX7D_PAD_GPIO1_IO13__FLEXCAN1_TX        0x59
+               >;
+       };
+
+       pinctrl_flexcan1_stby: flexcan1stbygrp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO08__GPIO1_IO8          0x59
+               >;
+       };
+
+       pinctrl_flexcan2: flexcan2grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO14__FLEXCAN2_RX        0x59
+                       MX7D_PAD_GPIO1_IO15__FLEXCAN2_TX        0x59
+               >;
+       };
+
+       pinctrl_flexcan2_stby: flexcan2stbygrp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO09__GPIO1_IO9          0x59
+               >;
+       };
+
+       pinctrl_gpio1: gpio1grp {
+               fsl,pins = <
+                       MX7D_PAD_GPIO1_IO10__GPIO1_IO10         0x00
+                       MX7D_PAD_GPIO1_IO11__GPIO1_IO11         0x00
+               >;
+       };
+
+       pinctrl_gpio2: gpio2grp {
+               fsl,pins = <
+                       MX7D_PAD_EPDC_DATA00__GPIO2_IO0         0x00
+                       MX7D_PAD_EPDC_DATA01__GPIO2_IO1         0x00
+                       MX7D_PAD_EPDC_DATA02__GPIO2_IO2         0x00
+                       MX7D_PAD_EPDC_DATA03__GPIO2_IO3         0x03
+                       MX7D_PAD_EPDC_DATA04__GPIO2_IO4         0x03
+                       MX7D_PAD_EPDC_DATA05__GPIO2_IO5         0x03
+                       MX7D_PAD_EPDC_DATA06__GPIO2_IO6         0x03
+                       MX7D_PAD_EPDC_DATA07__GPIO2_IO7         0x03
+                       MX7D_PAD_EPDC_DATA10__GPIO2_IO10        0x00
+                       MX7D_PAD_EPDC_DATA11__GPIO2_IO11        0x00
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C1_SDA__I2C1_SDA             0x4000007f
+                       MX7D_PAD_I2C1_SCL__I2C1_SCL             0x4000007f
+               >;
+       };
+
+       pinctrl_i2c1_gpio: i2c1gpiogrp {
+               fsl,pins = <
+                       MX7D_PAD_I2C1_SDA__GPIO4_IO9            0x4000007f
+                       MX7D_PAD_I2C1_SCL__GPIO4_IO8            0x4000007f
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C2_SDA__I2C2_SDA             0x4000007f
+                       MX7D_PAD_I2C2_SCL__I2C2_SCL             0x4000007f
+               >;
+       };
+
+       pinctrl_i2c2_gpio: i2c2gpiogrp {
+               fsl,pins = <
+                       MX7D_PAD_I2C2_SDA__GPIO4_IO11           0x4000007f
+                       MX7D_PAD_I2C2_SCL__GPIO4_IO10           0x4000007f
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C3_SDA__I2C3_SDA             0x4000007f
+                       MX7D_PAD_I2C3_SCL__I2C3_SCL             0x4000007f
+               >;
+       };
+
+       pinctrl_i2c3_gpio: i2c3gpiogrp {
+               fsl,pins = <
+                       MX7D_PAD_I2C3_SDA__GPIO4_IO13           0x4000007f
+                       MX7D_PAD_I2C3_SCL__GPIO4_IO12           0x4000007f
+               >;
+       };
+
+       pinctrl_i2c4: i2c4grp {
+               fsl,pins = <
+                       MX7D_PAD_I2C4_SDA__I2C4_SDA             0x4000007f
+                       MX7D_PAD_I2C4_SCL__I2C4_SCL             0x4000007f
+               >;
+       };
+
+       pinctrl_i2c4_gpio: i2c4gpiogrp {
+               fsl,pins = <
+                       MX7D_PAD_SAI1_RX_BCLK__GPIO6_IO17       0x4000007f
+                       MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16       0x4000007f
+               >;
+       };
+
+       pinctrl_leds_debug: debuggrp {
+               fsl,pins = <
+                       MX7D_PAD_EPDC_DATA08__GPIO2_IO8         0x59
+               >;
+       };
+
+       pinctrl_sai1: sai1grp {
+               fsl,pins = <
+                       MX7D_PAD_SAI1_TX_BCLK__SAI1_TX_BCLK     0x1f
+                       MX7D_PAD_SAI1_TX_SYNC__SAI1_TX_SYNC     0x1f
+                       MX7D_PAD_SAI1_TX_DATA__SAI1_TX_DATA0    0x30
+               >;
+       };
+
+       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
+               >;
+       };
+
+       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_tpa1: tpa6130-1grp {
+               fsl,pins = <
+                       MX7D_PAD_LCD_DATA21__GPIO3_IO26         0x40000038
+               >;
+       };
+
+       pinctrl_tpa2: tpa6130-2grp {
+               fsl,pins = <
+                       MX7D_PAD_LCD_DATA22__GPIO3_IO27         0x40000038
+               >;
+       };
+
+       pinctrl_tpa3: tpa6130-3grp {
+               fsl,pins = <
+                       MX7D_PAD_LCD_DATA23__GPIO3_IO28         0x40000038
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX7D_PAD_UART2_RX_DATA__UART2_DCE_RX    0x79
+                       MX7D_PAD_UART2_TX_DATA__UART2_DCE_TX    0x79
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX7D_PAD_SD2_DATA0__UART4_DCE_RX        0x79
+                       MX7D_PAD_SD2_DATA1__UART4_DCE_TX        0x79
+               >;
+       };
+
+       pinctrl_usdhc1: usdhc1grp {
+               fsl,pins = <
+                       MX7D_PAD_SD1_CMD__SD1_CMD               0x59
+                       MX7D_PAD_SD1_CLK__SD1_CLK               0x19
+                       MX7D_PAD_SD1_DATA0__SD1_DATA0           0x59
+                       MX7D_PAD_SD1_DATA1__SD1_DATA1           0x59
+                       MX7D_PAD_SD1_DATA2__SD1_DATA2           0x59
+                       MX7D_PAD_SD1_DATA3__SD1_DATA3           0x59
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX7D_PAD_SD3_CMD__SD3_CMD               0x59
+                       MX7D_PAD_SD3_CLK__SD3_CLK               0x19
+                       MX7D_PAD_SD3_DATA0__SD3_DATA0           0x59
+                       MX7D_PAD_SD3_DATA1__SD3_DATA1           0x59
+                       MX7D_PAD_SD3_DATA2__SD3_DATA2           0x59
+                       MX7D_PAD_SD3_DATA3__SD3_DATA3           0x59
+                       MX7D_PAD_SD3_DATA4__SD3_DATA4           0x59
+                       MX7D_PAD_SD3_DATA5__SD3_DATA5           0x59
+                       MX7D_PAD_SD3_DATA6__SD3_DATA6           0x59
+                       MX7D_PAD_SD3_DATA7__SD3_DATA7           0x59
+                       MX7D_PAD_SD3_RESET_B__SD3_RESET_B       0x59
+               >;
+       };
+};
+
+&iomuxc_lpsr {
+       pinctrl_codec1: dac1grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO05__GPIO1_IO5     0x40000038
+               >;
+       };
+
+       pinctrl_codec2: dac2grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO06__GPIO1_IO6     0x40000038
+               >;
+       };
+
+       pinctrl_codec3: dac3grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO07__GPIO1_IO7     0x40000038
+               >;
+       };
+
+       pinctrl_switch: switchgrp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO02__GPIO1_IO2     0x08
+               >;
+       };
+};
index 6eb98e7..f33b560 100644 (file)
                ranges = <0x81000000 0 0          0x4ff80000 0 0x00010000   /* downstream I/O */
                          0x82000000 0 0x40000000 0x40000000 0 0x0ff00000>; /* non-prefetchable memory */
                num-lanes = <1>;
+               num-viewport = <4>;
                interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
                interrupt-names = "msi";
                #interrupt-cells = <1>;
diff --git a/arch/arm/boot/dts/imx7s-mba7.dts b/arch/arm/boot/dts/imx7s-mba7.dts
new file mode 100644 (file)
index 0000000..a143d56
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Source for TQ Systems TQMa7S board on MBa7 carrier board.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "imx7s-tqma7.dtsi"
+#include "imx7-mba7.dtsi"
+
+/ {
+       model = "TQ Systems TQMa7S board on MBa7 carrier board";
+       compatible = "tq,imx7s-mba7", "fsl,imx7s";
+};
diff --git a/arch/arm/boot/dts/imx7s-tqma7.dtsi b/arch/arm/boot/dts/imx7s-tqma7.dtsi
new file mode 100644 (file)
index 0000000..5f5433e
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
+/*
+ * Device Tree Include file for TQ Systems TQMa7S board with NXP i.MX7Solo SoC.
+ *
+ * Copyright (C) 2016 TQ Systems GmbH
+ * Author: Markus Niebel <Markus.Niebel@tq-group.com>
+ * Copyright (C) 2019 Bruno Thomsen <bruno.thomsen@gmail.com>
+ */
+
+#include "imx7s.dtsi"
+#include "imx7-tqma7.dtsi"
index 23431fa..d6b4888 100644 (file)
                regulator-always-on;
        };
 
+       reg_peri_3p15v: regulator-peri-3p15v {
+               compatible = "regulator-fixed";
+               regulator-name = "peri_3p15v_reg";
+               regulator-min-microvolt = <3150000>;
+               regulator-max-microvolt = <3150000>;
+               regulator-always-on;
+       };
+
        sound {
                compatible = "simple-audio-card";
                simple-audio-card,name = "imx7-sgtl5000";
        assigned-clock-rates = <884736000>;
 };
 
+&csi {
+       status = "okay";
+};
+
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c1>;
                        swbst_reg: swbst {
                                regulator-min-microvolt = <5000000>;
                                regulator-max-microvolt = <5150000>;
+                               regulator-boot-on;
+                               regulator-always-on;
                        };
 
                        snvs_reg: vsnvs {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
+
+       ov2680: camera@36 {
+               compatible = "ovti,ov2680";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ov2680>;
+               reg = <0x36>;
+               clocks = <&osc>;
+               clock-names = "xvclk";
+               reset-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
+               DOVDD-supply = <&sw2_reg>;
+               DVDD-supply = <&sw2_reg>;
+               AVDD-supply = <&reg_peri_3p15v>;
+
+               port {
+                       ov2680_to_mipi: endpoint {
+                               remote-endpoint = <&mipi_from_sensor>;
+                               clock-lanes = <0>;
+                               data-lanes = <1>;
+                       };
+               };
+       };
 };
 
 &i2c3 {
        };
 };
 
+&mipi_csi {
+       clock-frequency = <166000000>;
+       fsl,csis-hs-settle = <3>;
+       status = "okay";
+
+       port@0 {
+               reg = <0>;
+
+               mipi_from_sensor: endpoint {
+                       remote-endpoint = <&ov2680_to_mipi>;
+                       data-lanes = <1>;
+               };
+
+       };
+};
+
 &sai1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_sai1>;
        status = "okay";
 };
 
+&video_mux {
+       status = "okay";
+};
+
 &wdog1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_wdog>;
                >;
        };
 
+       pinctrl_ov2680: ov2660grp {
+               fsl,pins = <
+                       MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3     0x14
+               >;
+       };
+
        pinctrl_sai1: sai1grp {
                fsl,pins = <
                        MX7D_PAD_SAI1_RX_DATA__SAI1_RX_DATA0    0x1f
index e88f53a..106711d 100644 (file)
@@ -8,6 +8,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/reset/imx7-reset.h>
 #include "imx7d-pinfunc.h"
 
 / {
 
                        gpr: iomuxc-gpr@30340000 {
                                compatible = "fsl,imx7d-iomuxc-gpr",
-                                       "fsl,imx6q-iomuxc-gpr", "syscon";
+                                       "fsl,imx6q-iomuxc-gpr", "syscon",
+                                       "simple-mfd";
                                reg = <0x30340000 0x10000>;
+
+                               mux: mux-controller {
+                                       compatible = "mmio-mux";
+                                       #mux-control-cells = <0>;
+                                       mux-reg-masks = <0x14 0x00000010>;
+                               };
+
+                               video_mux: csi-mux {
+                                       compatible = "video-mux";
+                                       mux-controls = <&mux 0>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       status = "disabled";
+
+                                       port@0 {
+                                               reg = <0>;
+                                       };
+
+                                       port@1 {
+                                               reg = <1>;
+
+                                               csi_mux_from_mipi_vc0: endpoint {
+                                                       remote-endpoint = <&mipi_vc0_to_csi_mux>;
+                                               };
+                                       };
+
+                                       port@2 {
+                                               reg = <2>;
+
+                                               csi_mux_to_csi: endpoint {
+                                                       remote-endpoint = <&csi_from_csi_mux>;
+                                               };
+                                       };
+                               };
                        };
 
                        ocotp: ocotp-ctrl@30350000 {
                                        #address-cells = <1>;
                                        #size-cells = <0>;
 
-                                       pgc_pcie_phy: pgc-power-domain@1 {
+                                       pgc_mipi_phy: power-domain@0 {
+                                               #power-domain-cells = <0>;
+                                               reg = <0>;
+                                               power-supply = <&reg_1p0d>;
+                                       };
+
+                                       pgc_pcie_phy: power-domain@1 {
                                                #power-domain-cells = <0>;
                                                reg = <1>;
                                                power-supply = <&reg_1p0d>;
                                interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX7D_ADC_ROOT_CLK>;
                                clock-names = "adc";
+                               #io-channel-cells = <1>;
                                status = "disabled";
                        };
 
                                interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX7D_ADC_ROOT_CLK>;
                                clock-names = "adc";
+                               #io-channel-cells = <1>;
                                status = "disabled";
                        };
 
                                status = "disabled";
                        };
 
+                       csi: csi@30710000 {
+                               compatible = "fsl,imx7-csi";
+                               reg = <0x30710000 0x10000>;
+                               interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX7D_CLK_DUMMY>,
+                                        <&clks IMX7D_CSI_MCLK_ROOT_CLK>,
+                                        <&clks IMX7D_CLK_DUMMY>;
+                               clock-names = "axi", "mclk", "dcic";
+                               status = "disabled";
+
+                               port {
+                                       csi_from_csi_mux: endpoint {
+                                               remote-endpoint = <&csi_mux_to_csi>;
+                                       };
+                               };
+                       };
+
                        lcdif: lcdif@30730000 {
                                compatible = "fsl,imx7d-lcdif", "fsl,imx28-lcdif";
                                reg = <0x30730000 0x10000>;
                                clock-names = "pix", "axi";
                                status = "disabled";
                        };
+
+                       mipi_csi: mipi-csi@30750000 {
+                               compatible = "fsl,imx7-mipi-csi2";
+                               reg = <0x30750000 0x10000>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clks IMX7D_IPG_ROOT_CLK>,
+                                        <&clks IMX7D_MIPI_CSI_ROOT_CLK>,
+                                        <&clks IMX7D_MIPI_DPHY_ROOT_CLK>;
+                               clock-names = "pclk", "wrap", "phy";
+                               power-domains = <&pgc_mipi_phy>;
+                               phy-supply = <&reg_1p0d>;
+                               resets = <&src IMX7_RESET_MIPI_PHY_MRST>;
+                               reset-names = "mrst";
+                               status = "disabled";
+
+                               port@0 {
+                                       reg = <0>;
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+
+                                       mipi_vc0_to_csi_mux: endpoint {
+                                               remote-endpoint = <&csi_mux_from_mipi_vc0>;
+                                       };
+                               };
+                       };
                };
 
                aips3: aips-bus@30800000 {
                                compatible = "fsl,imx7d-sdma", "fsl,imx35-sdma";
                                reg = <0x30bd0000 0x10000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&clks IMX7D_SDMA_CORE_CLK>,
-                                        <&clks IMX7D_AHB_CHANNEL_ROOT_CLK>;
+                               clocks = <&clks IMX7D_IPG_ROOT_CLK>,
+                                        <&clks IMX7D_SDMA_CORE_CLK>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
index fca6e50..d6b7110 100644 (file)
                        status = "disabled";
                };
 
+               memory-controller@40ab0000 {
+                       compatible = "fsl,imx7ulp-mmdc", "fsl,imx6q-mmdc";
+                       reg = <0x40ab0000 0x1000>;
+                       clocks = <&pcc3 IMX7ULP_CLK_MMDC>;
+               };
+
                iomuxc1: pinctrl@40ac0000 {
                        compatible = "fsl,imx7ulp-iomuxc1";
                        reg = <0x40ac0000 0x1000>;
                        compatible = "fsl,imx7ulp-sim", "syscon";
                        reg = <0x410a3000 0x1000>;
                };
+
+               ocotp: ocotp-ctrl@410a6000 {
+                       compatible = "fsl,imx7ulp-ocotp", "syscon";
+                       reg = <0x410a6000 0x4000>;
+                       clocks = <&scg1 IMX7ULP_CLK_DUMMY>;
+               };
        };
 };
diff --git a/arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts b/arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts
new file mode 100644 (file)
index 0000000..8fcd958
--- /dev/null
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Linksys NSLU2
+ */
+
+/dts-v1/;
+
+#include "intel-ixp42x.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Linksys NSLU2 (Network Storage Link for USB 2.0 Disk Drives)";
+       compatible = "linksys,nslu2", "intel,ixp42x";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       memory@0 {
+               /* 32 MB SDRAM */
+               device_type = "memory";
+               reg = <0x00000000 0x2000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2 rootwait";
+               stdout-path = "uart0:115200n8";
+       };
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               led-status {
+                       label = "nslu2:red:status";
+                       gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+               led-ready {
+                       label = "nslu2:green:ready";
+                       gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+               led-disk-1 {
+                       label = "nslu2:green:disk-1";
+                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+               led-disk-2 {
+                       label = "nslu2:green:disk-2";
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+
+               button-power {
+                       wakeup-source;
+                       linux,code = <KEY_POWER>;
+                       label = "power";
+                       gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
+               };
+               button-reset {
+                       wakeup-source;
+                       linux,code = <KEY_ESC>;
+                       label = "reset";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       i2c {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rtc@6f {
+                       compatible = "xicor,x1205";
+                       reg = <0x6f>;
+               };
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
+               timeout-ms = <5000>;
+       };
+
+       /* The first 16MB region on the expansion bus */
+       flash@50000000 {
+               compatible = "intel,ixp4xx-flash", "cfi-flash";
+               bank-width = <2>;
+               /*
+                * 8 MB of Flash in 0x20000 byte blocks
+                * mapped in at 0x50000000
+                */
+               reg = <0x50000000 0x800000>;
+
+               partitions {
+                       compatible = "redboot-fis";
+                       /* Eraseblock at 0x7e0000 */
+                       fis-index-block = <0x3f>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/intel-ixp42x.dtsi b/arch/arm/boot/dts/intel-ixp42x.dtsi
new file mode 100644 (file)
index 0000000..a9622ca
--- /dev/null
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP 42x series. This series has 32 interrupts.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+       soc {
+               interrupt-controller@c8003000 {
+                       compatible = "intel,ixp42x-interrupt";
+               };
+
+               /*
+                * This is the USB Device Mode (UDC) controller, which is used
+                * to present the IXP4xx as a device on a USB bus.
+                */
+               usb@c800b000 {
+                       compatible = "intel,ixp4xx-udc";
+                       reg = <0xc800b000 0x1000>;
+                       interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts b/arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts
new file mode 100644 (file)
index 0000000..ba1163a
--- /dev/null
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Gateworks IXP43x-based Cambria GW2358
+ */
+
+/dts-v1/;
+
+#include "intel-ixp43x.dtsi"
+
+/ {
+       model = "Gateworks Cambria GW2358";
+       compatible = "gateworks,gw2358", "intel,ixp43x";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       memory@0 {
+               /* 128 MB SDRAM */
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2 rootwait";
+               stdout-path = "uart0:115200n8";
+       };
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               led-user {
+                       label = "gw2358:green:LED";
+                       gpios = <&pld1 0 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+
+       i2c {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               hwmon@28 {
+                       compatible = "adi,ad7418";
+                       reg = <0x28>;
+               };
+               rtc: ds1672@68 {
+                       compatible = "dallas,ds1672";
+                       reg = <0x68>;
+               };
+               eeprom@51 {
+                       compatible = "atmel,24c08";
+                       reg = <0x51>;
+                       pagesize = <16>;
+                       size = <1024>;
+                       read-only;
+               };
+               pld0: pld@56 {
+                       compatible = "gateworks,pld-gpio";
+                       reg = <0x56>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
+               /* This PLD just handles the LED and user button */
+               pld1: pld@57 {
+                       compatible = "gateworks,pld-gpio";
+                       reg = <0x57>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+               };
+       };
+
+       flash@50000000 {
+               compatible = "intel,ixp4xx-flash", "cfi-flash";
+               bank-width = <2>;
+               /*
+                * 32 MB of Flash in 0x20000 byte blocks
+                * mapped in at 0x50000000
+                */
+               reg = <0x50000000 0x2000000>;
+
+               partitions {
+                       compatible = "redboot-fis";
+                       /* Eraseblock at 0x1fe0000 */
+                       fis-index-block = <0xff>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/intel-ixp43x.dtsi b/arch/arm/boot/dts/intel-ixp43x.dtsi
new file mode 100644 (file)
index 0000000..494fb2f
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP 43x series. This series has 64 interrupts and adds a few more
+ * peripherals over the 42x series.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+       soc {
+               interrupt-controller@c8003000 {
+                       compatible = "intel,ixp43x-interrupt";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi b/arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi
new file mode 100644 (file)
index 0000000..f8cd506
--- /dev/null
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP45x and IXP46x series. This series has 64 interrupts and adds a
+ * few more peripherals over the 42x and 43x series so this extends the
+ * basic IXP4xx DTSI.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+       soc {
+               interrupt-controller@c8003000 {
+                       compatible = "intel,ixp43x-interrupt";
+               };
+
+               /*
+                * This is the USB Device Mode (UDC) controller, which is used
+                * to present the IXP4xx as a device on a USB bus.
+                */
+               usb@c800b000 {
+                       compatible = "intel,ixp4xx-udc";
+                       reg = <0xc800b000 0x1000>;
+                       interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
+               i2c@c8011000 {
+                       compatible = "intel,ixp4xx-i2c";
+                       reg = <0xc8011000 0x18>;
+                       interrupts = <33 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/intel-ixp4xx.dtsi b/arch/arm/boot/dts/intel-ixp4xx.dtsi
new file mode 100644 (file)
index 0000000..d4a0958
--- /dev/null
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP 4xx series.
+ */
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               compatible = "simple-bus";
+               interrupt-parent = <&intcon>;
+
+               qmgr: queue-manager@60000000 {
+                       compatible = "intel,ixp4xx-ahb-queue-manager";
+                       reg = <0x60000000 0x4000>;
+                       interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>;
+               };
+
+               uart0: serial@c8000000 {
+                       compatible = "intel,xscale-uart";
+                       reg = <0xc8000000 0x1000>;
+                       /*
+                        * The reg-offset and reg-shift is a side effect
+                        * of running the platform in big endian mode.
+                        */
+                       reg-offset = <3>;
+                       reg-shift = <2>;
+                       interrupts = <15 IRQ_TYPE_LEVEL_HIGH>;
+                       clock-frequency = <14745600>;
+                       no-loopback-test;
+               };
+
+               gpio0: gpio@c8004000 {
+                       compatible = "intel,ixp4xx-gpio";
+                       reg = <0xc8004000 0x1000>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               intcon: interrupt-controller@c8003000 {
+                       /*
+                        * Note: no compatible string. The subvariant of the
+                        * chip needs to define what version it is. The
+                        * location of the interrupt controller is fixed in
+                        * memory across all variants.
+                        */
+                       reg = <0xc8003000 0x100>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+               };
+
+               timer@c8005000 {
+                       compatible = "intel,ixp4xx-timer";
+                       reg = <0xc8005000 0x100>;
+                       interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+               };
+
+               npe@c8006000 {
+                       compatible = "intel,ixp4xx-network-processing-engine";
+                       reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>;
+               };
+       };
+};
index 4990ed9..3e39b9a 100644 (file)
        pinctrl-names = "default";
        pinctrl-0 = <&mmc1_pins>;
        wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;                /* gpio_126 */
-       cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>;              /* gpio_110 */
+       cd-gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;                 /* gpio_110 */
        vmmc-supply = <&vmmc1>;
        bus-width = <4>;
        cap-power-off-card;
index f46a118..4adf4c9 100644 (file)
 &mac {
        phy-mode = "rmii";
        use-iram;
+       status = "okay";
 };
 
 /* Here, choose exactly one from: ohci, usbd */
index ebd1925..1b15f79 100644 (file)
 &mac {
        phy-mode = "rmii";
        use-iram;
+       status = "okay";
 };
 
 /* Here, choose exactly one from: ohci, usbd */
 };
 
 &ssp0 {
-       #address-cells = <1>;
-       #size-cells = <0>;
        num-cs = <1>;
        cs-gpios = <&gpio 3 5 0>;
        status = "okay";
index 20b38f4..7b7ec7b 100644 (file)
@@ -1,14 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * NXP LPC32xx SoC
  *
+ * Copyright (C) 2015-2019 Vladimir Zapolskiy <vz@mleia.com>
  * Copyright 2012 Roland Stigge <stigge@antcom.de>
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
  */
 
 #include <dt-bindings/clock/lpc32xx-clock.h>
                        reg = <0x31060000 0x1000>;
                        interrupts = <29 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clk LPC32XX_CLK_MAC>;
+                       status = "disabled";
                };
 
                emc: memory-controller@31080000 {
                                interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk LPC32XX_CLK_SSP0>;
                                clock-names = "apb_pclk";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                                status = "disabled";
                        };
 
                                compatible = "nxp,lpc3220-spi";
                                reg = <0x20088000 0x1000>;
                                clocks = <&clk LPC32XX_CLK_SPI1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                                status = "disabled";
                        };
 
                                interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk LPC32XX_CLK_SSP1>;
                                clock-names = "apb_pclk";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                                status = "disabled";
                        };
 
                                compatible = "nxp,lpc3220-spi";
                                reg = <0x20090000 0x1000>;
                                clocks = <&clk LPC32XX_CLK_SPI2>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                                status = "disabled";
                        };
 
                        i2s0: i2s@20094000 {
                                compatible = "nxp,lpc3220-i2s";
                                reg = <0x20094000 0x1000>;
+                               status = "disabled";
                        };
 
                        sd: sd@20098000 {
 
                        i2s1: i2s@2009c000 {
                                compatible = "nxp,lpc3220-i2s";
-                               reg = <0x2009C000 0x1000>;
+                               reg = <0x2009c000 0x1000>;
+                               status = "disabled";
                        };
 
                        /* UART5 first since it is the default console, ttyS0 */
 
                        i2c1: i2c@400a0000 {
                                compatible = "nxp,pnx-i2c";
-                               reg = <0x400A0000 0x100>;
+                               reg = <0x400a0000 0x100>;
                                interrupt-parent = <&sic1>;
                                interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
                                #address-cells = <1>;
 
                        i2c2: i2c@400a8000 {
                                compatible = "nxp,pnx-i2c";
-                               reg = <0x400A8000 0x100>;
+                               reg = <0x400a8000 0x100>;
                                interrupt-parent = <&sic1>;
                                interrupts = <18 IRQ_TYPE_LEVEL_LOW>;
                                #address-cells = <1>;
 
                        mpwm: mpwm@400e8000 {
                                compatible = "nxp,lpc3220-motor-pwm";
-                               reg = <0x400E8000 0x78>;
+                               reg = <0x400e8000 0x78>;
                                status = "disabled";
                                #pwm-cells = <2>;
                        };
 
                        timer4: timer@4002c000 {
                                compatible = "nxp,lpc3220-timer";
-                               reg = <0x4002C000 0x1000>;
+                               reg = <0x4002c000 0x1000>;
                                interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
                                clocks = <&clk LPC32XX_CLK_TIMER4>;
                                clock-names = "timerclk";
 
                        watchdog: watchdog@4003c000 {
                                compatible = "nxp,pnx4008-wdt";
-                               reg = <0x4003C000 0x1000>;
+                               reg = <0x4003c000 0x1000>;
                                clocks = <&clk LPC32XX_CLK_WDOG>;
                        };
 
 
                        timer1: timer@4004c000 {
                                compatible = "nxp,lpc3220-timer";
-                               reg = <0x4004C000 0x1000>;
+                               reg = <0x4004c000 0x1000>;
                                interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
                                clocks = <&clk LPC32XX_CLK_TIMER1>;
                                clock-names = "timerclk";
 
                        pwm1: pwm@4005c000 {
                                compatible = "nxp,lpc3220-pwm";
-                               reg = <0x4005C000 0x4>;
+                               reg = <0x4005c000 0x4>;
                                clocks = <&clk LPC32XX_CLK_PWM1>;
                                assigned-clocks = <&clk LPC32XX_CLK_PWM1>;
                                assigned-clock-parents = <&clk LPC32XX_CLK_PERIPH>;
 
                        pwm2: pwm@4005c004 {
                                compatible = "nxp,lpc3220-pwm";
-                               reg = <0x4005C004 0x4>;
+                               reg = <0x4005c004 0x4>;
                                clocks = <&clk LPC32XX_CLK_PWM2>;
                                assigned-clocks = <&clk LPC32XX_CLK_PWM2>;
                                assigned-clock-parents = <&clk LPC32XX_CLK_PERIPH>;
index ba1ddd9..dcb1d9b 100644 (file)
 };
 
 &qspi {
-       fsl,qspi-has-second-chip;
        status = "okay";
 
        flash: flash@0 {
index ca60730..74a6760 100644 (file)
        status = "okay";
 };
 
+&esdhc {
+       status = "okay";
+};
+
 &i2c0 {
        status = "okay";
 
index 97e1fb7..9b1fe99 100644 (file)
 };
 
 &enet0 {
-       tbi-handle = <&tbi1>;
+       tbi-handle = <&tbi0>;
        phy-handle = <&sgmii_phy2>;
        phy-connection-type = "sgmii";
        status = "okay";
        sgmii_phy2: ethernet-phy@2 {
                reg = <0x2>;
        };
+       tbi0: tbi-phy@1f {
+               reg = <0x1f>;
+               device_type = "tbi-phy";
+       };
+};
+
+&mdio1 {
        tbi1: tbi-phy@1f {
                reg = <0x1f>;
                device_type = "tbi-phy";
index b10ff58..464df42 100644 (file)
                        interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "qspi_en", "qspi";
                        clocks = <&clockgen 4 1>, <&clockgen 4 1>;
-                       big-endian;
                        status = "disabled";
                };
 
                };
 
                mdio0: mdio@2d24000 {
-                       compatible = "gianfar";
+                       compatible = "fsl,etsec2-mdio";
                        device_type = "mdio";
                        #address-cells = <1>;
                        #size-cells = <0>;
                              <0x0 0x2d10030 0x0 0x4>;
                };
 
+               mdio1: mdio@2d64000 {
+                       compatible = "fsl,etsec2-mdio";
+                       device_type = "mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x0 0x2d64000 0x0 0x4000>,
+                             <0x0 0x2d50030 0x0 0x4>;
+               };
+
                ptp_clock@2d10e00 {
                        compatible = "fsl,etsec-ptp";
                        reg = <0x0 0x2d10e00 0x0 0xb0>;
index 6f54a88..8841783 100644 (file)
                                #size-cells = <0>;
                                status = "disabled";
                        };
+
+                       rtc: rtc@740 {
+                               compatible = "amlogic,meson6-rtc";
+                               reg = <0x740 0x14>;
+                               interrupts = <GIC_SPI 72 IRQ_TYPE_EDGE_RISING>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               status = "disabled";
+                       };
                };
 
                usb0: usb@c9040000 {
index a978124..7ef4424 100644 (file)
                status = "disabled";
        };
 
+       clock-measure@8758 {
+               compatible = "amlogic,meson8-clk-measure";
+               reg = <0x8758 0x1c>;
+       };
+
        pinctrl_cbus: pinctrl@9880 {
                compatible = "amlogic,meson8-cbus-pinctrl";
                reg = <0x9880 0x10>;
        compatible = "amlogic,meson8-pwm", "amlogic,meson8b-pwm";
 };
 
+&rtc {
+       compatible = "amlogic,meson8-rtc";
+       resets = <&reset RESET_RTC>;
+};
+
 &saradc {
        compatible = "amlogic,meson8-saradc", "amlogic,meson-saradc";
        clocks = <&clkc CLKID_XTAL>,
index 3ca9638..9bf4249 100644 (file)
                };
        };
 
+       rtc32k_xtal: rtc32k-xtal-clk {
+               /* X2 in the schematics */
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               clock-output-names = "RTC32K";
+               #clock-cells = <0>;
+       };
+
        usb_vbus: regulator-usb-vbus {
                /*
                 * Silergy SY6288CCAC-GP 2A Power Distribution Switch.
        clock-names = "clkin0";
 };
 
+&rtc {
+       status = "okay";
+       clocks = <&rtc32k_xtal>;
+       vdd-supply = <&vcc_rtc>;
+};
+
 /* exposed through the pin headers labeled "URDUG1" on the top of the PCB */
 &uart_AO {
        status = "okay";
index 3b0e0f8..f3ad939 100644 (file)
                io-channels = <&saradc 8>;
        };
 
+       rtc32k_xtal: rtc32k-xtal-clk {
+               /* X3 in the schematics */
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               clock-output-names = "RTC32K";
+               #clock-cells = <0>;
+       };
+
        vcc_1v8: regulator-vcc-1v8 {
                /*
                 * RICHTEK RT9179 configured for a fixed output voltage of
        };
 };
 
+&gpio {
+       gpio-line-names = /* Bank GPIOX */
+                         "J2 Header Pin 35", "J2 Header Pin 36",
+                         "J2 Header Pin 32", "J2 Header Pin 31",
+                         "J2 Header Pin 29", "J2 Header Pin 18",
+                         "J2 Header Pin 22", "J2 Header Pin 16",
+                         "J2 Header Pin 23", "J2 Header Pin 21",
+                         "J2 Header Pin 19", "J2 Header Pin 33",
+                         "J2 Header Pin 8", "J2 Header Pin 10",
+                         "J2 Header Pin 15", "J2 Header Pin 13",
+                         "J2 Header Pin 24", "J2 Header Pin 26",
+                         /* Bank GPIOY */
+                         "Revision (upper)", "Revision (lower)",
+                         "J2 Header Pin 7", "", "J2 Header Pin 12",
+                         "J2 Header Pin 11", "", "", "",
+                         "TFLASH_VDD_EN", "", "",
+                         /* Bank GPIODV */
+                         "VCCK_PWM (PWM_C)", "I2CA_SDA", "I2CA_SCL",
+                         "I2CB_SDA", "I2CB_SCL", "VDDEE_PWM (PWM_D)",
+                         "",
+                         /* Bank GPIOH */
+                         "HDMI_HPD", "HDMI_I2C_SDA", "HDMI_I2C_SCL",
+                         "ETH_PHY_INTR", "ETH_PHY_NRST", "ETH_TXD1",
+                         "ETH_TXD0", "ETH_TXD3", "ETH_TXD2",
+                         "ETH_RGMII_TX_CLK",
+                         /* Bank CARD */
+                         "SD_DATA1 (SDB_D1)", "SD_DATA0 (SDB_D0)",
+                         "SD_CLK",  "SD_CMD", "SD_DATA3 (SDB_D3)",
+                         "SD_DATA2 (SDB_D2)", "SD_CDN (SD_DET_N)",
+                         /* Bank BOOT */
+                         "SDC_D0 (EMMC)", "SDC_D1 (EMMC)",
+                         "SDC_D2 (EMMC)", "SDC_D3 (EMMC)",
+                         "SDC_D4 (EMMC)", "SDC_D5 (EMMC)",
+                         "SDC_D6 (EMMC)", "SDC_D7 (EMMC)",
+                         "SDC_CLK (EMMC)", "SDC_RSTn (EMMC)",
+                         "SDC_CMD (EMMC)", "BOOT_SEL", "", "", "",
+                         "", "", "", "",
+                         /* Bank DIF */
+                         "ETH_RXD1", "ETH_RXD0", "ETH_RX_DV",
+                         "RGMII_RX_CLK", "ETH_RXD3", "ETH_RXD2",
+                         "ETH_TXEN", "ETH_PHY_REF_CLK_25MOUT",
+                         "ETH_MDC", "ETH_MDIO";
+};
+
 &gpio_ao {
+       gpio-line-names = "UART TX", "UART RX", "",
+                         "TF_3V3N_1V8_EN", "USB_HUB_RST_N",
+                         "USB_OTG_PWREN", "J7 Header Pin 2",
+                         "IR_IN", "J7 Header Pin 4",
+                         "J7 Header Pin 6", "J7 Header Pin 5",
+                         "J7 Header Pin 7", "HDMI_CEC",
+                         "SYS_LED", "", "";
+
        /*
         * WARNING: The USB Hub on the Odroid-C1/C1+ needs a reset signal
         * to be turned high in order to be detected by the USB Controller.
        clock-names = "clkin0";
 };
 
+&rtc {
+       /* needs to be enabled manually when a battery is connected */
+       clocks = <&rtc32k_xtal>;
+       vdd-supply = <&vdd_rtc>;
+};
+
 &uart_AO {
        status = "okay";
        pinctrl-0 = <&uart_ao_a_pins>;
index fe84a8c..800cd65 100644 (file)
                status = "disabled";
        };
 
+       clock-measure@8758 {
+               compatible = "amlogic,meson8b-clk-measure";
+               reg = <0x8758 0x1c>;
+       };
+
        pinctrl_cbus: pinctrl@9880 {
                compatible = "amlogic,meson8b-cbus-pinctrl";
                reg = <0x9880 0x10>;
        compatible = "amlogic,meson8b-pwm";
 };
 
+&rtc {
+       compatible = "amlogic,meson8b-rtc";
+       resets = <&reset RESET_RTC>;
+};
+
 &saradc {
        compatible = "amlogic,meson8b-saradc", "amlogic,meson-saradc";
        clocks = <&clkc CLKID_XTAL>,
index 4a962a2..eb5291b 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* moxart-uc7112lx.dts - Device Tree file for MOXA UC-7112-LX
  *
  * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index cbf1765..f5f070a 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* moxart.dtsi - Device Tree Include file for MOXA ART family SoC
  *
  * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/interrupt-controller/irq.h>
index 96b9913..09c1dbc 100644 (file)
@@ -48,7 +48,7 @@
                pinctrl-names = "default";
                pinctrl-0 = <&aic33_pins>;
 
-               gpio-reset = <&gpio4 22 GPIO_ACTIVE_LOW>; /* gpio118 */
+               reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; /* gpio118 */
 
                ai3x-gpio-func = <
                        10 /* AIC3X_GPIO1_FUNC_DIGITAL_MIC_MODCLK */
index 826920e..84a5ade 100644 (file)
@@ -1,10 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2013 Pavel Machek <pavel@ucw.cz>
  * Copyright (C) 2013-2014 Aaro Koskinen <aaro.koskinen@iki.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 (or later) as
- * published by the Free Software Foundation.
  */
 
 /dts-v1/;
index 5e81691..a1dacb8 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "omap443x.dtsi"
+#include "omap4-mcpdm.dtsi"
 
 / {
        model = "Gumstix Duovero";
                >;
        };
 
-       mcpdm_pins: pinmux_mcpdm_pins {
-               pinctrl-single,pins = <
-                       OMAP4_IOPAD(0x106, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_ul_data.abe_pdm_ul_data */
-                       OMAP4_IOPAD(0x108, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_dl_data.abe_pdm_dl_data */
-                       OMAP4_IOPAD(0x10a, PIN_INPUT_PULLUP   | MUX_MODE0)      /* abe_pdm_frame.abe_pdm_frame */
-                       OMAP4_IOPAD(0x10c, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_lb_clk.abe_pdm_lb_clk */
-                       OMAP4_IOPAD(0x10e, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_clks.abe_clks */
-               >;
-       };
-
        mcbsp1_pins: pinmux_mcbsp1_pins {
                pinctrl-single,pins = <
                        OMAP4_IOPAD(0x0fe, PIN_INPUT | MUX_MODE0)               /* abe_mcbsp1_clkx.abe_mcbsp1_clkx */
        status = "okay";
 };
 
-&mcpdm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mcpdm_pins>;
-
-       clocks = <&twl6040>;
-       clock-names = "pdmclk";
-
-       status = "okay";
-};
-
 &mmc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc1_pins>;
diff --git a/arch/arm/boot/dts/omap4-l4-abe.dtsi b/arch/arm/boot/dts/omap4-l4-abe.dtsi
new file mode 100644 (file)
index 0000000..67072df
--- /dev/null
@@ -0,0 +1,501 @@
+&l4_abe {                                              /* 0x40100000 */
+       compatible = "ti,omap4-l4-abe", "simple-bus";
+       reg = <0x40100000 0x400>,
+             <0x40100400 0x400>;
+       reg-names = "la", "ap";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
+                <0x49000000 0x49000000 0x100000>;
+       segment@0 {                                     /* 0x40100000 */
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges =
+                        /* CPU to L4 ABE mapping */
+                        <0x00000000 0x00000000 0x000400>,      /* ap 0 */
+                        <0x00000400 0x00000400 0x000400>,      /* ap 1 */
+                        <0x00022000 0x00022000 0x001000>,      /* ap 2 */
+                        <0x00023000 0x00023000 0x001000>,      /* ap 3 */
+                        <0x00024000 0x00024000 0x001000>,      /* ap 4 */
+                        <0x00025000 0x00025000 0x001000>,      /* ap 5 */
+                        <0x00026000 0x00026000 0x001000>,      /* ap 6 */
+                        <0x00027000 0x00027000 0x001000>,      /* ap 7 */
+                        <0x00028000 0x00028000 0x001000>,      /* ap 8 */
+                        <0x00029000 0x00029000 0x001000>,      /* ap 9 */
+                        <0x0002a000 0x0002a000 0x001000>,      /* ap 10 */
+                        <0x0002b000 0x0002b000 0x001000>,      /* ap 11 */
+                        <0x0002e000 0x0002e000 0x001000>,      /* ap 12 */
+                        <0x0002f000 0x0002f000 0x001000>,      /* ap 13 */
+                        <0x00030000 0x00030000 0x001000>,      /* ap 14 */
+                        <0x00031000 0x00031000 0x001000>,      /* ap 15 */
+                        <0x00032000 0x00032000 0x001000>,      /* ap 16 */
+                        <0x00033000 0x00033000 0x001000>,      /* ap 17 */
+                        <0x00038000 0x00038000 0x001000>,      /* ap 18 */
+                        <0x00039000 0x00039000 0x001000>,      /* ap 19 */
+                        <0x0003a000 0x0003a000 0x001000>,      /* ap 20 */
+                        <0x0003b000 0x0003b000 0x001000>,      /* ap 21 */
+                        <0x0003c000 0x0003c000 0x001000>,      /* ap 22 */
+                        <0x0003d000 0x0003d000 0x001000>,      /* ap 23 */
+                        <0x0003e000 0x0003e000 0x001000>,      /* ap 24 */
+                        <0x0003f000 0x0003f000 0x001000>,      /* ap 25 */
+                        <0x00080000 0x00080000 0x010000>,      /* ap 26 */
+                        <0x00080000 0x00080000 0x001000>,      /* ap 27 */
+                        <0x000a0000 0x000a0000 0x010000>,      /* ap 28 */
+                        <0x000a0000 0x000a0000 0x001000>,      /* ap 29 */
+                        <0x000c0000 0x000c0000 0x010000>,      /* ap 30 */
+                        <0x000c0000 0x000c0000 0x001000>,      /* ap 31 */
+                        <0x000f1000 0x000f1000 0x001000>,      /* ap 32 */
+                        <0x000f2000 0x000f2000 0x001000>,      /* ap 33 */
+
+                        /* L3 to L4 ABE mapping */
+                        <0x49000000 0x49000000 0x000400>,      /* ap 0 */
+                        <0x49000400 0x49000400 0x000400>,      /* ap 1 */
+                        <0x49022000 0x49022000 0x001000>,      /* ap 2 */
+                        <0x49023000 0x49023000 0x001000>,      /* ap 3 */
+                        <0x49024000 0x49024000 0x001000>,      /* ap 4 */
+                        <0x49025000 0x49025000 0x001000>,      /* ap 5 */
+                        <0x49026000 0x49026000 0x001000>,      /* ap 6 */
+                        <0x49027000 0x49027000 0x001000>,      /* ap 7 */
+                        <0x49028000 0x49028000 0x001000>,      /* ap 8 */
+                        <0x49029000 0x49029000 0x001000>,      /* ap 9 */
+                        <0x4902a000 0x4902a000 0x001000>,      /* ap 10 */
+                        <0x4902b000 0x4902b000 0x001000>,      /* ap 11 */
+                        <0x4902e000 0x4902e000 0x001000>,      /* ap 12 */
+                        <0x4902f000 0x4902f000 0x001000>,      /* ap 13 */
+                        <0x49030000 0x49030000 0x001000>,      /* ap 14 */
+                        <0x49031000 0x49031000 0x001000>,      /* ap 15 */
+                        <0x49032000 0x49032000 0x001000>,      /* ap 16 */
+                        <0x49033000 0x49033000 0x001000>,      /* ap 17 */
+                        <0x49038000 0x49038000 0x001000>,      /* ap 18 */
+                        <0x49039000 0x49039000 0x001000>,      /* ap 19 */
+                        <0x4903a000 0x4903a000 0x001000>,      /* ap 20 */
+                        <0x4903b000 0x4903b000 0x001000>,      /* ap 21 */
+                        <0x4903c000 0x4903c000 0x001000>,      /* ap 22 */
+                        <0x4903d000 0x4903d000 0x001000>,      /* ap 23 */
+                        <0x4903e000 0x4903e000 0x001000>,      /* ap 24 */
+                        <0x4903f000 0x4903f000 0x001000>,      /* ap 25 */
+                        <0x49080000 0x49080000 0x010000>,      /* ap 26 */
+                        <0x49080000 0x49080000 0x001000>,      /* ap 27 */
+                        <0x490a0000 0x490a0000 0x010000>,      /* ap 28 */
+                        <0x490a0000 0x490a0000 0x001000>,      /* ap 29 */
+                        <0x490c0000 0x490c0000 0x010000>,      /* ap 30 */
+                        <0x490c0000 0x490c0000 0x001000>,      /* ap 31 */
+                        <0x490f1000 0x490f1000 0x001000>,      /* ap 32 */
+                        <0x490f2000 0x490f2000 0x001000>;      /* ap 33 */
+
+               target-module@22000 {                   /* 0x40122000, ap 2 02.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp1";
+                       reg = <0x2208c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_MCBSP1_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x22000 0x1000>,
+                                <0x49022000 0x49022000 0x1000>;
+
+                       mcbsp1: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49022000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 33>,
+                                      <&sdma 34>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@24000 {                   /* 0x40124000, ap 4 04.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp2";
+                       reg = <0x2408c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_MCBSP2_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x24000 0x1000>,
+                                <0x49024000 0x49024000 0x1000>;
+
+                       mcbsp2: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49024000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 17>,
+                                      <&sdma 18>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@26000 {                   /* 0x40126000, ap 6 06.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp3";
+                       reg = <0x2608c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_MCBSP3_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x26000 0x1000>,
+                                <0x49026000 0x49026000 0x1000>;
+
+                       mcbsp3: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49026000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 19>,
+                                      <&sdma 20>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@28000 {                   /* 0x40128000, ap 8 08.0 */
+                       compatible = "ti,sysc-mcasp", "ti,sysc";
+                       ti,hwmods = "mcasp";
+                       reg = <0x28000 0x4>,
+                             <0x28004 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x28000 0x1000>,
+                                <0x49028000 0x49028000 0x1000>;
+
+                       /*
+                        * Child device unsupported by davinci-mcasp. At least
+                        * RX path is disabled for omap4, and only DIT mode
+                        * works with no I2S. See also old Android kernel
+                        * omap-mcasp driver for more information.
+                        */
+               };
+
+               target-module@2a000 {                   /* 0x4012a000, ap 10 0a.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x2a000 0x1000>,
+                                <0x4902a000 0x4902a000 0x1000>;
+               };
+
+               target-module@2e000 {                   /* 0x4012e000, ap 12 0c.0 */
+                       compatible = "ti,sysc-omap4", "ti,sysc";
+                       ti,hwmods = "dmic";
+                       reg = <0x2e000 0x4>,
+                             <0x2e010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_DMIC_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x2e000 0x1000>,
+                                <0x4902e000 0x4902e000 0x1000>;
+
+                       dmic: dmic@0 {
+                               compatible = "ti,omap4-dmic";
+                               reg = <0x0 0x7f>, /* MPU private access */
+                                     <0x4902e000 0x7f>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+                               dmas = <&sdma 67>;
+                               dma-names = "up_link";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@30000 {                   /* 0x40130000, ap 14 0e.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "wd_timer3";
+                       reg = <0x30000 0x4>,
+                             <0x30010 0x4>,
+                             <0x30014 0x4>;
+                       reg-names = "rev", "sysc", "syss";
+                       ti,sysc-mask = <(SYSC_OMAP2_EMUFREE |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       ti,syss-mask = <1>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_WD_TIMER3_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x30000 0x1000>,
+                                <0x49030000 0x49030000 0x1000>;
+
+                       wdt3: wdt@0 {
+                               compatible = "ti,omap4-wdt", "ti,omap3-wdt";
+                               reg = <0x0 0x80>;
+                               interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
+               mcpdm_module: target-module@32000 {     /* 0x40132000, ap 16 10.0 */
+                       compatible = "ti,sysc-omap4", "ti,sysc";
+                       ti,hwmods = "mcpdm";
+                       reg = <0x32000 0x4>,
+                             <0x32010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_MCPDM_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x32000 0x1000>,
+                                <0x49032000 0x49032000 0x1000>;
+
+                       /* Must be only enabled for boards with pdmclk wired */
+                       status = "disabled";
+
+                       mcpdm: mcpdm@0 {
+                               compatible = "ti,omap4-mcpdm";
+                               reg = <0x0 0x7f>, /* MPU private access */
+                                     <0x49032000 0x7f>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                               dmas = <&sdma 65>,
+                                      <&sdma 66>;
+                               dma-names = "up_link", "dn_link";
+                       };
+               };
+
+               target-module@38000 {                   /* 0x40138000, ap 18 12.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer5";
+                       reg = <0x38000 0x4>,
+                             <0x38010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_TIMER5_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x38000 0x1000>,
+                                <0x49038000 0x49038000 0x1000>;
+
+                       timer5: timer@0 {
+                               compatible = "ti,omap4430-timer";
+                               reg = <0x00000000 0x80>,
+                                     <0x49038000 0x80>;
+                               clocks = <&abe_clkctrl OMAP4_TIMER5_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                       };
+               };
+
+               target-module@3a000 {                   /* 0x4013a000, ap 20 14.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer6";
+                       reg = <0x3a000 0x4>,
+                             <0x3a010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_TIMER6_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3a000 0x1000>,
+                                <0x4903a000 0x4903a000 0x1000>;
+
+                       timer6: timer@0 {
+                               compatible = "ti,omap4430-timer";
+                               reg = <0x00000000 0x80>,
+                                     <0x4903a000 0x80>;
+                               clocks = <&abe_clkctrl OMAP4_TIMER6_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                       };
+               };
+
+               target-module@3c000 {                   /* 0x4013c000, ap 22 16.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer7";
+                       reg = <0x3c000 0x4>,
+                             <0x3c010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_TIMER7_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3c000 0x1000>,
+                                <0x4903c000 0x4903c000 0x1000>;
+
+                       timer7: timer@0 {
+                               compatible = "ti,omap4430-timer";
+                               reg = <0x00000000 0x80>,
+                                     <0x4903c000 0x80>;
+                               clocks = <&abe_clkctrl OMAP4_TIMER7_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                       };
+               };
+
+               target-module@3e000 {                   /* 0x4013e000, ap 24 18.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer8";
+                       reg = <0x3e000 0x4>,
+                             <0x3e010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3e000 0x1000>,
+                                <0x4903e000 0x4903e000 0x1000>;
+
+                       timer8: timer@0 {
+                               compatible = "ti,omap4430-timer";
+                               reg = <0x00000000 0x80>,
+                                     <0x4903e000 0x80>;
+                               clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-pwm;
+                               ti,timer-dsp;
+                       };
+               };
+
+               target-module@80000 {                   /* 0x40180000, ap 26 1a.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x80000 0x10000>,
+                                <0x49080000 0x49080000 0x10000>;
+               };
+
+               target-module@a0000 {                   /* 0x401a0000, ap 28 1c.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xa0000 0x10000>,
+                                <0x490a0000 0x490a0000 0x10000>;
+               };
+
+               target-module@c0000 {                   /* 0x401c0000, ap 30 1e.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xc0000 0x10000>,
+                                <0x490c0000 0x490c0000 0x10000>;
+               };
+
+               target-module@f1000 {                   /* 0x401f1000, ap 32 20.0 */
+                       compatible = "ti,sysc-omap4", "ti,sysc";
+                       ti,hwmods = "aess";
+                       reg = <0xf1000 0x4>,
+                             <0xf1010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-midle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): iva, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP4_AESS_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xf1000 0x1000>,
+                                <0x490f1000 0x490f1000 0x1000>;
+
+                       /*
+                        * No child device binding or driver in mainline.
+                        * See Android tree and related upstreaming efforts
+                        * for the old driver.
+                        */
+               };
+       };
+};
+
diff --git a/arch/arm/boot/dts/omap4-mcpdm.dtsi b/arch/arm/boot/dts/omap4-mcpdm.dtsi
new file mode 100644 (file)
index 0000000..915a9b3
--- /dev/null
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Common omap4 mcpdm configuration
+ *
+ * Only include this file if your board has pdmclk wired from the
+ * pmic to ABE as mcpdm uses an external clock for the module.
+ */
+
+&omap4_pmx_core {
+       mcpdm_pins: pinmux_mcpdm_pins {
+               pinctrl-single,pins = <
+               /* 0x4a100106 abe_pdm_ul_data.abe_pdm_ul_data ag25 */
+               OMAP4_IOPAD(0x106, PIN_INPUT_PULLDOWN | MUX_MODE0)
+
+               /* 0x4a100108 abe_pdm_dl_data.abe_pdm_dl_data af25 */
+               OMAP4_IOPAD(0x108, PIN_INPUT_PULLDOWN | MUX_MODE0)
+
+               /* 0x4a10010a abe_pdm_frame.abe_pdm_frame ae25 */
+               OMAP4_IOPAD(0x10a, PIN_INPUT_PULLUP   | MUX_MODE0)
+
+               /* 0x4a10010c abe_pdm_lb_clk.abe_pdm_lb_clk af26 */
+               OMAP4_IOPAD(0x10c, PIN_INPUT_PULLDOWN | MUX_MODE0)
+
+               /* 0x4a10010e abe_clks.abe_clks ah26 */
+               OMAP4_IOPAD(0x10e, PIN_INPUT_PULLDOWN | MUX_MODE0)
+               >;
+       };
+};
+
+&mcpdm_module {
+       /*
+        * McPDM pads must be muxed at the interconnect target module
+        * level as the module on the SoC needs external clock from
+        * the PMIC
+        */
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcpdm_pins>;
+       status = "okay";
+};
+
+&mcpdm {
+       clocks = <&twl6040>;
+       clock-names = "pdmclk";
+};
index 926f018..68e1894 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <dt-bindings/input/input.h>
 #include "elpida_ecb240abacn.dtsi"
+#include "omap4-mcpdm.dtsi"
 
 / {
        memory@80000000 {
                >;
        };
 
-       mcpdm_pins: pinmux_mcpdm_pins {
-               pinctrl-single,pins = <
-                       OMAP4_IOPAD(0x106, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_ul_data.abe_pdm_ul_data */
-                       OMAP4_IOPAD(0x108, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_dl_data.abe_pdm_dl_data */
-                       OMAP4_IOPAD(0x10a, PIN_INPUT_PULLUP   | MUX_MODE0)      /* abe_pdm_frame.abe_pdm_frame */
-                       OMAP4_IOPAD(0x10c, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_lb_clk.abe_pdm_lb_clk */
-                       OMAP4_IOPAD(0x10e, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_clks.abe_clks */
-               >;
-       };
-
        mcbsp1_pins: pinmux_mcbsp1_pins {
                pinctrl-single,pins = <
                        OMAP4_IOPAD(0x0fe, PIN_INPUT | MUX_MODE0)               /* abe_mcbsp1_clkx.abe_mcbsp1_clkx */
        status = "okay";
 };
 
-&mcpdm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mcpdm_pins>;
-
-       clocks = <&twl6040>;
-       clock-names = "pdmclk";
-
-       status = "okay";
-};
-
 &twl_usb_comparator {
        usb-supply = <&vusb>;
 };
index c88817b..fb51a4b 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "omap443x.dtsi"
 #include "elpida_ecb240abacn.dtsi"
+#include "omap4-mcpdm.dtsi"
 
 / {
        model = "TI OMAP4 SDP board";
                >;
        };
 
-       mcpdm_pins: pinmux_mcpdm_pins {
-               pinctrl-single,pins = <
-                       OMAP4_IOPAD(0x106, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_ul_data.abe_pdm_ul_data */
-                       OMAP4_IOPAD(0x108, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_dl_data.abe_pdm_dl_data */
-                       OMAP4_IOPAD(0x10a, PIN_INPUT_PULLUP | MUX_MODE0)        /* abe_pdm_frame.abe_pdm_frame */
-                       OMAP4_IOPAD(0x10c, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_lb_clk.abe_pdm_lb_clk */
-                       OMAP4_IOPAD(0x10e, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_clks.abe_clks */
-               >;
-       };
-
        dmic_pins: pinmux_dmic_pins {
                pinctrl-single,pins = <
                        OMAP4_IOPAD(0x110, PIN_OUTPUT | MUX_MODE0)              /* abe_dmic_clk1.abe_dmic_clk1 */
        status = "okay";
 };
 
-&mcpdm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mcpdm_pins>;
-
-       clocks = <&twl6040>;
-       clock-names = "pdmclk";
-
-       status = "okay";
-};
-
 &twl_usb_comparator {
        usb-supply = <&vusb>;
 };
index 10fce28..9562d37 100644 (file)
@@ -7,6 +7,7 @@
  * published by the Free Software Foundation.
  */
 #include "omap4460.dtsi"
+#include "omap4-mcpdm.dtsi"
 
 / {
        model = "Variscite VAR-SOM-OM44";
                >;
        };
 
-       mcpdm_pins: pinmux_mcpdm_pins {
-               pinctrl-single,pins = <
-                       OMAP4_IOPAD(0x106, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_ul_data.abe_pdm_ul_data */
-                       OMAP4_IOPAD(0x108, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_dl_data.abe_pdm_dl_data */
-                       OMAP4_IOPAD(0x10a, PIN_INPUT_PULLUP | MUX_MODE0)        /* abe_pdm_frame.abe_pdm_frame */
-                       OMAP4_IOPAD(0x10c, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_pdm_lb_clk.abe_pdm_lb_clk */
-                       OMAP4_IOPAD(0x10e, PIN_INPUT_PULLDOWN | MUX_MODE0)      /* abe_clks.abe_clks */
-               >;
-       };
-
        tsc2004_pins: pinmux_tsc2004_pins {
                pinctrl-single,pins = <
                        OMAP4_IOPAD(0x090, PIN_INPUT | MUX_MODE3)               /* gpmc_ncs4.gpio_101 (irq) */
        status = "disabled";
 };
 
-&mcpdm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mcpdm_pins>;
-
-       clocks = <&twl6040>;
-       clock-names = "pdmclk";
-
-       status = "okay";
-};
-
 &gpmc {
        status = "disabled";
 };
index 1a96d43..442a737 100644 (file)
                l4_per: interconnect@48000000 {
                };
 
+               l4_abe: interconnect@40100000 {
+               };
+
                ocmcram: ocmcram@40304000 {
                        compatible = "mmio-sram";
                        reg = <0x40304000 0xa000>; /* 40k */
                        #iommu-cells = <0>;
                        ti,iommu-bus-err-back;
                };
-               target-module@40130000 {
-                       compatible = "ti,sysc-omap2", "ti,sysc";
-                       ti,hwmods = "wd_timer3";
-                       reg = <0x40130000 0x4>,
-                             <0x40130010 0x4>,
-                             <0x40130014 0x4>;
-                       reg-names = "rev", "sysc", "syss";
-                       ti,sysc-mask = <(SYSC_OMAP2_EMUFREE |
-                                        SYSC_OMAP2_SOFTRESET)>;
-                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
-                                       <SYSC_IDLE_NO>,
-                                       <SYSC_IDLE_SMART>,
-                                       <SYSC_IDLE_SMART_WKUP>;
-                       ti,syss-mask = <1>;
-                       /* Domains (V, P, C): abe, abe_pwrdm, abe_clkdm */
-                       clocks = <&abe_clkctrl OMAP4_WD_TIMER3_CLKCTRL 0>;
-                       clock-names = "fck";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges = <0x00000000 0x40130000 0x1000>, /* MPU private access */
-                                <0x49030000 0x49030000 0x0080>; /* L3 Interconnect */
-
-                       wdt3: wdt@0 {
-                               compatible = "ti,omap4-wdt", "ti,omap3-wdt";
-                               reg = <0x0 0x80>;
-                               interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
-                       };
-               };
-
-               mcpdm: mcpdm@40132000 {
-                       compatible = "ti,omap4-mcpdm";
-                       reg = <0x40132000 0x7f>, /* MPU private access */
-                             <0x49032000 0x7f>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "mcpdm";
-                       dmas = <&sdma 65>,
-                              <&sdma 66>;
-                       dma-names = "up_link", "dn_link";
-                       status = "disabled";
-               };
-
-               dmic: dmic@4012e000 {
-                       compatible = "ti,omap4-dmic";
-                       reg = <0x4012e000 0x7f>, /* MPU private access */
-                             <0x4902e000 0x7f>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "dmic";
-                       dmas = <&sdma 67>;
-                       dma-names = "up_link";
-                       status = "disabled";
-               };
-
-               mcbsp1: mcbsp@40122000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40122000 0xff>, /* MPU private access */
-                             <0x49022000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp1";
-                       dmas = <&sdma 33>,
-                              <&sdma 34>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               mcbsp2: mcbsp@40124000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40124000 0xff>, /* MPU private access */
-                             <0x49024000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp2";
-                       dmas = <&sdma 17>,
-                              <&sdma 18>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               mcbsp3: mcbsp@40126000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40126000 0xff>, /* MPU private access */
-                             <0x49026000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp3";
-                       dmas = <&sdma 19>,
-                              <&sdma 20>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               target-module@40128000 {
-                       compatible = "ti,sysc-mcasp", "ti,sysc";
-                       ti,hwmods = "mcasp";
-                       reg = <0x40128000 0x4>,
-                             <0x40128004 0x4>;
-                       reg-names = "rev", "sysc";
-                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
-                                       <SYSC_IDLE_NO>,
-                                       <SYSC_IDLE_SMART>,
-                                       <SYSC_IDLE_SMART_WKUP>;
-                       clocks = <&abe_clkctrl OMAP4_MCASP_CLKCTRL 0>;
-                       clock-names = "fck";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges = <0x00000000 0x40128000 0x1000>, /* MPU */
-                                <0x49028000 0x49028000 0x1000>; /* L3 */
-
-                       /*
-                        * Child device unsupported by davinci-mcasp. At least
-                        * RX path is disabled for omap4, and only DIT mode
-                        * works with no I2S. See also old Android kernel
-                        * omap-mcasp driver for more information.
-                        */
-               };
-
                target-module@4012c000 {
                        compatible = "ti,sysc-omap4", "ti,sysc";
                        ti,hwmods = "slimbus1";
                        /* No child device binding or driver in mainline */
                };
 
-               target-module@401f1000 {
-                       compatible = "ti,sysc-omap4", "ti,sysc";
-                       ti,hwmods = "aess";
-                       reg = <0x401f1000 0x4>,
-                             <0x401f1010 0x4>;
-                       reg-names = "rev", "sysc";
-                       ti,sysc-midle = <SYSC_IDLE_FORCE>,
-                                       <SYSC_IDLE_NO>,
-                                       <SYSC_IDLE_SMART>,
-                                       <SYSC_IDLE_SMART_WKUP>;
-                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
-                                       <SYSC_IDLE_NO>,
-                                       <SYSC_IDLE_SMART>;
-                       clocks = <&abe_clkctrl OMAP4_AESS_CLKCTRL 0>;
-                       clock-names = "fck";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       ranges = <0x00000000 0x401f1000 0x1000>, /* MPU */
-                                <0x490f1000 0x490f1000 0x1000>; /* L3 */
-
-                       /*
-                        * No child device binding or driver in mainline.
-                        * See Android tree and related upstreaming efforts
-                        * for the old driver.
-                        */
-               };
-
                dmm@4e000000 {
                        compatible = "ti,omap4-dmm";
                        reg = <0x4e000000 0x800>;
                        hw-caps-temp-alert;
                };
 
-               timer5: timer@40138000 {
-                       compatible = "ti,omap4430-timer";
-                       reg = <0x40138000 0x80>,
-                             <0x49038000 0x80>;
-                       interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer5";
-                       ti,timer-dsp;
-               };
-
-               timer6: timer@4013a000 {
-                       compatible = "ti,omap4430-timer";
-                       reg = <0x4013a000 0x80>,
-                             <0x4903a000 0x80>;
-                       interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer6";
-                       ti,timer-dsp;
-               };
-
-               timer7: timer@4013c000 {
-                       compatible = "ti,omap4430-timer";
-                       reg = <0x4013c000 0x80>,
-                             <0x4903c000 0x80>;
-                       interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer7";
-                       ti,timer-dsp;
-               };
-
-               timer8: timer@4013e000 {
-                       compatible = "ti,omap4430-timer";
-                       reg = <0x4013e000 0x80>,
-                             <0x4903e000 0x80>;
-                       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer8";
-                       ti,timer-pwm;
-                       ti,timer-dsp;
-               };
-
                aes1: aes@4b501000 {
                        compatible = "ti,omap4-aes";
                        ti,hwmods = "aes1";
 };
 
 #include "omap4-l4.dtsi"
+#include "omap4-l4-abe.dtsi"
 #include "omap44xx-clocks.dtsi"
index 61a06f6..2dc3e19 100644 (file)
        };
 };
 
-&mcpdm {
+&mcpdm_module {
+       /* Module on the SoC needs external clock from the PMIC */
        pinctrl-names = "default";
        pinctrl-0 = <&mcpdm_pins>;
+       status = "okay";
+};
 
+&mcpdm {
        clocks = <&twl6040>;
        clock-names = "pdmclk";
-
-       status = "okay";
 };
 
 &mcbsp1 {
diff --git a/arch/arm/boot/dts/omap5-l4-abe.dtsi b/arch/arm/boot/dts/omap5-l4-abe.dtsi
new file mode 100644 (file)
index 0000000..dc9d053
--- /dev/null
@@ -0,0 +1,447 @@
+&l4_abe {                                              /* 0x40100000 */
+       compatible = "ti,omap5-l4-abe", "simple-bus";
+       reg = <0x40100000 0x400>,
+             <0x40100400 0x400>;
+       reg-names = "la", "ap";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges = <0x00000000 0x40100000 0x100000>,      /* segment 0 */
+                <0x49000000 0x49000000 0x100000>;
+       segment@0 {                                     /* 0x40100000 */
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges =
+                        /* CPU to L4 ABE mapping */
+                        <0x00000000 0x00000000 0x000400>,      /* ap 0 */
+                        <0x00000400 0x00000400 0x000400>,      /* ap 1 */
+                        <0x00022000 0x00022000 0x001000>,      /* ap 2 */
+                        <0x00023000 0x00023000 0x001000>,      /* ap 3 */
+                        <0x00024000 0x00024000 0x001000>,      /* ap 4 */
+                        <0x00025000 0x00025000 0x001000>,      /* ap 5 */
+                        <0x00026000 0x00026000 0x001000>,      /* ap 6 */
+                        <0x00027000 0x00027000 0x001000>,      /* ap 7 */
+                        <0x00028000 0x00028000 0x001000>,      /* ap 8 */
+                        <0x00029000 0x00029000 0x001000>,      /* ap 9 */
+                        <0x0002a000 0x0002a000 0x001000>,      /* ap 10 */
+                        <0x0002b000 0x0002b000 0x001000>,      /* ap 11 */
+                        <0x0002e000 0x0002e000 0x001000>,      /* ap 12 */
+                        <0x0002f000 0x0002f000 0x001000>,      /* ap 13 */
+                        <0x00030000 0x00030000 0x001000>,      /* ap 14 */
+                        <0x00031000 0x00031000 0x001000>,      /* ap 15 */
+                        <0x00032000 0x00032000 0x001000>,      /* ap 16 */
+                        <0x00033000 0x00033000 0x001000>,      /* ap 17 */
+                        <0x00038000 0x00038000 0x001000>,      /* ap 18 */
+                        <0x00039000 0x00039000 0x001000>,      /* ap 19 */
+                        <0x0003a000 0x0003a000 0x001000>,      /* ap 20 */
+                        <0x0003b000 0x0003b000 0x001000>,      /* ap 21 */
+                        <0x0003c000 0x0003c000 0x001000>,      /* ap 22 */
+                        <0x0003d000 0x0003d000 0x001000>,      /* ap 23 */
+                        <0x0003e000 0x0003e000 0x001000>,      /* ap 24 */
+                        <0x0003f000 0x0003f000 0x001000>,      /* ap 25 */
+                        <0x00080000 0x00080000 0x010000>,      /* ap 26 */
+                        <0x00080000 0x00080000 0x001000>,      /* ap 27 */
+                        <0x000a0000 0x000a0000 0x010000>,      /* ap 28 */
+                        <0x000a0000 0x000a0000 0x001000>,      /* ap 29 */
+                        <0x000c0000 0x000c0000 0x010000>,      /* ap 30 */
+                        <0x000c0000 0x000c0000 0x001000>,      /* ap 31 */
+                        <0x000f1000 0x000f1000 0x001000>,      /* ap 32 */
+                        <0x000f2000 0x000f2000 0x001000>,      /* ap 33 */
+
+                        /* L3 to L4 ABE mapping */
+                        <0x49000000 0x49000000 0x000400>,      /* ap 0 */
+                        <0x49000400 0x49000400 0x000400>,      /* ap 1 */
+                        <0x49022000 0x49022000 0x001000>,      /* ap 2 */
+                        <0x49023000 0x49023000 0x001000>,      /* ap 3 */
+                        <0x49024000 0x49024000 0x001000>,      /* ap 4 */
+                        <0x49025000 0x49025000 0x001000>,      /* ap 5 */
+                        <0x49026000 0x49026000 0x001000>,      /* ap 6 */
+                        <0x49027000 0x49027000 0x001000>,      /* ap 7 */
+                        <0x49028000 0x49028000 0x001000>,      /* ap 8 */
+                        <0x49029000 0x49029000 0x001000>,      /* ap 9 */
+                        <0x4902a000 0x4902a000 0x001000>,      /* ap 10 */
+                        <0x4902b000 0x4902b000 0x001000>,      /* ap 11 */
+                        <0x4902e000 0x4902e000 0x001000>,      /* ap 12 */
+                        <0x4902f000 0x4902f000 0x001000>,      /* ap 13 */
+                        <0x49030000 0x49030000 0x001000>,      /* ap 14 */
+                        <0x49031000 0x49031000 0x001000>,      /* ap 15 */
+                        <0x49032000 0x49032000 0x001000>,      /* ap 16 */
+                        <0x49033000 0x49033000 0x001000>,      /* ap 17 */
+                        <0x49038000 0x49038000 0x001000>,      /* ap 18 */
+                        <0x49039000 0x49039000 0x001000>,      /* ap 19 */
+                        <0x4903a000 0x4903a000 0x001000>,      /* ap 20 */
+                        <0x4903b000 0x4903b000 0x001000>,      /* ap 21 */
+                        <0x4903c000 0x4903c000 0x001000>,      /* ap 22 */
+                        <0x4903d000 0x4903d000 0x001000>,      /* ap 23 */
+                        <0x4903e000 0x4903e000 0x001000>,      /* ap 24 */
+                        <0x4903f000 0x4903f000 0x001000>,      /* ap 25 */
+                        <0x49080000 0x49080000 0x010000>,      /* ap 26 */
+                        <0x49080000 0x49080000 0x001000>,      /* ap 27 */
+                        <0x490a0000 0x490a0000 0x010000>,      /* ap 28 */
+                        <0x490a0000 0x490a0000 0x001000>,      /* ap 29 */
+                        <0x490c0000 0x490c0000 0x010000>,      /* ap 30 */
+                        <0x490c0000 0x490c0000 0x001000>,      /* ap 31 */
+                        <0x490f1000 0x490f1000 0x001000>,      /* ap 32 */
+                        <0x490f2000 0x490f2000 0x001000>;      /* ap 33 */
+
+               target-module@22000 {                   /* 0x40122000, ap 2 02.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp1";
+                       reg = <0x2208c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_MCBSP1_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x22000 0x1000>,
+                                <0x49022000 0x49022000 0x1000>;
+
+                       mcbsp1: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49022000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 33>,
+                                      <&sdma 34>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@24000 {                   /* 0x40124000, ap 4 04.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp2";
+                       reg = <0x2408c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_MCBSP2_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x24000 0x1000>,
+                                <0x49024000 0x49024000 0x1000>;
+
+                       mcbsp2: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49024000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 17>,
+                                      <&sdma 18>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@26000 {                   /* 0x40126000, ap 6 06.0 */
+                       compatible = "ti,sysc-omap2", "ti,sysc";
+                       ti,hwmods = "mcbsp3";
+                       reg = <0x2608c 0x4>;
+                       reg-names = "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP2_CLOCKACTIVITY |
+                                        SYSC_OMAP2_ENAWAKEUP |
+                                        SYSC_OMAP2_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_MCBSP3_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x26000 0x1000>,
+                                <0x49026000 0x49026000 0x1000>;
+
+                       mcbsp3: mcbsp@0 {
+                               compatible = "ti,omap4-mcbsp";
+                               reg = <0x0 0xff>, /* MPU private access */
+                                     <0x49026000 0xff>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupt-names = "common";
+                               ti,buffer-size = <128>;
+                               dmas = <&sdma 19>,
+                                      <&sdma 20>;
+                               dma-names = "tx", "rx";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@28000 {                   /* 0x40128000, ap 8 08.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x28000 0x1000>,
+                                <0x49028000 0x49028000 0x1000>;
+               };
+
+               target-module@2a000 {                   /* 0x4012a000, ap 10 0a.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x2a000 0x1000>,
+                                <0x4902a000 0x4902a000 0x1000>;
+               };
+
+               target-module@2e000 {                   /* 0x4012e000, ap 12 0c.0 */
+                       compatible = "ti,sysc-omap4", "ti,sysc";
+                       ti,hwmods = "dmic";
+                       reg = <0x2e000 0x4>,
+                             <0x2e010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_DMIC_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x2e000 0x1000>,
+                                <0x4902e000 0x4902e000 0x1000>;
+
+                       dmic: dmic@0 {
+                               compatible = "ti,omap4-dmic";
+                               reg = <0x0 0x7f>, /* MPU private access */
+                                     <0x4902e000 0x7f>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
+                               dmas = <&sdma 67>;
+                               dma-names = "up_link";
+                               status = "disabled";
+                       };
+               };
+
+               target-module@30000 {                   /* 0x40130000, ap 14 0e.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x30000 0x1000>,
+                                <0x49030000 0x49030000 0x1000>;
+               };
+
+               mcpdm_module: target-module@32000 {     /* 0x40132000, ap 16 10.0 */
+                       compatible = "ti,sysc-omap4", "ti,sysc";
+                       ti,hwmods = "mcpdm";
+                       reg = <0x32000 0x4>,
+                             <0x32010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_MCPDM_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x32000 0x1000>,
+                                <0x49032000 0x49032000 0x1000>;
+
+                       /* Must be only enabled for boards with pdmclk wired */
+                       status = "disabled";
+
+                       mcpdm: mcpdm@0 {
+                               compatible = "ti,omap4-mcpdm";
+                               reg = <0x0 0x7f>, /* MPU private access */
+                                     <0x49032000 0x7f>; /* L3 Interconnect */
+                               reg-names = "mpu", "dma";
+                               interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
+                               dmas = <&sdma 65>,
+                                      <&sdma 66>;
+                               dma-names = "up_link", "dn_link";
+                       };
+               };
+
+               target-module@38000 {                   /* 0x40138000, ap 18 12.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer5";
+                       reg = <0x38000 0x4>,
+                             <0x38010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_TIMER5_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x38000 0x1000>,
+                                <0x49038000 0x49038000 0x1000>;
+
+                       timer5: timer@0 {
+                               compatible = "ti,omap5430-timer";
+                               reg = <0x0 0x80>,
+                                     <0x49038000 0x80>;
+                               clocks = <&abe_clkctrl OMAP5_TIMER5_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                               ti,timer-pwm;
+                       };
+               };
+
+               target-module@3a000 {                   /* 0x4013a000, ap 20 14.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer6";
+                       reg = <0x3a000 0x4>,
+                             <0x3a010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_TIMER6_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3a000 0x1000>,
+                                <0x4903a000 0x4903a000 0x1000>;
+
+                       timer6: timer@0 {
+                               compatible = "ti,omap5430-timer";
+                               reg = <0x0 0x80>,
+                                     <0x4903a000 0x80>;
+                               clocks = <&abe_clkctrl OMAP5_TIMER6_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                               ti,timer-pwm;
+                       };
+               };
+
+               target-module@3c000 {                   /* 0x4013c000, ap 22 16.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer7";
+                       reg = <0x3c000 0x4>,
+                             <0x3c010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_TIMER7_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3c000 0x1000>,
+                                <0x4903c000 0x4903c000 0x1000>;
+
+                       timer7: timer@0 {
+                               compatible = "ti,omap5430-timer";
+                               reg = <0x0 0x80>,
+                                     <0x4903c000 0x80>;
+                               clocks = <&abe_clkctrl OMAP5_TIMER7_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                       };
+               };
+
+               target-module@3e000 {                   /* 0x4013e000, ap 24 18.0 */
+                       compatible = "ti,sysc-omap4-timer", "ti,sysc";
+                       ti,hwmods = "timer8";
+                       reg = <0x3e000 0x4>,
+                             <0x3e010 0x4>;
+                       reg-names = "rev", "sysc";
+                       ti,sysc-mask = <(SYSC_OMAP4_FREEEMU |
+                                        SYSC_OMAP4_SOFTRESET)>;
+                       ti,sysc-sidle = <SYSC_IDLE_FORCE>,
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
+                       /* Domains (V, P, C): core, abe_pwrdm, abe_clkdm */
+                       clocks = <&abe_clkctrl OMAP5_TIMER8_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x3e000 0x1000>,
+                                <0x4903e000 0x4903e000 0x1000>;
+
+                       timer8: timer@0 {
+                               compatible = "ti,omap5430-timer";
+                               reg = <0x0 0x80>,
+                                     <0x4903e000 0x80>;
+                               clocks = <&abe_clkctrl OMAP5_TIMER8_CLKCTRL 24>;
+                               clock-names = "fck";
+                               interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-dsp;
+                               ti,timer-pwm;
+                       };
+               };
+
+               target-module@80000 {                   /* 0x40180000, ap 26 1a.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x80000 0x10000>,
+                                <0x49080000 0x49080000 0x10000>;
+               };
+
+               target-module@a0000 {                   /* 0x401a0000, ap 28 1c.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xa0000 0x10000>,
+                                <0x490a0000 0x490a0000 0x10000>;
+               };
+
+               target-module@c0000 {                   /* 0x401c0000, ap 30 1e.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xc0000 0x10000>,
+                                <0x490c0000 0x490c0000 0x10000>;
+               };
+
+               target-module@f1000 {                   /* 0x401f1000, ap 32 20.0 */
+                       compatible = "ti,sysc";
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0xf1000 0x1000>,
+                                <0x490f1000 0x490f1000 0x1000>;
+               };
+       };
+};
+
index 2fefaaf..4b40e47 100644 (file)
                l4_per: interconnect@48000000 {
                };
 
+               l4_abe: interconnect@40100000 {
+               };
+
                ocmcram: ocmcram@40300000 {
                        compatible = "mmio-sram";
                        reg = <0x40300000 0x20000>; /* 128k */
                        ti,iommu-bus-err-back;
                };
 
-               mcpdm: mcpdm@40132000 {
-                       compatible = "ti,omap4-mcpdm";
-                       reg = <0x40132000 0x7f>, /* MPU private access */
-                             <0x49032000 0x7f>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "mcpdm";
-                       dmas = <&sdma 65>,
-                              <&sdma 66>;
-                       dma-names = "up_link", "dn_link";
-                       status = "disabled";
-               };
-
-               dmic: dmic@4012e000 {
-                       compatible = "ti,omap4-dmic";
-                       reg = <0x4012e000 0x7f>, /* MPU private access */
-                             <0x4902e000 0x7f>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "dmic";
-                       dmas = <&sdma 67>;
-                       dma-names = "up_link";
-                       status = "disabled";
-               };
-
-               mcbsp1: mcbsp@40122000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40122000 0xff>, /* MPU private access */
-                             <0x49022000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp1";
-                       dmas = <&sdma 33>,
-                              <&sdma 34>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               mcbsp2: mcbsp@40124000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40124000 0xff>, /* MPU private access */
-                             <0x49024000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp2";
-                       dmas = <&sdma 17>,
-                              <&sdma 18>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               mcbsp3: mcbsp@40126000 {
-                       compatible = "ti,omap4-mcbsp";
-                       reg = <0x40126000 0xff>, /* MPU private access */
-                             <0x49026000 0xff>; /* L3 Interconnect */
-                       reg-names = "mpu", "dma";
-                       interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-names = "common";
-                       ti,buffer-size = <128>;
-                       ti,hwmods = "mcbsp3";
-                       dmas = <&sdma 19>,
-                              <&sdma 20>;
-                       dma-names = "tx", "rx";
-                       status = "disabled";
-               };
-
-               timer5: timer@40138000 {
-                       compatible = "ti,omap5430-timer";
-                       reg = <0x40138000 0x80>,
-                             <0x49038000 0x80>;
-                       interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer5";
-                       ti,timer-dsp;
-                       ti,timer-pwm;
-               };
-
-               timer6: timer@4013a000 {
-                       compatible = "ti,omap5430-timer";
-                       reg = <0x4013a000 0x80>,
-                             <0x4903a000 0x80>;
-                       interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer6";
-                       ti,timer-dsp;
-                       ti,timer-pwm;
-               };
-
-               timer7: timer@4013c000 {
-                       compatible = "ti,omap5430-timer";
-                       reg = <0x4013c000 0x80>,
-                             <0x4903c000 0x80>;
-                       interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer7";
-                       ti,timer-dsp;
-               };
-
-               timer8: timer@4013e000 {
-                       compatible = "ti,omap5430-timer";
-                       reg = <0x4013e000 0x80>,
-                             <0x4903e000 0x80>;
-                       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
-                       ti,hwmods = "timer8";
-                       ti,timer-dsp;
-                       ti,timer-pwm;
-               };
-
                dmm@4e000000 {
                        compatible = "ti,omap5-dmm";
                        reg = <0x4e000000 0x800>;
 &core_thermal {
        coefficients = <0 2000>;
 };
+
+#include "omap5-l4-abe.dtsi"
+#include "omap54xx-clocks.dtsi"
index ac3250a..7e2fcb2 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wd-mbwe.dtsi - Device tree file for Western Digital My Book World Edition
  *
  * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index 3a26650..9f6c2b6 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ox810se.dtsi - Device tree file for Oxford Semiconductor OX810SE SoC
  *
  * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
- *
- * Licensed under GPLv2 or later
  */
 
 #include <dt-bindings/clock/oxsemi,ox810se.h>
index bfde32e..c3dacec 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * cloudengines-pogoplug-series-3.dtsi - Device tree file for Cloud Engines PogoPlug Series 3
  *
  * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index f323958..c9b3277 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ox820.dtsi - Device tree file for Oxford Semiconductor OX820 SoC
  *
  * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
- *
- * Licensed under GPLv2 or later
  */
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
index 55594b3..7394f76 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFprimaII Evaluation Board
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 /dts-v1/;
index 54d4f88..9c7b46b 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DTS file for CSR SiRFprimaII SoC
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index bd6bf6d..84154c4 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pxa2xx.dtsi - Device Tree Include file for Marvell PXA2xx family SoC
  *
  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "dt-bindings/clock/pxa-clock.h"
index bd6907d..65975df 100644 (file)
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
                                        gpio-controller;
+                                       gpio-ranges = <&pm8921_gpio 0 0 44>;
                                        #gpio-cells = <2>;
 
                                };
                                <0x04700300 0x200>,
                                <0x04700500 0x5c>;
                        reg-names = "dsi_pll", "dsi_phy", "dsi_phy_regulator";
-                       clock-names = "iface_clk";
-                       clocks = <&mmcc DSI_M_AHB_CLK>;
+                       clock-names = "iface_clk", "ref";
+                       clocks = <&mmcc DSI_M_AHB_CLK>,
+                                <&cxo_board>;
                };
 
 
index 9e75f97..1008dfb 100644 (file)
                        #address-cells = <3>;
                        #size-cells = <2>;
 
-                       ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000
-                                 0x82000000 0 0x40300000 0x40300000 0 0x400000>;
+                       ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000>,
+                                <0x82000000 0 0x40300000 0x40300000 0 0x00d00000>;
 
                        interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "msi";
index 02afc6a..356e953 100644 (file)
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
                                        gpio-controller;
+                                       gpio-ranges = <&pmicgpio 0 0 6>;
                                        #gpio-cells = <2>;
                                };
                        };
index 65a994f..ec5cbc4 100644 (file)
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
                                        gpio-controller;
+                                       gpio-ranges = <&pm8058_gpio 0 0 44>;
                                        #gpio-cells = <2>;
 
                                };
index 8f5ea7a..ea1ca16 100644 (file)
@@ -31,6 +31,7 @@
                        compatible = "qcom,pma8084-gpio", "qcom,spmi-gpio";
                        reg = <0xc000>;
                        gpio-controller;
+                       gpio-ranges = <&pma8084_gpios 0 0 22>;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
index 8ee44a1..ff24301 100644 (file)
        };
 
        leds {
-               status = "okay";
                compatible = "gpio-leds";
 
                led0 {
                        gpios = <&port7 1 GPIO_ACTIVE_LOW>;
                };
+
+               led1 {
+                       gpios = <&io_expander1 0 GPIO_ACTIVE_LOW>;
+               };
+
+               led2 {
+                       gpios = <&io_expander1 1 GPIO_ACTIVE_LOW>;
+               };
+
+               led3 {
+                       gpios = <&io_expander1 2 GPIO_ACTIVE_LOW>;
+               };
        };
 };
 
        clock-frequency = <13330000>;
 };
 
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c3_pins>;
+       status = "okay";
+
+       clock-frequency = <400000>;
+
+       io_expander1: gpio@20 {
+               compatible = "onnn,cat9554";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       io_expander2: gpio@21 {
+               compatible = "onnn,cat9554";
+               reg = <0x21>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       eeprom@50 {
+               compatible = "renesas,r1ex24016", "atmel,24c16";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+};
+
 &usb_x1_clk {
        clock-frequency = <48000000>;
 };
 };
 
 &pinctrl {
+       /* RIIC ch3 (Port Expander, EEPROM (MAC Addr), Audio Codec) */
+       i2c3_pins: i2c3 {
+               pinmux = <RZA1_PINMUX(1, 6, 1)>,        /* RIIC3SCL */
+                        <RZA1_PINMUX(1, 7, 1)>;        /* RIIC3SDA */
+       };
 
        /* Serial Console */
        scif2_pins: serial2 {
index d530f45..f70f4a3 100644 (file)
@@ -19,7 +19,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel root=/dev/nfs ip=dhcp rw";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial0:115200n8";
        };
 
 };
 
 &bsc {
+       flash@0 {
+               compatible = "cfi-flash", "mtd-rom";
+               reg = <0x0 0x08000000>;
+               bank-width = <2>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "uboot";
+                               reg = <0x00000000 0x00040000>;
+                               read-only;
+                       };
+                       partition@40000 {
+                               label = "uboot-env";
+                               reg = <0x00040000 0x00040000>;
+                               read-only;
+                       };
+                       partition@80000 {
+                               label = "flash";
+                               reg = <0x00080000 0x07f80000>;
+                       };
+               };
+       };
+
        ethernet@8000000 {
                compatible = "smsc,lan9220", "smsc,lan9115";
                reg = <0x08000000 0x1000>;
index 77d1824..2840eb0 100644 (file)
                stdout-path = "serial1:115200n8";
        };
 
+       hdmi-out {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_con: endpoint {
+                               remote-endpoint = <&bridge_out>;
+                       };
+               };
+       };
+
        memory@40000000 {
                device_type = "memory";
                reg = <0 0x40000000 0 0x20000000>;
        status = "okay";
 };
 
+&du {
+       pinctrl-0 = <&du0_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+
+       ports {
+               port@0 {
+                       endpoint {
+                               remote-endpoint = <&bridge_in>;
+                       };
+               };
+       };
+};
+
+&ehci1 {
+       status = "okay";
+};
+
 &extal_clk {
        clock-frequency = <20000000>;
 };
 
+&gpio2 {
+       interrupt-fixup {
+               gpio-hog;
+               gpios = <29 GPIO_ACTIVE_HIGH>;
+               line-name = "hdmi-hpd-int";
+               input;
+       };
+};
+
+&hsusb0 {
+       status = "okay";
+};
+
 &i2c3 {
        pinctrl-0 = <&i2c3_pins>;
        pinctrl-names = "default";
        };
 };
 
+&i2c4 {
+       pinctrl-0 = <&i2c4_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+       clock-frequency = <100000>;
+
+       hdmi@39 {
+               compatible = "sil,sii9022";
+               reg = <0x39>;
+               interrupt-parent = <&gpio2>;
+               interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+                               bridge_in: endpoint {
+                                       remote-endpoint = <&du_out_rgb0>;
+                               };
+                       };
+
+                       port@1 {
+                               reg = <1>;
+                               bridge_out: endpoint {
+                                       remote-endpoint = <&hdmi_con>;
+                               };
+                       };
+               };
+       };
+};
+
+&ohci1 {
+       status = "okay";
+};
+
 &pfc {
        avb_pins: avb {
                groups = "avb_mdio", "avb_gmii_tx_rx";
                function = "avb";
        };
 
+       du0_pins: du0 {
+               groups = "du0_rgb888", "du0_sync", "du0_disp", "du0_clk0_out";
+               function = "du0";
+       };
+
+       i2c4_pins: i2c4 {
+               groups = "i2c4_e";
+               function = "i2c4";
+       };
+
        i2c3_pins: i2c3 {
                groups = "i2c3_c";
                function = "i2c3";
                function = "sdhi2";
                power-source = <1800>;
        };
+
+       usb0_pins: usb0 {
+               groups = "usb0";
+               function = "usb0";
+       };
+
+       usb1_pins: usb1 {
+               groups = "usb1";
+               function = "usb1";
+       };
 };
 
 &qspi0 {
        sd-uhs-sdr50;
        status = "okay";
 };
+
+&usb2_phy0 {
+       status = "okay";
+};
+
+&usb2_phy1 {
+       status = "okay";
+};
+
+&usbphy0 {
+       pinctrl-0 = <&usb0_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
+
+&usbphy1 {
+       pinctrl-0 = <&usb1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
index f4e232b..56cb10b 100644 (file)
                        status = "disabled";
                };
 
+               hsusb0: hsusb@e6590000 {
+                       compatible = "renesas,usbhs-r8a77470",
+                                    "renesas,rcar-gen2-usbhs";
+                       reg = <0 0xe6590000 0 0x100>;
+                       interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 704>;
+                       dmas = <&usb_dmac00 0>, <&usb_dmac00 1>,
+                              <&usb_dmac10 0>, <&usb_dmac10 1>;
+                       dma-names = "ch0", "ch1", "ch2", "ch3";
+                       renesas,buswait = <4>;
+                       phys = <&usb0 1>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 704>;
+                       status = "disabled";
+               };
+
+               usbphy0: usb-phy@e6590100 {
+                       compatible = "renesas,usb-phy-r8a77470",
+                                    "renesas,rcar-gen2-usb-phy";
+                       reg = <0 0xe6590100 0 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clocks = <&cpg CPG_MOD 704>;
+                       clock-names = "usbhs";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 704>;
+                       status = "disabled";
+
+                       usb0: usb-channel@0 {
+                               reg = <0>;
+                               #phy-cells = <1>;
+                       };
+               };
+
+               hsusb1: hsusb@e6598000 {
+                       compatible = "renesas,usbhs-r8a77470",
+                                    "renesas,rcar-gen2-usbhs";
+                       reg = <0 0xe6598000 0 0x100>;
+                       interrupts = <GIC_SPI 291 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 706>;
+                       dmas = <&usb_dmac01 0>, <&usb_dmac01 1>,
+                              <&usb_dmac11 0>, <&usb_dmac11 1>;
+                       dma-names = "ch0", "ch1", "ch2", "ch3";
+                       renesas,buswait = <4>;
+                       /* We need to turn on usbphy0 to make usbphy1 to work */
+                       phys = <&usb1 1>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 706>;
+                       status = "disabled";
+               };
+
+               usbphy1: usb-phy@e6598100 {
+                       compatible = "renesas,usb-phy-r8a77470",
+                                    "renesas,rcar-gen2-usb-phy";
+                       reg = <0 0xe6598100 0 0x100>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       clocks = <&cpg CPG_MOD 706>;
+                       clock-names = "usbhs";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 706>;
+                       status = "disabled";
+
+                       usb1: usb-channel@0 {
+                               reg = <0>;
+                               #phy-cells = <1>;
+                       };
+               };
+
                usb_dmac00: dma-controller@e65a0000 {
                        compatible = "renesas,r8a77470-usb-dmac",
                                     "renesas,usb-dmac";
                        status = "disabled";
                };
 
+               hscif0: serial@e62c0000 {
+                       compatible = "renesas,hscif-r8a77470",
+                                    "renesas,rcar-gen2-hscif", "renesas,hscif";
+                       reg = <0 0xe62c0000 0 0x60>;
+                       interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 717>,
+                                <&cpg CPG_CORE R8A77470_CLK_ZS>, <&scif_clk>;
+                       clock-names = "fck", "brg_int", "scif_clk";
+                       dmas = <&dmac0 0x39>, <&dmac0 0x3a>,
+                              <&dmac1 0x39>, <&dmac1 0x3a>;
+                       dma-names = "tx", "rx", "tx", "rx";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 717>;
+                       status = "disabled";
+               };
+
+               hscif1: serial@e62c8000 {
+                       compatible = "renesas,hscif-r8a77470",
+                                    "renesas,rcar-gen2-hscif", "renesas,hscif";
+                       reg = <0 0xe62c8000 0 0x60>;
+                       interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 716>,
+                                <&cpg CPG_CORE R8A77470_CLK_ZS>, <&scif_clk>;
+                       clock-names = "fck", "brg_int", "scif_clk";
+                       dmas = <&dmac0 0x4d>, <&dmac0 0x4e>,
+                              <&dmac1 0x4d>, <&dmac1 0x4e>;
+                       dma-names = "tx", "rx", "tx", "rx";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 716>;
+                       status = "disabled";
+               };
+
+               hscif2: serial@e62d0000 {
+                       compatible = "renesas,hscif-r8a77470",
+                                    "renesas,rcar-gen2-hscif", "renesas,hscif";
+                       reg = <0 0xe62d0000 0 0x60>;
+                       interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 713>,
+                                <&cpg CPG_CORE R8A77470_CLK_ZS>, <&scif_clk>;
+                       clock-names = "fck", "brg_int", "scif_clk";
+                       dmas = <&dmac0 0x3b>, <&dmac0 0x3c>,
+                              <&dmac1 0x3b>, <&dmac1 0x3c>;
+                       dma-names = "tx", "rx", "tx", "rx";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 713>;
+                       status = "disabled";
+               };
+
+               pwm0: pwm@e6e30000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e30000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm1: pwm@e6e31000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e31000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm2: pwm@e6e32000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e32000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm3: pwm@e6e33000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e33000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm4: pwm@e6e34000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e34000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm5: pwm@e6e35000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e35000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               pwm6: pwm@e6e36000 {
+                       compatible = "renesas,pwm-r8a77470", "renesas,pwm-rcar";
+                       reg = <0 0xe6e36000 0 0x8>;
+                       clocks = <&cpg CPG_MOD 523>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 523>;
+                       #pwm-cells = <2>;
+                       status = "disabled";
+               };
+
+               vin0: video@e6ef0000 {
+                       compatible = "renesas,vin-r8a77470",
+                                    "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 R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 811>;
+                       status = "disabled";
+               };
+
+               vin1: video@e6ef1000 {
+                       compatible = "renesas,vin-r8a77470",
+                                    "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 R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 810>;
+                       status = "disabled";
+               };
+
+               ohci0: usb@ee080000 {
+                       compatible = "generic-ohci";
+                       reg = <0 0xee080000 0 0x100>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 703>;
+                       phys = <&usb0 0>, <&usb2_phy0>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>;
+                       status = "disabled";
+               };
+
+               ehci0: usb@ee080100 {
+                       compatible = "generic-ehci";
+                       reg = <0 0xee080100 0 0x100>;
+                       interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 703>;
+                       phys = <&usb0 0>, <&usb2_phy0>;
+                       phy-names = "usb";
+                       companion = <&ohci0>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>;
+                       status = "disabled";
+               };
+
+               usb2_phy0: usb-phy@ee080200 {
+                       compatible = "renesas,usb2-phy-r8a77470";
+                       reg = <0 0xee080200 0 0x700>;
+                       clocks = <&cpg CPG_MOD 703>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 703>;
+                       #phy-cells = <0>;
+                       status = "disabled";
+               };
+
+               ohci1: usb@ee0c0000 {
+                       compatible = "generic-ohci";
+                       reg = <0 0xee0c0000 0 0x100>;
+                       interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 705>;
+                       phys = <&usb0 1>, <&usb2_phy1>, <&usb1 0>;
+                       phy-names = "usb";
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 705>;
+                       status = "disabled";
+               };
+
+               ehci1: usb@ee0c0100 {
+                       compatible = "generic-ehci";
+                       reg = <0 0xee0c0100 0 0x100>;
+                       interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 705>;
+                       phys = <&usb0 1>, <&usb2_phy1>, <&usb1 0>;
+                       phy-names = "usb";
+                       companion = <&ohci1>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 705>;
+                       status = "disabled";
+               };
+
+               usb2_phy1: usb-phy@ee0c0200 {
+                       compatible = "renesas,usb2-phy-r8a77470";
+                       reg = <0 0xee0c0200 0 0x700>;
+                       clocks = <&cpg CPG_MOD 705>;
+                       power-domains = <&sysc R8A77470_PD_ALWAYS_ON>;
+                       resets = <&cpg 705>;
+                       #phy-cells = <0>;
+                       status = "disabled";
+               };
+
                sdhi0: sd@ee100000 {
                        compatible = "renesas,sdhi-r8a77470",
                                     "renesas,rcar-gen2-sdhi";
                        resets = <&cpg 408>;
                };
 
+               du: display@feb00000 {
+                       compatible = "renesas,du-r8a77470";
+                       reg = <0 0xfeb00000 0 0x40000>;
+                       interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 724>,
+                                <&cpg CPG_MOD 723>;
+                       clock-names = "du.0", "du.1";
+                       status = "disabled";
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       du_out_rgb0: endpoint {
+                                       };
+                               };
+                               port@1 {
+                                       reg = <1>;
+                                       du_out_rgb1: endpoint {
+                                       };
+                               };
+                               port@2 {
+                                       reg = <2>;
+                                       du_out_lvds0: endpoint {
+                                       };
+                               };
+                       };
+               };
+
                prr: chipid@ff000044 {
                        compatible = "renesas,prr";
                        reg = <0 0xff000044 0 4>;
index cecb229..0b49956 100644 (file)
@@ -25,7 +25,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel ip=dhcp root=/dev/nfs rw";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial0:115200n8";
        };
 
index abc14e7..d4bee1e 100644 (file)
@@ -21,7 +21,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel root=/dev/nfs ip=on";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial0:115200n8";
        };
 
index f923012..b6fa80c 100644 (file)
        };
 };
 
+&iic3 {
+       status = "okay";
+
+       pmic@58 {
+               compatible = "dlg,da9063";
+               reg = <0x58>;
+               interrupt-parent = <&irqc>;
+               interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+
+               rtc {
+                       compatible = "dlg,da9063-rtc";
+               };
+
+               wdt {
+                       compatible = "dlg,da9063-watchdog";
+               };
+       };
+};
+
 &du {
        pinctrl-0 = <&du0_pins &du1_pins>;
        pinctrl-names = "default";
index 8e9eb4b..38fb43d 100644 (file)
@@ -22,6 +22,7 @@
                i2c3 = &i2c3;
                i2c4 = &i2c4;
                i2c5 = &i2c5;
+               i2c6 = &iic3;
                spi0 = &qspi;
                spi1 = &msiof0;
                spi2 = &msiof1;
                        status = "disabled";
                };
 
+               iic3: i2c@e60b0000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "renesas,iic-r8a7792",
+                                    "renesas,rcar-gen2-iic",
+                                    "renesas,rmobile-iic";
+                       reg = <0 0xe60b0000 0 0x425>;
+                       interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 926>;
+                       dmas = <&dmac0 0x77>, <&dmac0 0x78>,
+                              <&dmac1 0x77>, <&dmac1 0x78>;
+                       dma-names = "tx", "rx", "tx", "rx";
+                       power-domains = <&sysc R8A7792_PD_ALWAYS_ON>;
+                       resets = <&cpg 926>;
+                       status = "disabled";
+               };
+
                dmac0: dma-controller@e6700000 {
                        compatible = "renesas,dmac-r8a7792",
                                     "renesas,rcar-dmac";
index ef7e2a8..0ab3d8d 100644 (file)
        };
 };
 
+&pci0 {
+       status = "okay";
+       pinctrl-0 = <&usb0_pins>;
+       pinctrl-names = "default";
+};
+
+&pci1 {
+       status = "okay";
+       pinctrl-0 = <&usb1_pins>;
+       pinctrl-names = "default";
+};
+
+&usbphy {
+       status = "okay";
+};
+
 &du {
        pinctrl-0 = <&du_pins>;
        pinctrl-names = "default";
                function = "sdhi1";
                power-source = <1800>;
        };
+
+       usb0_pins: usb0 {
+               groups = "usb0";
+               function = "usb0";
+       };
+
+       usb1_pins: usb1 {
+               groups = "usb1";
+               function = "usb1";
+       };
 };
 
 &cmt0 {
        pinctrl-names = "i2c-exio4";
 };
 
+&i2c7 {
+       status = "okay";
+       clock-frequency = <100000>;
+
+       pmic@58 {
+               compatible = "dlg,da9063";
+               reg = <0x58>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+
+               rtc {
+                       compatible = "dlg,da9063-rtc";
+               };
+
+               wdt {
+                       compatible = "dlg,da9063-watchdog";
+               };
+       };
+};
+
 &vin0 {
        status = "okay";
        pinctrl-0 = <&vin0_pins>;
index 0173eb1..fb3cf00 100644 (file)
 &pinctrl {
        leds {
                led_ctl: led-ctl {
-                       rockchip,pins = <2 30 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <2 2 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        sdio {
                bt_wake_h: bt-wake-h {
-                       rockchip,pins = <2 8 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        sdmmc {
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <2 28 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sleep {
                global_pwroff: global-pwroff {
-                       rockchip,pins = <2 7 RK_FUNC_1 &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA7 1 &pcfg_pull_none>;
                };
        };
 };
index 59c9086..0290ea4 100644 (file)
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins = <0 1 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA1 2 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
-                               rockchip,pins = <0 1 2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA1 2 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_pin: pwm3-pin {
-                               rockchip,pins = <0 27 1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                sdmmc {
                        sdmmc_clk: sdmmc-clk {
-                               rockchip,pins = <1 16 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC0 1 &pcfg_pull_none>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
-                               rockchip,pins = <1 15 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PB7 1 &pcfg_pull_default>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
-                               rockchip,pins = <1 17 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PC1 1 &pcfg_pull_default>;
                        };
 
                        sdmmc_bus1: sdmmc-bus1 {
-                               rockchip,pins = <1 18 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PC2 1 &pcfg_pull_default>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
-                               rockchip,pins = <1 18 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 19 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 20 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 21 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PC2 1 &pcfg_pull_default>,
+                                               <1 RK_PC3 1 &pcfg_pull_default>,
+                                               <1 RK_PC4 1 &pcfg_pull_default>,
+                                               <1 RK_PC5 1 &pcfg_pull_default>;
                        };
                };
 
                sdio {
                        sdio_bus1: sdio-bus1 {
-                               rockchip,pins = <0 11 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PB3 1 &pcfg_pull_default>;
                        };
 
                        sdio_bus4: sdio-bus4 {
-                               rockchip,pins = <0 11 RK_FUNC_1 &pcfg_pull_default>,
-                                               <0 12 RK_FUNC_1 &pcfg_pull_default>,
-                                               <0 13 RK_FUNC_1 &pcfg_pull_default>,
-                                               <0 14 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PB3 1 &pcfg_pull_default>,
+                                               <0 RK_PB4 1 &pcfg_pull_default>,
+                                               <0 RK_PB5 1 &pcfg_pull_default>,
+                                               <0 RK_PB6 1 &pcfg_pull_default>;
                        };
 
                        sdio_cmd: sdio-cmd {
-                               rockchip,pins = <0 8 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PB0 1 &pcfg_pull_default>;
                        };
 
                        sdio_clk: sdio-clk {
-                               rockchip,pins = <0 9 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB1 1 &pcfg_pull_none>;
                        };
                };
 
                         * We also have external pulls, so disable the internal ones.
                         */
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <2 1 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PA1 2 &pcfg_pull_default>;
                        };
 
                        emmc_bus8: emmc-bus8 {
-                               rockchip,pins = <1 24 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 25 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 26 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 27 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 28 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 29 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 30 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 31 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PD0 2 &pcfg_pull_default>,
+                                               <1 RK_PD1 2 &pcfg_pull_default>,
+                                               <1 RK_PD2 2 &pcfg_pull_default>,
+                                               <1 RK_PD3 2 &pcfg_pull_default>,
+                                               <1 RK_PD4 2 &pcfg_pull_default>,
+                                               <1 RK_PD5 2 &pcfg_pull_default>,
+                                               <1 RK_PD6 2 &pcfg_pull_default>,
+                                               <1 RK_PD7 2 &pcfg_pull_default>;
                        };
                };
 
                emac {
                        emac_xfer: emac-xfer {
-                               rockchip,pins = <2 10 RK_FUNC_1 &pcfg_pull_default>, /* crs_dvalid */
-                                               <2 13 RK_FUNC_1 &pcfg_pull_default>, /* tx_en */
-                                               <2 14 RK_FUNC_1 &pcfg_pull_default>, /* mac_clk */
-                                               <2 15 RK_FUNC_1 &pcfg_pull_default>, /* rx_err */
-                                               <2 16 RK_FUNC_1 &pcfg_pull_default>, /* rxd1 */
-                                               <2 17 RK_FUNC_1 &pcfg_pull_default>, /* rxd0 */
-                                               <2 18 RK_FUNC_1 &pcfg_pull_default>, /* txd1 */
-                                               <2 19 RK_FUNC_1 &pcfg_pull_default>; /* txd0 */
+                               rockchip,pins = <2 RK_PB2 1 &pcfg_pull_default>, /* crs_dvalid */
+                                               <2 RK_PB5 1 &pcfg_pull_default>, /* tx_en */
+                                               <2 RK_PB6 1 &pcfg_pull_default>, /* mac_clk */
+                                               <2 RK_PB7 1 &pcfg_pull_default>, /* rx_err */
+                                               <2 RK_PC0 1 &pcfg_pull_default>, /* rxd1 */
+                                               <2 RK_PC1 1 &pcfg_pull_default>, /* rxd0 */
+                                               <2 RK_PC2 1 &pcfg_pull_default>, /* txd1 */
+                                               <2 RK_PC3 1 &pcfg_pull_default>; /* txd0 */
                        };
 
                        emac_mdio: emac-mdio {
-                               rockchip,pins = <2 12 RK_FUNC_1 &pcfg_pull_default>, /* mac_md */
-                                               <2 25 RK_FUNC_1 &pcfg_pull_default>; /* mac_mdclk */
+                               rockchip,pins = <2 RK_PB4 1 &pcfg_pull_default>, /* mac_md */
+                                               <2 RK_PD1 1 &pcfg_pull_default>; /* mac_mdclk */
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 1 &pcfg_pull_none>,
+                                               <0 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <0 2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA2 1 &pcfg_pull_none>,
+                                               <0 RK_PA3 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <2 20 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC4 1 &pcfg_pull_none>,
+                                               <2 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                i2s {
                        i2s_bus: i2s-bus {
-                               rockchip,pins = <1 0 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 1 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 2 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 3 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 4 RK_FUNC_1 &pcfg_pull_default>,
-                                               <1 5 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA0 1 &pcfg_pull_default>,
+                                               <1 RK_PA1 1 &pcfg_pull_default>,
+                                               <1 RK_PA2 1 &pcfg_pull_default>,
+                                               <1 RK_PA3 1 &pcfg_pull_default>,
+                                               <1 RK_PA4 1 &pcfg_pull_default>,
+                                               <1 RK_PA5 1 &pcfg_pull_default>;
                        };
                };
 
                hdmi {
                        hdmi_ctl: hdmi-ctl {
-                               rockchip,pins = <1 8  RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 9  RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 10 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB0  1 &pcfg_pull_none>,
+                                               <1 RK_PB1  1 &pcfg_pull_none>,
+                                               <1 RK_PB2 1 &pcfg_pull_none>,
+                                               <1 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <0 16 RK_FUNC_1 &pcfg_pull_default>,
-                                               <0 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC0 1 &pcfg_pull_default>,
+                                               <0 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <0 18 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PC2 1 &pcfg_pull_default>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <0 19 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <2 22 RK_FUNC_1 &pcfg_pull_default>,
-                                               <2 23 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC6 1 &pcfg_pull_default>,
+                                               <2 RK_PC7 1 &pcfg_pull_none>;
                        };
                        /* no rts / cts for uart1 */
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_default>,
-                                               <1 19 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC2 2 &pcfg_pull_default>,
+                                               <1 RK_PC3 2 &pcfg_pull_none>;
                        };
                        /* no rts / cts for uart2 */
                };
 
                spi-pins {
                        spi_txd:spi-txd {
-                               rockchip,pins = <1 29 RK_FUNC_3 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PD5 3 &pcfg_pull_default>;
                        };
 
                        spi_rxd:spi-rxd {
-                               rockchip,pins = <1 28 RK_FUNC_3 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PD4 3 &pcfg_pull_default>;
                        };
 
                        spi_clk:spi-clk {
-                               rockchip,pins = <2 0 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PA0 2 &pcfg_pull_default>;
                        };
 
                        spi_cs0:spi-cs0 {
-                               rockchip,pins = <1 30 RK_FUNC_3 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PD6 3 &pcfg_pull_default>;
 
                        };
 
                        spi_cs1:spi-cs1 {
-                               rockchip,pins = <1 31 RK_FUNC_3 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PD7 3 &pcfg_pull_default>;
 
                        };
                };
index ce525b9..7e01f64 100644 (file)
 &pinctrl {
        lan8720a {
                phy_int: phy-int {
-                       rockchip,pins = <RK_GPIO1 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 9d2216d..365eff6 100644 (file)
                };
        };
 
+       hdmi_con {
+               compatible = "hdmi-connector";
+               type = "c";
+
+               port {
+                       hdmi_con_in: endpoint {
+                               remote-endpoint = <&hdmi_out_con>;
+                       };
+               };
+       };
+
        vcc_io: vcc-io {
                compatible = "regulator-fixed";
                regulator-name = "vcc_io";
        };
 };
 
+&hdmi {
+       status = "okay";
+};
+
+&hdmi_in_vop1 {
+       status = "disabled";
+};
+
+&hdmi_out {
+       hdmi_out_con: endpoint {
+               remote-endpoint = <&hdmi_con_in>;
+       };
+};
+
 &mmc0 {
        bus-width = <4>;
        cap-mmc-highspeed;
 &pinctrl {
        usb-host {
                host_drv: host-drv {
-                       rockchip,pins = <RK_GPIO0 6 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        usb-otg {
                otg_drv: otg-drv {
-                       rockchip,pins = <RK_GPIO0 5 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        sdmmc {
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <RK_GPIO3 7 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        sdio {
                wifi_pwr: wifi-pwr {
-                       rockchip,pins = <RK_GPIO3 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
        status = "okay";
 };
 
+&vop0 {
+       status = "okay";
+};
+
 &wdt {
        status = "okay";
 };
index 949fa80..f9db6bb 100644 (file)
 
        ak8963 {
                comp_int: comp-int {
-                       rockchip,pins = <4 17 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <4 RK_PC1 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        emac {
                rmii_rst: rmii-rst {
-                       rockchip,pins = <1 30 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <1 RK_PD6 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <6 1 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <6 RK_PA1 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <6 2 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <6 RK_PA2 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        mma8452 {
                gsensor_int: gsensor-int {
-                       rockchip,pins = <4 16 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <4 RK_PC0 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        mmc {
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <3 7 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        usb_host {
                host_drv: host-drv {
-                       rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_default>;
                };
 
                hub_rst: hub-rst {
-                       rockchip,pins = <1 31 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <1 RK_PD7 RK_FUNC_GPIO &pcfg_output_high>;
                };
 
                sata_pwr: sata-pwr {
-                       rockchip,pins = <4 22 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <4 RK_PC6 RK_FUNC_GPIO &pcfg_pull_default>;
                };
 
                sata_reset: sata-reset {
-                       rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        usb_otg {
                otg_drv: otg-drv {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_default>;
                };
        };
 
        tps {
                pmic_int: pmic-int {
-                       rockchip,pins = <6 4 RK_FUNC_GPIO &pcfg_pull_default>;
+                       rockchip,pins = <6 RK_PA4 RK_FUNC_GPIO &pcfg_pull_default>;
                };
 
                pwr_hold: pwr-hold {
-                       rockchip,pins = <6 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <6 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 };
index 653127a..3d1b02f 100644 (file)
                vop0_out: port {
                        #address-cells = <1>;
                        #size-cells = <0>;
+
+                       vop0_out_hdmi: endpoint@0 {
+                               reg = <0>;
+                               remote-endpoint = <&hdmi_in_vop0>;
+                       };
                };
        };
 
                vop1_out: port {
                        #address-cells = <1>;
                        #size-cells = <0>;
+
+                       vop1_out_hdmi: endpoint@0 {
+                               reg = <0>;
+                               remote-endpoint = <&hdmi_in_vop1>;
+                       };
+               };
+       };
+
+       hdmi: hdmi@10116000 {
+               compatible = "rockchip,rk3066-hdmi";
+               reg = <0x10116000 0x2000>;
+               interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru HCLK_HDMI>;
+               clock-names = "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>;
+               power-domains = <&power RK3066_PD_VIO>;
+               rockchip,grf = <&grf>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               hdmi_in_vop0: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&vop0_out_hdmi>;
+                               };
+
+                               hdmi_in_vop1: endpoint@1 {
+                                       reg = <1>;
+                                       remote-endpoint = <&vop1_out_hdmi>;
+                               };
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                       };
                };
        };
 
 
                emac {
                        emac_xfer: emac-xfer {
-                               rockchip,pins = <RK_GPIO1 16 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */
-                                               <RK_GPIO1 17 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */
-                                               <RK_GPIO1 18 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */
-                                               <RK_GPIO1 19 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */
-                                               <RK_GPIO1 20 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */
-                                               <RK_GPIO1 21 RK_FUNC_2 &pcfg_pull_none>, /* crs_dvalid */
-                                               <RK_GPIO1 22 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */
-                                               <RK_GPIO1 23 RK_FUNC_2 &pcfg_pull_none>; /* rxd0 */
+                               rockchip,pins = <1 RK_PC0 2 &pcfg_pull_none>, /* mac_clk */
+                                               <1 RK_PC1 2 &pcfg_pull_none>, /* tx_en */
+                                               <1 RK_PC2 2 &pcfg_pull_none>, /* txd1 */
+                                               <1 RK_PC3 2 &pcfg_pull_none>, /* txd0 */
+                                               <1 RK_PC4 2 &pcfg_pull_none>, /* rx_err */
+                                               <1 RK_PC5 2 &pcfg_pull_none>, /* crs_dvalid */
+                                               <1 RK_PC6 2 &pcfg_pull_none>, /* rxd1 */
+                                               <1 RK_PC7 2 &pcfg_pull_none>; /* rxd0 */
                        };
 
                        emac_mdio: emac-mdio {
-                               rockchip,pins = <RK_GPIO1 24 RK_FUNC_2 &pcfg_pull_none>, /* mac_md */
-                                               <RK_GPIO1 25 RK_FUNC_2 &pcfg_pull_none>; /* mac_mdclk */
+                               rockchip,pins = <1 RK_PD0 2 &pcfg_pull_none>, /* mac_md */
+                                               <1 RK_PD1 2 &pcfg_pull_none>; /* mac_mdclk */
                        };
                };
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <RK_GPIO3 31 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PD7 2 &pcfg_pull_default>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <RK_GPIO4 9 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <4 RK_PB1 2 &pcfg_pull_default>;
                        };
 
                        emmc_rst: emmc-rst {
-                               rockchip,pins = <RK_GPIO4 10 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <4 RK_PB2 2 &pcfg_pull_default>;
                        };
 
                        /*
                         */
                };
 
+               hdmi {
+                       hdmi_hpd: hdmi-hpd {
+                               rockchip,pins = <0 RK_PA0 1 &pcfg_pull_default>;
+                       };
+
+                       hdmii2c_xfer: hdmii2c-xfer {
+                               rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>,
+                                               <0 RK_PA2 1 &pcfg_pull_none>;
+                       };
+               };
+
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <RK_GPIO2 28 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO2 29 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD4 1 &pcfg_pull_none>,
+                                               <2 RK_PD5 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <RK_GPIO2 30 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO2 31 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD6 1 &pcfg_pull_none>,
+                                               <2 RK_PD7 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <RK_GPIO3 0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA0 1 &pcfg_pull_none>,
+                                               <3 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <RK_GPIO3 2 RK_FUNC_2 &pcfg_pull_none>,
-                                               <RK_GPIO3 3 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA2 2 &pcfg_pull_none>,
+                                               <3 RK_PA3 2 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
-                               rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA4 1 &pcfg_pull_none>,
+                                               <3 RK_PA5 1 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_out: pwm0-out {
-                               rockchip,pins = <RK_GPIO0 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA3 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_out: pwm1-out {
-                               rockchip,pins = <RK_GPIO0 4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA4 1 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_out: pwm2-out {
-                               rockchip,pins = <RK_GPIO0 30 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD6 1 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_out: pwm3-out {
-                               rockchip,pins = <RK_GPIO0 31 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD7 1 &pcfg_pull_none>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
-                               rockchip,pins = <RK_GPIO1 5 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA5 2 &pcfg_pull_default>;
                        };
                        spi0_cs0: spi0-cs0 {
-                               rockchip,pins = <RK_GPIO1 4 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA4 2 &pcfg_pull_default>;
                        };
                        spi0_tx: spi0-tx {
-                               rockchip,pins = <RK_GPIO1 7 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA7 2 &pcfg_pull_default>;
                        };
                        spi0_rx: spi0-rx {
-                               rockchip,pins = <RK_GPIO1 6 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA6 2 &pcfg_pull_default>;
                        };
                        spi0_cs1: spi0-cs1 {
-                               rockchip,pins = <RK_GPIO4 15 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <4 RK_PB7 1 &pcfg_pull_default>;
                        };
                };
 
                spi1 {
                        spi1_clk: spi1-clk {
-                               rockchip,pins = <RK_GPIO2 19 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PC3 2 &pcfg_pull_default>;
                        };
                        spi1_cs0: spi1-cs0 {
-                               rockchip,pins = <RK_GPIO2 20 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PC4 2 &pcfg_pull_default>;
                        };
                        spi1_rx: spi1-rx {
-                               rockchip,pins = <RK_GPIO2 22 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PC6 2 &pcfg_pull_default>;
                        };
                        spi1_tx: spi1-tx {
-                               rockchip,pins = <RK_GPIO2 21 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PC5 2 &pcfg_pull_default>;
                        };
                        spi1_cs1: spi1-cs1 {
-                               rockchip,pins = <RK_GPIO2 23 RK_FUNC_2 &pcfg_pull_default>;
+                               rockchip,pins = <2 RK_PC7 2 &pcfg_pull_default>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA0 1 &pcfg_pull_default>,
+                                               <1 RK_PA1 1 &pcfg_pull_default>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA2 1 &pcfg_pull_default>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA3 1 &pcfg_pull_default>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA4 1 &pcfg_pull_default>,
+                                               <1 RK_PA5 1 &pcfg_pull_default>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA6 1 &pcfg_pull_default>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PA7 1 &pcfg_pull_default>;
                        };
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <1 RK_PB0 1 &pcfg_pull_default>,
+                                               <1 RK_PB1 1 &pcfg_pull_default>;
                        };
                        /* no rts / cts for uart2 */
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
-                               rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PD3 1 &pcfg_pull_default>,
+                                               <3 RK_PD4 1 &pcfg_pull_default>;
                        };
 
                        uart3_cts: uart3-cts {
-                               rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PD5 1 &pcfg_pull_default>;
                        };
 
                        uart3_rts: uart3-rts {
-                               rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PD6 1 &pcfg_pull_default>;
                        };
                };
 
                sd0 {
                        sd0_clk: sd0-clk {
-                               rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB0 1 &pcfg_pull_default>;
                        };
 
                        sd0_cmd: sd0-cmd {
-                               rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB1 1 &pcfg_pull_default>;
                        };
 
                        sd0_cd: sd0-cd {
-                               rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB6 1 &pcfg_pull_default>;
                        };
 
                        sd0_wp: sd0-wp {
-                               rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB7 1 &pcfg_pull_default>;
                        };
 
                        sd0_bus1: sd0-bus-width1 {
-                               rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB2 1 &pcfg_pull_default>;
                        };
 
                        sd0_bus4: sd0-bus-width4 {
-                               rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PB2 1 &pcfg_pull_default>,
+                                               <3 RK_PB3 1 &pcfg_pull_default>,
+                                               <3 RK_PB4 1 &pcfg_pull_default>,
+                                               <3 RK_PB5 1 &pcfg_pull_default>;
                        };
                };
 
                sd1 {
                        sd1_clk: sd1-clk {
-                               rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC5 1 &pcfg_pull_default>;
                        };
 
                        sd1_cmd: sd1-cmd {
-                               rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC0 1 &pcfg_pull_default>;
                        };
 
                        sd1_cd: sd1-cd {
-                               rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC6 1 &pcfg_pull_default>;
                        };
 
                        sd1_wp: sd1-wp {
-                               rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC7 1 &pcfg_pull_default>;
                        };
 
                        sd1_bus1: sd1-bus-width1 {
-                               rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC1 1 &pcfg_pull_default>;
                        };
 
                        sd1_bus4: sd1-bus-width4 {
-                               rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <3 RK_PC1 1 &pcfg_pull_default>,
+                                               <3 RK_PC2 1 &pcfg_pull_default>,
+                                               <3 RK_PC3 1 &pcfg_pull_default>,
+                                               <3 RK_PC4 1 &pcfg_pull_default>;
                        };
                };
 
                i2s0 {
                        i2s0_bus: i2s0-bus {
-                               rockchip,pins = <RK_GPIO0 7 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 8 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 9 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 10 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 11 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 12 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 13 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 14 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 15 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PA7 1 &pcfg_pull_default>,
+                                               <0 RK_PB0 1 &pcfg_pull_default>,
+                                               <0 RK_PB1 1 &pcfg_pull_default>,
+                                               <0 RK_PB2 1 &pcfg_pull_default>,
+                                               <0 RK_PB3 1 &pcfg_pull_default>,
+                                               <0 RK_PB4 1 &pcfg_pull_default>,
+                                               <0 RK_PB5 1 &pcfg_pull_default>,
+                                               <0 RK_PB6 1 &pcfg_pull_default>,
+                                               <0 RK_PB7 1 &pcfg_pull_default>;
                        };
                };
 
                i2s1 {
                        i2s1_bus: i2s1-bus {
-                               rockchip,pins = <RK_GPIO0 16 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 17 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 18 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 19 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 20 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 21 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PC0 1 &pcfg_pull_default>,
+                                               <0 RK_PC1 1 &pcfg_pull_default>,
+                                               <0 RK_PC2 1 &pcfg_pull_default>,
+                                               <0 RK_PC3 1 &pcfg_pull_default>,
+                                               <0 RK_PC4 1 &pcfg_pull_default>,
+                                               <0 RK_PC5 1 &pcfg_pull_default>;
                        };
                };
 
                i2s2 {
                        i2s2_bus: i2s2-bus {
-                               rockchip,pins = <RK_GPIO0 24 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 25 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 26 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 27 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 28 RK_FUNC_1 &pcfg_pull_default>,
-                                               <RK_GPIO0 29 RK_FUNC_1 &pcfg_pull_default>;
+                               rockchip,pins = <0 RK_PD0 1 &pcfg_pull_default>,
+                                               <0 RK_PD1 1 &pcfg_pull_default>,
+                                               <0 RK_PD2 1 &pcfg_pull_default>,
+                                               <0 RK_PD3 1 &pcfg_pull_default>,
+                                               <0 RK_PD4 1 &pcfg_pull_default>,
+                                               <0 RK_PD5 1 &pcfg_pull_default>;
                        };
                };
        };
index c0eaa9c..c32e1d4 100644 (file)
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <2 31 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 94bc81c..c9a7f54 100644 (file)
 
        act8846 {
                act8846_dvs0_ctl: act8846-dvs0-ctl {
-                       rockchip,pins = <RK_GPIO3 27 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <3 RK_PD3 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        hym8563 {
                rtc_int: rtc-int {
-                       rockchip,pins = <RK_GPIO0 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        lan8720a  {
                phy_int: phy-int {
-                       rockchip,pins = <RK_GPIO3 26 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <3 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        ir-receiver {
                ir_recv_pin: ir-recv-pin {
-                       rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sd0 {
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <RK_GPIO3 1 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <2 31 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 3ed4989..10ede65 100644 (file)
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <RK_GPIO0 24 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD0 2 &pcfg_pull_none>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <RK_GPIO0 26 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PD2 2 &pcfg_pull_up>;
                        };
 
                        emmc_rst: emmc-rst {
-                               rockchip,pins = <RK_GPIO0 27 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD3 2 &pcfg_pull_none>;
                        };
 
                        /*
 
                emac {
                        emac_xfer: emac-xfer {
-                               rockchip,pins = <RK_GPIO3 16 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */
-                                               <RK_GPIO3 17 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */
-                                               <RK_GPIO3 18 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */
-                                               <RK_GPIO3 19 RK_FUNC_2 &pcfg_pull_none>, /* rxd0 */
-                                               <RK_GPIO3 20 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */
-                                               <RK_GPIO3 21 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */
-                                               <RK_GPIO3 22 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */
-                                               <RK_GPIO3 23 RK_FUNC_2 &pcfg_pull_none>; /* crs_dvalid */
+                               rockchip,pins = <3 RK_PC0 2 &pcfg_pull_none>, /* tx_en */
+                                               <3 RK_PC1 2 &pcfg_pull_none>, /* txd1 */
+                                               <3 RK_PC2 2 &pcfg_pull_none>, /* txd0 */
+                                               <3 RK_PC3 2 &pcfg_pull_none>, /* rxd0 */
+                                               <3 RK_PC4 2 &pcfg_pull_none>, /* rxd1 */
+                                               <3 RK_PC5 2 &pcfg_pull_none>, /* mac_clk */
+                                               <3 RK_PC6 2 &pcfg_pull_none>, /* rx_err */
+                                               <3 RK_PC7 2 &pcfg_pull_none>; /* crs_dvalid */
                        };
 
                        emac_mdio: emac-mdio {
-                               rockchip,pins = <RK_GPIO3 24 RK_FUNC_2 &pcfg_pull_none>,
-                                               <RK_GPIO3 25 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD0 2 &pcfg_pull_none>,
+                                               <3 RK_PD1 2 &pcfg_pull_none>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <RK_GPIO1 24 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD0 1 &pcfg_pull_none>,
+                                               <1 RK_PD1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <RK_GPIO1 26 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD2 1 &pcfg_pull_none>,
+                                               <1 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <RK_GPIO1 28 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 29 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>,
+                                               <1 RK_PD5 1 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <RK_GPIO3 14 RK_FUNC_2 &pcfg_pull_none>,
-                                               <RK_GPIO3 15 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB6 2 &pcfg_pull_none>,
+                                               <3 RK_PB7 2 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
-                               rockchip,pins = <RK_GPIO1 30 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 31 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD6 1 &pcfg_pull_none>,
+                                               <1 RK_PD7 1 &pcfg_pull_none>;
                        };
                };
 
                lcdc1 {
                        lcdc1_dclk: lcdc1-dclk {
-                               rockchip,pins = <2 RK_PD0 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD0 1 &pcfg_pull_none>;
                        };
 
                        lcdc1_den: lcdc1-den {
-                               rockchip,pins = <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        lcdc1_hsync: lcdc1-hsync {
-                               rockchip,pins = <2 RK_PD2 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD2 1 &pcfg_pull_none>;
                        };
 
                        lcdc1_vsync: lcdc1-vsync {
-                               rockchip,pins = <2 RK_PD3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD3 1 &pcfg_pull_none>;
                        };
 
                        lcdc1_rgb24: ldcd1-rgb24 {
-                               rockchip,pins = <2 RK_PA0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA1 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA3 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA5 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PA7 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB1 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB3 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB5 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PB7 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC1 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC3 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC5 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 RK_PC7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA0 1 &pcfg_pull_none>,
+                                               <2 RK_PA1 1 &pcfg_pull_none>,
+                                               <2 RK_PA2 1 &pcfg_pull_none>,
+                                               <2 RK_PA3 1 &pcfg_pull_none>,
+                                               <2 RK_PA4 1 &pcfg_pull_none>,
+                                               <2 RK_PA5 1 &pcfg_pull_none>,
+                                               <2 RK_PA6 1 &pcfg_pull_none>,
+                                               <2 RK_PA7 1 &pcfg_pull_none>,
+                                               <2 RK_PB0 1 &pcfg_pull_none>,
+                                               <2 RK_PB1 1 &pcfg_pull_none>,
+                                               <2 RK_PB2 1 &pcfg_pull_none>,
+                                               <2 RK_PB3 1 &pcfg_pull_none>,
+                                               <2 RK_PB4 1 &pcfg_pull_none>,
+                                               <2 RK_PB5 1 &pcfg_pull_none>,
+                                               <2 RK_PB6 1 &pcfg_pull_none>,
+                                               <2 RK_PB7 1 &pcfg_pull_none>,
+                                               <2 RK_PC0 1 &pcfg_pull_none>,
+                                               <2 RK_PC1 1 &pcfg_pull_none>,
+                                               <2 RK_PC2 1 &pcfg_pull_none>,
+                                               <2 RK_PC3 1 &pcfg_pull_none>,
+                                               <2 RK_PC4 1 &pcfg_pull_none>,
+                                               <2 RK_PC5 1 &pcfg_pull_none>,
+                                               <2 RK_PC6 1 &pcfg_pull_none>,
+                                               <2 RK_PC7 1 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_out: pwm0-out {
-                               rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_out: pwm1-out {
-                               rockchip,pins = <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD4 1 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_out: pwm2-out {
-                               rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD5 1 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_out: pwm3-out {
-                               rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD6 1 &pcfg_pull_none>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
-                               rockchip,pins = <RK_GPIO1 6 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PA6 2 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
-                               rockchip,pins = <RK_GPIO1 7 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PA7 2 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
-                               rockchip,pins = <RK_GPIO1 5 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PA5 2 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
-                               rockchip,pins = <RK_GPIO1 4 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PA4 2 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
-                               rockchip,pins = <RK_GPIO1 15 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PB7 1 &pcfg_pull_up>;
                        };
                };
 
                spi1 {
                        spi1_clk: spi1-clk {
-                               rockchip,pins = <RK_GPIO0 30 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PD6 1 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
-                               rockchip,pins = <RK_GPIO0 31 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PD7 1 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
-                               rockchip,pins = <RK_GPIO0 28 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PD4 1 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
-                               rockchip,pins = <RK_GPIO0 29 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PD5 1 &pcfg_pull_up>;
                        };
                        spi1_cs1: spi1-cs1 {
-                               rockchip,pins = <RK_GPIO1 14 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PB6 2 &pcfg_pull_up>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_up>,
-                                               <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up>,
+                                               <1 RK_PA1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA2 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_up>,
-                                               <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up>,
+                                               <1 RK_PA5 1 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_up>,
-                                               <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB0 1 &pcfg_pull_up>,
+                                               <1 RK_PB1 1 &pcfg_pull_none>;
                        };
                        /* no rts / cts for uart2 */
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
-                               rockchip,pins = <RK_GPIO1 10 RK_FUNC_1 &pcfg_pull_up>,
-                                               <RK_GPIO1 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB2 1 &pcfg_pull_up>,
+                                               <1 RK_PB3 1 &pcfg_pull_none>;
                        };
 
                        uart3_cts: uart3-cts {
-                               rockchip,pins = <RK_GPIO1 12 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB4 1 &pcfg_pull_none>;
                        };
 
                        uart3_rts: uart3-rts {
-                               rockchip,pins = <RK_GPIO1 13 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB5 1 &pcfg_pull_none>;
                        };
                };
 
                sd0 {
                        sd0_clk: sd0-clk {
-                               rockchip,pins = <RK_GPIO3 2 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA2 1 &pcfg_pull_none>;
                        };
 
                        sd0_cmd: sd0-cmd {
-                               rockchip,pins = <RK_GPIO3 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA3 1 &pcfg_pull_none>;
                        };
 
                        sd0_cd: sd0-cd {
-                               rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB0 1 &pcfg_pull_none>;
                        };
 
                        sd0_wp: sd0-wp {
-                               rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB1 1 &pcfg_pull_none>;
                        };
 
                        sd0_pwr: sd0-pwr {
-                               rockchip,pins = <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA1 1 &pcfg_pull_none>;
                        };
 
                        sd0_bus1: sd0-bus-width1 {
-                               rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA4 1 &pcfg_pull_none>;
                        };
 
                        sd0_bus4: sd0-bus-width4 {
-                               rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA4 1 &pcfg_pull_none>,
+                                               <3 RK_PA5 1 &pcfg_pull_none>,
+                                               <3 RK_PA6 1 &pcfg_pull_none>,
+                                               <3 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                sd1 {
                        sd1_clk: sd1-clk {
-                               rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        sd1_cmd: sd1-cmd {
-                               rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC0 1 &pcfg_pull_none>;
                        };
 
                        sd1_cd: sd1-cd {
-                               rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC6 1 &pcfg_pull_none>;
                        };
 
                        sd1_wp: sd1-wp {
-                               rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC7 1 &pcfg_pull_none>;
                        };
 
                        sd1_bus1: sd1-bus-width1 {
-                               rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        sd1_bus4: sd1-bus-width4 {
-                               rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC1 1 &pcfg_pull_none>,
+                                               <3 RK_PC2 1 &pcfg_pull_none>,
+                                               <3 RK_PC3 1 &pcfg_pull_none>,
+                                               <3 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                i2s0 {
                        i2s0_bus: i2s0-bus {
-                               rockchip,pins = <RK_GPIO1 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 18 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 20 RK_FUNC_1 &pcfg_pull_none>,
-                                               <RK_GPIO1 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC0 1 &pcfg_pull_none>,
+                                               <1 RK_PC1 1 &pcfg_pull_none>,
+                                               <1 RK_PC2 1 &pcfg_pull_none>,
+                                               <1 RK_PC3 1 &pcfg_pull_none>,
+                                               <1 RK_PC4 1 &pcfg_pull_none>,
+                                               <1 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                spdif {
                        spdif_tx: spdif-tx {
-                               rockchip,pins = <RK_GPIO1 14 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB6 1 &pcfg_pull_none>;
                        };
                };
        };
index 29f1907..da102ff 100644 (file)
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <2 7 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA7 2 &pcfg_pull_none>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <1 22 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC6 2 &pcfg_pull_none>;
                        };
 
                        emmc_bus8: emmc-bus8 {
-                               rockchip,pins = <1 24 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 25 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 26 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 27 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 28 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 29 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 30 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 31 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD0 2 &pcfg_pull_none>,
+                                               <1 RK_PD1 2 &pcfg_pull_none>,
+                                               <1 RK_PD2 2 &pcfg_pull_none>,
+                                               <1 RK_PD3 2 &pcfg_pull_none>,
+                                               <1 RK_PD4 2 &pcfg_pull_none>,
+                                               <1 RK_PD5 2 &pcfg_pull_none>,
+                                               <1 RK_PD6 2 &pcfg_pull_none>,
+                                               <1 RK_PD7 2 &pcfg_pull_none>;
                        };
                };
 
                gmac {
                        rgmii_pins: rgmii-pins {
-                               rockchip,pins = <2 14 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 12 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 25 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 19 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 18 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 22 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 23 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 9 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 13 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 21 RK_FUNC_2 &pcfg_pull_none>,
-                                               <2 20 RK_FUNC_2 &pcfg_pull_none>,
-                                               <2 11 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB6 1 &pcfg_pull_none>,
+                                               <2 RK_PB4 1 &pcfg_pull_none>,
+                                               <2 RK_PD1 1 &pcfg_pull_none>,
+                                               <2 RK_PC3 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC2 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC6 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC7 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PB1 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PB5 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC1 1 &pcfg_pull_none>,
+                                               <2 RK_PC0 1 &pcfg_pull_none>,
+                                               <2 RK_PC5 2 &pcfg_pull_none>,
+                                               <2 RK_PC4 2 &pcfg_pull_none>,
+                                               <2 RK_PB3 1 &pcfg_pull_none>,
+                                               <2 RK_PB0 1 &pcfg_pull_none>;
                        };
 
                        rmii_pins: rmii-pins {
-                               rockchip,pins = <2 14 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 12 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 25 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 19 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 18 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 13 RK_FUNC_1 &pcfg_pull_none_drv_12ma>,
-                                               <2 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 8 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 15 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB6 1 &pcfg_pull_none>,
+                                               <2 RK_PB4 1 &pcfg_pull_none>,
+                                               <2 RK_PD1 1 &pcfg_pull_none>,
+                                               <2 RK_PC3 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC2 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PB5 1 &pcfg_pull_none_drv_12ma>,
+                                               <2 RK_PC1 1 &pcfg_pull_none>,
+                                               <2 RK_PC0 1 &pcfg_pull_none>,
+                                               <2 RK_PB0 1 &pcfg_pull_none>,
+                                               <2 RK_PB7 1 &pcfg_pull_none>;
                        };
 
                        phy_pins: phy-pins {
-                               rockchip,pins = <2 14 RK_FUNC_2 &pcfg_pull_none>,
-                                               <2 8 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB6 2 &pcfg_pull_none>,
+                                               <2 RK_PB0 2 &pcfg_pull_none>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 1 &pcfg_pull_none>,
+                                               <0 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <0 2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA2 1 &pcfg_pull_none>,
+                                               <0 RK_PA3 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <2 20 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC4 1 &pcfg_pull_none>,
+                                               <2 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <0 6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA6 1 &pcfg_pull_none>,
+                                               <0 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                spi-0 {
                        spi0_clk: spi0-clk {
-                               rockchip,pins = <0 9 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB1 2 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
-                               rockchip,pins = <0 14 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB6 2 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
-                               rockchip,pins = <0 11 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB3 2 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
-                               rockchip,pins = <0 13 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB5 2 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
-                               rockchip,pins = <1 12 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PB4 1 &pcfg_pull_up>;
                        };
                };
 
                spi-1 {
                        spi1_clk: spi1-clk {
-                               rockchip,pins = <0 23 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PC7 2 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
-                               rockchip,pins = <2 2 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA2 2 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
-                               rockchip,pins = <2 0 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA0 2 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
-                               rockchip,pins = <2 1 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA1 2 &pcfg_pull_up>;
                        };
                        spi1_cs1: spi1-cs1 {
-                               rockchip,pins = <2 3 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA3 2 &pcfg_pull_up>;
                        };
                };
 
                i2s1 {
                        i2s1_bus: i2s1-bus {
-                               rockchip,pins = <0 8 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 9 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 11 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 12 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 13 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 14 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 2 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 4 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 5 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB0 1 &pcfg_pull_none>,
+                                               <0 RK_PB1 1 &pcfg_pull_none>,
+                                               <0 RK_PB3 1 &pcfg_pull_none>,
+                                               <0 RK_PB4 1 &pcfg_pull_none>,
+                                               <0 RK_PB5 1 &pcfg_pull_none>,
+                                               <0 RK_PB6 1 &pcfg_pull_none>,
+                                               <1 RK_PA2 2 &pcfg_pull_none>,
+                                               <1 RK_PA4 2 &pcfg_pull_none>,
+                                               <1 RK_PA5 2 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins = <3 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins = <0 30 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD6 2 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
-                               rockchip,pins = <1 12 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB4 2 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_pin: pwm3-pin {
-                               rockchip,pins = <1 11 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB3 2 &pcfg_pull_none>;
                        };
                };
 
                spdif {
                        spdif_tx: spdif-tx {
-                               rockchip,pins = <3 31 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD7 2 &pcfg_pull_none>;
                        };
                };
 
                tsadc {
                        otp_gpio: otp-gpio {
-                               rockchip,pins = <0 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
 
                        otp_out: otp-out {
-                               rockchip,pins = <0 24 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD0 2 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <2 26 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD2 1 &pcfg_pull_none>,
+                                               <2 RK_PD3 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <2 29 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD5 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <0 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC1 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <1 9 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 10 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB1 1 &pcfg_pull_none>,
+                                               <1 RK_PB2 1 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <1 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB0 1 &pcfg_pull_none>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <1 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 19 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up>,
+                                               <1 RK_PC3 2 &pcfg_pull_none>;
                        };
 
                        uart21_xfer: uart21-xfer {
-                               rockchip,pins = <1 10 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 9 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB2 2 &pcfg_pull_up>,
+                                               <1 RK_PB1 2 &pcfg_pull_none>;
                        };
 
                        uart2_cts: uart2-cts {
-                               rockchip,pins = <0 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        uart2_rts: uart2-rts {
-                               rockchip,pins = <0 24 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD0 1 &pcfg_pull_none>;
                        };
                };
        };
index 6592c80..8008076 100644 (file)
 &pinctrl {
        lcd {
                lcd_en: lcd-en  {
-                       rockchip,pins = <7 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        wifi {
                wifi_pwr: wifi-pwr {
-                       rockchip,pins = <7 9 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 97e4d55..8204407 100644 (file)
 
        backlight {
                bl_en: bl-en {
-                       rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buttons {
                pwrbtn: pwrbtn {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        lcd {
                lcd_cs: lcd-cs {
-                       rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
                 * high-speed mode on EVB board so bump up to 8ma.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        eth_phy {
                eth_phy_pwr: eth-phy-pwr {
-                       rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 29af26e..4847cf9 100644 (file)
 
        gmac {
                phy_int: phy-int {
-                       rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_pmeb: phy-pmeb {
-                       rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usbphy {
                host_drv: host-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 0f3c29d..135e883 100644 (file)
 &pinctrl {
        act8846 {
                pmic_vsel: pmic-vsel {
-                       rockchip,pins = <7 1 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <7 RK_PA1 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <7 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index f57f286..61435d8 100644 (file)
 
        act8846 {
                pwr_hold: pwr-hold {
-                       rockchip,pins = <0 1 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>;
                };
 
                pmic_vsel: pmic-vsel {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        gmac {
                phy_int: phy-int {
-                       rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_pmeb: phy-pmeb {
-                       rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 };
index 3a646c5..1574383 100644 (file)
 &pinctrl {
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <7 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        dvp {
                dvp_pwr: dvp-pwr {
-                       rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                cif_pwr: cif-pwr {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        hym8563 {
                rtc_int: rtc-int {
-                       rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        leds {
                power_led: power-led {
-                       rockchip,pins = <8 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <8 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                work_led: work-led {
-                       rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
                 * high-speed mode on firefly board so bump up to 12ma.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_12ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdio {
                wifi_enable: wifi-enable {
-                       rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_host {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                usbhub_rst: usbhub-rst {
-                       rockchip,pins = <8 3 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <8 RK_PA3 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        usb_otg {
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 556ab42..313459d 100644 (file)
 &pinctrl {
        act8846 {
                pmic_vsel: pmic-vsel {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <7 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index a6ff7ea..5e0a190 100644 (file)
 
        act8846 {
                pwr_hold: pwr-hold {
-                       rockchip,pins = <0 1 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        dvp {
                dvp_pwr: dvp-pwr {
-                       rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        gmac {
                phy_int: phy-int {
-                       rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_pmeb: phy-pmeb {
-                       rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        hym8563 {
                rtc_int: rtc-int {
-                       rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        leds {
                power_led: power-led {
-                       rockchip,pins = <8 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <8 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                work_led: work-led {
-                       rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
                 * high-speed mode on firefly board so bump up to 12ma.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_12ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_host {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                usbhub_rst: usbhub-rst {
-                       rockchip,pins = <8 3 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <8 RK_PA3 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        usb_otg {
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index fb7365b..c41d012 100644 (file)
 
        act8846 {
                pmic_int: pmic-int {
-                       rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                pmic_sleep: pmic-sleep {
-                       rockchip,pins = <0 0 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_output_low>;
                };
 
                pmic_vsel: pmic-vsel {
-                       rockchip,pins = <7 1 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <7 RK_PA1 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        gmac {
                phy_int: phy-int {
-                       rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_pmeb: phy-pmeb {
-                       rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
                 * high-speed mode on firefly board so bump up to 12ma.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_12ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_host {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 7077c34..1e33859 100644 (file)
        buttons {
                user_button_pins: user-button-pins {
                        /* button 1 */
-                       rockchip,pins = <8 3 RK_FUNC_GPIO &pcfg_pull_up>,
+                       rockchip,pins = <8 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
                        /* button 2 */
-                                       <8 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                                       <8 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        rv4162 {
                i2c_rtc_int: i2c-rtc-int {
-                       rockchip,pins = <5 10 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <5 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
                 * high-speed mode on pcm-947 board so bump up to 12 mA.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_12ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_12ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_12ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_12ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_12ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        touchscreen {
                ts_irq_pin: ts-irq-pin {
-                       rockchip,pins = <5 15 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <5 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_host {
                host0_vbus_drv: host0-vbus-drv {
-                       rockchip,pins = <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                host1_vbus_drv: host1-vbus-drv {
-                       rockchip,pins = <2 0 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_otg {
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <2 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index c218dd5..77a47b9 100644 (file)
                 * We also have external pulls, so disable the internal ones.
                 */
                emmc_clk: emmc-clk {
-                       rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <3 RK_PC2 2 &pcfg_pull_none_12ma>;
                };
 
                emmc_cmd: emmc-cmd {
-                       rockchip,pins = <3 16 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <3 RK_PC0 2 &pcfg_pull_none_12ma>;
                };
 
                emmc_bus8: emmc-bus8 {
-                       rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 1 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 2 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 3 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 4 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 5 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 6 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <3 7 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                       rockchip,pins = <3 RK_PA0 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA1 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA2 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA3 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA4 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA5 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA6 2 &pcfg_pull_none_12ma>,
+                                       <3 RK_PA7 2 &pcfg_pull_none_12ma>;
                };
        };
 
        gmac {
                phy_int: phy-int {
-                       rockchip,pins = <4 2 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        leds {
                user_led: user-led {
-                       rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                /* Pin for switching state between sleep and non-sleep state */
                pmic_sleep: pmic-sleep {
-                       rockchip,pins = <RK_GPIO0 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 28972fb..a6ffc38 100644 (file)
 
        act8846 {
                pmic_vsel: pmic-vsel {
-                       rockchip,pins = <7 1 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <7 RK_PA1 RK_FUNC_GPIO &pcfg_output_low>;
                };
 
                pwr_hold: pwr-hold {
-                       rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        buttons {
                pwrbtn: pwrbtn {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <7 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 32e1ab3..9f9e2bf 100644 (file)
 
        emmc {
                        emmc_reset: emmc-reset {
-                               rockchip,pins = <3 9 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
        };
 
        gmac {
                phy_rst: phy-rst {
-                       rockchip,pins = <4 8 RK_FUNC_GPIO  &pcfg_output_high>;
+                       rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO  &pcfg_output_high>;
                };
        };
 };
index 5b7e1c9..cdcdc92 100644 (file)
 &pinctrl {
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        headphone {
                hp_det: hp-det {
-                       rockchip,pins = <7 7 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                phone_ctl: phone-ctl {
-                       rockchip,pins = <8 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <8 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sata {
                sata_pwr_en: sata-pwr-en {
-                       rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdmmc {
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdio {
                wifi_enable: wifi-enable {
-                       rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index d97da89..970e138 100644 (file)
@@ -23,3 +23,8 @@
        mmc-ddr-1_8v;
        status = "okay";
 };
+
+&hdmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hdmi_cec_c0>;
+};
index ef653c3..2935768 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "rk3288.dtsi"
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/clock/rockchip,rk808.h>
 
 / {
        chosen {
                };
        };
 
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 RK808_CLKOUT1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_enable>;
+               reset-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_LOW>,
+                       <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>;
+       };
+
        sound {
                compatible = "simple-audio-card";
                simple-audio-card,format = "i2s";
        status = "okay";
 
        sdcard-supply = <&vccio_sd>;
+       wifi-supply = <&vcc_18>;
 };
 
 &pinctrl {
 
        backlight {
                bl_en: bl-en {
-                       rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buttons {
                pwrbtn: pwrbtn {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        eth_phy {
                eth_phy_pwr: eth-phy-pwr {
-                       rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO \
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO \
                                        &pcfg_pull_up>;
                };
 
                dvs_1: dvs-1 {
-                       rockchip,pins = <RK_GPIO0 11 RK_FUNC_GPIO \
+                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO \
                                        &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO \
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO \
                                        &pcfg_pull_down>;
                };
        };
 
        sdmmc {
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_up_drv_8ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 \
+                       rockchip,pins = <6 RK_PC4 1 \
                                        &pcfg_pull_none_drv_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_pwr: sdmmc-pwr {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                pwr_3g: pwr-3g {
-                       rockchip,pins = <7 8 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       sdio {
+               wifi_enable: wifi-enable {
+                       rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>,
+                               <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
        vqmmc-supply = <&vccio_sd>;
 };
 
+&sdio0 {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       keep-power-in-suspend;
+       max-frequency = <50000000>;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4>, <&sdio0_cmd>, <&sdio0_clk>, <&sdio0_int>;
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       vmmc-supply = <&vcc_io>;
+       vqmmc-supply = <&vcc_18>;
+       status = "okay";
+};
+
 &tsadc {
        rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
        rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
index eaf9216..445270a 100644 (file)
@@ -73,7 +73,7 @@
 &pinctrl {
        codec {
                hp_det: hp-det {
-                       rockchip,pins = <6 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <6 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                /*
                 * we've got a ts3a227e chip but the driver requires it.
                 */
                int_codec: int-codec {
-                       rockchip,pins = <6 7 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <6 RK_PA7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                mic_det: mic-det {
-                       rockchip,pins = <6 11 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <6 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        headset {
                ts3a227e_int_l: ts3a227e-int-l {
-                       rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 5c94a33..406146c 100644 (file)
 &pinctrl {
        hdmi {
                vcc50_hdmi_en: vcc50-hdmi-en {
-                       rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        usb-host {
                usb2_pwr_en: usb2-pwr-en {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index b54746d..fbef345 100644 (file)
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-state-mem {
-                               regulator-on-in-suspend;
-                               regulator-suspend-microvolt = <3300000>;
+                               regulator-off-in-suspend;
                        };
                };
        };
 &pinctrl {
        pinctrl-0 = <
                /* Common for sleep and wake, but no owners */
+               &ddr0_retention
+               &ddrio_pwroff
                &global_pwroff
 
                /* Wake only */
        >;
        pinctrl-1 = <
                /* Common for sleep and wake, but no owners */
+               &ddr0_retention
+               &ddrio_pwroff
                &global_pwroff
 
                /* Sleep only */
 
        backlight {
                bl_en: bl-en {
-                       rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buttons {
                ap_lid_int_l: ap-lid-int-l {
-                       rockchip,pins = <0 6 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        charger {
                ac_present_ap: ac-present-ap {
-                       rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        cros-ec {
                ec_int: ec-int {
-                       rockchip,pins = <7 7 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        suspend {
                suspend_l_wake: suspend-l-wake {
-                       rockchip,pins = <0 17 RK_FUNC_GPIO &pcfg_output_low>;
+                       rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_output_low>;
                };
 
                suspend_l_sleep: suspend-l-sleep {
-                       rockchip,pins = <0 17 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_output_high>;
                };
        };
 
        trackpad {
                trackpad_int: trackpad-int {
-                       rockchip,pins = <7 3 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usb-host {
                host1_pwr_en: host1-pwr-en {
-                       rockchip,pins = <0 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                usbotg_pwren_h: usbotg-pwren-h {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 9d6814c..e248f55 100644 (file)
 &pinctrl {
        backlight {
                bl_pwr_en: bl_pwr_en {
-                       rockchip,pins = <2 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buck-5v {
                drv_5v: drv-5v {
-                       rockchip,pins = <7 21 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        hdmi {
                vcc50_hdmi_en: vcc50-hdmi-en {
-                       rockchip,pins = <5 19 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <5 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        lcd {
                lcd_enable_h: lcd-en {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                avdd_1v8_disp_en: avdd-1v8-disp-en {
-                       rockchip,pins = <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 };
index 2ba8989..b1613af 100644 (file)
 
 / {
        model = "Google Jerry";
-       compatible = "google,veyron-jerry-rev7", "google,veyron-jerry-rev6",
+       compatible = "google,veyron-jerry-rev15", "google,veyron-jerry-rev14",
+                    "google,veyron-jerry-rev13", "google,veyron-jerry-rev12",
+                    "google,veyron-jerry-rev11", "google,veyron-jerry-rev10",
+                    "google,veyron-jerry-rev7", "google,veyron-jerry-rev6",
                     "google,veyron-jerry-rev5", "google,veyron-jerry-rev4",
                     "google,veyron-jerry-rev3", "google,veyron-jerry",
                     "google,veyron", "rockchip,rk3288";
@@ -61,7 +64,9 @@
 
 &rk808 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pmic_int_l>;
+       pinctrl-0 = <&pmic_int_l &dvs_1 &dvs_2>;
+       dvs-gpios = <&gpio7 RK_PB4 GPIO_ACTIVE_HIGH>,
+                   <&gpio7 RK_PB7 GPIO_ACTIVE_HIGH>;
 
        regulators {
                mic_vcc: LDO_REG2 {
 &pinctrl {
        backlight {
                bl_pwr_en: bl_pwr_en {
-                       rockchip,pins = <2 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buck-5v {
                drv_5v: drv-5v {
-                       rockchip,pins = <7 21 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        hdmi {
                vcc50_hdmi_en: vcc50-hdmi-en {
-                       rockchip,pins = <5 19 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <5 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        lcd {
                lcd_enable_h: lcd-en {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                avdd_1v8_disp_en: avdd-1v8-disp-en {
-                       rockchip,pins = <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 };
index d889ab3..e852594 100644 (file)
 &pinctrl {
        hdmi {
                power_hdmi_on: power-hdmi-on {
-                       rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 };
diff --git a/arch/arm/boot/dts/rk3288-veyron-mighty.dts b/arch/arm/boot/dts/rk3288-veyron-mighty.dts
new file mode 100644 (file)
index 0000000..27fbc07
--- /dev/null
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Google Veyron Mighty Rev 1+ board device tree source
+ *
+ * Copyright 2015 Google, Inc
+ */
+
+/dts-v1/;
+
+#include "rk3288-veyron-jaq.dts"
+
+/ {
+       model = "Google Mighty";
+       compatible = "google,veyron-mighty-rev5", "google,veyron-mighty-rev4",
+                    "google,veyron-mighty-rev3", "google,veyron-mighty-rev2",
+                    "google,veyron-mighty-rev1", "google,veyron-mighty",
+                    "google,veyron", "rockchip,rk3288";
+};
+
+&sdmmc {
+       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd_disabled &sdmmc_cd_gpio
+                       &sdmmc_wp_gpio &sdmmc_bus4>;
+       wp-gpios = <&gpio7 10 GPIO_ACTIVE_HIGH>;
+
+       /delete-property/ disable-wp;
+};
+
+&pinctrl {
+       sdmmc {
+               sdmmc_wp_gpio: sdmmc-wp-gpio {
+                       rockchip,pins = <7 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+};
index f95d0c5..468a181 100644 (file)
 &pinctrl {
        backlight {
                bl_pwr_en: bl_pwr_en {
-                       rockchip,pins = <2 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buck-5v {
                drv_5v: drv-5v {
-                       rockchip,pins = <7 21 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buttons {
                volum_down_l: volum-down-l {
-                       rockchip,pins = <5 11 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <5 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                volum_up_l: volum-up-l {
-                       rockchip,pins = <5 10 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <5 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        hdmi {
                vcc50_hdmi_en: vcc50-hdmi-en {
-                       rockchip,pins = <5 19 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <5 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        lcd {
                lcd_enable_h: lcd-en {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                avdd_1v8_disp_en: avdd-1v8-disp-en {
-                       rockchip,pins = <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        prochot {
                gpio_prochot: gpio-prochot {
-                       rockchip,pins = <2 8 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        touchscreen {
                touch_int: touch-int {
-                       rockchip,pins = <2 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                touch_rst: touch-rst {
-                       rockchip,pins = <2 15 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 2950aad..9645be7 100644 (file)
 &pinctrl {
        buttons {
                pwr_key_h: pwr-key-h {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        emmc {
                emmc_reset: emmc-reset {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        sdmmc {
                sdmmc_wp_gpio: sdmmc-wp-gpio {
-                       rockchip,pins = <7 10 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <7 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index a457044..fe950f9 100644 (file)
                 * We also have external pulls, so disable the internal ones.
                 */
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <6 17 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <6 18 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <6 19 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <6 RK_PC0 1 &pcfg_pull_none_drv_8ma>,
+                                       <6 RK_PC1 1 &pcfg_pull_none_drv_8ma>,
+                                       <6 RK_PC2 1 &pcfg_pull_none_drv_8ma>,
+                                       <6 RK_PC3 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <6 RK_PC5 1 &pcfg_pull_none_drv_8ma>;
                };
 
                /*
                 * think there's a card inserted
                 */
                sdmmc_cd_disabled: sdmmc-cd-disabled {
-                       rockchip,pins = <6 22 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <6 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /* This is where we actually hook up CD */
                sdmmc_cd_gpio: sdmmc-cd-gpio {
-                       rockchip,pins = <7 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index e16421d..2ac8748 100644 (file)
 &pinctrl {
        backlight {
                bl_pwr_en: bl_pwr_en {
-                       rockchip,pins = <2 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        buck-5v {
                drv_5v: drv-5v {
-                       rockchip,pins = <7 21 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        hdmi {
                vcc50_hdmi_en: vcc50-hdmi-en {
-                       rockchip,pins = <5 19 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <5 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        lcd {
                lcd_enable_h: lcd-en {
-                       rockchip,pins = <7 14 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                avdd_1v8_disp_en: avdd-1v8-disp-en {
-                       rockchip,pins = <2 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                dvs_1: dvs-1 {
-                       rockchip,pins = <7 12 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                dvs_2: dvs-2 {
-                       rockchip,pins = <7 15 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <7 RK_PB7 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 };
index 192dbc0..1252522 100644 (file)
                pinctrl-0 = <&bt_enable_l>, <&wifi_enable_h>;
 
                /*
-                * On the module itself this is one of these (depending
-                * on the actual card populated):
+                * Depending on the actual card populated GPIO4 D4 and D5
+                * correspond to one of these signals on the module:
+                *
+                * D4:
                 * - SDIO_RESET_L_WL_REG_ON
                 * - PDN (power down when low)
+                *
+                * D5:
+                * - BT_I2S_WS_BT_RFDISABLE_L
+                * - No connect
                 */
-               reset-gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>;
+               reset-gpios = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>,
+                             <&gpio4 RK_PD5 GPIO_ACTIVE_LOW>;
        };
 
        vcc_5v: vcc-5v {
                regulator-boot-on;
                vin-supply = <&vcc_5v>;
        };
+
+       vdd_logic: vdd-logic {
+               compatible = "pwm-regulator";
+               regulator-name = "vdd_logic";
+
+               pwms = <&pwm1 0 1994 0>;
+               pwm-supply = <&vcc33_sys>;
+
+               pwm-dutycycle-range = <0x7b 0>;
+               pwm-dutycycle-unit = <0x94>;
+
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <950000>;
+               regulator-max-microvolt = <1350000>;
+               regulator-ramp-delay = <4000>;
+       };
 };
 
 &cpu0 {
                                regulator-max-microvolt = <1250000>;
                                regulator-ramp-delay = <6001>;
                                regulator-state-mem {
-                                       regulator-on-in-suspend;
-                                       regulator-suspend-microvolt = <1000000>;
+                                       regulator-off-in-suspend;
                                };
                        };
 
 &uart0 {
        status = "okay";
 
-       /* We need to go faster than 24MHz, so adjust clock parents / rates */
-       assigned-clocks = <&cru SCLK_UART0>;
-       assigned-clock-rates = <48000000>;
-
        /* Pins don't include flow control by default; add that in */
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <
                /* Common for sleep and wake, but no owners */
+               &ddr0_retention
+               &ddrio_pwroff
                &global_pwroff
        >;
        pinctrl-1 = <
                /* Common for sleep and wake, but no owners */
+               &ddr0_retention
+               &ddrio_pwroff
                &global_pwroff
        >;
 
 
        buttons {
                pwr_key_l: pwr-key-l {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        emmc {
                emmc_reset: emmc-reset {
-                       rockchip,pins = <2 9 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /*
                 * We also have external pulls, so disable the internal ones.
                 */
                emmc_clk: emmc-clk {
-                       rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <3 RK_PC2 2 &pcfg_pull_none_drv_8ma>;
                };
 
                emmc_cmd: emmc-cmd {
-                       rockchip,pins = <3 16 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <3 RK_PC0 2 &pcfg_pull_none_drv_8ma>;
                };
 
                emmc_bus8: emmc-bus8 {
-                       rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 1 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 2 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 3 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 4 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 5 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 6 RK_FUNC_2 &pcfg_pull_none_drv_8ma>,
-                                       <3 7 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <3 RK_PA0 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA1 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA2 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA3 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA4 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA5 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA6 2 &pcfg_pull_none_drv_8ma>,
+                                       <3 RK_PA7 2 &pcfg_pull_none_drv_8ma>;
                };
        };
 
        pmic {
                pmic_int_l: pmic-int-l {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        reboot {
                ap_warm_reset_h: ap-warm-reset-h {
-                       rockchip,pins = <RK_GPIO0 13 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        recovery-switch {
                rec_mode_l: rec-mode-l {
-                       rockchip,pins = <0 9 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        sdio0 {
                wifi_enable_h: wifienable-h {
-                       rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /* NOTE: mislabelled on schematic; should be bt_enable_h */
                bt_enable_l: bt-enable-l {
-                       rockchip,pins = <4 29 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /*
                 * We also have external pulls, so disable the internal ones.
                 */
                sdio0_bus4: sdio0-bus4 {
-                       rockchip,pins = <4 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <4 21 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <4 22 RK_FUNC_1 &pcfg_pull_none_drv_8ma>,
-                                       <4 23 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <4 RK_PC4 1 &pcfg_pull_none_drv_8ma>,
+                                       <4 RK_PC5 1 &pcfg_pull_none_drv_8ma>,
+                                       <4 RK_PC6 1 &pcfg_pull_none_drv_8ma>,
+                                       <4 RK_PC7 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdio0_cmd: sdio0-cmd {
-                       rockchip,pins = <4 24 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <4 RK_PD0 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdio0_clk: sdio0-clk {
-                       rockchip,pins = <4 25 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <4 RK_PD1 1 &pcfg_pull_none_drv_8ma>;
                };
        };
 
        tpm {
                tpm_int_h: tpm-int-h {
-                       rockchip,pins = <7 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        write-protect {
                fw_wp_ap: fw-wp-ap {
-                       rockchip,pins = <7 6 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <7 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 40b232e..ba06e9f 100644 (file)
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usb_host {
                phy_pwr_en: phy-pwr-en {
-                       rockchip,pins = <RK_GPIO2 RK_PB1 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_output_high>;
                };
 
                usb2_pwr_en: usb2-pwr-en {
 
        usb_otg {
                otg_vbus_drv: otg-vbus-drv {
-                       rockchip,pins = <RK_GPIO0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
 
                };
        };
index 8ce3dd2..aa017ab 100644 (file)
@@ -64,6 +64,7 @@
                        #cooling-cells = <2>; /* min followed by max */
                        clock-latency = <40000>;
                        clocks = <&cru ARMCLK>;
+                       dynamic-power-coefficient = <370>;
                };
                cpu1: cpu@501 {
                        device_type = "cpu";
@@ -74,6 +75,7 @@
                        #cooling-cells = <2>; /* min followed by max */
                        clock-latency = <40000>;
                        clocks = <&cru ARMCLK>;
+                       dynamic-power-coefficient = <370>;
                };
                cpu2: cpu@502 {
                        device_type = "cpu";
@@ -84,6 +86,7 @@
                        #cooling-cells = <2>; /* min followed by max */
                        clock-latency = <40000>;
                        clocks = <&cru ARMCLK>;
+                       dynamic-power-coefficient = <370>;
                };
                cpu3: cpu@503 {
                        device_type = "cpu";
@@ -94,6 +97,7 @@
                        #cooling-cells = <2>; /* min followed by max */
                        clock-latency = <40000>;
                        clocks = <&cru ARMCLK>;
+                       dynamic-power-coefficient = <370>;
                };
        };
 
                pinctrl-1 = <&otp_out>;
                pinctrl-2 = <&otp_gpio>;
                #thermal-sensor-cells = <1>;
+               rockchip,grf = <&grf>;
                rockchip,hw-tshut-temp = <95000>;
                status = "disabled";
        };
                reg = <0x0 0xffaf0080 0x0 0x20>;
        };
 
-       gic: interrupt-controller@ffc01000 {
-               compatible = "arm,gic-400";
-               interrupt-controller;
-               #interrupt-cells = <3>;
-               #address-cells = <0>;
-
-               reg = <0x0 0xffc01000 0x0 0x1000>,
-                     <0x0 0xffc02000 0x0 0x2000>,
-                     <0x0 0xffc04000 0x0 0x2000>,
-                     <0x0 0xffc06000 0x0 0x2000>;
-               interrupts = <GIC_PPI 9 0xf04>;
-       };
-
        efuse: efuse@ffb40000 {
                compatible = "rockchip,rk3288-efuse";
                reg = <0x0 0xffb40000 0x0 0x20>;
                };
        };
 
+       gic: interrupt-controller@ffc01000 {
+               compatible = "arm,gic-400";
+               interrupt-controller;
+               #interrupt-cells = <3>;
+               #address-cells = <0>;
+
+               reg = <0x0 0xffc01000 0x0 0x1000>,
+                     <0x0 0xffc02000 0x0 0x2000>,
+                     <0x0 0xffc04000 0x0 0x2000>,
+                     <0x0 0xffc06000 0x0 0x2000>;
+               interrupts = <GIC_PPI 9 0xf04>;
+       };
+
        pinctrl: pinctrl {
                compatible = "rockchip,rk3288-pinctrl";
                rockchip,grf = <&grf>;
 
                hdmi {
                        hdmi_cec_c0: hdmi-cec-c0 {
-                               rockchip,pins = <7 RK_PC0 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC0 2 &pcfg_pull_none>;
                        };
 
                        hdmi_cec_c7: hdmi-cec-c7 {
-                               rockchip,pins = <7 RK_PC7 RK_FUNC_4 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC7 4 &pcfg_pull_none>;
                        };
 
                        hdmi_ddc: hdmi-ddc {
-                               rockchip,pins = <7 19 RK_FUNC_2 &pcfg_pull_none>,
-                                               <7 20 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC3 2 &pcfg_pull_none>,
+                                               <7 RK_PC4 2 &pcfg_pull_none>;
                        };
                };
 
 
                sleep {
                        global_pwroff: global-pwroff {
-                               rockchip,pins = <0 0 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 1 &pcfg_pull_none>;
                        };
 
                        ddrio_pwroff: ddrio-pwroff {
-                               rockchip,pins = <0 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>;
                        };
 
                        ddr0_retention: ddr0-retention {
-                               rockchip,pins = <0 2 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PA2 1 &pcfg_pull_up>;
                        };
 
                        ddr1_retention: ddr1-retention {
-                               rockchip,pins = <0 3 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PA3 1 &pcfg_pull_up>;
                        };
                };
 
                edp {
                        edp_hpd: edp-hpd {
-                               rockchip,pins = <7 11 RK_FUNC_2 &pcfg_pull_down>;
+                               rockchip,pins = <7 RK_PB3 2 &pcfg_pull_down>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <0 15 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 16 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB7 1 &pcfg_pull_none>,
+                                               <0 RK_PC0 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <8 4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <8 5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <8 RK_PA4 1 &pcfg_pull_none>,
+                                               <8 RK_PA5 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <6 9 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 10 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <6 RK_PB1 1 &pcfg_pull_none>,
+                                               <6 RK_PB2 1 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <2 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC0 1 &pcfg_pull_none>,
+                                               <2 RK_PC1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
-                               rockchip,pins = <7 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <7 18 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC1 1 &pcfg_pull_none>,
+                                               <7 RK_PC2 1 &pcfg_pull_none>;
                        };
                };
 
                i2c5 {
                        i2c5_xfer: i2c5-xfer {
-                               rockchip,pins = <7 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <7 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC3 1 &pcfg_pull_none>,
+                                               <7 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                i2s0 {
                        i2s0_bus: i2s0-bus {
-                               rockchip,pins = <6 0 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 1 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 2 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 3 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 4 RK_FUNC_1 &pcfg_pull_none>,
-                                               <6 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <6 RK_PA0 1 &pcfg_pull_none>,
+                                               <6 RK_PA1 1 &pcfg_pull_none>,
+                                               <6 RK_PA2 1 &pcfg_pull_none>,
+                                               <6 RK_PA3 1 &pcfg_pull_none>,
+                                               <6 RK_PA4 1 &pcfg_pull_none>,
+                                               <6 RK_PB0 1 &pcfg_pull_none>;
                        };
                };
 
                lcdc {
                        lcdc_ctl: lcdc-ctl {
-                               rockchip,pins = <1 24 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 25 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 26 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD0 1 &pcfg_pull_none>,
+                                               <1 RK_PD1 1 &pcfg_pull_none>,
+                                               <1 RK_PD2 1 &pcfg_pull_none>,
+                                               <1 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                sdmmc {
                        sdmmc_clk: sdmmc-clk {
-                               rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
-                               rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
-                               rockchip,pins = <6 22 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <6 RK_PC6 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus1: sdmmc-bus1 {
-                               rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
-                               rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up>,
-                                               <6 17 RK_FUNC_1 &pcfg_pull_up>,
-                                               <6 18 RK_FUNC_1 &pcfg_pull_up>,
-                                               <6 19 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up>,
+                                               <6 RK_PC1 1 &pcfg_pull_up>,
+                                               <6 RK_PC2 1 &pcfg_pull_up>,
+                                               <6 RK_PC3 1 &pcfg_pull_up>;
                        };
                };
 
                sdio0 {
                        sdio0_bus1: sdio0-bus1 {
-                               rockchip,pins = <4 20 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PC4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bus4: sdio0-bus4 {
-                               rockchip,pins = <4 20 RK_FUNC_1 &pcfg_pull_up>,
-                                               <4 21 RK_FUNC_1 &pcfg_pull_up>,
-                                               <4 22 RK_FUNC_1 &pcfg_pull_up>,
-                                               <4 23 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PC4 1 &pcfg_pull_up>,
+                                               <4 RK_PC5 1 &pcfg_pull_up>,
+                                               <4 RK_PC6 1 &pcfg_pull_up>,
+                                               <4 RK_PC7 1 &pcfg_pull_up>;
                        };
 
                        sdio0_cmd: sdio0-cmd {
-                               rockchip,pins = <4 24 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD0 1 &pcfg_pull_up>;
                        };
 
                        sdio0_clk: sdio0-clk {
-                               rockchip,pins = <4 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <4 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        sdio0_cd: sdio0-cd {
-                               rockchip,pins = <4 26 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD2 1 &pcfg_pull_up>;
                        };
 
                        sdio0_wp: sdio0-wp {
-                               rockchip,pins = <4 27 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_pwr: sdio0-pwr {
-                               rockchip,pins = <4 28 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bkpwr: sdio0-bkpwr {
-                               rockchip,pins = <4 29 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD5 1 &pcfg_pull_up>;
                        };
 
                        sdio0_int: sdio0-int {
-                               rockchip,pins = <4 30 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PD6 1 &pcfg_pull_up>;
                        };
                };
 
                sdio1 {
                        sdio1_bus1: sdio1-bus1 {
-                               rockchip,pins = <3 24 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD0 4 &pcfg_pull_up>;
                        };
 
                        sdio1_bus4: sdio1-bus4 {
-                               rockchip,pins = <3 24 4 &pcfg_pull_up>,
-                                               <3 25 4 &pcfg_pull_up>,
-                                               <3 26 4 &pcfg_pull_up>,
-                                               <3 27 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD0 4 &pcfg_pull_up>,
+                                               <3 RK_PD1 4 &pcfg_pull_up>,
+                                               <3 RK_PD2 4 &pcfg_pull_up>,
+                                               <3 RK_PD3 4 &pcfg_pull_up>;
                        };
 
                        sdio1_cd: sdio1-cd {
-                               rockchip,pins = <3 28 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD4 4 &pcfg_pull_up>;
                        };
 
                        sdio1_wp: sdio1-wp {
-                               rockchip,pins = <3 29 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD5 4 &pcfg_pull_up>;
                        };
 
                        sdio1_bkpwr: sdio1-bkpwr {
-                               rockchip,pins = <3 30 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD6 4 &pcfg_pull_up>;
                        };
 
                        sdio1_int: sdio1-int {
-                               rockchip,pins = <3 31 4 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD7 4 &pcfg_pull_up>;
                        };
 
                        sdio1_cmd: sdio1-cmd {
-                               rockchip,pins = <4 6 4 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PA6 4 &pcfg_pull_up>;
                        };
 
                        sdio1_clk: sdio1-clk {
-                               rockchip,pins = <4 7 4 &pcfg_pull_none>;
+                               rockchip,pins = <4 RK_PA7 4 &pcfg_pull_none>;
                        };
 
                        sdio1_pwr: sdio1-pwr {
-                               rockchip,pins = <4 9 4 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PB1 4 &pcfg_pull_up>;
                        };
                };
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <3 18 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC2 2 &pcfg_pull_none>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <3 16 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PC0 2 &pcfg_pull_up>;
                        };
 
                        emmc_pwr: emmc-pwr {
-                               rockchip,pins = <3 9 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PB1 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus1: emmc-bus1 {
-                               rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA0 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus4: emmc-bus4 {
-                               rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 1 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 2 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 3 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA0 2 &pcfg_pull_up>,
+                                               <3 RK_PA1 2 &pcfg_pull_up>,
+                                               <3 RK_PA2 2 &pcfg_pull_up>,
+                                               <3 RK_PA3 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus8: emmc-bus8 {
-                               rockchip,pins = <3 0 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 1 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 2 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 3 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 4 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 5 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 6 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 7 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA0 2 &pcfg_pull_up>,
+                                               <3 RK_PA1 2 &pcfg_pull_up>,
+                                               <3 RK_PA2 2 &pcfg_pull_up>,
+                                               <3 RK_PA3 2 &pcfg_pull_up>,
+                                               <3 RK_PA4 2 &pcfg_pull_up>,
+                                               <3 RK_PA5 2 &pcfg_pull_up>,
+                                               <3 RK_PA6 2 &pcfg_pull_up>,
+                                               <3 RK_PA7 2 &pcfg_pull_up>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
-                               rockchip,pins = <5 12 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB4 1 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
-                               rockchip,pins = <5 13 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB5 1 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
-                               rockchip,pins = <5 14 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB6 1 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
-                               rockchip,pins = <5 15 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB7 1 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
-                               rockchip,pins = <5 16 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PC0 1 &pcfg_pull_up>;
                        };
                };
                spi1 {
                        spi1_clk: spi1-clk {
-                               rockchip,pins = <7 12 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <7 RK_PB4 2 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
-                               rockchip,pins = <7 13 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <7 RK_PB5 2 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
-                               rockchip,pins = <7 14 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <7 RK_PB6 2 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
-                               rockchip,pins = <7 15 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <7 RK_PB7 2 &pcfg_pull_up>;
                        };
                };
 
                spi2 {
                        spi2_cs1: spi2-cs1 {
-                               rockchip,pins = <8 3 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <8 RK_PA3 1 &pcfg_pull_up>;
                        };
                        spi2_clk: spi2-clk {
-                               rockchip,pins = <8 6 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <8 RK_PA6 1 &pcfg_pull_up>;
                        };
                        spi2_cs0: spi2-cs0 {
-                               rockchip,pins = <8 7 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <8 RK_PA7 1 &pcfg_pull_up>;
                        };
                        spi2_rx: spi2-rx {
-                               rockchip,pins = <8 8 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <8 RK_PB0 1 &pcfg_pull_up>;
                        };
                        spi2_tx: spi2-tx {
-                               rockchip,pins = <8 9 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <8 RK_PB1 1 &pcfg_pull_up>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <4 16 RK_FUNC_1 &pcfg_pull_up>,
-                                               <4 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <4 RK_PC0 1 &pcfg_pull_up>,
+                                               <4 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <4 18 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <4 RK_PC2 1 &pcfg_pull_up>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <4 19 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <4 RK_PC3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <5 8 RK_FUNC_1 &pcfg_pull_up>,
-                                               <5 9 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <5 RK_PB0 1 &pcfg_pull_up>,
+                                               <5 RK_PB1 1 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <5 10 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB2 1 &pcfg_pull_up>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <5 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <5 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <7 22 RK_FUNC_1 &pcfg_pull_up>,
-                                               <7 23 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC6 1 &pcfg_pull_up>,
+                                               <7 RK_PC7 1 &pcfg_pull_none>;
                        };
                        /* no rts / cts for uart2 */
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
-                               rockchip,pins = <7 7 RK_FUNC_1 &pcfg_pull_up>,
-                                               <7 8 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PA7 1 &pcfg_pull_up>,
+                                               <7 RK_PB0 1 &pcfg_pull_none>;
                        };
 
                        uart3_cts: uart3-cts {
-                               rockchip,pins = <7 9 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <7 RK_PB1 1 &pcfg_pull_up>;
                        };
 
                        uart3_rts: uart3-rts {
-                               rockchip,pins = <7 10 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PB2 1 &pcfg_pull_none>;
                        };
                };
 
                uart4 {
                        uart4_xfer: uart4-xfer {
-                               rockchip,pins = <5 15 3 &pcfg_pull_up>,
-                                               <5 14 3 &pcfg_pull_none>;
+                               rockchip,pins = <5 RK_PB7 3 &pcfg_pull_up>,
+                                               <5 RK_PB6 3 &pcfg_pull_none>;
                        };
 
                        uart4_cts: uart4-cts {
-                               rockchip,pins = <5 12 3 &pcfg_pull_up>;
+                               rockchip,pins = <5 RK_PB4 3 &pcfg_pull_up>;
                        };
 
                        uart4_rts: uart4-rts {
-                               rockchip,pins = <5 13 3 &pcfg_pull_none>;
+                               rockchip,pins = <5 RK_PB5 3 &pcfg_pull_none>;
                        };
                };
 
                tsadc {
                        otp_gpio: otp-gpio {
-                               rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
 
                        otp_out: otp-out {
-                               rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB2 1 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins = <7 0 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PA0 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins = <7 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
-                               rockchip,pins = <7 22 3 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC6 3 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_pin: pwm3-pin {
-                               rockchip,pins = <7 23 3 &pcfg_pull_none>;
+                               rockchip,pins = <7 RK_PC7 3 &pcfg_pull_none>;
                        };
                };
 
                gmac {
                        rgmii_pins: rgmii-pins {
-                               rockchip,pins = <3 30 3 &pcfg_pull_none>,
-                                               <3 31 3 &pcfg_pull_none>,
-                                               <3 26 3 &pcfg_pull_none>,
-                                               <3 27 3 &pcfg_pull_none>,
-                                               <3 28 3 &pcfg_pull_none_12ma>,
-                                               <3 29 3 &pcfg_pull_none_12ma>,
-                                               <3 24 3 &pcfg_pull_none_12ma>,
-                                               <3 25 3 &pcfg_pull_none_12ma>,
-                                               <4 0 3 &pcfg_pull_none>,
-                                               <4 5 3 &pcfg_pull_none>,
-                                               <4 6 3 &pcfg_pull_none>,
-                                               <4 9 3 &pcfg_pull_none_12ma>,
-                                               <4 4 3 &pcfg_pull_none_12ma>,
-                                               <4 1 3 &pcfg_pull_none>,
-                                               <4 3 3 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD6 3 &pcfg_pull_none>,
+                                               <3 RK_PD7 3 &pcfg_pull_none>,
+                                               <3 RK_PD2 3 &pcfg_pull_none>,
+                                               <3 RK_PD3 3 &pcfg_pull_none>,
+                                               <3 RK_PD4 3 &pcfg_pull_none_12ma>,
+                                               <3 RK_PD5 3 &pcfg_pull_none_12ma>,
+                                               <3 RK_PD0 3 &pcfg_pull_none_12ma>,
+                                               <3 RK_PD1 3 &pcfg_pull_none_12ma>,
+                                               <4 RK_PA0 3 &pcfg_pull_none>,
+                                               <4 RK_PA5 3 &pcfg_pull_none>,
+                                               <4 RK_PA6 3 &pcfg_pull_none>,
+                                               <4 RK_PB1 3 &pcfg_pull_none_12ma>,
+                                               <4 RK_PA4 3 &pcfg_pull_none_12ma>,
+                                               <4 RK_PA1 3 &pcfg_pull_none>,
+                                               <4 RK_PA3 3 &pcfg_pull_none>;
                        };
 
                        rmii_pins: rmii-pins {
-                               rockchip,pins = <3 30 3 &pcfg_pull_none>,
-                                               <3 31 3 &pcfg_pull_none>,
-                                               <3 28 3 &pcfg_pull_none>,
-                                               <3 29 3 &pcfg_pull_none>,
-                                               <4 0 3 &pcfg_pull_none>,
-                                               <4 5 3 &pcfg_pull_none>,
-                                               <4 4 3 &pcfg_pull_none>,
-                                               <4 1 3 &pcfg_pull_none>,
-                                               <4 2 3 &pcfg_pull_none>,
-                                               <4 3 3 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD6 3 &pcfg_pull_none>,
+                                               <3 RK_PD7 3 &pcfg_pull_none>,
+                                               <3 RK_PD4 3 &pcfg_pull_none>,
+                                               <3 RK_PD5 3 &pcfg_pull_none>,
+                                               <4 RK_PA0 3 &pcfg_pull_none>,
+                                               <4 RK_PA5 3 &pcfg_pull_none>,
+                                               <4 RK_PA4 3 &pcfg_pull_none>,
+                                               <4 RK_PA1 3 &pcfg_pull_none>,
+                                               <4 RK_PA2 3 &pcfg_pull_none>,
+                                               <4 RK_PA3 3 &pcfg_pull_none>;
                        };
                };
 
                spdif {
                        spdif_tx: spdif-tx {
-                               rockchip,pins = <RK_GPIO6 11 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <6 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
        };
index 1c4507b..b1db924 100644 (file)
@@ -37,7 +37,6 @@
 &emmc {
        bus-width = <8>;
        cap-mmc-highspeed;
-       disable-wp;
        no-sd;
        no-sdio;
        non-removable;
index f47ac86..5876690 100644 (file)
 
                emmc {
                        emmc_bus8: emmc-bus8 {
-                               rockchip,pins = <2 RK_PA0 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA1 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA2 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA3 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA5 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA6 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                               <2 RK_PA7 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                               rockchip,pins = <2 RK_PA0 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA1 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA2 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA3 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA4 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA5 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA6 2 &pcfg_pull_up_drv_8ma>,
+                                               <2 RK_PA7 2 &pcfg_pull_up_drv_8ma>;
                        };
 
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <2 RK_PB6 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                               rockchip,pins = <2 RK_PB6 1 &pcfg_pull_none_drv_8ma>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <2 RK_PB4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                               rockchip,pins = <2 RK_PB4 2 &pcfg_pull_up_drv_8ma>;
                        };
                };
 
                gmac {
                        rmii_pins: rmii-pins {
-                               rockchip,pins = <1 RK_PC5 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 RK_PC3 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 RK_PC4 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 RK_PB2 RK_FUNC_3 &pcfg_pull_none_drv_12ma>,
-                                               <1 RK_PB3 RK_FUNC_3 &pcfg_pull_none_drv_12ma>,
-                                               <1 RK_PB4 RK_FUNC_3 &pcfg_pull_none_drv_12ma>,
-                                               <1 RK_PB5 RK_FUNC_3 &pcfg_pull_none>,
-                                               <1 RK_PB6 RK_FUNC_3 &pcfg_pull_none>,
-                                               <1 RK_PB7 RK_FUNC_3 &pcfg_pull_none>,
-                                               <1 RK_PC2 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC5 2 &pcfg_pull_none>,
+                                               <1 RK_PC3 2 &pcfg_pull_none>,
+                                               <1 RK_PC4 2 &pcfg_pull_none>,
+                                               <1 RK_PB2 3 &pcfg_pull_none_drv_12ma>,
+                                               <1 RK_PB3 3 &pcfg_pull_none_drv_12ma>,
+                                               <1 RK_PB4 3 &pcfg_pull_none_drv_12ma>,
+                                               <1 RK_PB5 3 &pcfg_pull_none>,
+                                               <1 RK_PB6 3 &pcfg_pull_none>,
+                                               <1 RK_PB7 3 &pcfg_pull_none>,
+                                               <1 RK_PC2 3 &pcfg_pull_none>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <0 RK_PB1 RK_FUNC_1 &pcfg_pull_none_smt>,
-                                               <0 RK_PB2 RK_FUNC_1 &pcfg_pull_none_smt>;
+                               rockchip,pins = <0 RK_PB1 1 &pcfg_pull_none_smt>,
+                                               <0 RK_PB2 1 &pcfg_pull_none_smt>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <2 RK_PD3 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 RK_PD4 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PD3 1 &pcfg_pull_up>,
+                                               <2 RK_PD4 1 &pcfg_pull_up>;
                        };
                };
 
                i2c2m1 {
                        i2c2m1_xfer: i2c2m1-xfer {
-                               rockchip,pins = <0 RK_PC2 RK_FUNC_2 &pcfg_pull_none>,
-                                               <0 RK_PC6 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC2 2 &pcfg_pull_none>,
+                                               <0 RK_PC6 3 &pcfg_pull_none>;
                        };
 
                        i2c2m1_gpio: i2c2m1-gpio {
 
                i2c2m05v {
                        i2c2m05v_xfer: i2c2m05v-xfer {
-                               rockchip,pins = <1 RK_PD5 RK_FUNC_2 &pcfg_pull_none>,
-                                               <1 RK_PD4 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD5 2 &pcfg_pull_none>,
+                                               <1 RK_PD4 2 &pcfg_pull_none>;
                        };
 
                        i2c2m05v_gpio: i2c2m05v-gpio {
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <0 RK_PB6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 RK_PC4 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB6 1 &pcfg_pull_none>,
+                                               <0 RK_PC4 2 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins = <0 RK_PC5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins = <0 RK_PC4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
-                               rockchip,pins = <0 RK_PC6 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC6 1 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_pin: pwm3-pin {
-                               rockchip,pins = <0 RK_PC0 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC0 1 &pcfg_pull_none>;
                        };
                };
 
                pwm4 {
                        pwm4_pin: pwm4-pin {
-                               rockchip,pins = <1 RK_PC1 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC1 3 &pcfg_pull_none>;
                        };
                };
 
                pwm5 {
                        pwm5_pin: pwm5-pin {
-                               rockchip,pins = <1 RK_PA7 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA7 2 &pcfg_pull_none>;
                        };
                };
 
                pwm6 {
                        pwm6_pin: pwm6-pin {
-                               rockchip,pins = <1 RK_PB0 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB0 2 &pcfg_pull_none>;
                        };
                };
 
                pwm7 {
                        pwm7_pin: pwm7-pin {
-                               rockchip,pins = <1 RK_PB1 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PB1 2 &pcfg_pull_none>;
                        };
                };
 
                sdmmc {
                        sdmmc_clk: sdmmc-clk {
-                               rockchip,pins = <3 RK_PC4 RK_FUNC_1 &pcfg_pull_none_drv_4ma>;
+                               rockchip,pins = <3 RK_PC4 1 &pcfg_pull_none_drv_4ma>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
-                               rockchip,pins = <3 RK_PC5 RK_FUNC_1 &pcfg_pull_up_drv_4ma>;
+                               rockchip,pins = <3 RK_PC5 1 &pcfg_pull_up_drv_4ma>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
-                               rockchip,pins = <0 RK_PA1 RK_FUNC_1 &pcfg_pull_up_drv_4ma>;
+                               rockchip,pins = <0 RK_PA1 1 &pcfg_pull_up_drv_4ma>;
                        };
 
                        sdmmc_bus1: sdmmc-bus1 {
-                               rockchip,pins = <3 RK_PC3 RK_FUNC_1 &pcfg_pull_up_drv_4ma>;
+                               rockchip,pins = <3 RK_PC3 1 &pcfg_pull_up_drv_4ma>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
-                               rockchip,pins = <3 RK_PC3 RK_FUNC_1 &pcfg_pull_up_drv_4ma>,
-                                               <3 RK_PC2 RK_FUNC_1 &pcfg_pull_up_drv_4ma>,
-                                               <3 RK_PC1 RK_FUNC_1 &pcfg_pull_up_drv_4ma>,
-                                               <3 RK_PC0 RK_FUNC_1 &pcfg_pull_up_drv_4ma>;
+                               rockchip,pins = <3 RK_PC3 1 &pcfg_pull_up_drv_4ma>,
+                                               <3 RK_PC2 1 &pcfg_pull_up_drv_4ma>,
+                                               <3 RK_PC1 1 &pcfg_pull_up_drv_4ma>,
+                                               <3 RK_PC0 1 &pcfg_pull_up_drv_4ma>;
                        };
                };
 
                spim0 {
                        spim0_clk: spim0-clk {
-                               rockchip,pins = <1 RK_PD0 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD0 2 &pcfg_pull_up>;
                        };
 
                        spim0_cs0: spim0-cs0 {
-                               rockchip,pins = <1 RK_PD1 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD1 2 &pcfg_pull_up>;
                        };
 
                        spim0_tx: spim0-tx {
-                               rockchip,pins = <1 RK_PD3 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD3 2 &pcfg_pull_up>;
                        };
 
                        spim0_rx: spim0-rx {
-                               rockchip,pins = <1 RK_PD2 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD2 2 &pcfg_pull_up>;
                        };
                };
 
                spim1 {
                        spim1_clk: spim1-clk {
-                               rockchip,pins = <0 RK_PA3 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PA3 1 &pcfg_pull_up>;
                        };
 
                        spim1_cs0: spim1-cs0 {
-                               rockchip,pins = <0 RK_PA4 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PA4 1 &pcfg_pull_up>;
                        };
 
                        spim1_rx: spim1-rx {
-                               rockchip,pins = <0 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB0 1 &pcfg_pull_up>;
                        };
 
                        spim1_tx: spim1-tx {
-                               rockchip,pins = <0 RK_PA7 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PA7 1 &pcfg_pull_up>;
                        };
                };
 
                tsadc {
                        otp_out: otp-out {
-                               rockchip,pins = <0 RK_PB7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB7 1 &pcfg_pull_none>;
                        };
 
                        otp_gpio: otp-gpio {
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <3 RK_PA6 RK_FUNC_1 &pcfg_pull_up>,
-                                               <3 RK_PA5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA6 1 &pcfg_pull_up>,
+                                               <3 RK_PA5 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <3 RK_PA4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA4 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <3 RK_PA3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA3 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts_gpio: uart0-rts-gpio {
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <1 RK_PD3 RK_FUNC_1 &pcfg_pull_up>,
-                                               <1 RK_PD2 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD3 1 &pcfg_pull_up>,
+                                               <1 RK_PD2 1 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <1 RK_PD0 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD0 1 &pcfg_pull_none>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <1 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD1 1 &pcfg_pull_none>;
                        };
                };
 
                uart2m0 {
                        uart2m0_xfer: uart2m0-xfer {
-                               rockchip,pins = <2 RK_PD2 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD2 1 &pcfg_pull_up>,
+                                               <2 RK_PD1 1 &pcfg_pull_none>;
                        };
                };
 
                uart2m1 {
                        uart2m1_xfer: uart2m1-xfer {
-                               rockchip,pins = <3 RK_PC3 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 RK_PC2 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC3 2 &pcfg_pull_up>,
+                                               <3 RK_PC2 2 &pcfg_pull_none>;
                        };
                };
 
                uart2_5v {
                        uart2_5v_cts: uart2_5v-cts {
-                               rockchip,pins = <1 RK_PD4 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD4 1 &pcfg_pull_none>;
                        };
 
                        uart2_5v_rts: uart2_5v-rts {
-                               rockchip,pins = <1 RK_PD5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PD5 1 &pcfg_pull_none>;
                        };
                };
        };
index eb6d192..fbbd937 100644 (file)
                vdd_core-supply = <&ldo14_reg>;
 
                clock-frequency = <16000000>;
-               clocks = <&clock_cam 0>;
+               clocks = <&camera 0>;
                clock-names = "mclk";
                nreset-gpios = <&gpb 2 0>;
                nstby-gpios = <&gpb 0 0>;
index a44d5eb..2ad642f 100644 (file)
                        clock-names = "sclk_cam0", "sclk_cam1";
                        #address-cells = <1>;
                        #size-cells = <1>;
+                       #clock-cells = <1>;
+                       clock-output-names = "cam_a_clkout", "cam_b_clkout";
                        ranges;
 
-                       clock_cam: clock-controller {
-                               #clock-cells = <1>;
-                       };
-
                        csis0: csis@fa600000 {
                                compatible = "samsung,s5pv210-csis";
                                reg = <0xfa600000 0x4000>;
index d159ee4..2e2c1a7 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * sama5d2.dtsi - Device Tree Include file for SAMA5D2 family SoC
  *
  *  Copyright (C) 2015 Atmel,
  *                2015 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include <dt-bindings/dma/at91.h>
                                ranges = <0 0xf8044000 0x1420>;
                        };
 
-                       rstc@f8048000 {
+                       reset_controller: rstc@f8048000 {
                                compatible = "atmel,sama5d3-rstc";
                                reg = <0xf8048000 0x10>;
                                clocks = <&clk32k>;
                        };
 
-                       shdwc@f8048010 {
+                       shutdown_controller: shdwc@f8048010 {
                                compatible = "atmel,sama5d2-shdwc";
                                reg = <0xf8048010 0x10>;
                                clocks = <&clk32k>;
                                clocks = <&pmc PMC_TYPE_CORE PMC_MCK2>;
                        };
 
-                       watchdog@f8048040 {
+                       watchdog: watchdog@f8048040 {
                                compatible = "atmel,sama5d4-wdt";
                                reg = <0xf8048040 0x10>;
                                interrupts = <4 IRQ_TYPE_LEVEL_HIGH 7>;
index 0219877..3bbc84b 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC
  *                applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36 SoC
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <dt-bindings/dma/at91.h>
index 883878b..cbe8f27 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d31.dtsi - Device Tree Include file for SAMA5D31 SoC
  *
  *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_lcd.dtsi"
index 25e4c0b..10fc80d 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d31ek.dts - Device Tree file for SAMA5D31-EK board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d31.dtsi"
index 4b4434a..146fd59 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d33.dtsi - Device Tree Include file for SAMA5D33 SoC
  *
  *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_lcd.dtsi"
index c517b87..7d4ae16 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d33ek.dts - Device Tree file for SAMA5D33-EK board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d33.dtsi"
index aa01573..132918c 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d34.dtsi - Device Tree Include file for SAMA5D34 SoC
  *
  *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_lcd.dtsi"
index 15d5c46..2335bf9 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d34ek.dts - Device Tree file for SAMA5D34-EK board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d34.dtsi"
index 16c39f4..b2ccfa7 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d35.dtsi - Device Tree Include file for SAMA5D35 SoC
  *
  *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_gmac.dtsi"
index 6e261fc..8edfceb 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d35ek.dts - Device Tree file for SAMA5D35-EK board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d35.dtsi"
index e85139e..5d88f99 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d36.dtsi - Device Tree Include file for SAMA5D36 SoC
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Josh Wu <josh.wu@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_can.dtsi"
index cd458b8..26950f9 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d36ek.dts - Device Tree file for SAMA5D36-EK board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Josh Wu <josh.wu@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "sama5d36.dtsi"
index b632143..66695b9 100644 (file)
@@ -1,45 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * sama5d36ek_cmp.dts - Device Tree file for SAMA5D36-EK CMP board
  *
  *  Copyright (C) 2016 Atmel,
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 /dts-v1/;
 #include "sama5d36.dtsi"
index 3311a88..65566e4 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3xcm.dtsi - Device Tree Include file for SAMA5D3x CPU Module
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index a02f590..9d25636 100644 (file)
@@ -1,45 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * sama5d3xcm_cmp.dtsi - Device Tree Include file for SAMA5D36 CMP CPU Module
  *
  *  Copyright (C) 2016 Atmel,
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 / {
index 035ab72..3c1c4d6 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3dm.dtsi - Device Tree file for SAMA5 display module
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index ef0f2d0..35031bb 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3xmb.dts - Device Tree file for SAMA5D3x mother board
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include "sama5d3xcm.dtsi"
 
index 97e171d..8a6916a 100644 (file)
@@ -1,45 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * sama5d3xmb_cmp.dts - Device Tree file for SAMA5D3x CMP mother board
  *
  *  Copyright (C) 2016 Atmel,
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 #include "sama5d3xcm_cmp.dtsi"
 
index 2fd14f3..a5dd41c 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3xmb_emac.dts - Device Tree Include file for SAMA5D3x mother board
  * Ethernet
  *
  *  Copyright (C) 2016 Atmel,
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index 65aea7a..d750da3 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * sama5d3xmb_gmac.dtsi - Device Tree Include file for SAMA5D3x motherboard
  * Gigabit Ethernet
  *
  *  Copyright (C) 2016 Atmel,
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index 6c1e41f..6ab27a7 100644 (file)
@@ -1,46 +1,9 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * sama5d4.dtsi - Device Tree Include file for SAMA5D4 family SoC
  *
  *  Copyright (C) 2014 Atmel,
  *                2014 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2 of the
- *     License, or (at your option) any later version.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include <dt-bindings/clock/at91.h>
index df2bab1..64dc079 100644 (file)
@@ -9,6 +9,7 @@
 &mmc {
        status = "okay";
        cap-sd-highspeed;
+       cap-mmc-highspeed;
        broken-cd;
        bus-width = <4>;
 };
index e6ed7c0..81fabf0 100644 (file)
                        status = "disabled";
                };
 
+               gpu@a0300000 {
+                       /*
+                        * This block is referred to as "Smart Graphics Adapter SGA500"
+                        * in documentation but is in practice a pretty straight-forward
+                        * MALI-400 GPU block.
+                        */
+                       compatible = "stericsson,db8500-mali", "arm,mali-400";
+                       reg = <0xa0300000 0x10000>;
+                       interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "gp",
+                                         "gpmmu",
+                                         "pp0",
+                                         "ppmmu0",
+                                         "combined";
+                       clocks = <&prcmu_clk PRCMU_ACLK>, <&prcmu_clk PRCMU_SGACLK>;
+                       clock-names = "bus", "core";
+                       mali-supply = <&db8500_sga_reg>;
+                       power-domains = <&pm_domains DOMAIN_VAPE>;
+               };
+
                mcde@a0350000 {
-                       compatible = "stericsson,mcde";
-                       reg = <0xa0350000 0x1000>, /* MCDE */
-                             <0xa0351000 0x1000>, /* DSI link 1 */
-                             <0xa0352000 0x1000>, /* DSI link 2 */
-                             <0xa0353000 0x1000>; /* DSI link 3 */
+                       compatible = "ste,mcde";
+                       reg = <0xa0350000 0x1000>;
                        interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
+                       epod-supply = <&db8500_b2r2_mcde_reg>;
+                       vana-supply = <&ab8500_ldo_ana_reg>;
                        clocks = <&prcmu_clk PRCMU_MCDECLK>, /* Main MCDE clock */
                                 <&prcmu_clk PRCMU_LCDCLK>, /* LCD clock */
-                                <&prcmu_clk PRCMU_PLLDSI>, /* HDMI clock */
-                                <&prcmu_clk PRCMU_DSI0CLK>, /* DSI 0 */
-                                <&prcmu_clk PRCMU_DSI1CLK>, /* DSI 1 */
-                                <&prcmu_clk PRCMU_DSI0ESCCLK>, /* TVout clock 0 */
-                                <&prcmu_clk PRCMU_DSI1ESCCLK>, /* TVout clock 1 */
-                                <&prcmu_clk PRCMU_DSI2ESCCLK>; /* TVout clock 2 */
+                                <&prcmu_clk PRCMU_PLLDSI>; /* HDMI clock */
+                       clock-names = "mcde", "lcd", "hdmi";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+                       status = "disabled";
+
+                       dsi0: dsi@a0351000 {
+                               compatible = "ste,mcde-dsi";
+                               reg = <0xa0351000 0x1000>;
+                               vana-supply = <&ab8500_ldo_ana_reg>;
+                               clocks = <&prcmu_clk PRCMU_DSI0CLK>, <&prcmu_clk PRCMU_DSI0ESCCLK>;
+                               clock-names = "hs", "lp";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+                       dsi1: dsi@a0352000 {
+                               compatible = "ste,mcde-dsi";
+                               reg = <0xa0352000 0x1000>;
+                               vana-supply = <&ab8500_ldo_ana_reg>;
+                               clocks = <&prcmu_clk PRCMU_DSI1CLK>, <&prcmu_clk PRCMU_DSI1ESCCLK>;
+                               clock-names = "hs", "lp";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+                       dsi2: dsi@a0353000 {
+                               compatible = "ste,mcde-dsi";
+                               reg = <0xa0353000 0x1000>;
+                               vana-supply = <&ab8500_ldo_ana_reg>;
+                               /* This DSI port only has the Low Power / Energy Save clock */
+                               clocks = <&prcmu_clk PRCMU_DSI2ESCCLK>;
+                               clock-names = "lp";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
                };
 
                cryp@a03cb000 {
index 35e944d..eeaea21 100644 (file)
                                };
                        };
                };
+
+               mcde@a0350000 {
+                       status = "okay";
+
+                       dsi@a0351000 {
+                               panel {
+                                       compatible = "samsung,s6d16d0";
+                                       reg = <0>;
+                                       vdd1-supply = <&ab8500_ldo_aux1_reg>;
+                                       reset-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
+                               };
+                       };
+               };
        };
 };
index 0e7d77d..7686844 100644 (file)
                                };
                        };
                };
+
+               mcde@a0350000 {
+                       status = "okay";
+
+                       dsi@a0351000 {
+                               panel {
+                                       compatible = "samsung,s6d16d0";
+                                       reg = <0>;
+                                       vdd1-supply = <&ab8500_ldo_aux1_reg>;
+                                       reset-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
+                               };
+                       };
+               };
        };
 };
index 588b6ef..4a49544 100644 (file)
        };
 
        soc {
+               romem: nvmem@1fff7800 {
+                       compatible = "st,stm32f4-otp";
+                       reg = <0x1fff7800 0x400>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ts_cal1: calib@22c {
+                               reg = <0x22c 0x2>;
+                       };
+                       ts_cal2: calib@22e {
+                               reg = <0x22e 0x2>;
+                       };
+               };
+
                timer2: timer@40000000 {
                        compatible = "st,stm32-timer";
                        reg = <0x40000000 0x400>;
index 3c72168..6f1d0ac 100644 (file)
        };
 };
 
+&rcc {
+       compatible = "st,stm32f769-rcc", "st,stm32f746-rcc", "st,stm32-rcc";
+};
+
 &cec {
        pinctrl-0 = <&cec_pins_a>;
        pinctrl-names = "default";
index 980b276..e44e7ba 100644 (file)
                                };
                        };
 
+                       sdmmc1_b4_pins_a: sdmmc1-b4-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1_CK */
+                                                <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-disable;
+                               };
+                       };
+
+                       sdmmc1_b4_od_pins_a: sdmmc1-b4-od-0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-disable;
+                               };
+                               pins2{
+                                       pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+                                       slew-rate = <3>;
+                                       drive-open-drain;
+                                       bias-disable;
+                               };
+                       };
+
+                       sdmmc1_b4_sleep_pins_a: sdmmc1-b4-sleep-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 8, ANALOG)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, ANALOG)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, ANALOG)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, ANALOG)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, ANALOG)>, /* SDMMC1_CK */
+                                                <STM32_PINMUX('D', 2, ANALOG)>; /* SDMMC1_CMD */
+                               };
+                       };
+
+                       sdmmc1_dir_pins_a: sdmmc1-dir-0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('C', 6, AF8)>, /* SDMMC1_D0DIR */
+                                                <STM32_PINMUX('C', 7, AF8)>, /* SDMMC1_D123DIR */
+                                                <STM32_PINMUX('B', 9, AF7)>; /* SDMMC1_CDIR */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-pull-up;
+                               };
+                               pins2{
+                                       pinmux = <STM32_PINMUX('B', 8, AF7)>; /* SDMMC1_CKIN */
+                                       bias-pull-up;
+                               };
+                       };
+
+                       sdmmc1_dir_sleep_pins_a: sdmmc1-dir-sleep-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 6, ANALOG)>, /* SDMMC1_D0DIR */
+                                                <STM32_PINMUX('C', 7, ANALOG)>, /* SDMMC1_D123DIR */
+                                                <STM32_PINMUX('B', 9, ANALOG)>, /* SDMMC1_CDIR */
+                                                <STM32_PINMUX('B', 8, ANALOG)>; /* SDMMC1_CKIN */
+                               };
+                       };
+
                        usart1_pins: usart1@0 {
                                pins1 {
                                        pinmux = <STM32_PINMUX('B', 14, AF4)>; /* USART1_TX */
index 5cac79e..c065266 100644 (file)
                        dma-requests = <32>;
                };
 
+               sdmmc1: sdmmc@52007000 {
+                       compatible = "arm,pl18x", "arm,primecell";
+                       arm,primecell-periphid = <0x10153180>;
+                       reg = <0x52007000 0x1000>;
+                       interrupts = <49>;
+                       interrupt-names = "cmd_irq";
+                       clocks = <&rcc SDMMC1_CK>;
+                       clock-names = "apb_pclk";
+                       resets = <&rcc STM32H7_AHB3_RESET(SDMMC1)>;
+                       cap-sd-highspeed;
+                       cap-mmc-highspeed;
+                       max-frequency = <120000000>;
+               };
+
                exti: interrupt-controller@58000000 {
                        compatible = "st,stm32h7-exti";
                        interrupt-controller;
index dd06c8f..3acd2e9 100644 (file)
        aliases {
                serial0 = &usart2;
        };
+
+       v3v3: regulator-v3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "v3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
 };
 
 &clk_hse {
        };
 };
 
+&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>;
+       broken-cd;
+       st,neg-edge;
+       bus-width = <4>;
+       vmmc-supply = <&v3v3>;
+       status = "okay";
+};
+
 &usart2 {
        pinctrl-0 = <&usart2_pins>;
        pinctrl-names = "default";
index ebc3f09..ab78ad5 100644 (file)
                regulator-always-on;
        };
 
+       v2v9_sd: regulator-v2v9_sd {
+               compatible = "regulator-fixed";
+               regulator-name = "v2v9_sd";
+               regulator-min-microvolt = <2900000>;
+               regulator-max-microvolt = <2900000>;
+               regulator-always-on;
+       };
+
        usbotg_hs_phy: usb-phy {
                #phy-cells = <0>;
                compatible = "usb-nop-xceiv";
                clocks = <&rcc USB1ULPI_CK>;
                clock-names = "main_clk";
        };
-
 };
 
 &adc_12 {
        };
 };
 
+&sdmmc1 {
+       pinctrl-names = "default", "opendrain", "sleep";
+       pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
+       pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
+       pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
+       broken-cd;
+       st,sig-dir;
+       st,neg-edge;
+       st,use-ckin;
+       bus-width = <4>;
+       vmmc-supply = <&v2v9_sd>;
+       status = "okay";
+};
+
 &usart1 {
        pinctrl-0 = <&usart1_pins>;
        pinctrl-names = "default";
index 9ec4694..85c417d 100644 (file)
                                };
                        };
 
+                       cec_pins_sleep_a: cec-sleep-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('A', 15, ANALOG)>; /* HDMI_CEC */
+                               };
+                       };
+
+                       cec_pins_b: cec-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('B', 6, AF5)>;
+                                       bias-disable;
+                                       drive-open-drain;
+                                       slew-rate = <0>;
+                               };
+                       };
+
+                       cec_pins_sleep_b: cec-sleep-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('B', 6, ANALOG)>; /* HDMI_CEC */
+                               };
+                       };
+
                        ethernet0_rgmii_pins_a: rgmii-0 {
                                pins1 {
                                        pinmux = <STM32_PINMUX('G', 5, AF11)>, /* ETH_RGMII_CLK125 */
                                };
                        };
 
+                       i2c1_pins_sleep_a: i2c1-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('D', 12, ANALOG)>, /* I2C1_SCL */
+                                                <STM32_PINMUX('F', 15, ANALOG)>; /* I2C1_SDA */
+                               };
+                       };
+
                        i2c2_pins_a: i2c2-0 {
                                pins {
                                        pinmux = <STM32_PINMUX('H', 4, AF4)>, /* I2C2_SCL */
                                };
                        };
 
+                       i2c2_pins_sleep_a: i2c2-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('H', 4, ANALOG)>, /* I2C2_SCL */
+                                                <STM32_PINMUX('H', 5, ANALOG)>; /* I2C2_SDA */
+                               };
+                       };
+
                        i2c5_pins_a: i2c5-0 {
                                pins {
                                        pinmux = <STM32_PINMUX('A', 11, AF4)>, /* I2C5_SCL */
                                };
                        };
 
+                       i2c5_pins_sleep_a: i2c5-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('A', 11, ANALOG)>, /* I2C5_SCL */
+                                                <STM32_PINMUX('A', 12, ANALOG)>; /* I2C5_SDA */
+
+                               };
+                       };
+
+                       ltdc_pins_a: ltdc-a-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('G',  7, AF14)>, /* LCD_CLK */
+                                                <STM32_PINMUX('I', 10, AF14)>, /* LCD_HSYNC */
+                                                <STM32_PINMUX('I',  9, AF14)>, /* LCD_VSYNC */
+                                                <STM32_PINMUX('F', 10, AF14)>, /* LCD_DE */
+                                                <STM32_PINMUX('H',  2, AF14)>, /* LCD_R0 */
+                                                <STM32_PINMUX('H',  3, AF14)>, /* LCD_R1 */
+                                                <STM32_PINMUX('H',  8, AF14)>, /* LCD_R2 */
+                                                <STM32_PINMUX('H',  9, AF14)>, /* LCD_R3 */
+                                                <STM32_PINMUX('H', 10, AF14)>, /* LCD_R4 */
+                                                <STM32_PINMUX('C',  0, AF14)>, /* LCD_R5 */
+                                                <STM32_PINMUX('H', 12, AF14)>, /* LCD_R6 */
+                                                <STM32_PINMUX('E', 15, AF14)>, /* LCD_R7 */
+                                                <STM32_PINMUX('E',  5, AF14)>, /* LCD_G0 */
+                                                <STM32_PINMUX('E',  6, AF14)>, /* LCD_G1 */
+                                                <STM32_PINMUX('H', 13, AF14)>, /* LCD_G2 */
+                                                <STM32_PINMUX('H', 14, AF14)>, /* LCD_G3 */
+                                                <STM32_PINMUX('H', 15, AF14)>, /* LCD_G4 */
+                                                <STM32_PINMUX('I',  0, AF14)>, /* LCD_G5 */
+                                                <STM32_PINMUX('I',  1, AF14)>, /* LCD_G6 */
+                                                <STM32_PINMUX('I',  2, AF14)>, /* LCD_G7 */
+                                                <STM32_PINMUX('D',  9, AF14)>, /* LCD_B0 */
+                                                <STM32_PINMUX('G', 12, AF14)>, /* LCD_B1 */
+                                                <STM32_PINMUX('G', 10, AF14)>, /* LCD_B2 */
+                                                <STM32_PINMUX('D', 10, AF14)>, /* LCD_B3 */
+                                                <STM32_PINMUX('I',  4, AF14)>, /* LCD_B4 */
+                                                <STM32_PINMUX('A',  3, AF14)>, /* LCD_B5 */
+                                                <STM32_PINMUX('B',  8, AF14)>, /* LCD_B6 */
+                                                <STM32_PINMUX('D',  8, AF14)>; /* LCD_B7 */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <1>;
+                               };
+                       };
+
+                       ltdc_pins_sleep_a: ltdc-a-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('G',  7, ANALOG)>, /* LCD_CLK */
+                                                <STM32_PINMUX('I', 10, ANALOG)>, /* LCD_HSYNC */
+                                                <STM32_PINMUX('I',  9, ANALOG)>, /* LCD_VSYNC */
+                                                <STM32_PINMUX('F', 10, ANALOG)>, /* LCD_DE */
+                                                <STM32_PINMUX('H',  2, ANALOG)>, /* LCD_R0 */
+                                                <STM32_PINMUX('H',  3, ANALOG)>, /* LCD_R1 */
+                                                <STM32_PINMUX('H',  8, ANALOG)>, /* LCD_R2 */
+                                                <STM32_PINMUX('H',  9, ANALOG)>, /* LCD_R3 */
+                                                <STM32_PINMUX('H', 10, ANALOG)>, /* LCD_R4 */
+                                                <STM32_PINMUX('C',  0, ANALOG)>, /* LCD_R5 */
+                                                <STM32_PINMUX('H', 12, ANALOG)>, /* LCD_R6 */
+                                                <STM32_PINMUX('E', 15, ANALOG)>, /* LCD_R7 */
+                                                <STM32_PINMUX('E',  5, ANALOG)>, /* LCD_G0 */
+                                                <STM32_PINMUX('E',  6, ANALOG)>, /* LCD_G1 */
+                                                <STM32_PINMUX('H', 13, ANALOG)>, /* LCD_G2 */
+                                                <STM32_PINMUX('H', 14, ANALOG)>, /* LCD_G3 */
+                                                <STM32_PINMUX('H', 15, ANALOG)>, /* LCD_G4 */
+                                                <STM32_PINMUX('I',  0, ANALOG)>, /* LCD_G5 */
+                                                <STM32_PINMUX('I',  1, ANALOG)>, /* LCD_G6 */
+                                                <STM32_PINMUX('I',  2, ANALOG)>, /* LCD_G7 */
+                                                <STM32_PINMUX('D',  9, ANALOG)>, /* LCD_B0 */
+                                                <STM32_PINMUX('G', 12, ANALOG)>, /* LCD_B1 */
+                                                <STM32_PINMUX('G', 10, ANALOG)>, /* LCD_B2 */
+                                                <STM32_PINMUX('D', 10, ANALOG)>, /* LCD_B3 */
+                                                <STM32_PINMUX('I',  4, ANALOG)>, /* LCD_B4 */
+                                                <STM32_PINMUX('A',  3, ANALOG)>, /* LCD_B5 */
+                                                <STM32_PINMUX('B',  8, ANALOG)>, /* LCD_B6 */
+                                                <STM32_PINMUX('D',  8, ANALOG)>; /* LCD_B7 */
+                               };
+                       };
+
+                       ltdc_pins_b: ltdc-b-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('I', 14, AF14)>, /* LCD_CLK */
+                                                <STM32_PINMUX('I', 12, AF14)>, /* LCD_HSYNC */
+                                                <STM32_PINMUX('I', 13, AF14)>, /* LCD_VSYNC */
+                                                <STM32_PINMUX('K',  7, AF14)>, /* LCD_DE */
+                                                <STM32_PINMUX('I', 15, AF14)>, /* LCD_R0 */
+                                                <STM32_PINMUX('J',  0, AF14)>, /* LCD_R1 */
+                                                <STM32_PINMUX('J',  1, AF14)>, /* LCD_R2 */
+                                                <STM32_PINMUX('J',  2, AF14)>, /* LCD_R3 */
+                                                <STM32_PINMUX('J',  3, AF14)>, /* LCD_R4 */
+                                                <STM32_PINMUX('J',  4, AF14)>, /* LCD_R5 */
+                                                <STM32_PINMUX('J',  5, AF14)>, /* LCD_R6 */
+                                                <STM32_PINMUX('J',  6, AF14)>, /* LCD_R7 */
+                                                <STM32_PINMUX('J',  7, AF14)>, /* LCD_G0 */
+                                                <STM32_PINMUX('J',  8, AF14)>, /* LCD_G1 */
+                                                <STM32_PINMUX('J',  9, AF14)>, /* LCD_G2 */
+                                                <STM32_PINMUX('J', 10, AF14)>, /* LCD_G3 */
+                                                <STM32_PINMUX('J', 11, AF14)>, /* LCD_G4 */
+                                                <STM32_PINMUX('K',  0, AF14)>, /* LCD_G5 */
+                                                <STM32_PINMUX('K',  1, AF14)>, /* LCD_G6 */
+                                                <STM32_PINMUX('K',  2, AF14)>, /* LCD_G7 */
+                                                <STM32_PINMUX('J', 12, AF14)>, /* LCD_B0 */
+                                                <STM32_PINMUX('J', 13, AF14)>, /* LCD_B1 */
+                                                <STM32_PINMUX('J', 14, AF14)>, /* LCD_B2 */
+                                                <STM32_PINMUX('J', 15, AF14)>, /* LCD_B3 */
+                                                <STM32_PINMUX('K',  3, AF14)>, /* LCD_B4 */
+                                                <STM32_PINMUX('K',  4, AF14)>, /* LCD_B5 */
+                                                <STM32_PINMUX('K',  5, AF14)>, /* LCD_B6 */
+                                                <STM32_PINMUX('K',  6, AF14)>; /* LCD_B7 */
+                                       bias-disable;
+                                       drive-push-pull;
+                                       slew-rate = <1>;
+                               };
+                       };
+
+                       ltdc_pins_sleep_b: ltdc-b-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('I', 14, ANALOG)>, /* LCD_CLK */
+                                                <STM32_PINMUX('I', 12, ANALOG)>, /* LCD_HSYNC */
+                                                <STM32_PINMUX('I', 13, ANALOG)>, /* LCD_VSYNC */
+                                                <STM32_PINMUX('K',  7, ANALOG)>, /* LCD_DE */
+                                                <STM32_PINMUX('I', 15, ANALOG)>, /* LCD_R0 */
+                                                <STM32_PINMUX('J',  0, ANALOG)>, /* LCD_R1 */
+                                                <STM32_PINMUX('J',  1, ANALOG)>, /* LCD_R2 */
+                                                <STM32_PINMUX('J',  2, ANALOG)>, /* LCD_R3 */
+                                                <STM32_PINMUX('J',  3, ANALOG)>, /* LCD_R4 */
+                                                <STM32_PINMUX('J',  4, ANALOG)>, /* LCD_R5 */
+                                                <STM32_PINMUX('J',  5, ANALOG)>, /* LCD_R6 */
+                                                <STM32_PINMUX('J',  6, ANALOG)>, /* LCD_R7 */
+                                                <STM32_PINMUX('J',  7, ANALOG)>, /* LCD_G0 */
+                                                <STM32_PINMUX('J',  8, ANALOG)>, /* LCD_G1 */
+                                                <STM32_PINMUX('J',  9, ANALOG)>, /* LCD_G2 */
+                                                <STM32_PINMUX('J', 10, ANALOG)>, /* LCD_G3 */
+                                                <STM32_PINMUX('J', 11, ANALOG)>, /* LCD_G4 */
+                                                <STM32_PINMUX('K',  0, ANALOG)>, /* LCD_G5 */
+                                                <STM32_PINMUX('K',  1, ANALOG)>, /* LCD_G6 */
+                                                <STM32_PINMUX('K',  2, ANALOG)>, /* LCD_G7 */
+                                                <STM32_PINMUX('J', 12, ANALOG)>, /* LCD_B0 */
+                                                <STM32_PINMUX('J', 13, ANALOG)>, /* LCD_B1 */
+                                                <STM32_PINMUX('J', 14, ANALOG)>, /* LCD_B2 */
+                                                <STM32_PINMUX('J', 15, ANALOG)>, /* LCD_B3 */
+                                                <STM32_PINMUX('K',  3, ANALOG)>, /* LCD_B4 */
+                                                <STM32_PINMUX('K',  4, ANALOG)>, /* LCD_B5 */
+                                                <STM32_PINMUX('K',  5, ANALOG)>, /* LCD_B6 */
+                                                <STM32_PINMUX('K',  6, ANALOG)>; /* LCD_B7 */
+                               };
+                       };
+
                        m_can1_pins_a: m-can1-0 {
                                pins1 {
                                        pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */
                                };
                        };
 
+                       sdmmc1_b4_pins_a: sdmmc1-b4-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>, /* SDMMC1_CK */
+                                                <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-disable;
+                               };
+                       };
+
+                       sdmmc1_b4_od_pins_a: sdmmc1-b4-od-0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-disable;
+                               };
+                               pins2{
+                                       pinmux = <STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
+                                       slew-rate = <3>;
+                                       drive-open-drain;
+                                       bias-disable;
+                               };
+                       };
+
+                       sdmmc1_b4_sleep_pins_a: sdmmc1-b4-sleep-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('C', 8, ANALOG)>, /* SDMMC1_D0 */
+                                                <STM32_PINMUX('C', 9, ANALOG)>, /* SDMMC1_D1 */
+                                                <STM32_PINMUX('C', 10, ANALOG)>, /* SDMMC1_D2 */
+                                                <STM32_PINMUX('C', 11, ANALOG)>, /* SDMMC1_D3 */
+                                                <STM32_PINMUX('C', 12, ANALOG)>, /* SDMMC1_CK */
+                                                <STM32_PINMUX('D', 2, ANALOG)>; /* SDMMC1_CMD */
+                               };
+                       };
+
+                       sdmmc1_dir_pins_a: sdmmc1-dir-0 {
+                               pins1 {
+                                       pinmux = <STM32_PINMUX('F', 2, AF11)>, /* SDMMC1_D0DIR */
+                                                <STM32_PINMUX('C', 7, AF8)>, /* SDMMC1_D123DIR */
+                                                <STM32_PINMUX('B', 9, AF11)>; /* SDMMC1_CDIR */
+                                       slew-rate = <3>;
+                                       drive-push-pull;
+                                       bias-pull-up;
+                               };
+                               pins2{
+                                       pinmux = <STM32_PINMUX('E', 4, AF8)>; /* SDMMC1_CKIN */
+                                       bias-pull-up;
+                               };
+                       };
+
+                       sdmmc1_dir_sleep_pins_a: sdmmc1-dir-sleep-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('F', 2, ANALOG)>, /* SDMMC1_D0DIR */
+                                                <STM32_PINMUX('C', 7, ANALOG)>, /* SDMMC1_D123DIR */
+                                                <STM32_PINMUX('B', 9, ANALOG)>, /* SDMMC1_CDIR */
+                                                <STM32_PINMUX('E', 4, ANALOG)>; /* SDMMC1_CKIN */
+                               };
+                       };
+
+                       spdifrx_pins_a: spdifrx-0 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('G', 12, AF8)>; /* SPDIF_IN1 */
+                                       bias-disable;
+                               };
+                       };
+
+                       spdifrx_sleep_pins_a: spdifrx-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('G', 12, ANALOG)>; /* SPDIF_IN1 */
+                               };
+                       };
+
                        uart4_pins_a: uart4-0 {
                                pins1 {
                                        pinmux = <STM32_PINMUX('G', 11, AF6)>; /* UART4_TX */
                                };
                        };
 
+                       i2c4_pins_sleep_a: i2c4-1 {
+                               pins {
+                                       pinmux = <STM32_PINMUX('Z', 4, ANALOG)>, /* I2C4_SCL */
+                                                <STM32_PINMUX('Z', 5, ANALOG)>; /* I2C4_SDA */
+                               };
+                       };
+
                        spi1_pins_a: spi1-0 {
                                pins1 {
                                        pinmux = <STM32_PINMUX('Z', 0, AF5)>, /* SPI1_SCK */
diff --git a/arch/arm/boot/dts/stm32mp157a-dk1.dts b/arch/arm/boot/dts/stm32mp157a-dk1.dts
new file mode 100644 (file)
index 0000000..098dbfb
--- /dev/null
@@ -0,0 +1,250 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2019 - All Rights Reserved
+ * Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
+ */
+
+/dts-v1/;
+
+#include "stm32mp157c.dtsi"
+#include "stm32mp157-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/mfd/st,stpmic1.h>
+
+/ {
+       model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
+       compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
+
+       aliases {
+               ethernet0 = &ethernet0;
+               serial0 = &uart4;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory@c0000000 {
+               reg = <0xc0000000 0x20000000>;
+       };
+
+       led {
+               compatible = "gpio-leds";
+               blue {
+                       label = "heartbeat";
+                       gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+                       default-state = "off";
+               };
+       };
+};
+
+&cec {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&cec_pins_b>;
+       pinctrl-1 = <&cec_pins_sleep_b>;
+       status = "okay";
+};
+
+&ethernet0 {
+       status = "okay";
+       pinctrl-0 = <&ethernet0_rgmii_pins_a>;
+       pinctrl-1 = <&ethernet0_rgmii_pins_sleep_a>;
+       pinctrl-names = "default", "sleep";
+       phy-mode = "rgmii";
+       max-speed = <1000>;
+       phy-handle = <&phy0>;
+
+       mdio0 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "snps,dwmac-mdio";
+               phy0: ethernet-phy@0 {
+                       reg = <0>;
+               };
+       };
+};
+
+
+&i2c4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c4_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>;
+               status = "okay";
+
+               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>;
+                       status = "okay";
+               };
+
+               watchdog {
+                       compatible = "st,stpmic1-wdt";
+                       status = "disabled";
+               };
+       };
+};
+
+&ipcc {
+       status = "okay";
+};
+
+&iwdg2 {
+       timeout-sec = <32>;
+       status = "okay";
+};
+
+&rng1 {
+       status = "okay";
+};
+
+&rtc {
+       status = "okay";
+};
+
+&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>;
+       broken-cd;
+       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/stm32mp157c-dk2.dts b/arch/arm/boot/dts/stm32mp157c-dk2.dts
new file mode 100644 (file)
index 0000000..20ea601
--- /dev/null
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2019 - All Rights Reserved
+ * Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
+ */
+
+/dts-v1/;
+
+#include "stm32mp157a-dk1.dts"
+
+/ {
+       model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
+       compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
+
+       reg18: reg18 {
+               compatible = "regulator-fixed";
+               regulator-name = "reg18";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+};
+
+&dsi {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       status = "okay";
+       phy-dsi-supply = <&reg18>;
+
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               port@0 {
+                       reg = <0>;
+                       dsi_in: endpoint {
+                               remote-endpoint = <&ltdc_ep1_out>;
+                       };
+               };
+
+               port@1 {
+                       reg = <1>;
+                       dsi_out: endpoint {
+                               remote-endpoint = <&panel_in>;
+                       };
+               };
+       };
+
+       panel@0 {
+               compatible = "orisetech,otm8009a";
+               reg = <0>;
+               reset-gpios = <&gpioe 4 GPIO_ACTIVE_LOW>;
+               power-supply = <&v3v3>;
+               status = "okay";
+
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&dsi_out>;
+                       };
+               };
+       };
+};
+
+&ltdc {
+       status = "okay";
+
+       port {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ltdc_ep1_out: endpoint@1 {
+                       reg = <1>;
+                       remote-endpoint = <&dsi_in>;
+               };
+       };
+};
index d66edb0..62a8c78 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "stm32mp157c.dtsi"
 #include "stm32mp157-pinctrl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/mfd/st,stpmic1.h>
 
 / {
        model = "STMicroelectronics STM32MP157C eval daughter";
                regulator-always-on;
        };
 
-       vdd_usb: vdd-usb {
-               compatible = "regulator-fixed";
-               regulator-name = "vdd_usb";
-               regulator-min-microvolt = <3300000>;
-               regulator-max-microvolt = <3300000>;
+       sd_switch: regulator-sd_switch {
+               compatible = "regulator-gpio";
+               regulator-name = "sd_switch";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <2900000>;
+               regulator-type = "voltage";
                regulator-always-on;
+
+               gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
+               gpios-states = <0>;
+               states = <1800000 0x1 2900000 0x0>;
        };
 };
 
        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>;
+               status = "okay";
+
+               regulators {
+                       compatible = "st,stpmic1-regulators";
+                       ldo1-supply = <&v3v3>;
+                       ldo2-supply = <&v3v3>;
+                       ldo3-supply = <&vdd_ddr>;
+                       ldo5-supply = <&v3v3>;
+                       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>;
+                       };
+
+                       vdda: ldo1 {
+                               regulator-name = "vdda";
+                               regulator-min-microvolt = <2900000>;
+                               regulator-max-microvolt = <2900000>;
+                               interrupts = <IT_CURLIM_LDO1 0>;
+                       };
+
+                       v2v8: ldo2 {
+                               regulator-name = "v2v8";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               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>;
+                       };
+
+                       vdd_sd: ldo5 {
+                               regulator-name = "vdd_sd";
+                               regulator-min-microvolt = <2900000>;
+                               regulator-max-microvolt = <2900000>;
+                               interrupts = <IT_CURLIM_LDO5 0>;
+                               regulator-boot-on;
+                       };
+
+                       v1v8: ldo6 {
+                               regulator-name = "v1v8";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               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>;
+                       status = "okay";
+               };
+
+               watchdog {
+                       compatible = "st,stpmic1-wdt";
+                       status = "disabled";
+               };
+       };
+};
+
+&ipcc {
+       status = "okay";
 };
 
 &iwdg2 {
        status = "okay";
 };
 
+&sdmmc1 {
+       pinctrl-names = "default", "opendrain", "sleep";
+       pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
+       pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
+       pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
+       broken-cd;
+       st,sig-dir;
+       st,neg-edge;
+       st,use-ckin;
+       bus-width = <4>;
+       vmmc-supply = <&vdd_sd>;
+       vqmmc-supply = <&sd_switch>;
+       status = "okay";
+};
+
 &timers6 {
        status = "okay";
        /* spare dmas for other usage */
index f8bbfff..2afeee6 100644 (file)
                        status = "disabled";
                };
 
+               spdifrx: audio-controller@4000d000 {
+                       compatible = "st,stm32h7-spdifrx";
+                       #sound-dai-cells = <0>;
+                       reg = <0x4000d000 0x400>;
+                       clocks = <&rcc SPDIF_K>;
+                       clock-names = "kclk";
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+                       dmas = <&dmamux1 93 0x400 0x01>,
+                              <&dmamux1 94 0x400 0x01>;
+                       dma-names = "rx", "rx-ctrl";
+                       status = "disabled";
+               };
+
                usart2: serial@4000e000 {
                        compatible = "st,stm32h7-uart";
                        reg = <0x4000e000 0x400>;
                        status = "disabled";
                };
 
+               ipcc: mailbox@4c001000 {
+                       compatible = "st,stm32mp1-ipcc";
+                       #mbox-cells = <1>;
+                       reg = <0x4c001000 0x400>;
+                       st,proc-id = <0>;
+                       interrupts-extended =
+                               <&intc GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
+                               <&intc GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
+                               <&exti 61 1>;
+                       interrupt-names = "rx", "tx", "wakeup";
+                       clocks = <&rcc IPCC>;
+                       wakeup-source;
+                       status = "disabled";
+               };
+
                rcc: rcc@50000000 {
                        compatible = "st,stm32mp1-rcc", "syscon";
                        reg = <0x50000000 0x1000>;
                syscfg: syscon@50020000 {
                        compatible = "st,stm32mp157-syscfg", "syscon";
                        reg = <0x50020000 0x400>;
+                       clocks = <&rcc SYSCFG>;
                };
 
                lptimer2: timer@50021000 {
                        status = "disabled";
                };
 
+               sdmmc1: sdmmc@58005000 {
+                       compatible = "arm,pl18x", "arm,primecell";
+                       arm,primecell-periphid = <0x10153180>;
+                       reg = <0x58005000 0x1000>;
+                       interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "cmd_irq";
+                       clocks = <&rcc SDMMC1_K>;
+                       clock-names = "apb_pclk";
+                       resets = <&rcc SDMMC1_R>;
+                       cap-sd-highspeed;
+                       cap-mmc-highspeed;
+                       max-frequency = <120000000>;
+               };
+
                crc1: crc@58009000 {
                        compatible = "st,stm32f7-crc";
                        reg = <0x58009000 0x400>;
                        status = "disabled";
                };
 
+               bsec: nvmem@5c005000 {
+                       compatible = "st,stm32mp15-bsec";
+                       reg = <0x5c005000 0x400>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ts_cal1: calib@5c {
+                               reg = <0x5c 0x2>;
+                       };
+                       ts_cal2: calib@5e {
+                               reg = <0x5e 0x2>;
+                       };
+               };
+
                i2c6: i2c@5c009000 {
                        compatible = "st,stm32f7-i2c";
                        reg = <0x5c009000 0x400>;
index cf7b392..7426298 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &reg_usb0_vbus {
        status = "okay";
 };
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 197a1f2..7306c65 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
 };
 
 &reg_ahci_5v {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 896e27a..8ee3ff4 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &pwm {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm0_pin>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index f63767c..bf2044b 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &reg_usb0_vbus {
        status = "okay";
 };
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 26d0c1d..ca87838 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &pwm {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm0_pin>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index 71c27ea..76016f2 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 2f0d966..0a562b2 100644 (file)
@@ -61,8 +61,6 @@
 
        gpio-keys {
                compatible = "gpio-keys-polled";
-               pinctrl-names = "default";
-               pinctrl-0 = <&key_pins_inet9f>;
                poll-interval = <20>;
 
                left-joystick-left {
@@ -70,7 +68,7 @@
                        linux,code = <ABS_X>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */
+                       gpios = <&pio 0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA6 */
                };
 
                left-joystick-right {
@@ -78,7 +76,7 @@
                        linux,code = <ABS_X>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */
+                       gpios = <&pio 0 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA5 */
                };
 
                left-joystick-up {
@@ -86,7 +84,7 @@
                        linux,code = <ABS_Y>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
+                       gpios = <&pio 0 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA8 */
                };
 
                left-joystick-down {
@@ -94,7 +92,7 @@
                        linux,code = <ABS_Y>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
+                       gpios = <&pio 0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA9 */
                };
 
                right-joystick-left {
                        linux,code = <ABS_Z>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */
+                       gpios = <&pio 0 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA1 */
                };
 
                right-joystick-right {
                        linux,code = <ABS_Z>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */
+                       gpios = <&pio 0 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA0 */
                };
 
                right-joystick-up {
                        linux,code = <ABS_RZ>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */
+                       gpios = <&pio 0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA3 */
                };
 
                right-joystick-down {
                        linux,code = <ABS_RZ>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */
+                       gpios = <&pio 0 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA4 */
                };
 
                dpad-left {
                        linux,code = <ABS_HAT0X>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 7 23 GPIO_ACTIVE_LOW>; /* PH23 */
+                       gpios = <&pio 7 23 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PH23 */
                };
 
                dpad-right {
                        linux,code = <ABS_HAT0X>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 7 24 GPIO_ACTIVE_LOW>; /* PH24 */
+                       gpios = <&pio 7 24 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PH24 */
                };
 
                dpad-up {
                        linux,code = <ABS_HAT0Y>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <0xffffffff>; /* -1 */
-                       gpios = <&pio 7 25 GPIO_ACTIVE_LOW>; /* PH25 */
+                       gpios = <&pio 7 25 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PH25 */
                };
 
                dpad-down {
                        linux,code = <ABS_HAT0Y>;
                        linux,input-type = <EV_ABS>;
                        linux,input-value = <1>;
-                       gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */
+                       gpios = <&pio 7 26 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PH26 */
                };
 
                x {
                        label = "Button X";
                        linux,code = <BTN_X>;
-                       gpios = <&pio 0 16 GPIO_ACTIVE_LOW>; /* PA16 */
+                       gpios = <&pio 0 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA16 */
                };
 
                y {
                        label = "Button Y";
                        linux,code = <BTN_Y>;
-                       gpios = <&pio 0 14 GPIO_ACTIVE_LOW>; /* PA14 */
+                       gpios = <&pio 0 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA14 */
                };
 
                a {
                        label = "Button A";
                        linux,code = <BTN_A>;
-                       gpios = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */
+                       gpios = <&pio 0 17 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA17 */
                };
 
                b {
                        label = "Button B";
                        linux,code = <BTN_B>;
-                       gpios = <&pio 0 15 GPIO_ACTIVE_LOW>; /* PA15 */
+                       gpios = <&pio 0 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA15 */
                };
 
                select {
                        label = "Select Button";
                        linux,code = <BTN_SELECT>;
-                       gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */
+                       gpios = <&pio 0 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA11 */
                };
 
                start {
                        label = "Start Button";
                        linux,code = <BTN_START>;
-                       gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */
+                       gpios = <&pio 0 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA12 */
                };
 
                top-left {
                        label = "Top Left Button";
                        linux,code = <BTN_TL>;
-                       gpios = <&pio 7 22 GPIO_ACTIVE_LOW>; /* PH22 */
+                       gpios = <&pio 7 22 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PH22 */
                };
 
                top-right {
                        label = "Top Right Button";
                        linux,code = <BTN_TR>;
-                       gpios = <&pio 0 13 GPIO_ACTIVE_LOW>; /* PA13 */
+                       gpios = <&pio 0 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PA13 */
                };
        };
 };
        status = "okay";
 };
 
-&pio {
-       key_pins_inet9f: key-pins {
-               pins = "PA0", "PA1", "PA3", "PA4",
-                      "PA5", "PA6", "PA8", "PA9",
-                      "PA11", "PA12", "PA13",
-                      "PA14", "PA15", "PA16", "PA17",
-                      "PH22", "PH23", "PH24", "PH25", "PH26";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 0dbf695..58ad2ad 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_usb1_vbus {
        status = "okay";
 };
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index b74a614..a8e537f 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 &reg_ahci_5v {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio   = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH5 */
        usb0_vbus-supply   = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index d82a604..0f1e781 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 #include "axp209.dtsi"
 
 &reg_dcdc2 {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_vcc5v0>; /* USB1 VBUS is always on */
        usb2_vbus-supply = <&reg_vcc5v0>; /* USB2 VBUS is always on */
        status = "okay";
index 84b25be..24a3d23 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-};
-
 &pwm {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm0_pin>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index 73c3ac4..e88daa4 100644 (file)
                        #dma-cells = <2>;
                };
 
-               nfc: nand@1c03000 {
+               nfc: nand-controller@1c03000 {
                        compatible = "allwinner,sun4i-a10-nand";
                        reg = <0x01c03000 0x1000>;
                        interrupts = <37>;
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon0-pixel-clock";
+                       #clock-cells = <0>;
                        dmas = <&dma SUN4I_DMA_DEDICATED 14>;
 
                        ports {
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon1-pixel-clock";
+                       #clock-cells = <0>;
                        dmas = <&dma SUN4I_DMA_DEDICATED 15>;
 
                        ports {
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
                        allwinner,sram = <&otg_sram 1>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                usbphy: phy@1c13400 {
                        #phy-cells = <1>;
                        compatible = "allwinner,sun4i-a10-usb-phy";
-                       reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>;
+                       reg = <0x01c13400 0x10>, <0x01c14800 0x4>, <0x01c1c800 0x4>;
                        reg-names = "phy_ctrl", "pmu1", "pmu2";
                        clocks = <&ccu CLK_USB_PHY>;
                        clock-names = "usb_phy";
                        interrupts = <39>;
                        clocks = <&ccu CLK_AHB_EHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <64>;
                        clocks = <&ccu CLK_USB_OHCI0>, <&ccu CLK_AHB_OHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <40>;
                        clocks = <&ccu CLK_AHB_EHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <65>;
                        clocks = <&ccu CLK_USB_OHCI1>, <&ccu CLK_AHB_OHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
index c88f089..8af0eae 100644 (file)
 };
 
 &pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG12";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
        led_pins_t004: led-pin {
                pins = "PB2";
                function = "gpio_out";
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+       usb0_id_det-gpios = <&pio 6 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG12 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
 };
index 262c2ff..5340b41 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG12";
-               function = "gpio_in";
-               bias-pull-up;
-       };
 };
 
 &reg_usb0_vbus {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+       usb0_id_det-gpios = <&pio 6 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG12 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index f3cede9..a23bf24 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PG1";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &pwm {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm0_pin>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PG1 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_ldo3>;
        status = "okay";
index 9369f74..9b9f2a5 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 #include "axp209.dtsi"
 
 &reg_dcdc2 {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+       usb0_id_det-gpios = <&pio 6 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG2 */
        usb0_vbus_det-gpios = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_ldo3>;
index ca8f3fd..ba8d75b 100644 (file)
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_vcc5v0>;
        status = "okay";
index 943868e..5df398d 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PG1";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 &reg_usb0_vbus {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PG1 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index 9409c23..3910122 100644 (file)
@@ -74,8 +74,6 @@
 
        bridge {
                compatible = "dumb-vga-dac";
-               #address-cells = <1>;
-               #size-cells = <0>;
 
                ports {
                        #address-cells = <1>;
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PG1";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 &reg_usb0_vbus {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PG1 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index 7257f39..fde559a 100644 (file)
                power-supply = <&reg_vcc3v3>;
                enable-gpios = <&axp_gpio 0 GPIO_ACTIVE_HIGH>; /* AXP GPIO0 */
                backlight = <&backlight>;
-               #address-cells = <1>;
-               #size-cells = <0>;
 
-               port@0 {
-                       reg = <0>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       panel_input: endpoint@0 {
-                               reg = <0>;
+               port {
+                       panel_input: endpoint {
                                remote-endpoint = <&tcon0_out_lcd>;
                        };
                };
index 732873c..be486d2 100644 (file)
                /delete-property/stdout-path;
        };
 
-       i2c_lcd: i2c-gpio {
+       i2c_lcd: i2c {
                /* The lcd panel i2c interface is hooked up via gpios */
                compatible = "i2c-gpio";
-               pinctrl-names = "default";
-               pinctrl-0 = <&i2c_lcd_pins>;
-               gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>, /* PG12, sda */
-                       <&pio 6 10 GPIO_ACTIVE_HIGH>; /* PG10, scl */
+               sda-gpios = <&pio 6 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG12 */
+               scl-gpios = <&pio 6 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG10 */
                i2c-gpio,delay-us = <5>;
        };
 };
        };
 };
 
-&pio {
-       i2c_lcd_pins: i2c-lcd-pin {
-               pins = "PG10", "PG12";
-               function = "gpio_out";
-               bias-pull-up;
-       };
-};
-
 &reg_usb0_vbus {
        gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 };
index 3f70b8c..a32cde3 100644 (file)
        status = "okay";
 
        nand@0 {
-               #address-cells = <2>;
-               #size-cells = <2>;
                reg = <0>;
                allwinner,rb = <0>;
                nand-ecc-mode = "hw";
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+       usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb1_vbus-supply = <&reg_vcc5v0>;
        status = "okay";
index 86e46aa..d003b89 100644 (file)
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index f4298fa..4bf4943 100644 (file)
@@ -84,9 +84,7 @@
 
        onewire {
                compatible = "w1-gpio";
-               gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */
-               pinctrl-names = "default";
-               pinctrl-0 = <&chip_w1_pin>;
+               gpios = <&pio 3 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PD2 */
        };
 };
 
        status = "okay";
 };
 
-&pio {
-       chip_w1_pin: chip-w1-pin {
-               pins = "PD2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_dcdc2 {
        regulator-min-microvolt = <1000000>;
        regulator-max-microvolt = <1400000>;
 &usbphy {
        status = "okay";
 
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
+       usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_vcc5v0>;
index 5b1f0e1..1a9926d 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PG1";
-               function = "gpio_in";
-               bias-pull-down;
-       };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PG2";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */
-       usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
+       usb0_id_det-gpios = <&pio 6 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PG2 */
+       usb0_vbus_det-gpios = <&pio 6 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PG1 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_ldo3>;
index 5497d98..2fb438c 100644 (file)
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
+               dma-ranges;
                ranges;
 
                system-control@1c00000 {
                        };
                };
 
+               mbus: dram-controller@1c01000 {
+                       compatible = "allwinner,sun5i-a13-mbus";
+                       reg = <0x01c01000 0x1000>;
+                       clocks = <&ccu 99>;
+                       dma-ranges = <0x00000000 0x40000000 0x20000000>;
+                       #interconnect-cells = <1>;
+               };
+
                dma: dma-controller@1c02000 {
                        compatible = "allwinner,sun4i-a10-dma";
                        reg = <0x01c02000 0x1000>;
                        #dma-cells = <2>;
                };
 
-               nfc: nand@1c03000 {
+               nfc: nand-controller@1c03000 {
                        compatible = "allwinner,sun4i-a10-nand";
                        reg = <0x01c03000 0x1000>;
                        interrupts = <37>;
                        status = "disabled";
 
                        port {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
 
-                               tve0_in_tcon0: endpoint@0 {
-                                       reg = <0>;
+                               tve0_in_tcon0: endpoint {
                                        remote-endpoint = <&tcon0_out_tve0>;
                                };
                        };
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon-pixel-clock";
+                       #clock-cells = <0>;
                        status = "disabled";
 
                        ports {
                                #size-cells = <0>;
 
                                tcon0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon0_in_be0: endpoint@0 {
-                                               reg = <0>;
+                                       tcon0_in_be0: endpoint {
                                                remote-endpoint = <&be0_out_tcon0>;
                                        };
                                };
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
                        allwinner,sram = <&otg_sram 1>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                usbphy: phy@1c13400 {
                        #phy-cells = <1>;
                        compatible = "allwinner,sun5i-a13-usb-phy";
-                       reg = <0x01c13400 0x10 0x01c14800 0x4>;
+                       reg = <0x01c13400 0x10>, <0x01c14800 0x4>;
                        reg-names = "phy_ctrl", "pmu1";
                        clocks = <&ccu CLK_USB_PHY0>;
                        clock-names = "usb_phy";
                        interrupts = <39>;
                        clocks = <&ccu CLK_AHB_EHCI>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <40>;
                        clocks = <&ccu CLK_USB_OHCI>, <&ccu CLK_AHB_OHCI>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                bias-pull-up;
                        };
 
-                       mmc2_8bit_pins: mmc2-8bit-pins {
+                       mmc2_4bit_pc_pins: mmc2-4bit-pc-pins {
                                pins = "PC6", "PC7", "PC8", "PC9",
-                                      "PC10", "PC11", "PC12", "PC13",
-                                      "PC14", "PC15";
+                                      "PC10", "PC11";
                                function = "mmc2";
                                drive-strength = <30>;
                                bias-pull-up;
                        };
 
-                       mmc2_4bit_pc_pins: mmc2-4bit-pc-pins {
+                       mmc2_8bit_pins: mmc2-8bit-pins {
                                pins = "PC6", "PC7", "PC8", "PC9",
-                                      "PC10", "PC11";
+                                      "PC10", "PC11", "PC12", "PC13",
+                                      "PC14", "PC15";
                                function = "mmc2";
                                drive-strength = <30>;
                                bias-pull-up;
                                function = "nand0";
                        };
 
+                       pwm0_pin: pwm0-pin {
+                               pins = "PB2";
+                               function = "pwm";
+                       };
+
                        spi2_pe_pins: spi2-pe-pins {
                                pins = "PE1", "PE2", "PE3";
                                function = "spi2";
                                pins = "PG11", "PG12";
                                function = "uart3";
                        };
-
-                       pwm0_pin: pwm0-pin {
-                               pins = "PB2";
-                               function = "pwm";
-                       };
                };
 
                timer@1c20c00 {
                        clock-names = "ahb", "mod",
                                      "ram";
                        resets = <&ccu RST_DE_FE>;
+                       interconnects = <&mbus 19>;
+                       interconnect-names = "dma-mem";
                        status = "disabled";
 
                        ports {
                                #size-cells = <0>;
 
                                fe0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       fe0_out_be0: endpoint@0 {
-                                               reg = <0>;
+                                       fe0_out_be0: endpoint {
                                                remote-endpoint = <&be0_in_fe0>;
                                        };
                                };
                        clock-names = "ahb", "mod",
                                      "ram";
                        resets = <&ccu RST_DE_BE>;
+                       interconnects = <&mbus 18>;
+                       interconnect-names = "dma-mem";
                        status = "disabled";
 
                        assigned-clocks = <&ccu CLK_DE_BE>;
                                #size-cells = <0>;
 
                                be0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       be0_in_fe0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_in_fe0: endpoint {
                                                remote-endpoint = <&fe0_out_be0>;
                                        };
                                };
 
                                be0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       be0_out_tcon0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_out_tcon0: endpoint {
                                                remote-endpoint = <&tcon0_in_be0>;
                                        };
                                };
index 0b7bedf..c3d56dc 100644 (file)
        i2c_lcd: i2c {
                /* The lcd panel i2c interface is hooked up via gpios */
                compatible = "i2c-gpio";
-               pinctrl-names = "default";
-               pinctrl-0 = <&i2c_lcd_pins>;
-               gpios = <&pio 0 23 GPIO_ACTIVE_HIGH>, /* PA23, sda */
-                       <&pio 0 24 GPIO_ACTIVE_HIGH>; /* PA24, scl */
+               sda-gpios = <&pio 0 23 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PA23 */
+               scl-gpios = <&pio 0 24 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PA24 */
                i2c-gpio,delay-us = <5>;
        };
 };
        status = "okay";
 };
 
-&pio {
-       i2c_lcd_pins: i2c-lcd-pins {
-               pins = "PA23", "PA24";
-               function = "gpio_out";
-               bias-pull-up;
-       };
-};
-
 &reg_usb2_vbus {
        gpio = <&pio 7 24 GPIO_ACTIVE_HIGH>;
        status = "okay";
index e17a65b..09832b4 100644 (file)
        vga-dac {
                compatible = "dumb-vga-dac";
                vdd-supply = <&reg_vga_3v3>;
-               #address-cells = <1>;
-               #size-cells = <0>;
 
                ports {
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                        port@0 {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
                                reg = <0>;
 
-                               vga_dac_in: endpoint@0 {
-                                       reg = <0>;
+                               vga_dac_in: endpoint {
                                        remote-endpoint = <&tcon0_out_vga>;
                                };
                        };
 
                        port@1 {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
                                reg = <1>;
 
-                               vga_dac_out: endpoint@0 {
-                                       reg = <0>;
+                               vga_dac_out: endpoint {
                                        remote-endpoint = <&vga_con_in>;
                                };
                        };
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
-       usb0_vbus_det-gpio = <&pio 0 16 GPIO_ACTIVE_HIGH>; /* PA16 */
+       usb0_id_det-gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
+       usb0_vbus_det-gpios = <&pio 0 16 GPIO_ACTIVE_HIGH>; /* PA16 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_drivevbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index 0832ac5..091eb2a 100644 (file)
 &spdif {
        pinctrl-names = "default";
        pinctrl-0 = <&spdif_tx_pin>;
-       spdif-out = "okay";
        status = "okay";
 };
 
index 13304b8..c04efad 100644 (file)
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon0-pixel-clock";
+                       #clock-cells = <0>;
 
                        ports {
                                #address-cells = <1>;
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon1-pixel-clock";
+                       #clock-cells = <0>;
 
                        ports {
                                #address-cells = <1>;
                                };
 
                                hdmi_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
                                };
                        };
                        phys = <&usbphy 0>;
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_AHB1_EHCI0>;
                        resets = <&ccu RST_AHB1_EHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_AHB1_OHCI0>, <&ccu CLK_USB_OHCI0>;
                        resets = <&ccu RST_AHB1_OHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_AHB1_EHCI1>;
                        resets = <&ccu RST_AHB1_EHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_AHB1_OHCI1>, <&ccu CLK_USB_OHCI1>;
                        resets = <&ccu RST_AHB1_OHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                };
 
                gic: interrupt-controller@1c81000 {
-                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
                              <0x01c82000 0x2000>,
                              <0x01c84000 0x2000>,
                                };
 
                                be0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       be0_out_drc0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_out_drc0: endpoint {
                                                remote-endpoint = <&drc0_in_be0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                drc0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       drc0_in_be0: endpoint@0 {
-                                               reg = <0>;
+                                       drc0_in_be0: endpoint {
                                                remote-endpoint = <&be0_out_drc0>;
                                        };
                                };
                        gpio-controller;
                        interrupt-controller;
                        #interrupt-cells = <3>;
-                       #size-cells = <0>;
                        #gpio-cells = <3>;
 
                        s_ir_rx_pin: s-ir-rx-pin {
index 60b355f..bc3170a 100644 (file)
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
+       usb0_id_det-gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_drivevbus>;
        usb1_vbus-supply = <&reg_dldo1>;
index 86143de..7de2abd 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PA15";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &p2wi {
        status = "okay";
 
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */
+       usb0_id_det-gpios = <&pio 0 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PA15 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_drivevbus>;
        usb1_vbus-supply = <&reg_dldo1>;
index 81bc85d..4df9216 100644 (file)
                        "SPI-MISO", "SPI-CE1", "",
                "IO-6", "IO-3", "IO-2", "IO-0", "", "", "", "",
                "", "", "", "", "", "", "", "";
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
 };
 
 #include "axp209.dtsi"
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index 200685b..08e5a5a 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_ahci_5v {
        status = "okay";
 };
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index f91e1be..3e170cf 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 #include "axp209.dtsi"
 
 &ac_power_supply {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index 823aabc..c34a83f 100644 (file)
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index 5e41119..e40dd47 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 &reg_ahci_5v {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index 4e1c590..95c6f89 100644 (file)
 };
 
 &pio {
+       vcc-pa-supply = <&reg_vcc3v3>;
+       vcc-pc-supply = <&reg_vcc3v3>;
+       vcc-pe-supply = <&reg_ldo3>;
+       vcc-pf-supply = <&reg_vcc3v3>;
+       vcc-pg-supply = <&reg_ldo4>;
+
        led_pins_olinuxinolime: led-pins {
                pins = "PH2";
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 &reg_ahci_5v {
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index 840ae11..0dcba07 100644 (file)
                function = "gpio_out";
                drive-strength = <20>;
        };
-
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-
-       usb0_vbus_detect_pin: usb0-vbus-detect-pin {
-               pins = "PH5";
-               function = "gpio_in";
-               bias-pull-down;
-       };
 };
 
 #include "axp209.dtsi"
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
-       usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
+       usb0_vbus_det-gpios = <&pio 7 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* PH5 */
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
index 1588108..9628041 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index d64de2e..7b35326 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index 538ea15..173b676 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_ahci_5v {
        gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
        status = "okay";
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
index a72ed43..14a88aa 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_ahci_5v {
        gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index ffade25..6a66b04 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &pwm {
        pinctrl-names = "default";
        pinctrl-0 = <&pwm0_pin>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index c27e560..f8475a3 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH4";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &reg_dcdc2 {
        regulator-always-on;
        regulator-min-microvolt = <1000000>;
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+       usb0_id_det-gpios = <&pio 7 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH4 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_usb0_vbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
index 641a8fa..9ad8e44 100644 (file)
                        #dma-cells = <2>;
                };
 
-               nfc: nand@1c03000 {
+               nfc: nand-controller@1c03000 {
                        compatible = "allwinner,sun4i-a10-nand";
                        reg = <0x01c03000 0x1000>;
                        interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon0-pixel-clock";
+                       #clock-cells = <0>;
                        dmas = <&dma SUN4I_DMA_DEDICATED 14>;
 
                        ports {
                                      "tcon-ch0",
                                      "tcon-ch1";
                        clock-output-names = "tcon1-pixel-clock";
+                       #clock-cells = <0>;
                        dmas = <&dma SUN4I_DMA_DEDICATED 15>;
 
                        ports {
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
                        allwinner,sram = <&otg_sram 1>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                usbphy: phy@1c13400 {
                        #phy-cells = <1>;
                        compatible = "allwinner,sun7i-a20-usb-phy";
-                       reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>;
+                       reg = <0x01c13400 0x10>, <0x01c14800 0x4>, <0x01c1c800 0x4>;
                        reg-names = "phy_ctrl", "pmu1", "pmu2";
                        clocks = <&ccu CLK_USB_PHY>;
                        clock-names = "usb_phy";
                        interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_AHB_EHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_USB_OHCI0>, <&ccu CLK_AHB_OHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_AHB_EHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_USB_OHCI1>, <&ccu CLK_AHB_OHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        #interrupt-cells = <3>;
                        #gpio-cells = <3>;
 
+                       /omit-if-no-ref/
+                       can_pa_pins: can-pa-pins {
+                               pins = "PA16", "PA17";
+                               function = "can";
+                       };
+
+                       /omit-if-no-ref/
                        can_ph_pins: can-ph-pins {
                                pins = "PH20", "PH21";
                                function = "can";
                        };
 
+                       /omit-if-no-ref/
                        clk_out_a_pin: clk-out-a-pin {
                                pins = "PI12";
                                function = "clk_out_a";
                        };
 
+                       /omit-if-no-ref/
                        clk_out_b_pin: clk-out-b-pin {
                                pins = "PI13";
                                function = "clk_out_b";
                        };
 
+                       /omit-if-no-ref/
                        emac_pa_pins: emac-pa-pins {
                                pins = "PA0", "PA1", "PA2",
                                       "PA3", "PA4", "PA5", "PA6",
                                function = "emac";
                        };
 
+                       /omit-if-no-ref/
+                       emac_ph_pins: emac-ph-pins {
+                               pins = "PH8", "PH9", "PH10", "PH11",
+                                      "PH14", "PH15", "PH16", "PH17",
+                                      "PH18", "PH19", "PH20", "PH21",
+                                      "PH22", "PH23", "PH24", "PH25",
+                                      "PH26";
+                               function = "emac";
+                       };
+
+                       /omit-if-no-ref/
                        gmac_mii_pins: gmac-mii-pins {
                                pins = "PA0", "PA1", "PA2",
                                       "PA3", "PA4", "PA5", "PA6",
                                function = "gmac";
                        };
 
+                       /omit-if-no-ref/
                        gmac_rgmii_pins: gmac-rgmii-pins {
                                pins = "PA0", "PA1", "PA2",
                                       "PA3", "PA4", "PA5", "PA6",
                                drive-strength = <40>;
                        };
 
+                       /omit-if-no-ref/
                        i2c0_pins: i2c0-pins {
                                pins = "PB0", "PB1";
                                function = "i2c0";
                        };
 
+                       /omit-if-no-ref/
                        i2c1_pins: i2c1-pins {
                                pins = "PB18", "PB19";
                                function = "i2c1";
                        };
 
+                       /omit-if-no-ref/
                        i2c2_pins: i2c2-pins {
                                pins = "PB20", "PB21";
                                function = "i2c2";
                        };
 
+                       /omit-if-no-ref/
                        i2c3_pins: i2c3-pins {
                                pins = "PI0", "PI1";
                                function = "i2c3";
                        };
 
+                       /omit-if-no-ref/
                        ir0_rx_pin: ir0-rx-pin {
                                pins = "PB4";
                                function = "ir0";
                        };
 
+                       /omit-if-no-ref/
                        ir0_tx_pin: ir0-tx-pin {
                                pins = "PB3";
                                function = "ir0";
                        };
 
+                       /omit-if-no-ref/
                        ir1_rx_pin: ir1-rx-pin {
                                pins = "PB23";
                                function = "ir1";
                        };
 
+                       /omit-if-no-ref/
                        ir1_tx_pin: ir1-tx-pin {
                                pins = "PB22";
                                function = "ir1";
                        };
 
+                       /omit-if-no-ref/
                        mmc0_pins: mmc0-pins {
                                pins = "PF0", "PF1", "PF2",
                                       "PF3", "PF4", "PF5";
                                bias-pull-up;
                        };
 
+                       /omit-if-no-ref/
                        mmc2_pins: mmc2-pins {
                                pins = "PC6", "PC7", "PC8",
                                       "PC9", "PC10", "PC11";
                                bias-pull-up;
                        };
 
+                       /omit-if-no-ref/
                        mmc3_pins: mmc3-pins {
                                pins = "PI4", "PI5", "PI6",
                                       "PI7", "PI8", "PI9";
                                bias-pull-up;
                        };
 
+                       /omit-if-no-ref/
                        ps2_0_pins: ps2-0-pins {
                                pins = "PI20", "PI21";
                                function = "ps2";
                        };
 
+                       /omit-if-no-ref/
                        ps2_1_ph_pins: ps2-1-ph-pins {
                                pins = "PH12", "PH13";
                                function = "ps2";
                        };
 
+                       /omit-if-no-ref/
                        pwm0_pin: pwm0-pin {
                                pins = "PB2";
                                function = "pwm";
                        };
 
+                       /omit-if-no-ref/
                        pwm1_pin: pwm1-pin {
                                pins = "PI3";
                                function = "pwm";
                        };
 
+                       /omit-if-no-ref/
                        spdif_tx_pin: spdif-tx-pin {
                                pins = "PB13";
                                function = "spdif";
                                bias-pull-up;
                        };
 
+                       /omit-if-no-ref/
                        spi0_pi_pins: spi0-pi-pins {
                                pins = "PI11", "PI12", "PI13";
                                function = "spi0";
                        };
 
+                       /omit-if-no-ref/
                        spi0_cs0_pi_pin: spi0-cs0-pi-pin {
                                pins = "PI10";
                                function = "spi0";
                        };
 
+                       /omit-if-no-ref/
                        spi0_cs1_pi_pin: spi0-cs1-pi-pin {
                                pins = "PI14";
                                function = "spi0";
                        };
 
+                       /omit-if-no-ref/
                        spi1_pi_pins: spi1-pi-pins {
                                pins = "PI17", "PI18", "PI19";
                                function = "spi1";
                        };
 
+                       /omit-if-no-ref/
                        spi1_cs0_pi_pin: spi1-cs0-pi-pin {
                                pins = "PI16";
                                function = "spi1";
                        };
 
+                       /omit-if-no-ref/
                        spi2_pb_pins: spi2-pb-pins {
                                pins = "PB15", "PB16", "PB17";
                                function = "spi2";
                        };
 
+                       /omit-if-no-ref/
                        spi2_cs0_pb_pin: spi2-cs0-pb-pin {
                                pins = "PB14";
                                function = "spi2";
                        };
 
+                       /omit-if-no-ref/
                        spi2_pc_pins: spi2-pc-pins {
                                pins = "PC20", "PC21", "PC22";
                                function = "spi2";
                        };
 
+                       /omit-if-no-ref/
                        spi2_cs0_pc_pin: spi2-cs0-pc-pin {
                                pins = "PC19";
                                function = "spi2";
                        };
 
+                       /omit-if-no-ref/
                        uart0_pb_pins: uart0-pb-pins {
                                pins = "PB22", "PB23";
                                function = "uart0";
                        };
 
+                       /omit-if-no-ref/
+                       uart0_pf_pins: uart0-pf-pins {
+                               pins = "PF2", "PF4";
+                               function = "uart0";
+                       };
+
+                       /omit-if-no-ref/
+                       uart1_pa_pins: uart1-pa-pins {
+                               pins = "PA10", "PA11";
+                               function = "uart1";
+                       };
+
+                       /omit-if-no-ref/
+                       uart1_cts_rts_pa_pins: uart1-cts-rts-pa-pins {
+                               pins = "PA12", "PA13";
+                               function = "uart1";
+                       };
+
+                       /omit-if-no-ref/
+                       uart2_pa_pins: uart2-pa-pins {
+                               pins = "PA2", "PA3";
+                               function = "uart2";
+                       };
+
+                       /omit-if-no-ref/
+                       uart2_cts_rts_pa_pins: uart2-cts-rts-pa-pins {
+                               pins = "PA0", "PA1";
+                               function = "uart2";
+                       };
+
+                       /omit-if-no-ref/
                        uart2_pi_pins: uart2-pi-pins {
                                pins = "PI18", "PI19";
                                function = "uart2";
                        };
 
+                       /omit-if-no-ref/
                        uart2_cts_rts_pi_pins: uart2-cts-rts-pi-pins {
                                pins = "PI16", "PI17";
                                function = "uart2";
                        };
 
+                       /omit-if-no-ref/
                        uart3_pg_pins: uart3-pg-pins {
                                pins = "PG6", "PG7";
                                function = "uart3";
                        };
 
+                       /omit-if-no-ref/
                        uart3_cts_rts_pg_pins: uart3-cts-rts-pg-pins {
                                pins = "PG8", "PG9";
                                function = "uart3";
                        };
 
+                       /omit-if-no-ref/
                        uart3_ph_pins: uart3-ph-pins {
                                pins = "PH0", "PH1";
                                function = "uart3";
                        };
 
+                       /omit-if-no-ref/
+                       uart3_cts_rts_ph_pins: uart3-cts-rts-ph-pins {
+                               pins = "PH2", "PH3";
+                               function = "uart3";
+                       };
+
+                       /omit-if-no-ref/
                        uart4_pg_pins: uart4-pg-pins {
                                pins = "PG10", "PG11";
                                function = "uart4";
                        };
 
+                       /omit-if-no-ref/
                        uart4_ph_pins: uart4-ph-pins {
                                pins = "PH4", "PH5";
                                function = "uart4";
                        };
 
+                       /omit-if-no-ref/
+                       uart5_ph_pins: uart5-ph-pins {
+                               pins = "PH6", "PH7";
+                               function = "uart5";
+                       };
+
+                       /omit-if-no-ref/
                        uart5_pi_pins: uart5-pi-pins {
                                pins = "PI10", "PI11";
                                function = "uart5";
                        };
 
+                       /omit-if-no-ref/
+                       uart6_pa_pins: uart6-pa-pins {
+                               pins = "PA12", "PA13";
+                               function = "uart6";
+                       };
+
+                       /omit-if-no-ref/
                        uart6_pi_pins: uart6-pi-pins {
                                pins = "PI12", "PI13";
                                function = "uart6";
                        };
 
+                       /omit-if-no-ref/
+                       uart7_pa_pins: uart7-pa-pins {
+                               pins = "PA14", "PA15";
+                               function = "uart7";
+                       };
+
+                       /omit-if-no-ref/
                        uart7_pi_pins: uart7-pi-pins {
                                pins = "PI20", "PI21";
                                function = "uart7";
                };
 
                gic: interrupt-controller@1c81000 {
-                       compatible = "arm,gic-400", "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
                              <0x01c82000 0x2000>,
                              <0x01c84000 0x2000>,
index 43fe215..af2fa69 100644 (file)
                        #dma-cells = <1>;
                };
 
-               nfc: nand@1c03000 {
-                       compatible = "allwinner,sun4i-a10-nand";
+               nfc: nand-controller@1c03000 {
+                       compatible = "allwinner,sun8i-a23-nand-controller";
                        reg = <0x01c03000 0x1000>;
                        interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_BUS_NAND>, <&ccu CLK_NAND>;
                        clock-names = "ahb", "mod";
                        resets = <&ccu RST_BUS_NAND>;
                        reset-names = "ahb";
+                       dmas = <&dma 5>;
+                       dma-names = "rxtx";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&nand_pins &nand_cs0_pin &nand_rb0_pin>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        clock-names = "ahb",
                                      "tcon-ch0";
                        clock-output-names = "tcon-pixel-clock";
+                       #clock-cells = <0>;
                        resets = <&ccu RST_BUS_LCD>;
                        reset-names = "lcd";
                        status = "disabled";
                                #size-cells = <0>;
 
                                tcon0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon0_in_drc0: endpoint@0 {
-                                               reg = <0>;
+                                       tcon0_in_drc0: endpoint {
                                                remote-endpoint = <&drc0_out_tcon0>;
                                        };
                                };
 
                                tcon0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
                                };
                        };
                        phys = <&usbphy 0>;
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI>;
                        resets = <&ccu RST_BUS_EHCI>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_OHCI>, <&ccu CLK_USB_OHCI>;
                        resets = <&ccu RST_BUS_OHCI>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                function = "nand0";
                        };
 
-                       nand_pins_cs0: nand-pins-cs0 {
+                       nand_cs0_pin: nand-cs0-pin {
                                pins = "PC4";
                                function = "nand0";
                                bias-pull-up;
                        };
 
-                       nand_pins_cs1: nand-pins-cs1 {
+                       nand_cs1_pin: nand-cs1-pin {
                                pins = "PC3";
                                function = "nand0";
                                bias-pull-up;
                        };
 
-                       nand_pins_rb0: nand-pins-rb0 {
+                       nand_rb0_pin: nand-rb0-pin {
                                pins = "PC6";
                                function = "nand0";
                                bias-pull-up;
                        };
 
-                       nand_pins_rb1: nand-pins-rb1 {
+                       nand_rb1_pin: nand-rb1-pin {
                                pins = "PC7";
                                function = "nand0";
                                bias-pull-up;
                };
 
                gic: interrupt-controller@1c81000 {
-                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
                              <0x01c82000 0x2000>,
                              <0x01c84000 0x2000>,
                                #size-cells = <0>;
 
                                fe0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       fe0_out_be0: endpoint@0 {
-                                               reg = <0>;
+                                       fe0_out_be0: endpoint {
                                                remote-endpoint = <&be0_in_fe0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                be0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       be0_in_fe0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_in_fe0: endpoint {
                                                remote-endpoint = <&fe0_out_be0>;
                                        };
                                };
 
                                be0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       be0_out_drc0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_out_drc0: endpoint {
                                                remote-endpoint = <&drc0_in_be0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                drc0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       drc0_in_be0: endpoint@0 {
-                                               reg = <0>;
+                                       drc0_in_be0: endpoint {
                                                remote-endpoint = <&be0_out_drc0>;
                                        };
                                };
 
                                drc0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       drc0_out_tcon0: endpoint@0 {
-                                               reg = <0>;
+                                       drc0_out_tcon0: endpoint {
                                                remote-endpoint = <&tcon0_in_drc0>;
                                        };
                                };
                        status = "disabled";
                };
 
+               r_i2c: i2c@1f02400 {
+                       compatible = "allwinner,sun8i-a23-i2c",
+                                    "allwinner,sun6i-a31-i2c";
+                       reg = <0x01f02400 0x400>;
+                       interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&r_i2c_pins>;
+                       clocks = <&apb0_gates 6>;
+                       resets = <&apb0_rst 6>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
                r_pio: pinctrl@1f02c00 {
                        compatible = "allwinner,sun8i-a23-r-pinctrl";
                        reg = <0x01f02c00 0x400>;
                        #interrupt-cells = <3>;
                        #gpio-cells = <3>;
 
+                       r_i2c_pins: r-i2c-pins {
+                               pins = "PL0", "PL1";
+                               function = "s_i2c";
+                               bias-pull-up;
+                       };
+
                        r_rsb_pins: r-rsb-pins {
                                pins = "PL0", "PL1";
                                function = "s_rsb";
index d4dab7c..5659c63 100644 (file)
@@ -65,3 +65,9 @@
 &panel {
        compatible = "bananapi,s070wv20-ct16", "simple-panel";
 };
+
+&tcon0_out {
+       tcon0_out_lcd: endpoint {
+               remote-endpoint = <&panel_input>;
+       };
+};
index b0bc236..9c5750c 100644 (file)
        model = "Q8 A33 Tablet";
        compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
 };
+
+&tcon0_out {
+       tcon0_out_lcd: endpoint@0 {
+               reg = <0>;
+               remote-endpoint = <&panel_input>;
+       };
+};
index f366726..785798e 100644 (file)
 
        panel {
                compatible = "netron-dy,e231732";
-               #address-cells = <1>;
-               #size-cells = <0>;
 
-               port@0 {
-                       reg = <0>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       panel_input: endpoint@0 {
-                               reg = <0>;
+               port {
+                       panel_input: endpoint {
                                remote-endpoint = <&tcon0_out_panel>;
                        };
                };
index 1111a64..1532a0e 100644 (file)
                        phys = <&dphy>;
                        phy-names = "dphy";
                        status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
 
-                       ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-
-                               port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
-                                       reg = <0>;
-
-                                       dsi_in_tcon0: endpoint {
-                                               remote-endpoint = <&tcon0_out_dsi>;
-                                       };
+                       port {
+                               dsi_in_tcon0: endpoint {
+                                       remote-endpoint = <&tcon0_out_dsi>;
                                };
                        };
                };
 };
 
 &tcon0_out {
+       #address-cells = <1>;
+       #size-cells = <0>;
+
        tcon0_out_dsi: endpoint@1 {
                reg = <1>;
                remote-endpoint = <&dsi_in_tcon0>;
index 838be7b..9d34eab 100644 (file)
        };
 };
 
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usb_power_supply {
+       status = "okay";
+};
+
 &usbphy {
+       usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
+       usb0_vbus_power-supply = <&usb_power_supply>;
+       usb0_vbus-supply = <&reg_drivevbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        status = "okay";
 };
index fcbec3d..ea299d3 100644 (file)
        };
 };
 
+&usb_otg {
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usb_power_supply {
+       status = "okay";
+};
+
 &usbphy {
+       usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
+       usb0_vbus_power-supply = <&usb_power_supply>;
+       usb0_vbus-supply = <&reg_drivevbus>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
        usb2_vbus-supply = <&reg_usb2_vbus>;
        status = "okay";
index 98e8cea..66d0780 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pwm/pwm.h>
+#include <dt-bindings/input/input.h>
 
 / {
        model = "TBS A711 Tablet";
                };
        };
 
+       reg_gps: reg-gps {
+               compatible = "regulator-fixed";
+               regulator-name = "gps";
+               regulator-min-microvolt = <3000000>;
+               regulator-max-microvolt = <3000000>;
+       };
+
        reg_vbat: reg-vbat {
                compatible = "regulator-fixed";
                regulator-name = "vbat";
        status = "okay";
 };
 
+&i2c1 {
+       clock-frequency = <400000>;
+       status = "okay";
+
+       accelerometer@18 {
+               compatible = "bosch,bma250";
+               reg = <0x18>;
+               interrupt-parent = <&pio>;
+               interrupts = <7 10 IRQ_TYPE_EDGE_RISING>; /* PH10 / EINT10 */
+       };
+};
+
 &mmc0 {
        vmmc-supply = <&reg_dcdc1>;
        pinctrl-names = "default";
        status = "okay";
 };
 
+&r_lradc {
+       vref-supply = <&reg_aldo2>;
+       status = "okay";
+
+       button@210 {
+               label = "Volume Up";
+               linux,code = <KEY_VOLUMEUP>;
+               channel = <0>;
+               voltage = <210000>;
+       };
+
+       button@410 {
+               label = "Volume Down";
+               linux,code = <KEY_VOLUMEDOWN>;
+               channel = <0>;
+               voltage = <410000>;
+       };
+};
+
 &r_rsb {
        status = "okay";
 
 };
 
 &tcon0_out {
-       tcon0_out_lcd: endpoint@0 {
-               reg = <0>;
+       tcon0_out_lcd: endpoint {
                remote-endpoint = <&panel_input>;
        };
 };
 &uart1 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+       uart-has-rtscts;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm20702a1";
+               clocks = <&ac100_rtc 1>;
+               clock-names = "lpo";
+               vbat-supply = <&reg_vbat>;
+               vddio-supply = <&reg_dldo1>;
+               device-wakeup-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+               host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
+               shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
+               max-speed = <1500000>;
+       };
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart2_pb_pins>;
        status = "okay";
+
+       gnss {
+               compatible = "u-blox,neo-6m";
+
+               v-bckp-supply = <&reg_rtc_ldo>;
+               vcc-supply = <&reg_gps>;
+               current-speed = <9600>;
+       };
 };
 
 &usb_otg {
 &usbphy {
        usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
        usb0_vbus-supply = <&reg_drivevbus>;
-       usb1_vbus_supply = <&reg_vmain>;
-       usb2_vbus_supply = <&reg_vmain>;
+       usb1_vbus-supply = <&reg_vmain>;
+       usb2_vbus-supply = <&reg_vmain>;
        status = "okay";
 };
index b099d2f..392b0ca 100644 (file)
                #size-cells = <0>;
 
                cpu0: cpu@0 {
-                       clocks = <&ccu CLK_C0CPUX>;
-                       clock-names = "cpu";
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C0CPUX>;
                        operating-points-v2 = <&cpu0_opp_table>;
                        cci-control-port = <&cci_control0>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <0>;
+                       #cooling-cells = <2>;
                };
 
                cpu@1 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C0CPUX>;
                        operating-points-v2 = <&cpu0_opp_table>;
                        cci-control-port = <&cci_control0>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <1>;
+                       #cooling-cells = <2>;
                };
 
                cpu@2 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C0CPUX>;
                        operating-points-v2 = <&cpu0_opp_table>;
                        cci-control-port = <&cci_control0>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <2>;
+                       #cooling-cells = <2>;
                };
 
                cpu@3 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C0CPUX>;
                        operating-points-v2 = <&cpu0_opp_table>;
                        cci-control-port = <&cci_control0>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <3>;
+                       #cooling-cells = <2>;
                };
 
                cpu100: cpu@100 {
-                       clocks = <&ccu CLK_C1CPUX>;
-                       clock-names = "cpu";
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C1CPUX>;
                        operating-points-v2 = <&cpu1_opp_table>;
                        cci-control-port = <&cci_control1>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <0x100>;
+                       #cooling-cells = <2>;
                };
 
                cpu@101 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C1CPUX>;
                        operating-points-v2 = <&cpu1_opp_table>;
                        cci-control-port = <&cci_control1>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <0x101>;
+                       #cooling-cells = <2>;
                };
 
                cpu@102 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C1CPUX>;
                        operating-points-v2 = <&cpu1_opp_table>;
                        cci-control-port = <&cci_control1>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <0x102>;
+                       #cooling-cells = <2>;
                };
 
                cpu@103 {
                        compatible = "arm,cortex-a7";
                        device_type = "cpu";
+                       clocks = <&ccu CLK_C1CPUX>;
                        operating-points-v2 = <&cpu1_opp_table>;
                        cci-control-port = <&cci_control1>;
                        enable-method = "allwinner,sun8i-a83t-smp";
                        reg = <0x103>;
+                       #cooling-cells = <2>;
                };
        };
 
                                                reg = <0>;
                                                remote-endpoint = <&tcon0_in_mixer0>;
                                        };
+
+                                       mixer0_out_tcon1: endpoint@1 {
+                                               reg = <1>;
+                                               remote-endpoint = <&tcon1_in_mixer0>;
+                                       };
                                };
                        };
                };
                                #size-cells = <0>;
 
                                mixer1_out: port@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       mixer1_out_tcon1: endpoint {
+                                       mixer1_out_tcon0: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&tcon0_in_mixer1>;
+                                       };
+
+                                       mixer1_out_tcon1: endpoint@1 {
+                                               reg = <1>;
                                                remote-endpoint = <&tcon1_in_mixer1>;
                                        };
                                };
                        clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
                        clock-names = "ahb", "tcon-ch0";
                        clock-output-names = "tcon-pixel-clock";
+                       #clock-cells = <0>;
                        resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
                        reset-names = "lcd", "lvds";
 
                                                reg = <0>;
                                                remote-endpoint = <&mixer0_out_tcon0>;
                                        };
+
+                                       tcon0_in_mixer1: endpoint@1 {
+                                               reg = <1>;
+                                               remote-endpoint = <&mixer1_out_tcon0>;
+                                       };
                                };
 
                                tcon0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
                                };
                        };
                                #size-cells = <0>;
 
                                tcon1_in: port@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon1_in_mixer1: endpoint {
+                                       tcon1_in_mixer0: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&mixer0_out_tcon1>;
+                                       };
+
+                                       tcon1_in_mixer1: endpoint@1 {
+                                               reg = <1>;
                                                remote-endpoint = <&mixer1_out_tcon1>;
                                        };
                                };
                        phys = <&usbphy 0>;
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI0>;
                        resets = <&ccu RST_BUS_EHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_OHCI0>, <&ccu CLK_USB_OHCI0>;
                        resets = <&ccu RST_BUS_OHCI0>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI1>;
                        resets = <&ccu RST_BUS_EHCI1>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                function = "i2c1";
                        };
 
+                       /omit-if-no-ref/
+                       i2c2_pe_pins: i2c2-pe-pins {
+                               pins = "PE14", "PE15";
+                               function = "i2c2";
+                       };
+
                        i2c2_ph_pins: i2c2-ph-pins {
                                pins = "PH4", "PH5";
                                function = "i2c2";
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };
+
+                       /omit-if-no-ref/
+                       uart2_pb_pins: uart2-pb-pins {
+                               pins = "PB0", "PB1";
+                               function = "uart2";
+                       };
                };
 
                timer@1c20c00 {
                        status = "disabled";
                };
 
+               uart2: serial@1c28800 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28800 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@1c28c00 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28c00 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@1c29000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c29000 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@1c2ac00 {
                        compatible = "allwinner,sun8i-a83t-i2c",
                                     "allwinner,sun6i-a31-i2c";
                };
 
                gic: interrupt-controller@1c81000 {
-                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
                              <0x01c82000 0x2000>,
                              <0x01c84000 0x2000>,
                        status = "disabled";
                };
 
+               r_lradc: lradc@1f03c00 {
+                       compatible = "allwinner,sun8i-a83t-r-lradc";
+                       reg = <0x01f03c00 0x100>;
+                       interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+               };
+
                r_pio: pinctrl@1f02c00 {
                        compatible = "allwinner,sun8i-a83t-r-pinctrl";
                        reg = <0x01f02c00 0x400>;
index 1db2541..78a37a4 100644 (file)
@@ -28,7 +28,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
 
                pwr_led {
                        label = "bananapi-m2-zero:red:pwr";
@@ -39,7 +38,6 @@
 
        gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
 
                sw4 {
                        label = "power";
@@ -67,8 +65,9 @@
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+               clocks = <&rtc 1>;
+               clock-names = "ext_clock";
        };
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
 &uart1 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+       uart-has-rtscts;
        status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rtc 1>;
+               clock-names = "lpo";
+               vbat-supply = <&reg_vcc3v3>;
+               vddio-supply = <&reg_vcc3v3>;
+               device-wakeup-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
+               host-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
+               shutdown-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+       };
+
 };
 
 &usb_otg {
index 84cd9c0..4970eda 100644 (file)
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 25540b7..6277f13 100644 (file)
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 
 &spdif {
        pinctrl-names = "default";
-       pinctrl-0 = <&spdif_tx_pins_a>;
+       pinctrl-0 = <&spdif_tx_pin>;
        status = "okay";
 };
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 2c952ea..ff0a7a9 100644 (file)
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 &mmc0 {
        vmmc-supply = <&reg_vcc3v3>;
        bus-width = <4>;
-       cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
-       cd-inverted;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
        status = "okay";
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 4ec94d7..4ba533b 100644 (file)
@@ -64,7 +64,6 @@
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
        };
 
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
index 9412668..69243dc 100644 (file)
@@ -93,7 +93,7 @@
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
index 6246d3e..07867a0 100644 (file)
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index f110ee3..4df29a6 100644 (file)
@@ -59,8 +59,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_npi>, <&leds_r_npi>;
 
                status {
                        label = "nanopi:blue:status";
@@ -78,8 +76,6 @@
        r_gpio_keys {
                compatible = "gpio-keys";
                input-name = "k1";
-               pinctrl-names = "default";
-               pinctrl-0 = <&sw_r_npi>;
 
                k1 {
                        label = "k1";
        status = "okay";
 };
 
-&pio {
-       leds_npi: led_pins {
-               pins = "PA10";
-               function = "gpio_out";
-       };
-};
-
-&r_pio {
-       leds_r_npi: led_pins {
-               pins = "PL10";
-               function = "gpio_out";
-       };
-
-       sw_r_npi: key_pins {
-               pins = "PL3";
-               function = "gpio_in";
-       };
-};
-
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index f1fc6bd..597c425 100644 (file)
@@ -75,8 +75,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
 
                status_led {
                        label = "orangepi:red:status";
@@ -92,8 +90,6 @@
 
        r_gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&sw_r_opc>;
 
                sw2 {
                        label = "sw2";
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
-               pinctrl-0 = <&wifi_pwrseq_pin_orangepi>;
                reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 WIFI_EN */
        };
 };
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
        };
 };
 
-&pio {
-       leds_opc: led_pins {
-               pins = "PA15";
-               function = "gpio_out";
-       };
-};
-
-&r_pio {
-       leds_r_opc: led_pins {
-               pins = "PL10";
-               function = "gpio_out";
-       };
-
-       sw_r_opc: key_pins {
-               pins = "PL3", "PL4";
-               function = "gpio_in";
-       };
-
-       wifi_pwrseq_pin_orangepi: wifi_pwrseq_pin {
-               pins = "PL7";
-               function = "gpio_out";
-       };
-};
-
 &reg_usb1_vbus {
        gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>;
        status = "okay";
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 476ae8e..6f9c97a 100644 (file)
@@ -74,8 +74,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
 
                pwr_led {
                        label = "orangepi:green:pwr";
@@ -91,8 +89,6 @@
 
        r_gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&sw_r_opc>;
 
                sw4 {
                        label = "sw4";
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
        status = "okay";
 };
 
-&pio {
-       leds_opc: led_pins {
-               pins = "PA15";
-               function = "gpio_out";
-       };
-};
-
-&r_pio {
-       leds_r_opc: led_pins {
-               pins = "PL10";
-               function = "gpio_out";
-       };
-
-       sw_r_opc: key_pins {
-               pins = "PL3";
-               function = "gpio_in";
-       };
-};
-
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 245fd65..8408491 100644 (file)
@@ -73,8 +73,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
 
                pwr_led {
                        label = "orangepi:green:pwr";
@@ -90,8 +88,6 @@
 
        r_gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&sw_r_opc>;
 
                sw4 {
                        label = "sw4";
        status = "okay";
 };
 
-&pio {
-       leds_opc: led_pins {
-               pins = "PA15";
-               function = "gpio_out";
-       };
-};
-
-&r_pio {
-       leds_r_opc: led_pins {
-               pins = "PL10";
-               function = "gpio_out";
-       };
-
-       sw_r_opc: key_pins {
-               pins = "PL3";
-               function = "gpio_in";
-       };
-};
-
 &reg_usb0_vbus {
        gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
        status = "okay";
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 4624033..5aff8ec 100644 (file)
@@ -73,8 +73,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
-               pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
 
                pwr_led {
                        label = "orangepi:green:pwr";
@@ -90,8 +88,6 @@
 
        r_gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
-               pinctrl-0 = <&sw_r_opc>;
 
                sw4 {
                        label = "sw4";
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
        status = "okay";
 };
 
-&pio {
-       leds_opc: led_pins {
-               pins = "PA15";
-               function = "gpio_out";
-       };
-};
-
 &r_i2c {
        status = "okay";
 
        };
 };
 
-&r_pio {
-       leds_r_opc: led_pins {
-               pins = "PL10";
-               function = "gpio_out";
-       };
-
-       sw_r_opc: key_pins {
-               pins = "PL3";
-               function = "gpio_in";
-       };
-};
-
 &reg_usb0_vbus {
        gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
        status = "okay";
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index ac8438c..97f4978 100644 (file)
@@ -63,8 +63,6 @@
 
        reg_usb3_vbus: usb3-vbus {
                compatible = "regulator-fixed";
-               pinctrl-names = "default";
-               pinctrl-0 = <&usb3_vbus_pin_a>;
                regulator-name = "usb3-vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
        bias-pull-up;
 };
 
-&pio {
-       usb3_vbus_pin_a: usb3_vbus_pin {
-               pins = "PG11";
-               function = "gpio_out";
-       };
-};
-
 &r_i2c {
        status = "okay";
 
index c834048..b8f46e2 100644 (file)
@@ -79,7 +79,6 @@
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
                post-power-on-delay-ms = <200>;
        };
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
diff --git a/arch/arm/boot/dts/sun8i-h3-rervision-dvk.dts b/arch/arm/boot/dts/sun8i-h3-rervision-dvk.dts
new file mode 100644 (file)
index 0000000..4738f3a
--- /dev/null
@@ -0,0 +1,114 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
+ */
+
+/dts-v1/;
+#include "sun8i-h3.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "RerVision H3-DVK";
+       compatible = "rervision,h3-dvk", "allwinner,sun8i-h3";
+
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_con_in: endpoint {
+                               remote-endpoint = <&hdmi_out_con>;
+                       };
+               };
+       };
+};
+
+&de {
+       status = "okay";
+};
+
+&ehci1 {
+       status = "okay";
+};
+
+&ehci2 {
+       status = "okay";
+};
+
+&ehci3 {
+       status = "okay";
+};
+
+&emac {
+       phy-handle = <&int_mii_phy>;
+       phy-mode = "mii";
+       allwinner,leds-active-low;
+       status = "okay";
+};
+
+&hdmi {
+       status = "okay";
+};
+
+&hdmi_out {
+       hdmi_out_con: endpoint {
+               remote-endpoint = <&hdmi_con_in>;
+       };
+};
+
+&mmc0 {
+       bus-width = <4>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+       status = "okay";
+       vmmc-supply = <&reg_vcc3v3>;
+};
+
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_8bit_pins>;
+       vmmc-supply = <&reg_vcc3v3>;
+       bus-width = <8>;
+       non-removable;
+       cap-mmc-hw-reset;
+       status = "okay";
+};
+
+&ohci1 {
+       status = "okay";
+};
+
+&ohci2 {
+       status = "okay";
+};
+
+&ohci3 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pa_pins>;
+       status = "okay";
+};
+
+&usb_otg {
+       status = "okay";
+       dr_mode = "peripheral";
+};
+
+&usbphy {
+       status = "okay";
+};
index 959d265..e37c30e 100644 (file)
 &rtc {
        compatible = "allwinner,sun8i-h3-rtc";
 };
+
+&sid {
+       compatible = "allwinner,sun8i-h3-sid";
+};
index 53104f4..3d9a152 100644 (file)
                backlight = <&backlight>;
                enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
                power-supply = <&reg_dc1sw>;
-               #address-cells = <1>;
-               #size-cells = <0>;
 
-               port@0 {
-                       reg = <0>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       panel_input: endpoint@0 {
-                               reg = <0>;
+               port {
+                       panel_input: endpoint {
                                remote-endpoint = <&tcon0_out_lcd>;
                        };
                };
        status = "okay";
 };
 
-&tcon0_out {
-       tcon0_out_lcd: endpoint@0 {
-               reg = <0>;
-               remote-endpoint = <&panel_input>;
-       };
-};
-
 &usbphy {
        usb1_vbus-supply = <&reg_dldo1>;
 };
index 32cf1ab..246dec5 100644 (file)
@@ -34,8 +34,6 @@
 
        /* 2Gb Macronix MX30LF2G18AC (3V) */
        nand@0 {
-               #address-cells = <1>;
-               #size-cells = <1>;
                reg = <0>;
                allwinner,rb = <0>;
                nand-ecc-mode = "hw";
index 316998e..4f48eec 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_det: usb0-id-detect-pin {
-               pins = "PD10";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &r_rsb {
        status = "okay";
 
 
 &usbphy {
        status = "okay";
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_det>;
        usb0_vbus-supply = <&reg_drivevbus>;
-       usb0_id_det-gpios = <&pio 3 10 GPIO_ACTIVE_HIGH>; /* PD10 */
+       usb0_id_det-gpios = <&pio 3 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PD10 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb1_vbus-supply = <&reg_usb1_vbus>;
 };
index 06b6858..bb856e5 100644 (file)
                        clocks = <&ccu CLK_BUS_EHCI1>;
                        resets = <&ccu RST_BUS_EHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI1>;
                        resets = <&ccu RST_BUS_OHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI2>;
                        resets = <&ccu RST_BUS_EHCI2>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI2>;
                        resets = <&ccu RST_BUS_OHCI2>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>;
                        resets = <&ccu RST_BUS_SATA>;
-                       resets-name = "ahci";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
+                       reset-names = "ahci";
                        status = "disabled";
 
                };
                                #size-cells = <0>;
 
                                tcon_top_mixer0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon_top_mixer0_in_mixer0: endpoint@0 {
-                                               reg = <0>;
+                                       tcon_top_mixer0_in_mixer0: endpoint {
                                                remote-endpoint = <&mixer0_out_tcon_top>;
                                        };
                                };
index 189e479..b3d8b8f 100644 (file)
        status = "okay";
 };
 
-&pio {
-       usb0_id_detect_pin: usb0-id-detect-pin {
-               pins = "PH8";
-               function = "gpio_in";
-               bias-pull-up;
-       };
-};
-
 &r_rsb {
        status = "okay";
 
 };
 
 &usbphy {
-       pinctrl-names = "default";
-       pinctrl-0 = <&usb0_id_detect_pin>;
-       usb0_id_det-gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+       usb0_id_det-gpios = <&pio 7 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH8 */
        usb0_vbus_power-supply = <&usb_power_supply>;
        usb0_vbus-supply = <&reg_drivevbus>;
        status = "okay";
index 99c8cf7..2e4587d 100644 (file)
@@ -96,6 +96,6 @@
 };
 
 &usbphy {
-       usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+       usb0_id_det-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
index 21e1806..df72b17 100644 (file)
                                #size-cells = <0>;
 
                                mixer0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       mixer0_out_tcon0: endpoint@0 {
-                                               reg = <0>;
+                                       mixer0_out_tcon0: endpoint {
                                                remote-endpoint = <&tcon0_in_mixer0>;
                                        };
                                };
                        clock-names = "ahb",
                                      "tcon-ch0";
                        clock-output-names = "tcon-pixel-clock";
+                       #clock-cells = <0>;
                        resets = <&ccu RST_BUS_TCON0>;
                        reset-names = "lcd";
                        status = "disabled";
                                #size-cells = <0>;
 
                                tcon0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon0_in_mixer0: endpoint@0 {
-                                               reg = <0>;
+                                       tcon0_in_mixer0: endpoint {
                                                remote-endpoint = <&mixer0_out_tcon0>;
                                        };
                                };
                };
 
                gic: interrupt-controller@1c81000 {
-                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c81000 0x1000>,
                              <0x01c82000 0x1000>,
                              <0x01c84000 0x2000>,
index bf97f62..f05cabd 100644 (file)
 
 #include "axp22x.dtsi"
 
+&mmc0 {
+       vmmc-supply = <&reg_dcdc1>;
+       bus-width = <4>;
+       cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
+       status = "okay";
+};
+
+&mmc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_pg_pins>;
+       vmmc-supply = <&reg_dldo2>;
+       vqmmc-supply = <&reg_dldo1>;
+       mmc-pwrseq = <&wifi_pwrseq>;
+       bus-width = <4>;
+       non-removable;
+       status = "okay";
+};
+
 &reg_aldo3 {
        regulator-always-on;
        regulator-min-microvolt = <2700000>;
        regulator-name = "vcc-wifi";
 };
 
-&mmc0 {
-       vmmc-supply = <&reg_dcdc1>;
-       bus-width = <4>;
-       cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
-       status = "okay";
-};
-
-&mmc1 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc1_pg_pins>;
-       vmmc-supply = <&reg_dldo2>;
-       vqmmc-supply = <&reg_dldo1>;
-       mmc-pwrseq = <&wifi_pwrseq>;
-       bus-width = <4>;
-       non-removable;
-       status = "okay";
-};
-
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pb_pins>;
index 28c0349..18156ff 100644 (file)
        vga-dac {
                compatible = "corpro,gm7123", "adi,adv7123", "dumb-vga-dac";
                vdd-supply = <&reg_dcdc1>;
-               #address-cells = <1>;
-               #size-cells = <0>;
 
                ports {
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                        port@0 {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
                                reg = <0>;
 
-                               vga_dac_in: endpoint@0 {
-                                       reg = <0>;
+                               vga_dac_in: endpoint {
                                        remote-endpoint = <&tcon0_out_vga>;
                                };
                        };
 
                        port@1 {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
                                reg = <1>;
 
-                               vga_dac_out: endpoint@0 {
-                                       reg = <0>;
+                               vga_dac_out: endpoint {
                                        remote-endpoint = <&vga_con_in>;
                                };
                        };
 };
 
 &tcon0_out {
-       tcon0_out_vga: endpoint@0 {
-               reg = <0>;
+       tcon0_out_vga: endpoint {
                remote-endpoint = <&vga_dac_in>;
        };
 };
index 864715e..2ed28d9 100644 (file)
@@ -82,7 +82,7 @@
 
        reg_usb1_vbus: usb1-vbus {
                compatible = "regulator-fixed";
-               pinctrl-names = "default";
+               regulator-name = "usb1-vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                enable-active-high;
@@ -91,7 +91,7 @@
 
        reg_usb3_vbus: usb3-vbus {
                compatible = "regulator-fixed";
-               pinctrl-names = "default";
+               regulator-name = "usb3-vbus";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                enable-active-high;
index 6fb292e..0c1eec9 100644 (file)
                status = "disabled";
        };
 
-       soc {
+       soc@20000 {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                        clocks = <&usb_clocks CLK_BUS_HCI0>;
                        resets = <&usb_clocks RST_USB0_HCI>;
                        phys = <&usbphy1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&usb_clocks CLK_USB_OHCI0>;
                        resets = <&usb_clocks RST_USB0_HCI>;
                        phys = <&usbphy1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&usb_clocks CLK_BUS_HCI1>;
                        resets = <&usb_clocks RST_USB1_HCI>;
                        phys = <&usbphy2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&usb_clocks CLK_BUS_HCI2>;
                        resets = <&usb_clocks RST_USB2_HCI>;
                        phys = <&usbphy3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&usb_clocks CLK_USB_OHCI2>;
                        resets = <&usb_clocks RST_USB2_HCI>;
                        phys = <&usbphy3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                };
 
                gic: interrupt-controller@1c41000 {
-                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       compatible = "arm,gic-400";
                        reg = <0x01c41000 0x1000>,
                              <0x01c42000 0x2000>,
                              <0x01c44000 0x2000>,
                                #size-cells = <0>;
 
                                fe0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       fe0_out_deu0: endpoint@0 {
-                                               reg = <0>;
+                                       fe0_out_deu0: endpoint {
                                                remote-endpoint = <&deu0_in_fe0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                fe1_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       fe1_out_deu1: endpoint@0 {
-                                               reg = <0>;
+                                       fe1_out_deu1: endpoint {
                                                remote-endpoint = <&deu1_in_fe1>;
                                        };
                                };
                                };
 
                                be0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       be0_out_drc0: endpoint@0 {
-                                               reg = <0>;
+                                       be0_out_drc0: endpoint {
                                                remote-endpoint = <&drc0_in_be0>;
                                        };
                                };
                                };
 
                                be1_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       be1_out_drc1: endpoint@0 {
-                                               reg = <0>;
+                                       be1_out_drc1: endpoint {
                                                remote-endpoint = <&drc1_in_be1>;
                                        };
                                };
                                #size-cells = <0>;
 
                                deu0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       deu0_in_fe0: endpoint@0 {
-                                               reg = <0>;
+                                       deu0_in_fe0: endpoint {
                                                remote-endpoint = <&fe0_out_deu0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                deu1_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       deu1_in_fe1: endpoint@0 {
-                                               reg = <0>;
+                                       deu1_in_fe1: endpoint {
                                                remote-endpoint = <&fe1_out_deu1>;
                                        };
                                };
                                #size-cells = <0>;
 
                                drc0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       drc0_in_be0: endpoint@0 {
-                                               reg = <0>;
+                                       drc0_in_be0: endpoint {
                                                remote-endpoint = <&be0_out_drc0>;
                                        };
                                };
 
                                drc0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       drc0_out_tcon0: endpoint@0 {
-                                               reg = <0>;
+                                       drc0_out_tcon0: endpoint {
                                                remote-endpoint = <&tcon0_in_drc0>;
                                        };
                                };
                                #size-cells = <0>;
 
                                drc1_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       drc1_in_be1: endpoint@0 {
-                                               reg = <0>;
+                                       drc1_in_be1: endpoint {
                                                remote-endpoint = <&be1_out_drc1>;
                                        };
                                };
 
                                drc1_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
 
-                                       drc1_out_tcon1: endpoint@0 {
-                                               reg = <0>;
+                                       drc1_out_tcon1: endpoint {
                                                remote-endpoint = <&tcon1_in_drc1>;
                                        };
                                };
                        resets = <&ccu RST_BUS_LCD0>, <&ccu RST_BUS_EDP>;
                        reset-names = "lcd", "edp";
                        clock-output-names = "tcon0-pixel-clock";
+                       #clock-cells = <0>;
 
                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
 
                                tcon0_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon0_in_drc0: endpoint@0 {
-                                               reg = <0>;
+                                       tcon0_in_drc0: endpoint {
                                                remote-endpoint = <&drc0_out_tcon0>;
                                        };
                                };
 
                                tcon0_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
                                };
                        };
                                #size-cells = <0>;
 
                                tcon1_in: port@0 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon1_in_drc1: endpoint@0 {
-                                               reg = <0>;
+                                       tcon1_in_drc1: endpoint {
                                                remote-endpoint = <&drc1_out_tcon1>;
                                        };
                                };
 
                                tcon1_out: port@1 {
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
                                        reg = <1>;
                                };
                        };
                        gpio-controller;
                        interrupt-controller;
                        #interrupt-cells = <3>;
-                       #size-cells = <0>;
                        #gpio-cells = <3>;
 
                        gmac_rgmii_pins: gmac-rgmii-pins {
-                               allwinner,pins = "PA0", "PA1", "PA2", "PA3",
-                                                "PA4", "PA5", "PA7", "PA8",
-                                                "PA9", "PA10", "PA12", "PA13",
-                                                "PA15", "PA16", "PA17";
-                               allwinner,function = "gmac";
+                               pins = "PA0", "PA1", "PA2", "PA3", "PA4", "PA5",
+                                      "PA7", "PA8", "PA9", "PA10", "PA12",
+                                      "PA13", "PA15", "PA16", "PA17";
+                               function = "gmac";
                                /*
                                 * data lines in RGMII mode use DDR mode
                                 * and need a higher signal drive strength
index 3bed375..39263e7 100644 (file)
@@ -69,7 +69,6 @@
 
        leds {
                compatible = "gpio-leds";
-               pinctrl-names = "default";
 
                pwr_led {
                        label = "bananapi-m2-plus:red:pwr";
@@ -80,7 +79,6 @@
 
        gpio_keys {
                compatible = "gpio-keys";
-               pinctrl-names = "default";
 
                sw4 {
                        label = "power";
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
                clocks = <&rtc 1>;
                clock-names = "ext_clock";
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index d74a6cb..84977d4 100644 (file)
                        #size-cells = <0>;
                };
 
+               sid: eeprom@1c14000 {
+                       /* compatible is in per SoC .dtsi file */
+                       reg = <0x1c14000 0x400>;
+               };
+
                usb_otg: usb@1c19000 {
                        compatible = "allwinner,sun8i-h3-musb";
                        reg = <0x01c19000 0x400>;
                        phys = <&usbphy 0>;
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI1>, <&ccu CLK_BUS_OHCI1>;
                        resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI1>;
                        resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI2>, <&ccu CLK_BUS_OHCI2>;
                        resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI2>;
                        resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>;
                        phys = <&usbphy 2>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        clocks = <&ccu CLK_BUS_EHCI3>, <&ccu CLK_BUS_OHCI3>;
                        resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>;
                        phys = <&usbphy 3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI3>;
                        resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>;
                        phys = <&usbphy 3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
-                       csi_pins: csi {
+                       csi_pins: csi-pins {
                                pins = "PE0", "PE2", "PE3", "PE4", "PE5",
                                       "PE6", "PE7", "PE8", "PE9", "PE10",
                                       "PE11";
                                function = "csi";
                        };
 
-                       emac_rgmii_pins: emac0 {
+                       emac_rgmii_pins: emac-rgmii-pins {
                                pins = "PD0", "PD1", "PD2", "PD3", "PD4",
                                       "PD5", "PD7", "PD8", "PD9", "PD10",
                                       "PD12", "PD13", "PD15", "PD16", "PD17";
                                drive-strength = <40>;
                        };
 
-                       i2c0_pins: i2c0 {
+                       i2c0_pins: i2c0-pins {
                                pins = "PA11", "PA12";
                                function = "i2c0";
                        };
 
-                       i2c1_pins: i2c1 {
+                       i2c1_pins: i2c1-pins {
                                pins = "PA18", "PA19";
                                function = "i2c1";
                        };
 
-                       i2c2_pins: i2c2 {
+                       i2c2_pins: i2c2-pins {
                                pins = "PE12", "PE13";
                                function = "i2c2";
                        };
 
-                       mmc0_pins: mmc0 {
+                       mmc0_pins: mmc0-pins {
                                pins = "PF0", "PF1", "PF2", "PF3",
                                       "PF4", "PF5";
                                function = "mmc0";
                                bias-pull-up;
                        };
 
-                       mmc1_pins: mmc1 {
+                       mmc1_pins: mmc1-pins {
                                pins = "PG0", "PG1", "PG2", "PG3",
                                       "PG4", "PG5";
                                function = "mmc1";
                                bias-pull-up;
                        };
 
-                       mmc2_8bit_pins: mmc2_8bit {
+                       mmc2_8bit_pins: mmc2-8bit-pins {
                                pins = "PC5", "PC6", "PC8",
                                       "PC9", "PC10", "PC11",
                                       "PC12", "PC13", "PC14",
                                bias-pull-up;
                        };
 
-                       spdif_tx_pins_a: spdif {
+                       spdif_tx_pin: spdif-tx-pin {
                                pins = "PA17";
                                function = "spdif";
                        };
 
-                       spi0_pins: spi0 {
+                       spi0_pins: spi0-pins {
                                pins = "PC0", "PC1", "PC2", "PC3";
                                function = "spi0";
                        };
 
-                       spi1_pins: spi1 {
+                       spi1_pins: spi1-pins {
                                pins = "PA15", "PA16", "PA14", "PA13";
                                function = "spi1";
                        };
 
-                       uart0_pins_a: uart0 {
+                       uart0_pa_pins: uart0-pa-pins {
                                pins = "PA4", "PA5";
                                function = "uart0";
                        };
 
-                       uart1_pins: uart1 {
+                       uart1_pins: uart1-pins {
                                pins = "PG6", "PG7";
                                function = "uart1";
                        };
 
-                       uart1_rts_cts_pins: uart1_rts_cts {
+                       uart1_rts_cts_pins: uart1-rts-cts-pins {
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };
 
-                       uart2_pins: uart2 {
+                       uart2_pins: uart2-pins {
                                pins = "PA0", "PA1";
                                function = "uart2";
                        };
 
-                       uart3_pins: uart3 {
+                       uart3_pins: uart3-pins {
                                pins = "PA13", "PA14";
                                function = "uart3";
                        };
 
-                       uart3_rts_cts_pins: uart3_rts_cts {
+                       uart3_rts_cts_pins: uart3-rts-cts-pins {
                                pins = "PA15", "PA16";
                                function = "uart3";
                        };
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
-                       ir_pins_a: ir {
+                       r_ir_rx_pin: r-ir-rx-pin {
                                pins = "PL11";
                                function = "s_cir_rx";
                        };
 
-                       r_i2c_pins: r-i2c {
+                       r_i2c_pins: r-i2c-pins {
                                pins = "PL0", "PL1";
                                function = "s_i2c";
                        };
index 1eadc13..19b3b23 100644 (file)
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index ca2c3a5..d18eaf4 100644 (file)
@@ -1,42 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
 /*
- * Copyright 2016 Toradex AG
+ * Copyright 2016-2019 Toradex AG
  *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 / {
index eaee10e..ceb3f63 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
 /*
- * Copyright 2016-2018 Toradex AG
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright 2016-2019 Toradex AG
  */
 
 /dts-v1/;
index 7961eb4..826b776 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
  * Copyright 2016-2018 Toradex AG
  */
index 367eb8c..0462ed2 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+// SPDX-License-Identifier: GPL-2.0 OR MIT
 /*
  * Copyright 2016-2018 Toradex AG
  */
@@ -17,6 +17,7 @@
 
        pcie@1003000 {
                status = "okay";
+
                avddio-pex-supply = <&reg_1v05_vdd>;
                avdd-pex-pll-supply = <&reg_1v05_vdd>;
                avdd-pll-erefe-supply = <&reg_1v05_avdd>;
                       <&{/padctl@7009f000/pads/usb2/lanes/usb2-2}>,
                       <&{/padctl@7009f000/pads/pcie/lanes/pcie-0}>;
                phy-names = "usb2-0", "usb3-1", "usb2-1", "usb2-2", "usb3-0";
+
                avddio-pex-supply = <&reg_1v05_vdd>;
                avdd-pll-erefe-supply = <&reg_1v05_avdd>;
                avdd-pll-utmip-supply = <&reg_1v8_vddio>;
        };
 
        padctl@7009f000 {
+               avdd-pll-utmip-supply = <&reg_1v8_vddio>;
+               avdd-pll-erefe-supply = <&reg_1v05_avdd>;
+               avdd-pex-pll-supply = <&reg_1v05_vdd>;
+               hvdd-pex-pll-e-supply = <&reg_module_3v3>;
+
                pads {
                        usb2 {
                                status = "okay";
index 13c93cd..d1e8593 100644 (file)
@@ -1,42 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 OR X11
 /*
- * Copyright 2016-2018 Toradex AG
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
+ * Copyright 2016-2019 Toradex AG
  */
 
 #include "tegra124.dtsi"
        };
 
        padctl@7009f000 {
+               avdd-pll-utmip-supply = <&reg_1v8_vddio>;
+               avdd-pll-erefe-supply = <&reg_1v05_avdd>;
+               avdd-pex-pll-supply = <&reg_1v05_vdd>;
+               hvdd-pex-pll-e-supply = <&reg_module_3v3>;
+
                pads {
                        usb2 {
                                status = "okay";
index 33bbb1c..d5fd642 100644 (file)
        padctl@7009f000 {
                status = "okay";
 
+               avdd-pll-utmip-supply = <&vddio_1v8>;
+               avdd-pll-erefe-supply = <&avdd_1v05_run>;
+               avdd-pex-pll-supply = <&vdd_1v05_run>;
+               hvdd-pex-pll-e-supply = <&vdd_3v3_lp0>;
+
                pads {
                        usb2 {
                                status = "okay";
index a1acd87..3b10f47 100644 (file)
        padctl@7009f000 {
                status = "okay";
 
+               avdd-pll-utmip-supply = <&vddio_1v8>;
+               avdd-pll-erefe-supply = <&avdd_1v05_run>;
+               avdd-pex-pll-supply = <&vdd_1v05_run>;
+               hvdd-pex-pll-e-supply = <&vdd_3v3_lp0>;
+
                pads {
                        usb2 {
                                status = "okay";
index 4882b61..5d5e6e1 100644 (file)
        };
 
        padctl@7009f000 {
+               avdd-pll-utmip-supply = <&vddio_1v8>;
+               avdd-pll-erefe-supply = <&avdd_1v05_run>;
+               avdd-pex-pll-supply = <&vdd_1v05_run>;
+               hvdd-pex-pll-e-supply = <&vdd_3v3_lp0>;
+
                pads {
                        usb2 {
                                status = "okay";
index d2b553f..e074258 100644 (file)
                reg = <0x6000c000 0x150>; /* AHB Arbitration + Gizmo Controller */
        };
 
+       actmon@6000c800 {
+               compatible = "nvidia,tegra30-actmon";
+               reg = <0x6000c800 0x400>;
+               interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA30_CLK_ACTMON>,
+                        <&tegra_car TEGRA30_CLK_EMC>;
+               clock-names = "actmon", "emc";
+               resets = <&tegra_car TEGRA30_CLK_ACTMON>;
+               reset-names = "actmon";
+       };
+
        gpio: gpio@6000d000 {
                compatible = "nvidia,tegra30-gpio";
                reg = <0x6000d000 0x1000>;
index de0c24f..ec8cd86 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * usb_a9260.dts - Device Tree file for Caloa USB A9260 board
  *
  *  Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "at91sam9260.dtsi"
index de3fa3a..8744b5f 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * usb_a926x.dts - Device Tree file for Caloa USB A926x board
  *
  *  Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 / {
index ec77cf8..2f667b0 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board
  *
  *  Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "usb_a9g20_common.dtsi"
index 81c3fe0..adbe750 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board
  *
  *  Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include "at91sam9g20.dtsi"
index f8cb1b9..f657120 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * usb_a9g20_lpw.dts - Device Tree file for Caloa USB A9G20 Low Power board
  *
  *  Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * Licensed under GPLv2 or later.
  */
 /dts-v1/;
 #include "usb_a9g20_common.dtsi"
index 445c7dc..9466913 100644 (file)
                        label = "zii:green:debug1";
                        gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
-                       max-brightness = <1>;
                };
 
                led-fail {
                        label = "zii:red:fail";
                        gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
                        default-state = "off";
-                       max-brightness = <1>;
                };
 
                led-status {
                        label = "zii:green:status";
                        gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
-                       max-brightness = <1>;
                };
 
                led-debug-a {
                        label = "zii:green:debug_a";
                        gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
-                       max-brightness = <1>;
                };
 
                led-debug-b {
                        label = "zii:green:debug_b";
                        gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
-                       max-brightness = <1>;
                };
        };
 
        bus-num = <1>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_dspi1>;
-       status = "okay";
-
-       m25p128@0 {
+       /*
+        * Some CFU1s come with SPI-NOR chip DNPed, so we leave this
+        * node disabled by default and rely on bootloader to enable
+        * it when appropriate.
+        */
+       status = "disabled";
+
+       flash@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "m25p128", "jedec,spi-nor";
        pinctrl-0 = <&pinctrl_i2c0>;
        status = "okay";
 
-       pca9554@22 {
+       io-expander@22 {
                compatible = "nxp,pca9554";
                reg = <0x22>;
                gpio-controller;
                reg = <0x48>;
        };
 
-       at24c04@52 {
+       eeprom@52 {
                compatible = "atmel,24c04";
                reg = <0x52>;
                label = "nvm";
        };
 
-       at24c04@54 {
+       eeprom@54 {
                compatible = "atmel,24c04";
                reg = <0x54>;
                label = "nameplate";
        };
 };
 
+&snvsrtc {
+       status = "disabled";
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart0>;
index bd79e00..48086c5 100644 (file)
@@ -1,45 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2015, 2016 Zodiac Inflight Innovations
- *
- * Based on an original 'vf610-twr.dts' which is Copyright 2015,
- * Freescale Semiconductor, Inc.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
                gpio-sck  = <&gpio1 12 GPIO_ACTIVE_HIGH>;
                gpio-mosi = <&gpio1 11 GPIO_ACTIVE_HIGH>;
                gpio-miso = <&gpio1 10 GPIO_ACTIVE_HIGH>;
-               cs-gpios  = <&gpio1  9 GPIO_ACTIVE_HIGH
+               cs-gpios  = <&gpio1  9 GPIO_ACTIVE_LOW
                             &gpio1  8 GPIO_ACTIVE_HIGH>;
                num-chipselects = <2>;
 
-               m25p128@0 {
+               flash@0 {
                        compatible = "m25p128", "jedec,spi-nor";
                        #address-cells = <1>;
                        #size-cells = <1>;
        pinctrl-0 = <&pinctrl_i2c0>;
        status = "okay";
 
-       gpio5: pca9554@20 {
+       gpio5: io-expander@20 {
                compatible = "nxp,pca9554";
                reg = <0x20>;
                gpio-controller;
 
        };
 
-       gpio6: pca9554@22 {
+       gpio6: io-expander@22 {
                compatible = "nxp,pca9554";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_pca9554_22>;
                        #size-cells = <0>;
                        reg = <0>;
 
-                       sfp1: at24c04@50 {
+                       sfp1: eeprom@50 {
                                compatible = "atmel,24c02";
                                reg = <0x50>;
                        };
                        #size-cells = <0>;
                        reg = <1>;
 
-                       sfp2: at24c04@50 {
+                       sfp2: eeprom@50 {
                                compatible = "atmel,24c02";
                                reg = <0x50>;
                        };
                        #size-cells = <0>;
                        reg = <2>;
 
-                       sfp3: at24c04@50 {
+                       sfp3: eeprom@50 {
                                compatible = "atmel,24c02";
                                reg = <0x50>;
                        };
                        #size-cells = <0>;
                        reg = <3>;
 
-                       sfp4: at24c04@50 {
+                       sfp4: eeprom@50 {
                                compatible = "atmel,24c02";
                                reg = <0x50>;
                        };
index 6f4a560..778e02c 100644 (file)
@@ -1,45 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
 /*
  * Copyright (C) 2015, 2016 Zodiac Inflight Innovations
- *
- * Based on an original 'vf610-twr.dts' which is Copyright 2015,
- * Freescale Semiconductor, Inc.
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 as published by the Free Software Foundation.
- *
- *     This file is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- *     obtaining a copy of this software and associated documentation
- *     files (the "Software"), to deal in the Software without
- *     restriction, including without limitation the rights to use,
- *     copy, modify, merge, publish, distribute, sublicense, and/or
- *     sell copies of the Software, and to permit persons to whom the
- *     Software is furnished to do so, subject to the following
- *     conditions:
- *
- *     The above copyright notice and this permission notice shall be
- *     included in all copies or substantial portions of the Software.
- *
- *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND,
- *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
        status = "okay";
        spi-num-chipselects = <2>;
 
-       m25p128@0 {
+       flash@0 {
                compatible = "m25p128", "jedec,spi-nor";
                #address-cells = <1>;
                #size-cells = <1>;
         *    P1 - WE2_CMD
         *    P2 - WE2_CLK
         */
-       gpio5: pca9557@18 {
+       gpio5: io-expander@18 {
                compatible = "nxp,pca9557";
                reg = <0x18>;
                gpio-controller;
         *     IO0 - WE1_CLK
         *     IO1 - WE1_CMD
         */
-       gpio7: pca9554@22 {
+       gpio7: io-expander@22 {
                compatible = "nxp,pca9554";
                reg = <0x22>;
                gpio-controller;
 };
 
 &i2c1 {
-       at24mac602@50 {
+       eeprom@50 {
                compatible = "atmel,24c02";
                reg = <0x50>;
                read-only;
index 19eb4a8..0507e6d 100644 (file)
        pinctrl-names = "default", "gpio";
        pinctrl-0 = <&pinctrl_i2c0>;
        pinctrl-1 = <&pinctrl_i2c0_gpio>;
-       scl-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+       scl-gpios = <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
        sda-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
        status = "okay";
 
                reg = <0x48>;
        };
 
-       at24c04@50 {
+       eeprom@50 {
                compatible = "atmel,24c04";
                reg = <0x50>;
        };
 
-       at24c04@52 {
+       eeprom@52 {
                compatible = "atmel,24c04";
                reg = <0x52>;
        };
index de6dfa5..d7019e8 100644 (file)
        pinctrl-0 = <&pinctrl_i2c0>;
        status = "okay";
 
-       gpio5: pca9554@20 {
+       gpio5: io-expander@20 {
                compatible = "nxp,pca9554";
                reg = <0x20>;
                gpio-controller;
                #gpio-cells = <2>;
        };
 
-       gpio6: pca9554@22 {
+       gpio6: io-expander@22 {
                compatible = "nxp,pca9554";
                reg = <0x22>;
                gpio-controller;
                reg = <0x48>;
        };
 
-       at24c04@50 {
+       eeprom@50 {
                compatible = "atmel,24c04";
                reg = <0x50>;
        };
 
-       at24c04@52 {
+       eeprom@52 {
                compatible = "atmel,24c04";
                reg = <0x52>;
        };
                reg = <0x4f>;
        };
 
-       gpio7: pca9555@23 {
+       gpio7: io-expander@23 {
                compatible = "nxp,pca9555";
                gpio-controller;
                #gpio-cells = <2>;
        };
 };
 
+&snvsrtc {
+       status = "disabled";
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart0>;
diff --git a/arch/arm/boot/dts/vf610-zii-spb4.dts b/arch/arm/boot/dts/vf610-zii-spb4.dts
new file mode 100644 (file)
index 0000000..9dde83c
--- /dev/null
@@ -0,0 +1,359 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/*
+ * Device tree file for ZII's SPB4 board
+ *
+ * SPB - Seat Power Box
+ *
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+
+/dts-v1/;
+#include "vf610.dtsi"
+
+/ {
+       model = "ZII VF610 SPB4 Board";
+       compatible = "zii,vf610spb4", "zii,vf610dev", "fsl,vf610";
+
+       chosen {
+               stdout-path = &uart0;
+       };
+
+       memory@80000000 {
+               device_type = "memory";
+               reg = <0x80000000 0x20000000>;
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&pinctrl_leds_debug>;
+               pinctrl-names = "default";
+
+               led-debug {
+                       label = "zii:green:debug1";
+                       gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       reg_vcc_3v3_mcu: regulator-vcc-3v3-mcu {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_3v3_mcu";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+&adc0 {
+       vref-supply = <&reg_vcc_3v3_mcu>;
+       status = "okay";
+};
+
+&adc1 {
+       vref-supply = <&reg_vcc_3v3_mcu>;
+       status = "okay";
+};
+
+&dspi1 {
+       bus-num = <1>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_dspi1>;
+       status = "okay";
+
+       flash@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "m25p128", "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+       };
+};
+
+&edma0 {
+       status = "okay";
+};
+
+&edma1 {
+       status = "okay";
+};
+
+&esdhc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc0>;
+       bus-width = <8>;
+       non-removable;
+       no-1-8-v;
+       keep-power-in-suspend;
+       no-sdio;
+       no-sd;
+       status = "okay";
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc1>;
+       bus-width = <4>;
+       no-sdio;
+       status = "okay";
+};
+
+&fec1 {
+       phy-mode = "rmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
+       status = "okay";
+
+       fixed-link {
+               speed = <100>;
+               full-duplex;
+       };
+
+       mdio1: mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               status = "okay";
+
+               switch0: switch0@0 {
+                       compatible = "marvell,mv88e6190";
+                       pinctrl-0 = <&pinctrl_gpio_switch0>;
+                       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;
+                       #interrupt-cells = <2>;
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       label = "cpu";
+                                       ethernet = <&fec1>;
+
+                                       fixed-link {
+                                               speed = <100>;
+                                               full-duplex;
+                                       };
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       label = "eth_cu_1000_1";
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       label = "eth_cu_1000_2";
+                               };
+
+                               port@3 {
+                                       reg = <3>;
+                                       label = "eth_cu_1000_3";
+                               };
+
+                               port@4 {
+                                       reg = <4>;
+                                       label = "eth_cu_1000_4";
+                               };
+
+                               port@5 {
+                                       reg = <5>;
+                                       label = "eth_cu_1000_5";
+                               };
+
+                               port@6 {
+                                       reg = <6>;
+                                       label = "eth_cu_1000_6";
+                               };
+                       };
+               };
+       };
+};
+
+&i2c0 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c0>;
+       status = "okay";
+
+       io-expander@22 {
+               compatible = "nxp,pca9554";
+               reg = <0x22>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c04";
+               reg = <0x50>;
+               label = "nameplate";
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c04";
+               reg = <0x52>;
+       };
+};
+
+&snvsrtc {
+       status = "disabled";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart0>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+
+       rave-sp {
+               compatible = "zii,rave-sp-rdu2";
+               current-speed = <1000000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               watchdog {
+                       compatible = "zii,rave-sp-watchdog";
+               };
+
+               eeprom@a3 {
+                       compatible = "zii,rave-sp-eeprom";
+                       reg = <0xa3 0x4000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       zii,eeprom-name = "main-eeprom";
+               };
+       };
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&wdoga5 {
+       status = "disabled";
+};
+
+&iomuxc {
+       pinctrl_dspi1: dspi1grp {
+               fsl,pins = <
+                       VF610_PAD_PTD5__DSPI1_CS0               0x1182
+                       VF610_PAD_PTD4__DSPI1_CS1               0x1182
+                       VF610_PAD_PTC6__DSPI1_SIN               0x1181
+                       VF610_PAD_PTC7__DSPI1_SOUT              0x1182
+                       VF610_PAD_PTC8__DSPI1_SCK               0x1182
+               >;
+       };
+
+       pinctrl_esdhc0: esdhc0grp {
+               fsl,pins = <
+                       VF610_PAD_PTC0__ESDHC0_CLK              0x31ef
+                       VF610_PAD_PTC1__ESDHC0_CMD              0x31ef
+                       VF610_PAD_PTC2__ESDHC0_DAT0             0x31ef
+                       VF610_PAD_PTC3__ESDHC0_DAT1             0x31ef
+                       VF610_PAD_PTC4__ESDHC0_DAT2             0x31ef
+                       VF610_PAD_PTC5__ESDHC0_DAT3             0x31ef
+                       VF610_PAD_PTD23__ESDHC0_DAT4            0x31ef
+                       VF610_PAD_PTD22__ESDHC0_DAT5            0x31ef
+                       VF610_PAD_PTD21__ESDHC0_DAT6            0x31ef
+                       VF610_PAD_PTD20__ESDHC0_DAT7            0x31ef
+               >;
+       };
+
+       pinctrl_esdhc1: esdhc1grp {
+               fsl,pins = <
+                       VF610_PAD_PTA24__ESDHC1_CLK             0x31ef
+                       VF610_PAD_PTA25__ESDHC1_CMD             0x31ef
+                       VF610_PAD_PTA26__ESDHC1_DAT0            0x31ef
+                       VF610_PAD_PTA27__ESDHC1_DAT1            0x31ef
+                       VF610_PAD_PTA28__ESDHC1_DATA2           0x31ef
+                       VF610_PAD_PTA29__ESDHC1_DAT3            0x31ef
+               >;
+       };
+
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       VF610_PAD_PTA6__RMII_CLKIN              0x30d1
+                       VF610_PAD_PTC9__ENET_RMII1_MDC          0x30d2
+                       VF610_PAD_PTC10__ENET_RMII1_MDIO        0x30d3
+                       VF610_PAD_PTC11__ENET_RMII1_CRS         0x30d1
+                       VF610_PAD_PTC12__ENET_RMII1_RXD1        0x30d1
+                       VF610_PAD_PTC13__ENET_RMII1_RXD0        0x30d1
+                       VF610_PAD_PTC14__ENET_RMII1_RXER        0x30d1
+                       VF610_PAD_PTC15__ENET_RMII1_TXD1        0x30d2
+                       VF610_PAD_PTC16__ENET_RMII1_TXD0        0x30d2
+                       VF610_PAD_PTC17__ENET_RMII1_TXEN        0x30d2
+               >;
+       };
+
+       pinctrl_gpio_switch0: pinctrl-gpio-switch0 {
+               fsl,pins = <
+                       VF610_PAD_PTE2__GPIO_107                0x31c2
+                       VF610_PAD_PTB28__GPIO_98                0x219d
+               >;
+       };
+
+       pinctrl_i2c0: i2c0grp {
+               fsl,pins = <
+                       VF610_PAD_PTB14__I2C0_SCL               0x37ff
+                       VF610_PAD_PTB15__I2C0_SDA               0x37ff
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       VF610_PAD_PTB16__I2C1_SCL               0x37ff
+                       VF610_PAD_PTB17__I2C1_SDA               0x37ff
+               >;
+       };
+
+       pinctrl_leds_debug: pinctrl-leds-debug {
+               fsl,pins = <
+                       VF610_PAD_PTD3__GPIO_82                 0x31c2
+               >;
+       };
+
+       pinctrl_uart0: uart0grp {
+               fsl,pins = <
+                       VF610_PAD_PTB10__UART0_TX               0x21a2
+                       VF610_PAD_PTB11__UART0_RX               0x21a1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       VF610_PAD_PTB23__UART1_TX               0x21a2
+                       VF610_PAD_PTB24__UART1_RX               0x21a1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       VF610_PAD_PTD0__UART2_TX                0x21a2
+                       VF610_PAD_PTD1__UART2_RX                0x21a1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       VF610_PAD_PTA30__UART3_TX               0x21a2
+                       VF610_PAD_PTA31__UART3_RX               0x21a1
+               >;
+       };
+};
index 2b10672..847c585 100644 (file)
@@ -37,7 +37,6 @@
                        label = "zii:green:debug1";
                        gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
-                       max-brightness = <1>;
                };
        };
 
        };
 };
 
+&snvsrtc {
+       status = "disabled";
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart0>;
index 0d9fe5a..453fce8 100644 (file)
@@ -37,7 +37,6 @@
                        label = "zii:green:debug1";
                        gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
-                       max-brightness = <1>;
                };
        };
 
@@ -70,7 +69,7 @@
         */
        status = "disabled";
 
-       m25p128@0 {
+       flash@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "m25p128", "jedec,spi-nor";
        pinctrl-0 = <&pinctrl_i2c0>;
        status = "okay";
 
-       gpio6: pca9505@22 {
+       gpio6: io-expander@22 {
                compatible = "nxp,pca9554";
                reg = <0x22>;
                gpio-controller;
                reg = <0x48>;
        };
 
-       at24c04@50 {
+       eeprom@50 {
                compatible = "atmel,24c04";
                reg = <0x50>;
                label = "nameplate";
        };
 
-       at24c04@52 {
+       eeprom@52 {
                compatible = "atmel,24c04";
                reg = <0x52>;
        };
 };
 
+&snvsrtc {
+       status = "disabled";
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart0>;
        };
 };
 
+&wdoga5 {
+       status = "disabled";
+};
+
 &iomuxc {
        pinctrl_dspi1: dspi1grp {
                fsl,pins = <
index 87f3331..e9f55bd 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * vt8500-bv07.dts - Device tree file for Benign BV07 Netbook
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index 8b5af03..b7e09ef 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * vt8500.dtsi - Device tree file for VIA VT8500 SoC
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 / {
index e3e6b9e..2d77c08 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8505-ref.dts - Device tree file for Wondermedia WM8505 reference netbook
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index cca6747..168cd12 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8505.dtsi - Device tree file for Wondermedia WM8505 SoC
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 / {
index dd0d1b6..f6a4214 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8650-mid.dts - Device tree file for Wondermedia WM8650-MID Tablet
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index 00d0176..bc057b6 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8650.dtsi - Device tree file for Wondermedia WM8650 SoC
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 / {
index 37e4a40..136e812 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8750-apc8750.dts
  *  - Device tree file for VIA APC8750
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index 54d8f7d..33aeb37 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8750.dtsi - Device tree file for Wondermedia WM8750 SoC
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 / {
index 7a563d2..c7a6fe0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8850-w70v2.dts
  *  - Device tree file for Wondermedia WM8850 Tablet
@@ -5,8 +6,6 @@
  *  - HongLianYing 'HLY070ML268-21A' 7" LCD panel
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 /dts-v1/;
index c572d77..65c9271 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * wm8850.dtsi - Device tree file for Wondermedia WM8850 SoC
  *
  * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
- *
- * Licensed under GPLv2 or later
  */
 
 / {
index 45412d2..179ca87 100644 (file)
@@ -32,7 +32,7 @@
 #include <mach/hardware.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/hardware/sa1111.h>
 
index d635edf..c95c542 100644 (file)
@@ -9,7 +9,6 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_ARCH_EXYNOS=y
 CONFIG_ARCH_EXYNOS3=y
-CONFIG_EXYNOS5420_MCPM=y
 CONFIG_SMP=y
 CONFIG_BIG_LITTLE=y
 CONFIG_NR_CPUS=8
index 8b0f7c4..7d26ca0 100644 (file)
@@ -152,7 +152,7 @@ CONFIG_SPI_S3C24XX=y
 CONFIG_SPI_SPIDEV=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_SENSORS_LM75=y
-CONFIG_THERMAL=m
+CONFIG_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_S3C2410_WATCHDOG=y
 CONFIG_FB=y
index b7b1cd0..6b748f2 100644 (file)
@@ -5,10 +5,6 @@ CONFIG_CGROUPS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_CMDLINE_PARTITION=y
 CONFIG_ARCH_VIRT=y
 CONFIG_ARCH_ALPINE=y
 CONFIG_ARCH_ARTPEC=y
@@ -33,7 +29,6 @@ CONFIG_MACH_BERLIN_BG2CD=y
 CONFIG_MACH_BERLIN_BG2Q=y
 CONFIG_ARCH_DIGICOLOR=y
 CONFIG_ARCH_EXYNOS=y
-CONFIG_EXYNOS5420_MCPM=y
 CONFIG_ARCH_HIGHBANK=y
 CONFIG_ARCH_HISI=y
 CONFIG_ARCH_HI3xxx=y
@@ -48,8 +43,8 @@ CONFIG_SOC_IMX6Q=y
 CONFIG_SOC_IMX6SL=y
 CONFIG_SOC_IMX6SX=y
 CONFIG_SOC_IMX6UL=y
-CONFIG_SOC_IMX7D=y
 CONFIG_SOC_LS1021A=y
+CONFIG_SOC_IMX7D=y
 CONFIG_SOC_VF610=y
 CONFIG_ARCH_KEYSTONE=y
 CONFIG_ARCH_MEDIATEK=y
@@ -76,24 +71,6 @@ CONFIG_ARCH_MSM8960=y
 CONFIG_ARCH_MSM8974=y
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_ARCH_RENESAS=y
-CONFIG_ARCH_EMEV2=y
-CONFIG_ARCH_R7S72100=y
-CONFIG_ARCH_R7S9210=y
-CONFIG_ARCH_R8A73A4=y
-CONFIG_ARCH_R8A7740=y
-CONFIG_ARCH_R8A7743=y
-CONFIG_ARCH_R8A7744=y
-CONFIG_ARCH_R8A7745=y
-CONFIG_ARCH_R8A77470=y
-CONFIG_ARCH_R8A7778=y
-CONFIG_ARCH_R8A7779=y
-CONFIG_ARCH_R8A7790=y
-CONFIG_ARCH_R8A7791=y
-CONFIG_ARCH_R8A7792=y
-CONFIG_ARCH_R8A7793=y
-CONFIG_ARCH_R8A7794=y
-CONFIG_ARCH_R9A06G032=y
-CONFIG_ARCH_SH73A0=y
 CONFIG_ARCH_SOCFPGA=y
 CONFIG_PLAT_SPEAR=y
 CONFIG_ARCH_SPEAR13XX=y
@@ -109,16 +86,6 @@ CONFIG_ARCH_VEXPRESS=y
 CONFIG_ARCH_VEXPRESS_TC2_PM=y
 CONFIG_ARCH_WM8850=y
 CONFIG_ARCH_ZYNQ=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_MVEBU=y
-CONFIG_PCI_TEGRA=y
-CONFIG_PCI_RCAR_GEN2=y
-CONFIG_PCIE_RCAR=y
-CONFIG_PCI_DRA7XX_EP=y
-CONFIG_PCI_KEYSTONE=y
-CONFIG_PCI_ENDPOINT=y
-CONFIG_PCI_ENDPOINT_CONFIGFS=y
-CONFIG_PCI_EPF_TEST=m
 CONFIG_SMP=y
 CONFIG_NR_CPUS=16
 CONFIG_SECCOMP=y
@@ -141,6 +108,29 @@ CONFIG_ARM_CPUIDLE=y
 CONFIG_ARM_ZYNQ_CPUIDLE=y
 CONFIG_ARM_EXYNOS_CPUIDLE=y
 CONFIG_KERNEL_MODE_NEON=y
+CONFIG_RASPBERRYPI_FIRMWARE=y
+CONFIG_TRUSTED_FOUNDATIONS=y
+CONFIG_BCM47XX_NVRAM=y
+CONFIG_BCM47XX_SPROM=y
+CONFIG_EFI_VARS=m
+CONFIG_EFI_CAPSULE_LOADER=m
+CONFIG_ARM_CRYPTO=y
+CONFIG_CRYPTO_SHA1_ARM_NEON=m
+CONFIG_CRYPTO_SHA1_ARM_CE=m
+CONFIG_CRYPTO_SHA2_ARM_CE=m
+CONFIG_CRYPTO_SHA512_ARM=m
+CONFIG_CRYPTO_AES_ARM=m
+CONFIG_CRYPTO_AES_ARM_BS=m
+CONFIG_CRYPTO_AES_ARM_CE=m
+CONFIG_CRYPTO_GHASH_ARM_CE=m
+CONFIG_CRYPTO_CRC32_ARM_CE=m
+CONFIG_CRYPTO_CHACHA20_NEON=m
+CONFIG_GCC_PLUGINS=y
+CONFIG_GCC_PLUGIN_STRUCTLEAK=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_CMDLINE_PARTITION=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -175,14 +165,27 @@ CONFIG_MAC80211=m
 CONFIG_RFKILL=y
 CONFIG_RFKILL_INPUT=y
 CONFIG_RFKILL_GPIO=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_MVEBU=y
+CONFIG_PCI_TEGRA=y
+CONFIG_PCI_RCAR_GEN2=y
+CONFIG_PCIE_RCAR=y
+CONFIG_PCI_DRA7XX_EP=y
+CONFIG_PCI_KEYSTONE=y
+CONFIG_PCI_ENDPOINT=y
+CONFIG_PCI_ENDPOINT_CONFIGFS=y
+CONFIG_PCI_EPF_TEST=m
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_OMAP_OCP2SCP=y
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_MTD=y
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_DENALI_DT=y
@@ -195,7 +198,6 @@ CONFIG_MTD_NAND_BRCMNAND=y
 CONFIG_MTD_NAND_VF610_NFC=y
 CONFIG_MTD_NAND_DAVINCI=y
 CONFIG_MTD_SPI_NOR=y
-CONFIG_SPI_FSL_QUADSPI=m
 CONFIG_MTD_UBI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
@@ -230,7 +232,6 @@ CONFIG_VIRTIO_NET=y
 CONFIG_B53_SPI_DRIVER=m
 CONFIG_B53_MDIO_DRIVER=m
 CONFIG_B53_MMAP_DRIVER=m
-CONFIG_B53_SRAB_DRIVER=m
 CONFIG_NET_DSA_BCM_SF2=m
 CONFIG_SUN4I_EMAC=y
 CONFIG_BCMGENET=m
@@ -259,7 +260,6 @@ CONFIG_BROADCOM_PHY=y
 CONFIG_ICPLUS_PHY=y
 CONFIG_MARVELL_PHY=y
 CONFIG_MICREL_PHY=y
-CONFIG_REALTEK_PHY=y
 CONFIG_ROCKCHIP_PHY=y
 CONFIG_SMSC_PHY=y
 CONFIG_USB_PEGASUS=y
@@ -288,6 +288,7 @@ CONFIG_MOUSE_ELAN_I2C=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ADC=m
 CONFIG_TOUCHSCREEN_ATMEL_MXT=m
+CONFIG_TOUCHSCREEN_ELAN=m
 CONFIG_TOUCHSCREEN_MMS114=m
 CONFIG_TOUCHSCREEN_WM97XX=m
 CONFIG_TOUCHSCREEN_ST1232=m
@@ -299,6 +300,7 @@ CONFIG_INPUT_MAX8997_HAPTIC=m
 CONFIG_INPUT_CPCAP_PWRBUTTON=m
 CONFIG_INPUT_AXP20X_PEK=m
 CONFIG_INPUT_ADXL34X=m
+CONFIG_INPUT_STPMIC1_ONKEY=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -349,6 +351,8 @@ CONFIG_SERIAL_DEV_BUS=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_ST=y
+CONFIG_TCG_TPM=m
+CONFIG_TCG_TIS_I2C_INFINEON=m
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_ARB_GPIO_CHALLENGE=m
 CONFIG_I2C_MUX_PCA954x=y
@@ -386,6 +390,7 @@ CONFIG_SPI_BCM2835=y
 CONFIG_SPI_BCM2835AUX=y
 CONFIG_SPI_CADENCE=y
 CONFIG_SPI_DAVINCI=y
+CONFIG_SPI_FSL_QUADSPI=m
 CONFIG_SPI_GPIO=m
 CONFIG_SPI_FSL_DSPI=m
 CONFIG_SPI_OMAP24XX=y
@@ -444,9 +449,11 @@ CONFIG_POWER_RESET_RMOBILE=y
 CONFIG_BATTERY_ACT8945A=y
 CONFIG_BATTERY_CPCAP=m
 CONFIG_BATTERY_SBS=y
+CONFIG_BATTERY_BQ27XXX=m
 CONFIG_AXP20X_POWER=m
 CONFIG_BATTERY_MAX17040=m
 CONFIG_BATTERY_MAX17042=m
+CONFIG_CHARGER_GPIO=m
 CONFIG_CHARGER_CPCAP=m
 CONFIG_CHARGER_MAX14577=m
 CONFIG_CHARGER_MAX77693=m
@@ -486,6 +493,7 @@ CONFIG_TEGRA_WATCHDOG=m
 CONFIG_MESON_WATCHDOG=y
 CONFIG_DIGICOLOR_WATCHDOG=y
 CONFIG_RENESAS_WDT=m
+CONFIG_STPMIC1_WATCHDOG=y
 CONFIG_BCM47XX_WDT=y
 CONFIG_BCM2835_WDT=y
 CONFIG_BCM_KONA_WDT=y
@@ -505,6 +513,7 @@ CONFIG_MFD_AXP20X_RSB=y
 CONFIG_MFD_CROS_EC=m
 CONFIG_CROS_EC_I2C=m
 CONFIG_CROS_EC_SPI=m
+CONFIG_MFD_CROS_EC_CHARDEV=m
 CONFIG_MFD_DA9063=m
 CONFIG_MFD_MAX14577=y
 CONFIG_MFD_MAX77686=y
@@ -527,6 +536,7 @@ CONFIG_MFD_TPS65218=y
 CONFIG_MFD_TPS6586X=y
 CONFIG_MFD_TPS65910=y
 CONFIG_MFD_STM32_LPTIMER=m
+CONFIG_MFD_STPMIC1=y
 CONFIG_REGULATOR_ACT8865=y
 CONFIG_REGULATOR_ACT8945A=y
 CONFIG_REGULATOR_ANATOP=y
@@ -559,6 +569,7 @@ CONFIG_REGULATOR_RN5T618=y
 CONFIG_REGULATOR_S2MPS11=y
 CONFIG_REGULATOR_S5M8767=y
 CONFIG_REGULATOR_STM32_VREFBUF=m
+CONFIG_REGULATOR_STPMIC1=y
 CONFIG_REGULATOR_TI_ABB=y
 CONFIG_REGULATOR_TPS51632=y
 CONFIG_REGULATOR_TPS62360=y
@@ -579,8 +590,6 @@ CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_STM32_DCMI=m
-CONFIG_SOC_CAMERA=m
-CONFIG_SOC_CAMERA_PLATFORM=m
 CONFIG_VIDEO_SAMSUNG_EXYNOS4_IS=m
 CONFIG_VIDEO_S5P_FIMC=m
 CONFIG_VIDEO_S5P_MIPI_CSIS=m
@@ -626,10 +635,12 @@ CONFIG_DRM_RCAR_LVDS=y
 CONFIG_DRM_SUN4I=m
 CONFIG_DRM_FSL_DCU=m
 CONFIG_DRM_TEGRA=y
-CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m
-CONFIG_DRM_PANEL_RAYDIUM_RM68200=m
+CONFIG_DRM_STM=m
+CONFIG_DRM_STM_DSI=m
 CONFIG_DRM_PANEL_SIMPLE=y
 CONFIG_DRM_PANEL_SAMSUNG_LD9040=m
+CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m
+CONFIG_DRM_PANEL_RAYDIUM_RM68200=m
 CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m
 CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=m
 CONFIG_DRM_DUMB_VGA_DAC=m
@@ -641,8 +652,6 @@ CONFIG_DRM_TOSHIBA_TC358764=m
 CONFIG_DRM_I2C_ADV7511=m
 CONFIG_DRM_I2C_ADV7511_AUDIO=y
 CONFIG_DRM_STI=m
-CONFIG_DRM_STM=m
-CONFIG_DRM_STM_DSI=m
 CONFIG_DRM_VC4=m
 CONFIG_DRM_ETNAVIV=m
 CONFIG_DRM_MXSFB=m
@@ -701,7 +710,6 @@ CONFIG_SND_SOC_SGTL5000=m
 CONFIG_SND_SOC_SPDIF=m
 CONFIG_SND_SOC_STI_SAS=m
 CONFIG_SND_SOC_WM8978=m
-CONFIG_SND_SIMPLE_SCU_CARD=m
 CONFIG_USB=y
 CONFIG_USB_OTG=y
 CONFIG_USB_XHCI_HCD=y
@@ -877,7 +885,6 @@ CONFIG_UNIPHIER_MDMAC=y
 CONFIG_XILINX_DMA=y
 CONFIG_QCOM_BAM_DMA=y
 CONFIG_DW_DMAC=y
-CONFIG_SH_DMAE=y
 CONFIG_RCAR_DMAC=y
 CONFIG_RENESAS_USB_DMAC=m
 CONFIG_VIRTIO_PCI=y
@@ -910,6 +917,24 @@ CONFIG_QCOM_GSBI=y
 CONFIG_QCOM_PM=y
 CONFIG_QCOM_SMD_RPM=m
 CONFIG_QCOM_WCNSS_CTRL=m
+CONFIG_ARCH_EMEV2=y
+CONFIG_ARCH_R7S72100=y
+CONFIG_ARCH_R7S9210=y
+CONFIG_ARCH_R8A73A4=y
+CONFIG_ARCH_R8A7740=y
+CONFIG_ARCH_R8A7743=y
+CONFIG_ARCH_R8A7744=y
+CONFIG_ARCH_R8A7745=y
+CONFIG_ARCH_R8A77470=y
+CONFIG_ARCH_R8A7778=y
+CONFIG_ARCH_R8A7779=y
+CONFIG_ARCH_R8A7790=y
+CONFIG_ARCH_R8A7791=y
+CONFIG_ARCH_R8A7792=y
+CONFIG_ARCH_R8A7793=y
+CONFIG_ARCH_R8A7794=y
+CONFIG_ARCH_R9A06G032=y
+CONFIG_ARCH_SH73A0=y
 CONFIG_ROCKCHIP_PM_DOMAINS=y
 CONFIG_ARCH_TEGRA_2x_SOC=y
 CONFIG_ARCH_TEGRA_3x_SOC=y
@@ -925,6 +950,7 @@ CONFIG_AT91_SAMA5D2_ADC=m
 CONFIG_BERLIN2_ADC=m
 CONFIG_CPCAP_ADC=m
 CONFIG_EXYNOS_ADC=m
+CONFIG_MESON_SARADC=m
 CONFIG_STM32_ADC_CORE=m
 CONFIG_STM32_ADC=m
 CONFIG_STM32_DFSDM_ADC=m
@@ -932,8 +958,12 @@ CONFIG_VF610_ADC=m
 CONFIG_XILINX_XADC=y
 CONFIG_STM32_LPTIMER_CNT=m
 CONFIG_STM32_DAC=m
+CONFIG_ROCKCHIP_SARADC=m
+CONFIG_IIO_CROS_EC_SENSORS_CORE=m
+CONFIG_IIO_CROS_EC_SENSORS=m
 CONFIG_MPU3050_I2C=y
 CONFIG_CM36651=m
+CONFIG_IIO_CROS_EC_LIGHT_PROX=m
 CONFIG_SENSORS_ISL29018=y
 CONFIG_SENSORS_ISL29028=y
 CONFIG_AK8975=y
@@ -969,24 +999,21 @@ CONFIG_PHY_RCAR_GEN2=m
 CONFIG_PHY_ROCKCHIP_DP=m
 CONFIG_PHY_ROCKCHIP_USB=y
 CONFIG_PHY_SAMSUNG_USB2=m
+CONFIG_PHY_UNIPHIER_USB2=y
+CONFIG_PHY_UNIPHIER_USB3=y
 CONFIG_PHY_MIPHY28LP=y
 CONFIG_PHY_STIH407_USB=y
 CONFIG_PHY_STM32_USBPHYC=y
 CONFIG_PHY_TEGRA_XUSB=y
 CONFIG_PHY_DM816X_USB=m
-CONFIG_PHY_UNIPHIER_USB3=y
-CONFIG_PHY_UNIPHIER_USB2=y
 CONFIG_OMAP_USB2=y
 CONFIG_TI_PIPE3=y
 CONFIG_TWL4030_USB=m
+CONFIG_MESON_MX_EFUSE=m
+CONFIG_ROCKCHIP_EFUSE=m
 CONFIG_NVMEM_IMX_OCOTP=y
 CONFIG_NVMEM_SUNXI_SID=y
 CONFIG_NVMEM_VF610_OCOTP=y
-CONFIG_RASPBERRYPI_FIRMWARE=y
-CONFIG_BCM47XX_NVRAM=y
-CONFIG_BCM47XX_SPROM=y
-CONFIG_EFI_VARS=m
-CONFIG_EFI_CAPSULE_LOADER=m
 CONFIG_EXT4_FS=y
 CONFIG_AUTOFS4_FS=y
 CONFIG_MSDOS_FS=y
@@ -1008,8 +1035,6 @@ CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
-CONFIG_PRINTK_TIME=y
-CONFIG_MAGIC_SYSRQ=y
 CONFIG_CRYPTO_USER=m
 CONFIG_CRYPTO_USER_API_HASH=m
 CONFIG_CRYPTO_USER_API_SKCIPHER=m
@@ -1023,16 +1048,6 @@ CONFIG_CRYPTO_DEV_ATMEL_TDES=m
 CONFIG_CRYPTO_DEV_ATMEL_SHA=m
 CONFIG_CRYPTO_DEV_SUN4I_SS=m
 CONFIG_CRYPTO_DEV_ROCKCHIP=m
-CONFIG_ARM_CRYPTO=y
-CONFIG_CRYPTO_SHA1_ARM_NEON=m
-CONFIG_CRYPTO_SHA1_ARM_CE=m
-CONFIG_CRYPTO_SHA2_ARM_CE=m
-CONFIG_CRYPTO_SHA512_ARM=m
-CONFIG_CRYPTO_AES_ARM=m
-CONFIG_CRYPTO_AES_ARM_BS=m
-CONFIG_CRYPTO_AES_ARM_CE=m
-CONFIG_CRYPTO_GHASH_ARM_CE=m
-CONFIG_CRYPTO_CRC32_ARM_CE=m
-CONFIG_CRYPTO_CHACHA20_NEON=m
-CONFIG_GCC_PLUGINS=y
-CONFIG_GCC_PLUGIN_STRUCTLEAK=y
+CONFIG_CMA_SIZE_MBYTES=64
+CONFIG_PRINTK_TIME=y
+CONFIG_MAGIC_SYSRQ=y
index f6d24d7..07ebbdc 100644 (file)
@@ -387,7 +387,7 @@ CONFIG_SENSORS_LM75=m
 CONFIG_SENSORS_LM90=m
 CONFIG_SENSORS_LM95245=m
 CONFIG_SENSORS_NTC_THERMISTOR=m
-CONFIG_THERMAL=m
+CONFIG_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_XILINX_WATCHDOG=m
 CONFIG_SA1100_WATCHDOG=m
index 4c50b53..c185475 100644 (file)
@@ -50,7 +50,8 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
-CONFIG_CFG80211=y
+CONFIG_CFG80211=m
+CONFIG_MAC80211=m
 CONFIG_RFKILL=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
@@ -72,6 +73,8 @@ CONFIG_SCSI_SCAN_ASYNC=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
+CONFIG_MD=y
+CONFIG_BLK_DEV_DM=m
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=y
 CONFIG_ATL1C=y
@@ -85,6 +88,7 @@ CONFIG_SLIP_MODE_SLIP6=y
 CONFIG_USB_USBNET=y
 # CONFIG_USB_NET_AX8817X is not set
 # CONFIG_USB_NET_ZAURUS is not set
+CONFIG_WCN36XX=m
 CONFIG_BRCMFMAC=m
 CONFIG_INPUT_EVDEV=y
 # CONFIG_KEYBOARD_ATKBD is not set
@@ -94,6 +98,8 @@ CONFIG_KEYBOARD_PMIC8XXX=y
 CONFIG_INPUT_JOYSTICK=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_INPUT_MISC=y
+CONFIG_INPUT_MSM_VIBRATOR=m
+CONFIG_INPUT_PM8941_PWRKEY=m
 CONFIG_INPUT_PM8XXX_VIBRATOR=y
 CONFIG_INPUT_PMIC8XXX_PWRKEY=y
 CONFIG_INPUT_UINPUT=y
@@ -127,6 +133,7 @@ CONFIG_GPIO_SYSFS=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_MSM=y
 CONFIG_CHARGER_QCOM_SMBB=y
+CONFIG_CHARGER_BQ24190=m
 CONFIG_THERMAL=y
 CONFIG_QCOM_TSENS=y
 CONFIG_MFD_PM8XXX=y
@@ -226,7 +233,11 @@ CONFIG_IIO=y
 CONFIG_IIO_BUFFER_CB=y
 CONFIG_IIO_SW_TRIGGER=y
 CONFIG_KXSD9=y
+CONFIG_QCOM_SPMI_IADC=m
+CONFIG_QCOM_SPMI_VADC=m
 CONFIG_MPU3050_I2C=y
+CONFIG_INV_MPU6050_I2C=m
+CONFIG_TSL2772=m
 CONFIG_AK8975=y
 CONFIG_IIO_HRTIMER_TRIGGER=y
 CONFIG_BMP280=y
index 515cb37..d5341b0 100644 (file)
@@ -150,7 +150,7 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_SOC_CAMERA=y
 CONFIG_VIDEO_ATMEL_ISI=y
-CONFIG_SOC_CAMERA_OV2640=y
+CONFIG_SOC_CAMERA_OV2640=m
 CONFIG_DRM=y
 CONFIG_DRM_ATMEL_HLCDC=y
 CONFIG_DRM_PANEL_SIMPLE=y
index 9b0efac..eb02ba9 100644 (file)
@@ -43,11 +43,13 @@ CONFIG_PCI_RCAR_GEN2=y
 CONFIG_PCIE_RCAR=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_DMA_CMA=y
-CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_MTD=y
 CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_EEPROM_AT24=y
@@ -123,7 +125,6 @@ CONFIG_VIDEO_ADV7604=y
 CONFIG_VIDEO_ML86V7667=y
 CONFIG_DRM=y
 CONFIG_DRM_RCAR_DU=y
-CONFIG_DRM_RCAR_LVDS=y
 CONFIG_DRM_DUMB_VGA_DAC=y
 CONFIG_DRM_SII902X=y
 CONFIG_DRM_I2C_ADV7511=y
@@ -141,12 +142,13 @@ CONFIG_SND_SOC_RCAR=y
 CONFIG_SND_SOC_AK4642=y
 CONFIG_SND_SOC_SGTL5000=y
 CONFIG_SND_SOC_WM8978=y
-CONFIG_SND_SIMPLE_SCU_CARD=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_PLATFORM=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_R8A66597_HCD=y
 CONFIG_USB_RENESAS_USBHS=y
 CONFIG_USB_GADGET=y
@@ -197,6 +199,7 @@ CONFIG_PWM_RENESAS_TPU=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_GENERIC_PHY=y
 CONFIG_PHY_RCAR_GEN2=y
+CONFIG_PHY_RCAR_GEN3_USB2=y
 # CONFIG_DNOTIFY is not set
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
@@ -209,6 +212,8 @@ CONFIG_NFS_V4_1=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
+CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_PRINTK_TIME=y
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
index 9d42cfe..6701a97 100644 (file)
@@ -21,7 +21,6 @@ CONFIG_NEON=y
 CONFIG_OPROFILE=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-# CONFIG_LBDAF is not set
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
@@ -128,6 +127,8 @@ CONFIG_RTC_DRV_DS1307=y
 CONFIG_DMADEVICES=y
 CONFIG_PL330_DMA=y
 CONFIG_DMATEST=m
+CONFIG_IIO=y
+CONFIG_LTC2497=y
 CONFIG_FPGA=y
 CONFIG_FPGA_MGR_SOCFPGA=y
 CONFIG_FPGA_MGR_SOCFPGA_A10=y
index c7b99eb..8f5c6a5 100644 (file)
@@ -1,6 +1,7 @@
 CONFIG_SYSVIPC=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_CGROUPS=y
@@ -14,23 +15,9 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
 CONFIG_ARCH_TEGRA=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_MSI=y
-CONFIG_PCI_TEGRA=y
 CONFIG_SMP=y
-CONFIG_PREEMPT=y
-CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
-CONFIG_CMA=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_KEXEC=y
@@ -40,6 +27,13 @@ CONFIG_CPUFREQ_DT=y
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
+CONFIG_TRUSTED_FOUNDATIONS=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_CMA=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -73,10 +67,12 @@ CONFIG_MAC80211=y
 CONFIG_RFKILL=y
 CONFIG_RFKILL_INPUT=y
 CONFIG_RFKILL_GPIO=y
+CONFIG_PCI=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_TEGRA=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_DMA_CMA=y
-CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_TEGRA_GMI=y
 CONFIG_MTD=y
 CONFIG_MTD_M25P80=y
@@ -152,7 +148,6 @@ CONFIG_WATCHDOG=y
 CONFIG_TEGRA_WATCHDOG=y
 CONFIG_MFD_AS3722=y
 CONFIG_MFD_CROS_EC=y
-CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
 CONFIG_MFD_STMPE=y
 CONFIG_MFD_PALMAS=y
@@ -180,6 +175,7 @@ CONFIG_DRM_NOUVEAU=m
 CONFIG_DRM_TEGRA=y
 CONFIG_DRM_PANEL_SIMPLE=y
 # CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_BACKLIGHT_GENERIC is not set
 CONFIG_BACKLIGHT_PWM=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
@@ -288,6 +284,10 @@ CONFIG_NFS_V4=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRC_CCITT=y
+CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
 CONFIG_MAGIC_SYSRQ=y
@@ -300,5 +300,3 @@ CONFIG_DEBUG_MUTEXES=y
 CONFIG_DEBUG_SG=y
 CONFIG_DEBUG_LL=y
 CONFIG_EARLY_PRINTK=y
-CONFIG_CRYPTO_TWOFISH=y
-CONFIG_CRC_CCITT=y
diff --git a/arch/arm/firmware/Kconfig b/arch/arm/firmware/Kconfig
deleted file mode 100644 (file)
index ad396af..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-config ARCH_SUPPORTS_FIRMWARE
-       bool
-
-config ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
-       bool
-       select ARCH_SUPPORTS_FIRMWARE
-
-menu "Firmware options"
-       depends on ARCH_SUPPORTS_FIRMWARE
-
-config TRUSTED_FOUNDATIONS
-       bool "Trusted Foundations secure monitor support"
-       depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
-       default y
-       help
-         Some devices (including most Tegra-based consumer devices on the
-         market) are booted with the Trusted Foundations secure monitor
-         active, requiring some core operations to be performed by the secure
-         monitor instead of the kernel.
-
-         This option allows the kernel to invoke the secure monitor whenever
-         required on devices using Trusted Foundations. See
-         arch/arm/include/asm/trusted_foundations.h or the
-         tlm,trusted-foundations device tree binding documentation for details
-         on how to use it.
-
-         Say n if you don't know what this is about.
-
-endmenu
diff --git a/arch/arm/firmware/Makefile b/arch/arm/firmware/Makefile
deleted file mode 100644 (file)
index 6e41336..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-obj-$(CONFIG_TRUSTED_FOUNDATIONS)      += trusted_foundations.o
-
-# tf_generic_smc() fails to build with -fsanitize-coverage=trace-pc
-KCOV_INSTRUMENT                := n
index 41deac2..60de9d1 100644 (file)
@@ -14,10 +14,8 @@ generic-y += msi.h
 generic-y += parport.h
 generic-y += preempt.h
 generic-y += seccomp.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += simd.h
-generic-y += sizes.h
 generic-y += trace_clock.h
 
 generated-y += mach-types.h
index 99d9f63..1888c2d 100644 (file)
@@ -133,9 +133,11 @@ static inline void modify_domain(unsigned dom, unsigned type)      { }
  * instructions (inline assembly)
  */
 #ifdef CONFIG_CPU_USE_DOMAINS
-#define TUSER(instr)   #instr "t"
+#define TUSER(instr)           TUSERCOND(instr, )
+#define TUSERCOND(instr, cond) #instr "t" #cond
 #else
-#define TUSER(instr)   #instr
+#define TUSER(instr)           TUSERCOND(instr, )
+#define TUSERCOND(instr, cond) #instr #cond
 #endif
 
 #else /* __ASSEMBLY__ */
index 34c1d96..6698272 100644 (file)
@@ -24,7 +24,7 @@ struct firmware_ops {
        /*
         * Inform the firmware we intend to enter CPU idle mode
         */
-       int (*prepare_idle)(void);
+       int (*prepare_idle)(unsigned long mode);
        /*
         * Enters CPU idle mode
         */
index 0a46676..83c391b 100644 (file)
@@ -110,10 +110,11 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
        preempt_disable();
        __ua_flags = uaccess_save_and_enable();
        __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n"
+       "       .syntax unified\n"
        "1:     " TUSER(ldr) "  %1, [%4]\n"
        "       teq     %1, %2\n"
        "       it      eq      @ explicit IT needed for the 2b label\n"
-       "2:     " TUSER(streq) "        %3, [%4]\n"
+       "2:     " TUSERCOND(str, eq) "  %3, [%4]\n"
        __futex_atomic_ex_table("%5")
        : "+r" (ret), "=&r" (val)
        : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT)
index cba23ea..7a88f16 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/threads.h>
 #include <asm/irq.h>
 
+/* number of IPIS _not_ including IPI_CPU_BACKTRACE */
 #define NR_IPI 7
 
 typedef struct {
index 8927cae..efb0e2c 100644 (file)
@@ -343,4 +343,6 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
        }
 }
 
+static inline void vcpu_ptrauth_setup_lazy(struct kvm_vcpu *vcpu) {}
+
 #endif /* __ARM_KVM_EMULATE_H__ */
index 770d732..075e192 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __ARM_KVM_HOST_H__
 #define __ARM_KVM_HOST_H__
 
+#include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/kvm_types.h>
 #include <asm/cputype.h>
@@ -53,6 +54,8 @@
 
 DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
 
+static inline int kvm_arm_init_sve(void) { return 0; }
+
 u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
 int __attribute_const__ kvm_target_cpu(void);
 int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
@@ -150,9 +153,13 @@ struct kvm_cpu_context {
        u32 cp15[NR_CP15_REGS];
 };
 
-typedef struct kvm_cpu_context kvm_cpu_context_t;
+struct kvm_host_data {
+       struct kvm_cpu_context host_ctxt;
+};
+
+typedef struct kvm_host_data kvm_host_data_t;
 
-static inline void kvm_init_host_cpu_context(kvm_cpu_context_t *cpu_ctxt,
+static inline void kvm_init_host_cpu_context(struct kvm_cpu_context *cpu_ctxt,
                                             int cpu)
 {
        /* The host's MPIDR is immutable, so let's set it up at boot time */
@@ -182,7 +189,7 @@ struct kvm_vcpu_arch {
        struct kvm_vcpu_fault_info fault;
 
        /* Host FP context */
-       kvm_cpu_context_t *host_cpu_context;
+       struct kvm_cpu_context *host_cpu_context;
 
        /* VGIC state */
        struct vgic_cpu vgic_cpu;
@@ -361,6 +368,9 @@ static inline void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) {}
 static inline void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu) {}
 static inline void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) {}
 
+static inline void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu) {}
+static inline void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu) {}
+
 static inline void kvm_arm_vhe_guest_enter(void) {}
 static inline void kvm_arm_vhe_guest_exit(void) {}
 
@@ -409,4 +419,14 @@ static inline int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type)
        return 0;
 }
 
+static inline int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature)
+{
+       return -EINVAL;
+}
+
+static inline bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu)
+{
+       return true;
+}
+
 #endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/limits.h b/arch/arm/include/asm/limits.h
deleted file mode 100644 (file)
index ab15937..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_PIPE_H
-#define __ASM_PIPE_H
-
-#ifndef PAGE_SIZE
-#include <asm/page.h>
-#endif
-
-#define PIPE_BUF       PAGE_SIZE
-
-#endif
-
index efcfdf9..0b58da8 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * opcodes-virt.h: Opcode definitions for the ARM virtualization extensions
  * Copyright (C) 2012  Linaro Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #ifndef __ASM_ARM_OPCODES_VIRT_H
 #define __ASM_ARM_OPCODES_VIRT_H
index 57fe73e..5d06f75 100644 (file)
@@ -135,8 +135,8 @@ static inline void prefetchw(const void *ptr)
        __asm__ __volatile__(
                ".arch_extension        mp\n"
                __ALT_SMP_ASM(
-                       WASM(pldw)              "\t%a0",
-                       WASM(pld)               "\t%a0"
+                       "pldw\t%a0",
+                       "pld\t%a0"
                )
                :: "p" (ptr));
 }
index dff4984..d49ce8f 100644 (file)
@@ -112,10 +112,11 @@ static inline void __user *__uaccess_mask_range_ptr(const void __user *ptr,
        unsigned long tmp;
 
        asm volatile(
+       "       .syntax unified\n"
        "       sub     %1, %3, #1\n"
        "       subs    %1, %1, %0\n"
        "       addhs   %1, %1, #1\n"
-       "       subhss  %1, %1, %2\n"
+       "       subshs  %1, %1, %2\n"
        "       movlo   %0, #0\n"
        : "+r" (safe_ptr), "=&r" (tmp)
        : "r" (size), "r" (current_thread_info()->addr_limit)
index 141144f..17c26cc 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2012 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef VIRT_H
index 630f231..e73e4de 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * arch/arm/mach-prima2/include/mach/debug-macro.S
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #define SIRF_LLUART_TXFIFO_STATUS      0x0114
index 2011002..067e12e 100644 (file)
@@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tags);
 const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
        unsigned int machine_nr);
 #else
-static inline const struct machine_desc *
+static inline const struct machine_desc * __init __noreturn
 setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
 {
        early_print("no ATAGS support: can't continue\n");
index 82a9428..ae50203 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2012 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/init.h>
index facd424..ebc5380 100644 (file)
@@ -70,6 +70,10 @@ enum ipi_msg_type {
        IPI_CPU_STOP,
        IPI_IRQ_WORK,
        IPI_COMPLETION,
+       /*
+        * CPU_BACKTRACE is special and not included in NR_IPI
+        * or tracable with trace_ipi_*
+        */
        IPI_CPU_BACKTRACE,
        /*
         * SGI8-15 can be reserved by secure firmware, and thus may
@@ -754,15 +758,20 @@ static int cpufreq_callback(struct notifier_block *nb,
                                        unsigned long val, void *data)
 {
        struct cpufreq_freqs *freq = data;
-       int cpu = freq->cpu;
+       struct cpumask *cpus = freq->policy->cpus;
+       int cpu, first = cpumask_first(cpus);
+       unsigned int lpj;
 
        if (freq->flags & CPUFREQ_CONST_LOOPS)
                return NOTIFY_OK;
 
-       if (!per_cpu(l_p_j_ref, cpu)) {
-               per_cpu(l_p_j_ref, cpu) =
-                       per_cpu(cpu_data, cpu).loops_per_jiffy;
-               per_cpu(l_p_j_ref_freq, cpu) = freq->old;
+       if (!per_cpu(l_p_j_ref, first)) {
+               for_each_cpu(cpu, cpus) {
+                       per_cpu(l_p_j_ref, cpu) =
+                               per_cpu(cpu_data, cpu).loops_per_jiffy;
+                       per_cpu(l_p_j_ref_freq, cpu) = freq->old;
+               }
+
                if (!global_l_p_j_ref) {
                        global_l_p_j_ref = loops_per_jiffy;
                        global_l_p_j_ref_freq = freq->old;
@@ -774,10 +783,11 @@ static int cpufreq_callback(struct notifier_block *nb,
                loops_per_jiffy = cpufreq_scale(global_l_p_j_ref,
                                                global_l_p_j_ref_freq,
                                                freq->new);
-               per_cpu(cpu_data, cpu).loops_per_jiffy =
-                       cpufreq_scale(per_cpu(l_p_j_ref, cpu),
-                                       per_cpu(l_p_j_ref_freq, cpu),
-                                       freq->new);
+
+               lpj = cpufreq_scale(per_cpu(l_p_j_ref, first),
+                                   per_cpu(l_p_j_ref_freq, first), freq->new);
+               for_each_cpu(cpu, cpus)
+                       per_cpu(cpu_data, cpu).loops_per_jiffy = lpj;
        }
        return NOTIFY_OK;
 }
@@ -797,7 +807,7 @@ core_initcall(register_cpufreq_notifier);
 
 static void raise_nmi(cpumask_t *mask)
 {
-       smp_cross_call(mask, IPI_CPU_BACKTRACE);
+       __smp_cross_call(mask, IPI_CPU_BACKTRACE);
 }
 
 void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
index 86870f4..71778bb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
index 1383103..8eae958 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-${CONFIG_SMP} += platsmp.o
index b667489..acbe013 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += alpine_machine.o
 obj-$(CONFIG_SMP)              += platsmp.o alpine_cpu_pm.o
index 85a962a..b9a6452 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_ARTPEC
        bool "Axis Communications ARM based ARTPEC SoCs"
        depends on ARCH_MULTI_V7
index 78325f0..fac5190 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MACH_ARTPEC6)             := board-artpec6.o
index 5224120..e42dbaa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MACH_ASM9260
        bool "Alphascale ASM9260"
        depends on ARCH_MULTI_V5
index 2d5570e..a15c3a2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_ASPEED
        bool "Aspeed BMC architectures"
        depends on ARCH_MULTI_V5 || ARCH_MULTI_V6
index 903f23c..af41725 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_AT91
        bool "AT91/Microchip SoCs"
        depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
@@ -21,7 +22,6 @@ config SOC_SAMA5D2
        depends on ARCH_MULTI_V7
        select SOC_SAMA5
        select CACHE_L2X0
-       select HAVE_FB_ATMEL
        select HAVE_AT91_UTMI
        select HAVE_AT91_USB_CLK
        select HAVE_AT91_H32MX
@@ -36,7 +36,6 @@ config SOC_SAMA5D3
        bool "SAMA5D3 family"
        depends on ARCH_MULTI_V7
        select SOC_SAMA5
-       select HAVE_FB_ATMEL
        select HAVE_AT91_UTMI
        select HAVE_AT91_SMD
        select HAVE_AT91_USB_CLK
@@ -50,7 +49,6 @@ config SOC_SAMA5D4
        depends on ARCH_MULTI_V7
        select SOC_SAMA5
        select CACHE_L2X0
-       select HAVE_FB_ATMEL
        select HAVE_AT91_UTMI
        select HAVE_AT91_SMD
        select HAVE_AT91_USB_CLK
@@ -107,6 +105,29 @@ config SOC_AT91SAM9
            AT91SAM9X35
            AT91SAM9XE
 
+comment "Clocksource driver selection"
+
+config ATMEL_CLOCKSOURCE_PIT
+       bool "Periodic Interval Timer (PIT) support"
+       depends on SOC_AT91SAM9 || SOC_SAMA5
+       default SOC_AT91SAM9 || SOC_SAMA5
+       select ATMEL_PIT
+       help
+         Select this to get a clocksource based on the Atmel Periodic Interval
+         Timer. It has a relatively low resolution and the TC Block clocksource
+         should be preferred.
+
+config ATMEL_CLOCKSOURCE_TCB
+       bool "Timer Counter Blocks (TCB) support"
+       default SOC_AT91RM9200 || SOC_AT91SAM9 || SOC_SAMA5
+       select ATMEL_TCB_CLKSRC
+       help
+         Select this to get a high precision clocksource based on a
+         TC block with a 5+ MHz base clock rate.
+         On platforms with 16-bit counters, two timer channels are combined
+         to make a single 32-bit timer.
+         It can also be used as a clock event device supporting oneshot mode.
+
 config HAVE_AT91_UTMI
        bool
 
index eacfc3f..cec195d 100644 (file)
@@ -1,3 +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 .
index 656ad40..4f81862 100644 (file)
@@ -1,11 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Setup code for AT91RM9200
  *
  *  Copyright (C) 2011 Atmel,
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
  *                2012 Joachim Eastwood <manabian@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/of.h>
index 3dbdef4..bf629c9 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Setup code for AT91SAM9
  *
  *  Copyright (C) 2011 Atmel,
  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/of.h>
@@ -32,3 +31,21 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
        .init_machine   = at91sam9_init,
        .dt_compat      = at91_dt_board_compat,
 MACHINE_END
+
+static void __init sam9x60_init(void)
+{
+       of_platform_default_populate(NULL, NULL, NULL);
+
+       sam9x60_pm_init();
+}
+
+static const char *const sam9x60_dt_board_compat[] __initconst = {
+       "microchip,sam9x60",
+       NULL
+};
+
+DT_MACHINE_START(sam9x60_dt, "Microchip SAM9X60")
+       /* Maintainer: Microchip */
+       .init_machine   = sam9x60_init,
+       .dt_compat      = sam9x60_dt_board_compat,
+MACHINE_END
index e2bd172..72b45ac 100644 (file)
 #ifdef CONFIG_PM
 extern void __init at91rm9200_pm_init(void);
 extern void __init at91sam9_pm_init(void);
+extern void __init sam9x60_pm_init(void);
 extern void __init sama5_pm_init(void);
 extern void __init sama5d2_pm_init(void);
 #else
 static inline void __init at91rm9200_pm_init(void) { }
 static inline void __init at91sam9_pm_init(void) { }
+static inline void __init sam9x60_pm_init(void) { }
 static inline void __init sama5_pm_init(void) { }
 static inline void __init sama5d2_pm_init(void) { }
 #endif
index 2a757dc..6c81475 100644 (file)
@@ -39,6 +39,20 @@ extern void at91_pinctrl_gpio_suspend(void);
 extern void at91_pinctrl_gpio_resume(void);
 #endif
 
+struct at91_soc_pm {
+       int (*config_shdwc_ws)(void __iomem *shdwc, u32 *mode, u32 *polarity);
+       int (*config_pmc_ws)(void __iomem *pmc, u32 mode, u32 polarity);
+       const struct of_device_id *ws_ids;
+       struct at91_pm_data data;
+};
+
+static struct at91_soc_pm soc_pm = {
+       .data = {
+               .standby_mode = AT91_PM_STANDBY,
+               .suspend_mode = AT91_PM_ULP0,
+       },
+};
+
 static const match_table_t pm_modes __initconst = {
        { AT91_PM_STANDBY, "standby" },
        { AT91_PM_ULP0, "ulp0" },
@@ -47,16 +61,11 @@ static const match_table_t pm_modes __initconst = {
        { -1, NULL },
 };
 
-static struct at91_pm_data pm_data = {
-       .standby_mode = AT91_PM_STANDBY,
-       .suspend_mode = AT91_PM_ULP0,
-};
-
 #define at91_ramc_read(id, field) \
-       __raw_readl(pm_data.ramc[id] + field)
+       __raw_readl(soc_pm.data.ramc[id] + field)
 
 #define at91_ramc_write(id, field, value) \
-       __raw_writel(value, pm_data.ramc[id] + field)
+       __raw_writel(value, soc_pm.data.ramc[id] + field)
 
 static int at91_pm_valid_state(suspend_state_t state)
 {
@@ -91,6 +100,8 @@ static const struct wakeup_source_info ws_info[] = {
        { .pmc_fsmr_bit = AT91_PMC_RTCAL,       .shdwc_mr_bit = BIT(17) },
        { .pmc_fsmr_bit = AT91_PMC_USBAL },
        { .pmc_fsmr_bit = AT91_PMC_SDMMC_CD },
+       { .pmc_fsmr_bit = AT91_PMC_RTTAL },
+       { .pmc_fsmr_bit = AT91_PMC_RXLP_MCE },
 };
 
 static const struct of_device_id sama5d2_ws_ids[] = {
@@ -105,6 +116,17 @@ static const struct of_device_id sama5d2_ws_ids[] = {
        { /* sentinel */ }
 };
 
+static const struct of_device_id sam9x60_ws_ids[] = {
+       { .compatible = "atmel,at91sam9x5-rtc",         .data = &ws_info[1] },
+       { .compatible = "atmel,at91rm9200-ohci",        .data = &ws_info[2] },
+       { .compatible = "usb-ohci",                     .data = &ws_info[2] },
+       { .compatible = "atmel,at91sam9g45-ehci",       .data = &ws_info[2] },
+       { .compatible = "usb-ehci",                     .data = &ws_info[2] },
+       { .compatible = "atmel,at91sam9260-rtt",        .data = &ws_info[4] },
+       { .compatible = "cdns,sam9x60-macb",            .data = &ws_info[5] },
+       { /* sentinel */ }
+};
+
 static int at91_pm_config_ws(unsigned int pm_mode, bool set)
 {
        const struct wakeup_source_info *wsi;
@@ -116,24 +138,22 @@ static int at91_pm_config_ws(unsigned int pm_mode, bool set)
        if (pm_mode != AT91_PM_ULP1)
                return 0;
 
-       if (!pm_data.pmc || !pm_data.shdwc)
+       if (!soc_pm.data.pmc || !soc_pm.data.shdwc || !soc_pm.ws_ids)
                return -EPERM;
 
        if (!set) {
-               writel(mode, pm_data.pmc + AT91_PMC_FSMR);
+               writel(mode, soc_pm.data.pmc + AT91_PMC_FSMR);
                return 0;
        }
 
-       /* SHDWC.WUIR */
-       val = readl(pm_data.shdwc + 0x0c);
-       mode |= (val & 0x3ff);
-       polarity |= ((val >> 16) & 0x3ff);
+       if (soc_pm.config_shdwc_ws)
+               soc_pm.config_shdwc_ws(soc_pm.data.shdwc, &mode, &polarity);
 
        /* SHDWC.MR */
-       val = readl(pm_data.shdwc + 0x04);
+       val = readl(soc_pm.data.shdwc + 0x04);
 
        /* Loop through defined wakeup sources. */
-       for_each_matching_node_and_match(np, sama5d2_ws_ids, &match) {
+       for_each_matching_node_and_match(np, soc_pm.ws_ids, &match) {
                pdev = of_find_device_by_node(np);
                if (!pdev)
                        continue;
@@ -155,8 +175,8 @@ put_device:
        }
 
        if (mode) {
-               writel(mode, pm_data.pmc + AT91_PMC_FSMR);
-               writel(polarity, pm_data.pmc + AT91_PMC_FSPR);
+               if (soc_pm.config_pmc_ws)
+                       soc_pm.config_pmc_ws(soc_pm.data.pmc, mode, polarity);
        } else {
                pr_err("AT91: PM: no ULP1 wakeup sources found!");
        }
@@ -164,6 +184,34 @@ put_device:
        return mode ? 0 : -EPERM;
 }
 
+static int at91_sama5d2_config_shdwc_ws(void __iomem *shdwc, u32 *mode,
+                                       u32 *polarity)
+{
+       u32 val;
+
+       /* SHDWC.WUIR */
+       val = readl(shdwc + 0x0c);
+       *mode |= (val & 0x3ff);
+       *polarity |= ((val >> 16) & 0x3ff);
+
+       return 0;
+}
+
+static int at91_sama5d2_config_pmc_ws(void __iomem *pmc, u32 mode, u32 polarity)
+{
+       writel(mode, pmc + AT91_PMC_FSMR);
+       writel(polarity, pmc + AT91_PMC_FSPR);
+
+       return 0;
+}
+
+static int at91_sam9x60_config_pmc_ws(void __iomem *pmc, u32 mode, u32 polarity)
+{
+       writel(mode, pmc + AT91_PMC_FSMR);
+
+       return 0;
+}
+
 /*
  * Called after processes are frozen, but before we shutdown devices.
  */
@@ -171,18 +219,18 @@ static int at91_pm_begin(suspend_state_t state)
 {
        switch (state) {
        case PM_SUSPEND_MEM:
-               pm_data.mode = pm_data.suspend_mode;
+               soc_pm.data.mode = soc_pm.data.suspend_mode;
                break;
 
        case PM_SUSPEND_STANDBY:
-               pm_data.mode = pm_data.standby_mode;
+               soc_pm.data.mode = soc_pm.data.standby_mode;
                break;
 
        default:
-               pm_data.mode = -1;
+               soc_pm.data.mode = -1;
        }
 
-       return at91_pm_config_ws(pm_data.mode, true);
+       return at91_pm_config_ws(soc_pm.data.mode, true);
 }
 
 /*
@@ -194,10 +242,10 @@ static int at91_pm_verify_clocks(void)
        unsigned long scsr;
        int i;
 
-       scsr = readl(pm_data.pmc + AT91_PMC_SCSR);
+       scsr = readl(soc_pm.data.pmc + AT91_PMC_SCSR);
 
        /* USB must not be using PLLB */
-       if ((scsr & pm_data.uhp_udp_mask) != 0) {
+       if ((scsr & soc_pm.data.uhp_udp_mask) != 0) {
                pr_err("AT91: PM - Suspend-to-RAM with USB still active\n");
                return 0;
        }
@@ -208,7 +256,7 @@ static int at91_pm_verify_clocks(void)
 
                if ((scsr & (AT91_PMC_PCK0 << i)) == 0)
                        continue;
-               css = readl(pm_data.pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
+               css = readl(soc_pm.data.pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
                if (css != AT91_PMC_CSS_SLOW) {
                        pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
                        return 0;
@@ -230,7 +278,7 @@ static int at91_pm_verify_clocks(void)
  */
 int at91_suspend_entering_slow_clock(void)
 {
-       return (pm_data.mode >= AT91_PM_ULP0);
+       return (soc_pm.data.mode >= AT91_PM_ULP0);
 }
 EXPORT_SYMBOL(at91_suspend_entering_slow_clock);
 
@@ -243,14 +291,14 @@ static int at91_suspend_finish(unsigned long val)
        flush_cache_all();
        outer_disable();
 
-       at91_suspend_sram_fn(&pm_data);
+       at91_suspend_sram_fn(&soc_pm.data);
 
        return 0;
 }
 
 static void at91_pm_suspend(suspend_state_t state)
 {
-       if (pm_data.mode == AT91_PM_BACKUP) {
+       if (soc_pm.data.mode == AT91_PM_BACKUP) {
                pm_bu->suspended = 1;
 
                cpu_suspend(0, at91_suspend_finish);
@@ -289,7 +337,7 @@ static int at91_pm_enter(suspend_state_t state)
                /*
                 * Ensure that clocks are in a valid state.
                 */
-               if (pm_data.mode >= AT91_PM_ULP0 &&
+               if (soc_pm.data.mode >= AT91_PM_ULP0 &&
                    !at91_pm_verify_clocks())
                        goto error;
 
@@ -318,7 +366,7 @@ error:
  */
 static void at91_pm_end(void)
 {
-       at91_pm_config_ws(pm_data.mode, false);
+       at91_pm_config_ws(soc_pm.data.mode, false);
 }
 
 
@@ -351,7 +399,7 @@ static void at91rm9200_standby(void)
                "    str    %2, [%1, %3]\n\t"
                "    mcr    p15, 0, %0, c7, c0, 4\n\t"
                :
-               : "r" (0), "r" (pm_data.ramc[0]),
+               : "r" (0), "r" (soc_pm.data.ramc[0]),
                  "r" (1), "r" (AT91_MC_SDRAMC_SRR));
 }
 
@@ -374,7 +422,7 @@ static void at91_ddr_standby(void)
                at91_ramc_write(0, AT91_DDRSDRC_MDR, mdr);
        }
 
-       if (pm_data.ramc[1]) {
+       if (soc_pm.data.ramc[1]) {
                saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
                lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB;
                lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
@@ -392,14 +440,14 @@ static void at91_ddr_standby(void)
 
        /* self-refresh mode now */
        at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
-       if (pm_data.ramc[1])
+       if (soc_pm.data.ramc[1])
                at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
 
        cpu_do_idle();
 
        at91_ramc_write(0, AT91_DDRSDRC_MDR, saved_mdr0);
        at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
-       if (pm_data.ramc[1]) {
+       if (soc_pm.data.ramc[1]) {
                at91_ramc_write(0, AT91_DDRSDRC_MDR, saved_mdr1);
                at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
        }
@@ -429,7 +477,7 @@ static void at91sam9_sdram_standby(void)
        u32 lpr0, lpr1 = 0;
        u32 saved_lpr0, saved_lpr1 = 0;
 
-       if (pm_data.ramc[1]) {
+       if (soc_pm.data.ramc[1]) {
                saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR);
                lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB;
                lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH;
@@ -441,13 +489,13 @@ static void at91sam9_sdram_standby(void)
 
        /* self-refresh mode now */
        at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0);
-       if (pm_data.ramc[1])
+       if (soc_pm.data.ramc[1])
                at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1);
 
        cpu_do_idle();
 
        at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0);
-       if (pm_data.ramc[1])
+       if (soc_pm.data.ramc[1])
                at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1);
 }
 
@@ -480,14 +528,14 @@ static __init void at91_dt_ramc(void)
        const struct ramc_info *ramc;
 
        for_each_matching_node_and_match(np, ramc_ids, &of_id) {
-               pm_data.ramc[idx] = of_iomap(np, 0);
-               if (!pm_data.ramc[idx])
+               soc_pm.data.ramc[idx] = of_iomap(np, 0);
+               if (!soc_pm.data.ramc[idx])
                        panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
 
                ramc = of_id->data;
                if (!standby)
                        standby = ramc->idle;
-               pm_data.memctrl = ramc->memctrl;
+               soc_pm.data.memctrl = ramc->memctrl;
 
                idx++;
        }
@@ -509,12 +557,17 @@ static void at91rm9200_idle(void)
         * Disable the processor clock.  The processor will be automatically
         * re-enabled by an interrupt or by a reset.
         */
-       writel(AT91_PMC_PCK, pm_data.pmc + AT91_PMC_SCDR);
+       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, pm_data.pmc + AT91_PMC_SCDR);
+       writel(AT91_PMC_PCK, soc_pm.data.pmc + AT91_PMC_SCDR);
        cpu_do_idle();
 }
 
@@ -566,8 +619,8 @@ static void __init at91_pm_sram_init(void)
 
 static bool __init at91_is_pm_mode_active(int pm_mode)
 {
-       return (pm_data.standby_mode == pm_mode ||
-               pm_data.suspend_mode == pm_mode);
+       return (soc_pm.data.standby_mode == pm_mode ||
+               soc_pm.data.suspend_mode == pm_mode);
 }
 
 static int __init at91_pm_backup_init(void)
@@ -577,6 +630,9 @@ static int __init at91_pm_backup_init(void)
        struct platform_device *pdev = NULL;
        int ret = -ENODEV;
 
+       if (!IS_ENABLED(CONFIG_SOC_SAMA5D2))
+               return -EPERM;
+
        if (!at91_is_pm_mode_active(AT91_PM_BACKUP))
                return 0;
 
@@ -586,7 +642,7 @@ static int __init at91_pm_backup_init(void)
                return ret;
        }
 
-       pm_data.sfrbu = of_iomap(np, 0);
+       soc_pm.data.sfrbu = of_iomap(np, 0);
        of_node_put(np);
 
        np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam");
@@ -622,8 +678,8 @@ static int __init at91_pm_backup_init(void)
 securam_fail:
        put_device(&pdev->dev);
 securam_fail_no_ref_dev:
-       iounmap(pm_data.sfrbu);
-       pm_data.sfrbu = NULL;
+       iounmap(soc_pm.data.sfrbu);
+       soc_pm.data.sfrbu = NULL;
        return ret;
 }
 
@@ -632,10 +688,10 @@ static void __init at91_pm_use_default_mode(int pm_mode)
        if (pm_mode != AT91_PM_ULP1 && pm_mode != AT91_PM_BACKUP)
                return;
 
-       if (pm_data.standby_mode == pm_mode)
-               pm_data.standby_mode = AT91_PM_ULP0;
-       if (pm_data.suspend_mode == pm_mode)
-               pm_data.suspend_mode = AT91_PM_ULP0;
+       if (soc_pm.data.standby_mode == pm_mode)
+               soc_pm.data.standby_mode = AT91_PM_ULP0;
+       if (soc_pm.data.suspend_mode == pm_mode)
+               soc_pm.data.suspend_mode = AT91_PM_ULP0;
 }
 
 static void __init at91_pm_modes_init(void)
@@ -653,7 +709,7 @@ static void __init at91_pm_modes_init(void)
                goto ulp1_default;
        }
 
-       pm_data.shdwc = of_iomap(np, 0);
+       soc_pm.data.shdwc = of_iomap(np, 0);
        of_node_put(np);
 
        ret = at91_pm_backup_init();
@@ -667,8 +723,8 @@ static void __init at91_pm_modes_init(void)
        return;
 
 unmap:
-       iounmap(pm_data.shdwc);
-       pm_data.shdwc = NULL;
+       iounmap(soc_pm.data.shdwc);
+       soc_pm.data.shdwc = NULL;
 ulp1_default:
        at91_pm_use_default_mode(AT91_PM_ULP1);
 backup_default:
@@ -711,14 +767,14 @@ static void __init at91_pm_init(void (*pm_idle)(void))
                platform_device_register(&at91_cpuidle_device);
 
        pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id);
-       pm_data.pmc = of_iomap(pmc_np, 0);
-       if (!pm_data.pmc) {
+       soc_pm.data.pmc = of_iomap(pmc_np, 0);
+       if (!soc_pm.data.pmc) {
                pr_err("AT91: PM not supported, PMC not found\n");
                return;
        }
 
        pmc = of_id->data;
-       pm_data.uhp_udp_mask = pmc->uhp_udp_mask;
+       soc_pm.data.uhp_udp_mask = pmc->uhp_udp_mask;
 
        if (pm_idle)
                arm_pm_idle = pm_idle;
@@ -728,8 +784,8 @@ static void __init at91_pm_init(void (*pm_idle)(void))
        if (at91_suspend_sram_fn) {
                suspend_set_ops(&at91_pm_ops);
                pr_info("AT91: PM: standby: %s, suspend: %s\n",
-                       pm_modes[pm_data.standby_mode].pattern,
-                       pm_modes[pm_data.suspend_mode].pattern);
+                       pm_modes[soc_pm.data.standby_mode].pattern,
+                       pm_modes[soc_pm.data.suspend_mode].pattern);
        } else {
                pr_info("AT91: PM not supported, due to no SRAM allocated\n");
        }
@@ -750,6 +806,19 @@ void __init at91rm9200_pm_init(void)
        at91_pm_init(at91rm9200_idle);
 }
 
+void __init sam9x60_pm_init(void)
+{
+       if (!IS_ENABLED(CONFIG_SOC_AT91SAM9))
+               return;
+
+       at91_pm_modes_init();
+       at91_dt_ramc();
+       at91_pm_init(at91sam9x60_idle);
+
+       soc_pm.ws_ids = sam9x60_ws_ids;
+       soc_pm.config_pmc_ws = at91_sam9x60_config_pmc_ws;
+}
+
 void __init at91sam9_pm_init(void)
 {
        if (!IS_ENABLED(CONFIG_SOC_AT91SAM9))
@@ -775,6 +844,10 @@ void __init sama5d2_pm_init(void)
 
        at91_pm_modes_init();
        sama5_pm_init();
+
+       soc_pm.ws_ids = sama5d2_ws_ids;
+       soc_pm.config_shdwc_ws = at91_sama5d2_config_shdwc_ws;
+       soc_pm.config_pmc_ws = at91_sama5d2_config_pmc_ws;
 }
 
 static int __init at91_pm_modes_select(char *str)
@@ -795,8 +868,8 @@ static int __init at91_pm_modes_select(char *str)
        if (suspend < 0)
                return 0;
 
-       pm_data.standby_mode = standby;
-       pm_data.suspend_mode = suspend;
+       soc_pm.data.standby_mode = standby;
+       soc_pm.data.suspend_mode = suspend;
 
        return 0;
 }
index bfe1c4d..77e2930 100644 (file)
@@ -51,15 +51,6 @@ tmp2 .req    r5
        .endm
 
 /*
- * Wait until PLLA has locked.
- */
-       .macro wait_pllalock
-1:     ldr     tmp1, [pmc, #AT91_PMC_SR]
-       tst     tmp1, #AT91_PMC_LOCKA
-       beq     1b
-       .endm
-
-/*
  * Put the processor to enter the idle state
  */
        .macro at91_cpu_idle
@@ -178,11 +169,46 @@ ENDPROC(at91_backup_mode)
        orr     tmp1, tmp1, #AT91_PMC_KEY
        str     tmp1, [pmc, #AT91_CKGR_MOR]
 
+       /* Save RC oscillator state */
+       ldr     tmp1, [pmc, #AT91_PMC_SR]
+       str     tmp1, .saved_osc_status
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       bne     1f
+
+       /* Turn off RC oscillator */
+       ldr     tmp1, [pmc, #AT91_CKGR_MOR]
+       bic     tmp1, tmp1, #AT91_PMC_MOSCRCEN
+       bic     tmp1, tmp1, #AT91_PMC_KEY_MASK
+       orr     tmp1, tmp1, #AT91_PMC_KEY
+       str     tmp1, [pmc, #AT91_CKGR_MOR]
+
+       /* Wait main RC disabled done */
+2:     ldr     tmp1, [pmc, #AT91_PMC_SR]
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       bne     2b
+
        /* Wait for interrupt */
-       at91_cpu_idle
+1:     at91_cpu_idle
 
-       /* Turn on the crystal oscillator */
+       /* Restore RC oscillator state */
+       ldr     tmp1, .saved_osc_status
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       beq     4f
+
+       /* Turn on RC oscillator */
        ldr     tmp1, [pmc, #AT91_CKGR_MOR]
+       orr     tmp1, tmp1, #AT91_PMC_MOSCRCEN
+       bic     tmp1, tmp1, #AT91_PMC_KEY_MASK
+       orr     tmp1, tmp1, #AT91_PMC_KEY
+       str     tmp1, [pmc, #AT91_CKGR_MOR]
+
+       /* Wait main RC stabilization */
+3:     ldr     tmp1, [pmc, #AT91_PMC_SR]
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       beq     3b
+
+       /* Turn on the crystal oscillator */
+4:     ldr     tmp1, [pmc, #AT91_CKGR_MOR]
        orr     tmp1, tmp1, #AT91_PMC_MOSCEN
        orr     tmp1, tmp1, #AT91_PMC_KEY
        str     tmp1, [pmc, #AT91_CKGR_MOR]
@@ -197,8 +223,26 @@ ENDPROC(at91_backup_mode)
 .macro at91_pm_ulp1_mode
        ldr     pmc, .pmc_base
 
-       /* Switch the main clock source to 12-MHz RC oscillator */
+       /* Save RC oscillator state and check if it is enabled. */
+       ldr     tmp1, [pmc, #AT91_PMC_SR]
+       str     tmp1, .saved_osc_status
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       bne     2f
+
+       /* Enable RC oscillator */
        ldr     tmp1, [pmc, #AT91_CKGR_MOR]
+       orr     tmp1, tmp1, #AT91_PMC_MOSCRCEN
+       bic     tmp1, tmp1, #AT91_PMC_KEY_MASK
+       orr     tmp1, tmp1, #AT91_PMC_KEY
+       str     tmp1, [pmc, #AT91_CKGR_MOR]
+
+       /* Wait main RC stabilization */
+1:     ldr     tmp1, [pmc, #AT91_PMC_SR]
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       beq     1b
+
+       /* Switch the main clock source to 12-MHz RC oscillator */
+2:     ldr     tmp1, [pmc, #AT91_CKGR_MOR]
        bic     tmp1, tmp1, #AT91_PMC_MOSCSEL
        bic     tmp1, tmp1, #AT91_PMC_KEY_MASK
        orr     tmp1, tmp1, #AT91_PMC_KEY
@@ -262,6 +306,25 @@ ENDPROC(at91_backup_mode)
        str     tmp1, [pmc, #AT91_PMC_MCKR]
 
        wait_mckrdy
+
+       /* Restore RC oscillator state */
+       ldr     tmp1, .saved_osc_status
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       bne     3f
+
+       /* Disable RC oscillator */
+       ldr     tmp1, [pmc, #AT91_CKGR_MOR]
+       bic     tmp1, tmp1, #AT91_PMC_MOSCRCEN
+       bic     tmp1, tmp1, #AT91_PMC_KEY_MASK
+       orr     tmp1, tmp1, #AT91_PMC_KEY
+       str     tmp1, [pmc, #AT91_CKGR_MOR]
+
+       /* Wait RC oscillator disable done */
+4:     ldr     tmp1, [pmc, #AT91_PMC_SR]
+       tst     tmp1, #AT91_PMC_MOSCRCS
+       bne     4b
+
+3:
 .endm
 
 ENTRY(at91_ulp_mode)
@@ -279,14 +342,6 @@ ENTRY(at91_ulp_mode)
 
        wait_mckrdy
 
-       /* Save PLLA setting and disable it */
-       ldr     tmp1, [pmc, #AT91_CKGR_PLLAR]
-       str     tmp1, .saved_pllar
-
-       mov     tmp1, #AT91_PMC_PLLCOUNT
-       orr     tmp1, tmp1, #(1 << 29)          /* bit 29 always set */
-       str     tmp1, [pmc, #AT91_CKGR_PLLAR]
-
        ldr     r0, .pm_mode
        cmp     r0, #AT91_PM_ULP1
        beq     ulp1_mode
@@ -301,18 +356,6 @@ ulp1_mode:
 ulp_exit:
        ldr     pmc, .pmc_base
 
-       /* Restore PLLA setting */
-       ldr     tmp1, .saved_pllar
-       str     tmp1, [pmc, #AT91_CKGR_PLLAR]
-
-       tst     tmp1, #(AT91_PMC_MUL &  0xff0000)
-       bne     3f
-       tst     tmp1, #(AT91_PMC_MUL & ~0xff0000)
-       beq     4f
-3:
-       wait_pllalock
-4:
-
        /*
         * Restore master clock setting
         */
@@ -465,8 +508,6 @@ ENDPROC(at91_sramc_self_refresh)
        .word 0
 .saved_mckr:
        .word 0
-.saved_pllar:
-       .word 0
 .saved_sam9_lpr:
        .word 0
 .saved_sam9_lpr1:
@@ -475,6 +516,8 @@ ENDPROC(at91_sramc_self_refresh)
        .word 0
 .saved_sam9_mdr1:
        .word 0
+.saved_osc_status:
+       .word 0
 
 ENTRY(at91_pm_suspend_in_sram_sz)
        .word .-at91_pm_suspend_in_sram
index 3d0bf95..89dab7c 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Setup code for SAMA5
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/of.h>
index 11386f1..28f998f 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Setup code for SAMv7x
  *
  *  Copyright (C) 2013 Atmel,
  *                2016 Andras Szemzo <szemzo.andras@gmail.com>
- *
- * Licensed under GPLv2 or later.
  */
 #include <linux/of.h>
 #include <linux/of_platform.h>
index 3d719cf..5b1f61f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_BERLIN
        bool "Marvell Berlin SoCs"
        depends on ARCH_MULTI_V7
index c0719ec..0d338e8 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                  += berlin.o
 obj-$(CONFIG_SMP)      += headsmp.o platsmp.o
index ff097ec..51a8927 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/platform_data/spi-davinci.h>
 #include <linux/platform_data/usb-davinci.h>
 #include <linux/platform_data/ti-aemif.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 #include <linux/nvmem-provider.h>
 
@@ -53,14 +54,50 @@ static const short da830_evm_usb11_pins[] = {
        -1
 };
 
-static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = {
+static struct regulator_consumer_supply da830_evm_usb_supplies[] = {
+       REGULATOR_SUPPLY("vbus", NULL),
+};
+
+static struct regulator_init_data da830_evm_usb_vbus_data = {
+       .consumer_supplies      = da830_evm_usb_supplies,
+       .num_consumer_supplies  = ARRAY_SIZE(da830_evm_usb_supplies),
+};
+
+static struct fixed_voltage_config da830_evm_usb_vbus = {
+       .supply_name            = "vbus",
+       .microvolts             = 33000000,
+       .init_data              = &da830_evm_usb_vbus_data,
+};
+
+static struct platform_device da830_evm_usb_vbus_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 0,
+       .dev            = {
+               .platform_data = &da830_evm_usb_vbus,
+       },
+};
+
+static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
        .dev_id         = "ohci-da8xx",
        .table = {
-               GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0),
                GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0),
+               { }
        },
 };
 
+static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
+       .dev_id         = "reg-fixed-voltage.0",
+       .table = {
+               GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = {
+       &da830_evm_usb_oc_gpio_lookup,
+       &da830_evm_usb_vbus_gpio_lookup,
+};
+
 static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
        /* TPS2065 switch @ 5V */
        .potpgt         = (3 + 1) / 2,  /* 3 ms max */
@@ -75,6 +112,9 @@ static __init void da830_evm_usb_init(void)
                pr_warn("%s: USB PHY CLK registration failed: %d\n",
                        __func__, ret);
 
+       gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups,
+                               ARRAY_SIZE(da830_evm_usb_gpio_lookups));
+
        ret = da8xx_register_usb_phy();
        if (ret)
                pr_warn("%s: USB PHY registration failed: %d\n",
@@ -100,7 +140,11 @@ static __init void da830_evm_usb_init(void)
                return;
        }
 
-       gpiod_add_lookup_table(&da830_evm_usb_gpio_lookup);
+       ret = platform_device_register(&da830_evm_usb_vbus_device);
+       if (ret) {
+               pr_warn("%s: Unable to register the vbus supply\n", __func__);
+               return;
+       }
 
        ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
        if (ret)
@@ -156,6 +200,7 @@ static struct gpiod_lookup_table mmc_gpios_table = {
                            GPIO_ACTIVE_LOW),
                GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp",
                            GPIO_ACTIVE_LOW),
+               { }
        },
 };
 
index 1fdc928..4ee65a8 100644 (file)
@@ -784,6 +784,7 @@ static struct gpiod_lookup_table mmc_gpios_table = {
                            GPIO_ACTIVE_LOW),
                GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp",
                            GPIO_ACTIVE_HIGH),
+               { }
        },
 };
 
index 64d81fc..5113273 100644 (file)
@@ -121,6 +121,7 @@ static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
                GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+               { }
        },
 };
 
index de15f78..9d87d4e 100644 (file)
@@ -663,6 +663,7 @@ static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
                GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+               { }
        },
 };
 
index 0896af2..db177a6 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/platform_data/mtd-davinci.h>
 #include <linux/platform_data/mtd-davinci-aemif.h>
 #include <linux/platform_data/ti-aemif.h>
+#include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 
 #include <asm/mach-types.h>
@@ -298,14 +299,50 @@ static const short da850_hawk_usb11_pins[] = {
        -1
 };
 
-static struct gpiod_lookup_table hawk_usb_gpio_lookup = {
+static struct regulator_consumer_supply hawk_usb_supplies[] = {
+       REGULATOR_SUPPLY("vbus", NULL),
+};
+
+static struct regulator_init_data hawk_usb_vbus_data = {
+       .consumer_supplies      = hawk_usb_supplies,
+       .num_consumer_supplies  = ARRAY_SIZE(hawk_usb_supplies),
+};
+
+static struct fixed_voltage_config hawk_usb_vbus = {
+       .supply_name            = "vbus",
+       .microvolts             = 3300000,
+       .init_data              = &hawk_usb_vbus_data,
+};
+
+static struct platform_device hawk_usb_vbus_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 0,
+       .dev            = {
+               .platform_data = &hawk_usb_vbus,
+       },
+};
+
+static struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = {
        .dev_id         = "ohci-da8xx",
        .table = {
-               GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, "vbus", 0),
                GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0),
+               { }
        },
 };
 
+static struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = {
+       .dev_id         = "reg-fixed-voltage.0",
+       .table = {
+               GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0),
+               { }
+       },
+};
+
+static struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = {
+       &hawk_usb_oc_gpio_lookup,
+       &hawk_usb_vbus_gpio_lookup,
+};
+
 static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
        /* TPS2087 switch @ 5V */
        .potpgt         = (3 + 1) / 2,  /* 3 ms max */
@@ -326,12 +363,19 @@ static __init void omapl138_hawk_usb_init(void)
                pr_warn("%s: USB PHY CLK registration failed: %d\n",
                        __func__, ret);
 
+       gpiod_add_lookup_tables(hawk_usb_gpio_lookups,
+                               ARRAY_SIZE(hawk_usb_gpio_lookups));
+
        ret = da8xx_register_usb_phy();
        if (ret)
                pr_warn("%s: USB PHY registration failed: %d\n",
                        __func__, ret);
 
-       gpiod_add_lookup_table(&hawk_usb_gpio_lookup);
+       ret = platform_device_register(&hawk_usb_vbus_device);
+       if (ret) {
+               pr_warn("%s: Unable to register the vbus supply\n", __func__);
+               return;
+       }
 
        ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
        if (ret)
index 63511f6..e6b8ffd 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/clk/davinci.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-cp-intc.h>
 #include <linux/platform_data/gpio-davinci.h>
 
index 67ab71b..77bc64d 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/cpufreq.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-cp-intc.h>
 #include <linux/mfd/da8xx-cfgchip.h>
 #include <linux/platform_data/clk-da8xx-cfgchip.h>
index b8dc674..036139f 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/dma-contiguous.h>
 #include <linux/dmaengine.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/serial_8250.h>
index 4a48244..c607332 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-aintc.h>
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
index 8e0a773..2f9ae64 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-aintc.h>
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
index cecc7ce..1b9e9a6 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/clkdev.h>
 #include <linux/dmaengine.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-aintc.h>
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
index f33392f..62ca952 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/irqchip/irq-davinci-aintc.h>
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
index 3d8a1d2..fc5b7c9 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARCH_DIGICOLOR)   += digicolor.o
index 760a0ef..e4dd1d2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000100
 initrd_phys-y  := 0x00800000
index 0d420a2..d7b826d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/clk-provider.h>
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/dma-mv_xor.h>
index a7d68c1..2965413 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 83cf07c..e7e9893 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000400
 initrd_phys-y  := 0x00800000
index 3a74af7..dede3fa 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += dtmachine.o
index eacfc3f..cec195d 100644 (file)
@@ -1,3 +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 .
index c095236..f2db5fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_EP93XX
 
 menu "Cirrus EP93xx Implementation Options"
index ed82ed7..4c0a039 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Empty file waiting for deletion once Makefile.boot isn't needed any more.
index bda6c3a..5d3a3e3 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/sizes.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index d2eee70..b9f523d 100644 (file)
@@ -20,8 +20,9 @@
 #include <linux/io.h>
 #include <linux/spinlock.h>
 #include <linux/clkdev.h>
+#include <linux/soc/cirrus/ep93xx.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 #include <asm/div64.h>
 
index 706515f..cc1382f 100644 (file)
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/random.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 #include <linux/platform_data/video-ep93xx.h>
 #include <linux/platform_data/keypad-ep93xx.h>
 #include <linux/platform_data/spi-ep93xx.h>
-#include <mach/gpio-ep93xx.h>
+#include <linux/soc/cirrus/ep93xx.h>
+
+#include "gpio-ep93xx.h"
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -123,7 +125,7 @@ void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits)
 /**
  * ep93xx_chip_revision() - returns the EP93xx chip revision
  *
- * See <mach/platform.h> for more information.
+ * See "platform.h" for more information.
  */
 unsigned int ep93xx_chip_revision(void)
 {
index 88a4c9b..8214271 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/platform_device.h>
 
 #include <linux/platform_data/dma-ep93xx.h>
-#include <mach/hardware.h>
+#include "hardware.h"
 
 #include "soc.h"
 
index 34e18e9..c8c4712 100644 (file)
 
 #include <sound/cs4271.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 #include <linux/platform_data/video-ep93xx.h>
 #include <linux/platform_data/spi-ep93xx.h>
-#include <mach/gpio-ep93xx.h>
+#include "gpio-ep93xx.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 0cca5b1..ac48e34 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/sizes.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
similarity index 96%
rename from arch/arm/mach-ep93xx/include/mach/hardware.h
rename to arch/arm/mach-ep93xx/hardware.h
index 8938906..e7d850e 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <mach/platform.h>
+#include "platform.h"
 
 /*
  * The EP93xx has two external crystal oscillators.  To generate the
index 373583c..c7f64e4 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
similarity index 65%
rename from arch/arm/mach-ep93xx/include/mach/platform.h
rename to arch/arm/mach-ep93xx/platform.h
index 6c41c79..b4045a1 100644 (file)
@@ -5,6 +5,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/platform_data/eth-ep93xx.h>
 #include <linux/reboot.h>
 
 struct device;
@@ -15,23 +16,9 @@ struct ep93xxfb_mach_info;
 struct ep93xx_keypad_platform_data;
 struct ep93xx_spi_info;
 
-struct ep93xx_eth_data
-{
-       unsigned char   dev_addr[6];
-       unsigned char   phy_id;
-};
-
 void ep93xx_map_io(void);
 void ep93xx_init_irq(void);
 
-#define EP93XX_CHIP_REV_D0     3
-#define EP93XX_CHIP_REV_D1     4
-#define EP93XX_CHIP_REV_E0     5
-#define EP93XX_CHIP_REV_E1     6
-#define EP93XX_CHIP_REV_E2     7
-
-unsigned int ep93xx_chip_revision(void);
-
 void ep93xx_register_flash(unsigned int width,
                           resource_size_t start, resource_size_t size);
 
@@ -41,19 +28,11 @@ void ep93xx_register_spi(struct ep93xx_spi_info *info,
                         struct spi_board_info *devices, int num);
 void ep93xx_register_fb(struct ep93xxfb_mach_info *data);
 void ep93xx_register_pwm(int pwm0, int pwm1);
-int ep93xx_pwm_acquire_gpio(struct platform_device *pdev);
-void ep93xx_pwm_release_gpio(struct platform_device *pdev);
 void ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data);
-int ep93xx_keypad_acquire_gpio(struct platform_device *pdev);
-void ep93xx_keypad_release_gpio(struct platform_device *pdev);
 void ep93xx_register_i2s(void);
-int ep93xx_i2s_acquire(void);
-void ep93xx_i2s_release(void);
 void ep93xx_register_ac97(void);
 void ep93xx_register_ide(void);
 void ep93xx_register_adc(void);
-int ep93xx_ide_acquire_gpio(struct platform_device *pdev);
-void ep93xx_ide_release_gpio(struct platform_device *pdev);
 
 struct device *ep93xx_init_devices(void);
 extern void ep93xx_timer_init(void);
index f0f38c0..5a3c32f 100644 (file)
@@ -27,8 +27,8 @@
 #include <linux/gpio.h>
 #include <linux/gpio/machine.h>
 
-#include <mach/hardware.h>
-#include <mach/gpio-ep93xx.h>
+#include "hardware.h"
+#include "gpio-ep93xx.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index cf0cb58..f8f8955 100644 (file)
@@ -25,9 +25,9 @@
 
 #include <linux/mtd/platnand.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 #include <linux/platform_data/video-ep93xx.h>
-#include <mach/gpio-ep93xx.h>
+#include "gpio-ep93xx.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index a3a20c8..e9f3690 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/platform_data/spi-ep93xx.h>
 #include <linux/gpio/machine.h>
 
-#include <mach/gpio-ep93xx.h>
-#include <mach/hardware.h>
+#include "gpio-ep93xx.h"
+#include "hardware.h"
 #include <mach/irqs.h>
 
 #include <asm/mach-types.h>
index f95a644..d44db6d 100644 (file)
 
 #include <sound/cs4271.h>
 
-#include <mach/hardware.h>
+#include "hardware.h"
 #include <linux/platform_data/video-ep93xx.h>
 #include <linux/platform_data/spi-ep93xx.h>
-#include <mach/gpio-ep93xx.h>
+#include "gpio-ep93xx.h"
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
index b40963c..1c518b8 100644 (file)
@@ -106,21 +106,15 @@ config SOC_EXYNOS5420
        bool "SAMSUNG EXYNOS5420"
        default y
        depends on ARCH_EXYNOS5
+       select MCPM if SMP
+       select ARM_CCI400_PORT_CTRL
+       select ARM_CPU_SUSPEND
 
 config SOC_EXYNOS5800
        bool "SAMSUNG EXYNOS5800"
        default y
        depends on SOC_EXYNOS5420
 
-config EXYNOS5420_MCPM
-       bool "Exynos5420 Multi-Cluster PM support"
-       depends on MCPM && SOC_EXYNOS5420
-       select ARM_CCI400_PORT_CTRL
-       select ARM_CPU_SUSPEND
-       help
-         This is needed to provide CPU and cluster power management
-         on Exynos5420 implementing big.LITTLE.
-
 config EXYNOS_CPU_SUSPEND
        bool
        select ARM_CPU_SUSPEND
index cd00c82..264dbaa 100644 (file)
@@ -18,5 +18,5 @@ plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_exynos-smc.o            :=-Wa,-march=armv7-a$(plus_sec)
 AFLAGS_sleep.o                 :=-Wa,-march=armv7-a$(plus_sec)
 
-obj-$(CONFIG_EXYNOS5420_MCPM)  += mcpm-exynos.o
+obj-$(CONFIG_MCPM)             += mcpm-exynos.o
 CFLAGS_mcpm-exynos.o           += -march=armv7-a
index 1b8699e..c93356a 100644 (file)
@@ -91,6 +91,7 @@ extern u32 cp15_save_power;
 
 extern void __iomem *sysram_ns_base_addr;
 extern void __iomem *sysram_base_addr;
+extern phys_addr_t sysram_base_phys;
 extern void __iomem *pmu_base_addr;
 void exynos_sysram_init(void);
 
index 865dcc4..9aa4833 100644 (file)
@@ -33,6 +33,7 @@ static struct platform_device exynos_cpuidle = {
 };
 
 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;
 
 void __init exynos_sysram_init(void)
@@ -43,6 +44,8 @@ void __init exynos_sysram_init(void)
                if (!of_device_is_available(node))
                        continue;
                sysram_base_addr = of_iomap(node, 0);
+               sysram_base_phys = of_translate_address(node,
+                                          of_get_address(node, 0, NULL, NULL));
                break;
        }
 
index d602e3b..2eaf2db 100644 (file)
@@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_available(void)
                return false;
 
        addr = of_get_address(nd, 0, NULL, NULL);
+       of_node_put(nd);
        if (!addr) {
                pr_err("%s: No address specified.\n", __func__);
                return false;
index 72bc035..9a681b4 100644 (file)
@@ -75,14 +75,25 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
                 */
                if (cluster &&
                    cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
+                       unsigned int timeout = 16;
+
                        /*
                         * Before we reset the Little cores, we should wait
                         * the SPARE2 register is set to 1 because the init
                         * codes of the iROM will set the register after
                         * initialization.
                         */
-                       while (!pmu_raw_readl(S5P_PMU_SPARE2))
+                       while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) {
+                               timeout--;
                                udelay(10);
+                       }
+
+                       if (timeout == 0) {
+                               pr_err("cpu %u cluster %u powerup failed\n",
+                                      cpu, cluster);
+                               exynos_cpu_power_down(cpunr);
+                               return -ETIMEDOUT;
+                       }
 
                        pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
                                        EXYNOS_SWRESET);
index abcac61..0cbbae8 100644 (file)
@@ -214,13 +214,20 @@ static inline void __iomem *cpu_boot_reg(int cpu)
  */
 void exynos_core_restart(u32 core_id)
 {
+       unsigned int timeout = 16;
        u32 val;
 
        if (!of_machine_is_compatible("samsung,exynos3250"))
                return;
 
-       while (!pmu_raw_readl(S5P_PMU_SPARE2))
+       while (timeout && !pmu_raw_readl(S5P_PMU_SPARE2)) {
+               timeout--;
                udelay(10);
+       }
+       if (timeout == 0) {
+               pr_err("cpu core %u restart failed\n", core_id);
+               return;
+       }
        udelay(10);
 
        val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
index f355185..98832e5 100644 (file)
 #define SMC_CMD_L2X0INVALL     (-24)
 #define SMC_CMD_L2X0DEBUG      (-25)
 
+/* For Accessing CP15/SFR (General) */
+#define SMC_CMD_REG            (-101)
+
+/* defines for SMC_CMD_REG */
+#define SMC_REG_CLASS_SFR_W    (0x1 << 30)
+#define SMC_REG_ID_SFR_W(addr) (SMC_REG_CLASS_SFR_W | ((addr) >> 2))
+
 #ifndef __ASSEMBLY__
 
 extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3);
index 0850505..be122af 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/suspend.h>
 
 #include "common.h"
+#include "smc.h"
 
 #define REG_TABLE_END (-1U)
 
@@ -62,6 +63,8 @@ struct exynos_pm_state {
        int cpu_state;
        unsigned int pmu_spare3;
        void __iomem *sysram_base;
+       phys_addr_t sysram_phys;
+       bool secure_firmware;
 };
 
 static const struct exynos_pm_data *pm_data __ro_after_init;
@@ -265,9 +268,7 @@ static int exynos5420_cpu_suspend(unsigned long arg)
        unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
        unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
 
-       writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE);
-
-       if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) {
+       if (IS_ENABLED(CONFIG_MCPM)) {
                mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume);
                mcpm_cpu_suspend();
        }
@@ -341,11 +342,16 @@ static void exynos5420_pm_prepare(void)
         */
        pm_state.cpu_state = readl_relaxed(pm_state.sysram_base +
                                           EXYNOS5420_CPU_STATE);
+       writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE);
+       if (pm_state.secure_firmware)
+               exynos_smc(SMC_CMD_REG, SMC_REG_ID_SFR_W(pm_state.sysram_phys +
+                                                        EXYNOS5420_CPU_STATE),
+                          0, 0);
 
        exynos_pm_enter_sleep_mode();
 
        /* ensure at least INFORM0 has the resume address */
-       if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
+       if (IS_ENABLED(CONFIG_MCPM))
                pmu_raw_writel(__pa_symbol(mcpm_entry_point), S5P_INFORM0);
 
        tmp = pmu_raw_readl(EXYNOS_L2_OPTION(0));
@@ -444,8 +450,27 @@ early_wakeup:
 
 static void exynos5420_prepare_pm_resume(void)
 {
-       if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM))
+       unsigned int mpidr, cluster;
+
+       mpidr = read_cpuid_mpidr();
+       cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+
+       if (IS_ENABLED(CONFIG_MCPM))
                WARN_ON(mcpm_cpu_powered_up());
+
+       if (IS_ENABLED(CONFIG_HW_PERF_EVENTS) && cluster != 0) {
+               /*
+                * When system is resumed on the LITTLE/KFC core (cluster 1),
+                * the DSCR is not properly updated until the power is turned
+                * on also for the cluster 0. Enable it for a while to
+                * propagate the SPNIDEN and SPIDEN signals from Secure JTAG
+                * block and avoid undefined instruction issue on CP14 reset.
+                */
+               pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN,
+                               EXYNOS_COMMON_CONFIGURATION(0));
+               pmu_raw_writel(0,
+                               EXYNOS_COMMON_CONFIGURATION(0));
+       }
 }
 
 static void exynos5420_pm_resume(void)
@@ -460,6 +485,11 @@ static void exynos5420_pm_resume(void)
        /* Restore the sysram cpu state register */
        writel_relaxed(pm_state.cpu_state,
                       pm_state.sysram_base + EXYNOS5420_CPU_STATE);
+       if (pm_state.secure_firmware)
+               exynos_smc(SMC_CMD_REG,
+                          SMC_REG_ID_SFR_W(pm_state.sysram_phys +
+                                           EXYNOS5420_CPU_STATE),
+                          EXYNOS_AFTR_MAGIC, 0);
 
        pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
                        S5P_CENTRAL_SEQ_OPTION);
@@ -639,8 +669,10 @@ void __init exynos_pm_init(void)
 
        if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) {
                pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
+               of_node_put(np);
                return;
        }
+       of_node_put(np);
 
        pm_data = (const struct exynos_pm_data *) match->data;
 
@@ -659,8 +691,11 @@ void __init exynos_pm_init(void)
         * Applicable as of now only to Exynos542x. If booted under secure
         * firmware, the non-secure region of sysram should be used.
         */
-       if (exynos_secure_firmware_available())
+       if (exynos_secure_firmware_available()) {
+               pm_state.sysram_phys = sysram_base_phys;
                pm_state.sysram_base = sysram_ns_base_addr;
-       else
+               pm_state.secure_firmware = true;
+       } else {
                pm_state.sysram_base = sysram_base_addr;
+       }
 }
index 816a5b8..1730ee8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_FOOTBRIDGE
 
 menu "Footbridge Implementations"
index ff0a4b5..e4313e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000100
 initrd_phys-y  := 0x00800000
index 70106b6..969674e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_GEMINI
        bool "Cortina Systems Gemini"
        depends on ARCH_MULTI_V4
index ca0db54..997a0be 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for Cortina systems Gemini
 obj-y                  := board-dt.o
index 5552968..1bc6891 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_HIGHBANK
        bool "Calxeda ECX-1000/2000 (Highbank/Midway)"
        depends on ARCH_MULTI_V7
index 55840f4..7e6732c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                                  := highbank.o system.o smc.o
 
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
index 65a048f..98338a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_HISI
        bool "Hisilicon SoC Support"
        depends on ARCH_MULTI_V7
index 659db19..3947635 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Hisilicon processors family
 #
index 9b8d4d6..593bf15 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MXC
        bool "Freescale i.MX family"
        depends on ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 || ARM_SINGLE_ARMV7M
index c0434a3..322caa2 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #include <linux/module.h>
index 0df71bf..3508c59 100644 (file)
@@ -1,22 +1,9 @@
+/* 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
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_BOARD_MX31LILLY_H__
index c1ad0ae..7d7c621 100644 (file)
@@ -1,23 +1,10 @@
+/* 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
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__
index de14543..6f3ff4d 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
index 8d2ae40..a969aa7 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 /*
index a1dfde5..3e6951e 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ARCH_ARM_MACH_MX3_CRM_REGS_H__
index 6ffe572..fdca73d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IMX_HAVE_PLATFORM_FEC
        bool
        default y if SOC_IMX25 || SOC_IMX27 || SOC_IMX35
index 3004517..cd72f08 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301, USA.
  */
 
 #include <linux/kernel.h>
index b403a4f..605c0af 100644 (file)
@@ -7,7 +7,7 @@
  * Free Software Foundation.
  */
 #include <linux/dma-mapping.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "../hardware.h"
 #include "devices-common.h"
index 4862825..4886784 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301, USA.
  */
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "../hardware.h"
 #include "devices-common.h"
index 8c134c8..0c6d3c0 100644 (file)
@@ -6,7 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "../hardware.h"
 #include "devices-common.h"
index 676df49..046e0cc 100644 (file)
@@ -6,7 +6,7 @@
  * the terms of the GNU General Public License version 2 as published by the
  * Free Software Foundation.
  */
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "../hardware.h"
 #include "devices-common.h"
index 90e10cb..92c5a9c 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007, 2014 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_HARDWARE_H__
@@ -24,7 +11,7 @@
 #include <asm/io.h>
 #include <soc/imx/revision.h>
 #endif
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #define addr_in_module(addr, mod) \
        ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
index 315bffa..72c3bca 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_IIM_H__
index 3982e91..abfc306 100644 (file)
@@ -1,21 +1,8 @@
+// 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #include <linux/gpio.h>
 #include <linux/module.h>
index a70cffc..6eab347 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 by Holger Schurig <hs4233@mail.mn-solutions.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #ifndef __MACH_IOMUX_MX21_H__
 #define __MACH_IOMUX_MX21_H__
index 218e99e..4d848d1 100644 (file)
@@ -1,20 +1,7 @@
+/* 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #ifndef __MACH_IOMUX_MX27_H__
 #define __MACH_IOMUX_MX27_H__
index 7a9b20a..ce6b6d2 100644 (file)
@@ -1,20 +1,7 @@
+/* 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #ifndef __MACH_IOMUX_MX2x_H__
 #define __MACH_IOMUX_MX2x_H__
index 368667b..99270a1 100644 (file)
@@ -1,20 +1,7 @@
+/* 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #ifndef __MACH_IOMUX_MX3_H__
 #define __MACH_IOMUX_MX3_H__
index 90bfa6b..7fb5259 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH <armlinux@phytec.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option, NO_PAD_CTRL) any later version.
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __MACH_IOMUX_MX35_H__
index 02651a4..b948529 100644 (file)
@@ -1,20 +1,7 @@
+/* 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #ifndef __MACH_IOMUX_V1_H__
 #define __MACH_IOMUX_V1_H__
index ca59d5f..043cf3c 100644 (file)
@@ -1,22 +1,9 @@
+// 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>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index f79e165..7db8ec9 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH,
  *                     <armlinux@phytec.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __MACH_IOMUX_V3_H__
index 210d36e..2ce3e01 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) BitBox Ltd 2010
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #include <linux/module.h>
index 6e3175d..1c2ac0f 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) BitBox Ltd 2010
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __PLAT_MXC_IRQ_COMMON_H__
index 17a97ba..4d9a56f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * armadillo5x0.c
  *
@@ -6,21 +7,6 @@
  *
  * Based on Atmark Techno, Inc. armadillo 500 BSP 2008
  * Based on mx31ads.c and pcm037.c Great Work!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/types.h>
index 07d4fcf..c0350bc 100644 (file)
@@ -1,24 +1,10 @@
+// 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.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 5714e2f..2e28e1b 100644 (file)
@@ -1,20 +1,7 @@
+// 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)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/platform_device.h>
index 2e91ab2..e117d28 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * arch/arm/mach-imx/mm-imx21.c
  *
  * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/mm.h>
index 862b9b7..dcbe7ec 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * arch/arm/mach-imx/mm-imx27.c
  *
  * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/mm.h>
index 468738a..38be12a 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
@@ -6,20 +7,6 @@
  * 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.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __MACH_MX21_H__
index f96bb26..c6f7aae 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
@@ -5,20 +6,6 @@
  * This contains i.MX27-specific hardware definitions. For those
  * hardware pieces that are common between i.MX21 and i.MX27, have a
  * look at mx2x.h.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __MACH_MX27_H__
index 11642f5..841c34e 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  *
  * This contains hardware definitions that are common between i.MX21 and
  * i.MX27.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 
 #ifndef __MACH_MX2x_H__
index 8e72d4e..2bfd2d5 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007, 2010-2015 Freescale Semiconductor, Inc.
  * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_MXC_H__
index e67e0b2..e527532 100644 (file)
@@ -354,9 +354,11 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode)
         *
         * Note that IRQ #32 is GIC SPI #0.
         */
-       imx_gpc_hwirq_unmask(0);
+       if (mode != WAIT_CLOCKED)
+               imx_gpc_hwirq_unmask(0);
        writel_relaxed(val, ccm_base + CLPCR);
-       imx_gpc_hwirq_mask(0);
+       if (mode != WAIT_CLOCKED)
+               imx_gpc_hwirq_mask(0);
 
        return 0;
 }
index cefe44f..982eabc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_INTEGRATOR
        bool "ARM Ltd. Integrator family"
        depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6
index 8dfad01..6ddbe15 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/irqchip/arm-vic.h>
 #include <linux/gpio/machine.h>
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include "lm.h"
 #include "impd1.h"
 
index 3a8c38c..4f29554 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y   += 0x00008000
 params_phys-y  := 0x00000100
 initrd_phys-y  := 0x00800000
index 070d92a..8426ab9 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/export.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/signal.h>
 #include <asm/mach/pci.h>
 #include "pci.h"
index 116feb6..d3d8c78 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach/irqs.h>
 
 /* assumes CONTROLLER_ONLY# is never asserted in the ESSR register */
index 0a833b1..5c3af01 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0xa0008000
 params_phys-y  := 0xa0000100
 initrd_phys-y  := 0xa0800000
index 9aa016b..cd6069c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_IOP33X
 
 menu "IOP33x Implementation Options"
index e95db30..320ecde 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 760a0ef..e4dd1d2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000100
 initrd_phys-y  := 0x00800000
index fea0081..2f052c5 100644 (file)
@@ -1,9 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_IXP4XX
 
 menu "Intel IXP4xx Implementation Options"
 
 comment "IXP4xx Platforms"
 
+config MACH_IXP4XX_OF
+       bool
+       prompt "Devce Tree IXP4xx boards"
+       default y
+       select ARM_APPENDED_DTB # Old Redboot bootloaders deployed
+       select I2C
+       select I2C_IOP3XX
+       select PCI
+       select SERIAL_OF_PLATFORM
+       select TIMER_OF
+       select USE_OF
+       help
+         Say 'Y' here to support Device Tree-based IXP4xx platforms.
+
 config MACH_NSLU2
        bool
        prompt "Linksys NSLU2"
@@ -222,19 +237,6 @@ config IXP4XX_INDIRECT_PCI
          need to use the indirect method instead. If you don't know
          what you need, leave this option unselected.
 
-config IXP4XX_QMGR
-       tristate "IXP4xx Queue Manager support"
-       help
-         This driver supports IXP4xx built-in hardware queue manager
-         and is automatically selected by Ethernet and HSS drivers.
-
-config IXP4XX_NPE
-       tristate "IXP4xx Network Processor Engine support"
-       select FW_LOADER
-       help
-         This driver supports IXP4xx built-in network coprocessors
-         and is automatically selected by Ethernet and HSS drivers.
-
 endmenu
 
 endif
index f099945..1fa4e66 100644 (file)
@@ -6,6 +6,9 @@
 obj-pci-y      :=
 obj-pci-n      :=
 
+# Device tree platform
+obj-pci-$(CONFIG_MACH_IXP4XX_OF)       += ixp4xx-of.o
+
 obj-pci-$(CONFIG_ARCH_IXDP4XX)         += ixdp425-pci.o
 obj-pci-$(CONFIG_MACH_AVILA)           += avila-pci.o
 obj-pci-$(CONFIG_MACH_IXDPG425)                += ixdpg425-pci.o
@@ -40,5 +43,3 @@ obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o
 obj-$(CONFIG_MACH_ARCOM_VULCAN)        += vulcan-setup.o
 
 obj-$(CONFIG_PCI)              += $(obj-pci-$(CONFIG_PCI)) common-pci.o
-obj-$(CONFIG_IXP4XX_QMGR)      += ixp4xx_qmgr.o
-obj-$(CONFIG_IXP4XX_NPE)       += ixp4xx_npe.o
index 9c7af91..9b015bd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000100
 
index 548c7d4..9c834f0 100644 (file)
@@ -27,6 +27,8 @@
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define AVILA_MAX_DEV  4
 #define LOFT_MAX_DEV   6
 #define IRQ_LINES      4
index 44cbbce..1981b33 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define AVILA_SDA_PIN  7
 #define AVILA_SCL_PIN  6
 
index 6835b17..a53104b 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <asm/cputype.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/mach/pci.h>
 #include <mach/hardware.h>
 
index 846e033..381f452 100644 (file)
 #include <linux/serial_core.h>
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
-#include <linux/time.h>
-#include <linux/clocksource.h>
-#include <linux/clockchips.h>
 #include <linux/io.h>
 #include <linux/export.h>
-#include <linux/gpio/driver.h>
 #include <linux/cpu.h>
 #include <linux/pci.h>
 #include <linux/sched_clock.h>
+#include <linux/irqchip/irq-ixp4xx.h>
+#include <linux/platform_data/timer-ixp4xx.h>
 #include <mach/udc.h>
 #include <mach/hardware.h>
 #include <mach/io.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
+#include <asm/exception.h>
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
-#define IXP4XX_TIMER_FREQ 66666000
-
-/*
- * The timer register doesn't allow to specify the two least significant bits of
- * the timeout value and assumes them being zero. So make sure IXP4XX_LATCH is
- * the best value with the two least significant bits unset.
- */
-#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, \
-                                      (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \
-                       (IXP4XX_OST_RELOAD_MASK + 1)
+#include "irqs.h"
 
-static void __init ixp4xx_clocksource_init(void);
-static void __init ixp4xx_clockevent_init(void);
-static struct clock_event_device clockevent_ixp4xx;
+#define IXP4XX_TIMER_FREQ 66666000
 
 /*************************************************************************
  * IXP4xx chipset I/O mapping
@@ -77,11 +65,6 @@ static struct map_desc ixp4xx_io_desc[] __initdata = {
                .pfn            = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),
                .length         = IXP4XX_PCI_CFG_REGION_SIZE,
                .type           = MT_DEVICE
-       }, {    /* Queue Manager */
-               .virtual        = (unsigned long)IXP4XX_QMGR_BASE_VIRT,
-               .pfn            = __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS),
-               .length         = IXP4XX_QMGR_REGION_SIZE,
-               .type           = MT_DEVICE
        },
 };
 
@@ -90,258 +73,23 @@ void __init ixp4xx_map_io(void)
        iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));
 }
 
-/*
- * GPIO-functions
- */
-/*
- * The following converted to the real HW bits the gpio_line_config
- */
-/* GPIO pin types */
-#define IXP4XX_GPIO_OUT                0x1
-#define IXP4XX_GPIO_IN                 0x2
-
-/* GPIO signal types */
-#define IXP4XX_GPIO_LOW                        0
-#define IXP4XX_GPIO_HIGH               1
-
-/* GPIO Clocks */
-#define IXP4XX_GPIO_CLK_0              14
-#define IXP4XX_GPIO_CLK_1              15
-
-static void gpio_line_config(u8 line, u32 direction)
-{
-       if (direction == IXP4XX_GPIO_IN)
-               *IXP4XX_GPIO_GPOER |= (1 << line);
-       else
-               *IXP4XX_GPIO_GPOER &= ~(1 << line);
-}
-
-static void gpio_line_get(u8 line, int *value)
-{
-       *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
-}
-
-static void gpio_line_set(u8 line, int value)
-{
-       if (value == IXP4XX_GPIO_HIGH)
-           *IXP4XX_GPIO_GPOUTR |= (1 << line);
-       else if (value == IXP4XX_GPIO_LOW)
-           *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
-}
-
-/*************************************************************************
- * IXP4xx chipset IRQ handling
- *
- * TODO: GPIO IRQs should be marked invalid until the user of the IRQ
- *       (be it PCI or something else) configures that GPIO line
- *       as an IRQ.
- **************************************************************************/
-enum ixp4xx_irq_type {
-       IXP4XX_IRQ_LEVEL, IXP4XX_IRQ_EDGE
-};
-
-/* Each bit represents an IRQ: 1: edge-triggered, 0: level triggered */
-static unsigned long long ixp4xx_irq_edge = 0;
-
-/*
- * IRQ -> GPIO mapping table
- */
-static signed char irq2gpio[32] = {
-       -1, -1, -1, -1, -1, -1,  0,  1,
-       -1, -1, -1, -1, -1, -1, -1, -1,
-       -1, -1, -1,  2,  3,  4,  5,  6,
-        7,  8,  9, 10, 11, 12, -1, -1,
-};
-
-static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
-{
-       int irq;
-
-       for (irq = 0; irq < 32; irq++) {
-               if (irq2gpio[irq] == gpio)
-                       return irq;
-       }
-       return -EINVAL;
-}
-
-static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
-{
-       int line = irq2gpio[d->irq];
-       u32 int_style;
-       enum ixp4xx_irq_type irq_type;
-       volatile u32 *int_reg;
-
-       /*
-        * Only for GPIO IRQs
-        */
-       if (line < 0)
-               return -EINVAL;
-
-       switch (type){
-       case IRQ_TYPE_EDGE_BOTH:
-               int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL;
-               irq_type = IXP4XX_IRQ_EDGE;
-               break;
-       case IRQ_TYPE_EDGE_RISING:
-               int_style = IXP4XX_GPIO_STYLE_RISING_EDGE;
-               irq_type = IXP4XX_IRQ_EDGE;
-               break;
-       case IRQ_TYPE_EDGE_FALLING:
-               int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE;
-               irq_type = IXP4XX_IRQ_EDGE;
-               break;
-       case IRQ_TYPE_LEVEL_HIGH:
-               int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
-               irq_type = IXP4XX_IRQ_LEVEL;
-               break;
-       case IRQ_TYPE_LEVEL_LOW:
-               int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW;
-               irq_type = IXP4XX_IRQ_LEVEL;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       if (irq_type == IXP4XX_IRQ_EDGE)
-               ixp4xx_irq_edge |= (1 << d->irq);
-       else
-               ixp4xx_irq_edge &= ~(1 << d->irq);
-
-       if (line >= 8) {        /* pins 8-15 */
-               line -= 8;
-               int_reg = IXP4XX_GPIO_GPIT2R;
-       } else {                /* pins 0-7 */
-               int_reg = IXP4XX_GPIO_GPIT1R;
-       }
-
-       /* Clear the style for the appropriate pin */
-       *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR <<
-                       (line * IXP4XX_GPIO_STYLE_SIZE));
-
-       *IXP4XX_GPIO_GPISR = (1 << line);
-
-       /* Set the new style */
-       *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
-
-       /* Configure the line as an input */
-       gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN);
-
-       return 0;
-}
-
-static void ixp4xx_irq_mask(struct irq_data *d)
-{
-       if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
-               *IXP4XX_ICMR2 &= ~(1 << (d->irq - 32));
-       else
-               *IXP4XX_ICMR &= ~(1 << d->irq);
-}
-
-static void ixp4xx_irq_ack(struct irq_data *d)
-{
-       int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
-
-       if (line >= 0)
-               *IXP4XX_GPIO_GPISR = (1 << line);
-}
-
-/*
- * Level triggered interrupts on GPIO lines can only be cleared when the
- * interrupt condition disappears.
- */
-static void ixp4xx_irq_unmask(struct irq_data *d)
-{
-       if (!(ixp4xx_irq_edge & (1 << d->irq)))
-               ixp4xx_irq_ack(d);
-
-       if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
-               *IXP4XX_ICMR2 |= (1 << (d->irq - 32));
-       else
-               *IXP4XX_ICMR |= (1 << d->irq);
-}
-
-static struct irq_chip ixp4xx_irq_chip = {
-       .name           = "IXP4xx",
-       .irq_ack        = ixp4xx_irq_ack,
-       .irq_mask       = ixp4xx_irq_mask,
-       .irq_unmask     = ixp4xx_irq_unmask,
-       .irq_set_type   = ixp4xx_set_irq_type,
-};
-
 void __init ixp4xx_init_irq(void)
 {
-       int i = 0;
-
        /*
         * ixp4xx does not implement the XScale PWRMODE register
         * so it must not call cpu_do_idle().
         */
        cpu_idle_poll_ctrl(true);
 
-       /* Route all sources to IRQ instead of FIQ */
-       *IXP4XX_ICLR = 0x0;
-
-       /* Disable all interrupt */
-       *IXP4XX_ICMR = 0x0; 
-
-       if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
-               /* Route upper 32 sources to IRQ instead of FIQ */
-               *IXP4XX_ICLR2 = 0x00;
-
-               /* Disable upper 32 interrupts */
-               *IXP4XX_ICMR2 = 0x00;
-       }
-
-        /* Default to all level triggered */
-       for(i = 0; i < NR_IRQS; i++) {
-               irq_set_chip_and_handler(i, &ixp4xx_irq_chip,
-                                        handle_level_irq);
-               irq_clear_status_flags(i, IRQ_NOREQUEST);
-       }
-}
-
-
-/*************************************************************************
- * IXP4xx timer tick
- * We use OS timer1 on the CPU for the timer tick and the timestamp 
- * counter as a source of real clock ticks to account for missed jiffies.
- *************************************************************************/
-
-static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
-{
-       struct clock_event_device *evt = dev_id;
-
-       /* Clear Pending Interrupt by writing '1' to it */
-       *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
-
-       evt->event_handler(evt);
-
-       return IRQ_HANDLED;
+       ixp4xx_irq_init(IXP4XX_INTC_BASE_PHYS,
+                       (cpu_is_ixp46x() || cpu_is_ixp43x()));
 }
 
-static struct irqaction ixp4xx_timer_irq = {
-       .name           = "timer1",
-       .flags          = IRQF_TIMER | IRQF_IRQPOLL,
-       .handler        = ixp4xx_timer_interrupt,
-       .dev_id         = &clockevent_ixp4xx,
-};
-
 void __init ixp4xx_timer_init(void)
 {
-       /* Reset/disable counter */
-       *IXP4XX_OSRT1 = 0;
-
-       /* Clear Pending Interrupt by writing '1' to it */
-       *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
-
-       /* Reset time-stamp counter */
-       *IXP4XX_OSTS = 0;
-
-       /* Connect the interrupt handler and enable the interrupt */
-       setup_irq(IRQ_IXP4XX_TIMER1, &ixp4xx_timer_irq);
-
-       ixp4xx_clocksource_init();
-       ixp4xx_clockevent_init();
+       return ixp4xx_timer_setup(IXP4XX_TIMER_BASE_PHYS,
+                                 IRQ_IXP4XX_TIMER1,
+                                 IXP4XX_TIMER_FREQ);
 }
 
 static struct pxa2xx_udc_mach_info ixp4xx_udc_info;
@@ -364,6 +112,24 @@ static struct resource ixp4xx_udc_resources[] = {
        },
 };
 
+static struct resource ixp4xx_gpio_resource[] = {
+       {
+               .start = IXP4XX_GPIO_BASE_PHYS,
+               .end = IXP4XX_GPIO_BASE_PHYS + 0xfff,
+               .flags = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device ixp4xx_gpio_device = {
+       .name           = "ixp4xx-gpio",
+       .id             = -1,
+       .dev = {
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+       .resource = ixp4xx_gpio_resource,
+       .num_resources  = ARRAY_SIZE(ixp4xx_gpio_resource),
+};
+
 /*
  * USB device controller. The IXP4xx uses the same controller as PXA25X,
  * so we just use the same device.
@@ -378,7 +144,61 @@ static struct platform_device ixp4xx_udc_device = {
        },
 };
 
+static struct resource ixp4xx_npe_resources[] = {
+       {
+               .start = IXP4XX_NPEA_BASE_PHYS,
+               .end = IXP4XX_NPEA_BASE_PHYS + 0xfff,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = IXP4XX_NPEB_BASE_PHYS,
+               .end = IXP4XX_NPEB_BASE_PHYS + 0xfff,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = IXP4XX_NPEC_BASE_PHYS,
+               .end = IXP4XX_NPEC_BASE_PHYS + 0xfff,
+               .flags = IORESOURCE_MEM,
+       },
+
+};
+
+static struct platform_device ixp4xx_npe_device = {
+       .name           = "ixp4xx-npe",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(ixp4xx_npe_resources),
+       .resource       = ixp4xx_npe_resources,
+};
+
+static struct resource ixp4xx_qmgr_resources[] = {
+       {
+               .start = IXP4XX_QMGR_BASE_PHYS,
+               .end = IXP4XX_QMGR_BASE_PHYS + 0x3fff,
+               .flags = IORESOURCE_MEM,
+       },
+       {
+               .start = IRQ_IXP4XX_QM1,
+               .end = IRQ_IXP4XX_QM1,
+               .flags = IORESOURCE_IRQ,
+       },
+       {
+               .start = IRQ_IXP4XX_QM2,
+               .end = IRQ_IXP4XX_QM2,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device ixp4xx_qmgr_device = {
+       .name           = "ixp4xx-qmgr",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(ixp4xx_qmgr_resources),
+       .resource       = ixp4xx_qmgr_resources,
+};
+
 static struct platform_device *ixp4xx_devices[] __initdata = {
+       &ixp4xx_npe_device,
+       &ixp4xx_qmgr_device,
+       &ixp4xx_gpio_device,
        &ixp4xx_udc_device,
 };
 
@@ -413,56 +233,12 @@ static struct platform_device *ixp46x_devices[] __initdata = {
 unsigned long ixp4xx_exp_bus_size;
 EXPORT_SYMBOL(ixp4xx_exp_bus_size);
 
-static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
-{
-       gpio_line_config(gpio, IXP4XX_GPIO_IN);
-
-       return 0;
-}
-
-static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
-                                       int level)
-{
-       gpio_line_set(gpio, level);
-       gpio_line_config(gpio, IXP4XX_GPIO_OUT);
-
-       return 0;
-}
-
-static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
-{
-       int value;
-
-       gpio_line_get(gpio, &value);
-
-       return value;
-}
-
-static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
-                                 int value)
-{
-       gpio_line_set(gpio, value);
-}
-
-static struct gpio_chip ixp4xx_gpio_chip = {
-       .label                  = "IXP4XX_GPIO_CHIP",
-       .direction_input        = ixp4xx_gpio_direction_input,
-       .direction_output       = ixp4xx_gpio_direction_output,
-       .get                    = ixp4xx_gpio_get_value,
-       .set                    = ixp4xx_gpio_set_value,
-       .to_irq                 = ixp4xx_gpio_to_irq,
-       .base                   = 0,
-       .ngpio                  = 16,
-};
-
 void __init ixp4xx_sys_init(void)
 {
        ixp4xx_exp_bus_size = SZ_16M;
 
        platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices));
 
-       gpiochip_add_data(&ixp4xx_gpio_chip, NULL);
-
        if (cpu_is_ixp46x()) {
                int region;
 
@@ -481,103 +257,8 @@ void __init ixp4xx_sys_init(void)
                        ixp4xx_exp_bus_size >> 20);
 }
 
-/*
- * sched_clock()
- */
-static u64 notrace ixp4xx_read_sched_clock(void)
-{
-       return *IXP4XX_OSTS;
-}
-
-/*
- * clocksource
- */
-
-static u64 ixp4xx_clocksource_read(struct clocksource *c)
-{
-       return *IXP4XX_OSTS;
-}
-
 unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
 EXPORT_SYMBOL(ixp4xx_timer_freq);
-static void __init ixp4xx_clocksource_init(void)
-{
-       sched_clock_register(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq);
-
-       clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32,
-                       ixp4xx_clocksource_read);
-}
-
-/*
- * clockevents
- */
-static int ixp4xx_set_next_event(unsigned long evt,
-                                struct clock_event_device *unused)
-{
-       unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
-
-       *IXP4XX_OSRT1 = (evt & ~IXP4XX_OST_RELOAD_MASK) | opts;
-
-       return 0;
-}
-
-static int ixp4xx_shutdown(struct clock_event_device *evt)
-{
-       unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
-       unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
-
-       opts &= ~IXP4XX_OST_ENABLE;
-       *IXP4XX_OSRT1 = osrt | opts;
-       return 0;
-}
-
-static int ixp4xx_set_oneshot(struct clock_event_device *evt)
-{
-       unsigned long opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT;
-       unsigned long osrt = 0;
-
-       /* period set by 'set next_event' */
-       *IXP4XX_OSRT1 = osrt | opts;
-       return 0;
-}
-
-static int ixp4xx_set_periodic(struct clock_event_device *evt)
-{
-       unsigned long opts = IXP4XX_OST_ENABLE;
-       unsigned long osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK;
-
-       *IXP4XX_OSRT1 = osrt | opts;
-       return 0;
-}
-
-static int ixp4xx_resume(struct clock_event_device *evt)
-{
-       unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
-       unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
-
-       opts |= IXP4XX_OST_ENABLE;
-       *IXP4XX_OSRT1 = osrt | opts;
-       return 0;
-}
-
-static struct clock_event_device clockevent_ixp4xx = {
-       .name                   = "ixp4xx timer1",
-       .features               = CLOCK_EVT_FEAT_PERIODIC |
-                                 CLOCK_EVT_FEAT_ONESHOT,
-       .rating                 = 200,
-       .set_state_shutdown     = ixp4xx_shutdown,
-       .set_state_periodic     = ixp4xx_set_periodic,
-       .set_state_oneshot      = ixp4xx_set_oneshot,
-       .tick_resume            = ixp4xx_resume,
-       .set_next_event         = ixp4xx_set_next_event,
-};
-
-static void __init ixp4xx_clockevent_init(void)
-{
-       clockevent_ixp4xx.cpumask = cpumask_of(0);
-       clockevents_config_and_register(&clockevent_ixp4xx, IXP4XX_TIMER_FREQ,
-                                       0xf, 0xfffffffe);
-}
 
 void ixp4xx_restart(enum reboot_mode mode, const char *cmd)
 {
index 5d14ce2..a16c35d 100644 (file)
@@ -23,6 +23,8 @@
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 #define SLOT0_DEVID    14
 #define SLOT1_DEVID    15
 
index 7e40fe7..7ca43ca 100644 (file)
@@ -25,6 +25,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define COYOTE_IDE_BASE_PHYS   IXP4XX_EXP_BUS_BASE(3)
 #define COYOTE_IDE_BASE_VIRT   0xFFFE1000
 #define COYOTE_IDE_REGION_SIZE 0x1000
index 8dca769..6899023 100644 (file)
@@ -22,6 +22,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV                4
 #define IRQ_LINES      3
 
index 397190f..4d4c62f 100644 (file)
@@ -35,6 +35,8 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
 
+#include "irqs.h"
+
 #define DSMG600_SDA_PIN                5
 #define DSMG600_SCL_PIN                4
 
@@ -268,9 +270,6 @@ static void __init dsmg600_init(void)
 {
        ixp4xx_sys_init();
 
-       /* Make sure that GPIO14 and GPIO15 are not used as clocks */
-       *IXP4XX_GPIO_GPCLKR = 0;
-
        dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
        dsmg600_flash_resource.end =
                IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
index fd4a862..6c08bb9 100644 (file)
@@ -22,6 +22,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV                3
 #define IRQ_LINES      3
 
index f0a152e..648932d 100644 (file)
@@ -29,6 +29,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define FSG_SDA_PIN            12
 #define FSG_SCL_PIN            13
 
index d9d6cc0..903c753 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init gateway7001_pci_preinit(void)
 {
        irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
index 1be6faf..678e7df 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 static struct flash_platform_data gateway7001_flash_data = {
        .map_name       = "cfi_probe",
        .width          = 2,
index 551d114..1223d16 100644 (file)
@@ -30,6 +30,8 @@
 #include <mach/hardware.h>
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 #define SLOT0_DEVID    0
 #define SLOT1_DEVID    1
 #define INTA           10 /* slot 1 has INTA and INTB crossed */
index 16a1299..5dbdde8 100644 (file)
@@ -36,6 +36,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 /* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch
    and operate as an SPI type interface.  The details of the interface
    are available on Kendin/Micrel's web site. */
diff --git a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S
deleted file mode 100644 (file)
index 79adf83..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for IXP4xx-based platforms
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-#include <mach/hardware.h>
-
-               .macro  get_irqnr_preamble, base, tmp
-               .endm
-
-               .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
-               ldr     \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
-               ldr     \irqstat, [\irqstat]            @ get interrupts
-               cmp     \irqstat, #0
-               beq     1001f                           @ upper IRQ?
-               clz     \irqnr, \irqstat
-               mov     \base, #31
-               sub     \irqnr, \base, \irqnr
-               b       1002f                           @ lower IRQ being
-                                                       @ handled
-
-1001:
-               /*
-                * IXP465/IXP435 has an upper IRQ status register
-                */
-#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X)
-               ldr     \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP2_OFFSET)
-               ldr     \irqstat, [\irqstat]            @ get upper interrupts
-               mov     \irqnr, #63
-               clz     \irqstat, \irqstat
-               cmp     \irqstat, #32
-               subne   \irqnr, \irqnr, \irqstat
-#endif
-1002:
-               .endm
-
-
diff --git a/arch/arm/mach-ixp4xx/include/mach/irqs.h b/arch/arm/mach-ixp4xx/include/mach/irqs.h
deleted file mode 100644 (file)
index 7e6d4cc..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/include/mach/irqs.h 
- *
- * IRQ definitions for IXP4XX based systems
- *
- * Copyright (C) 2002 Intel Corporation.
- * Copyright (C) 2003 MontaVista Software, Inc.
- *
- * 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.
- *
- */
-
-#ifndef _ARCH_IXP4XX_IRQS_H_
-#define _ARCH_IXP4XX_IRQS_H_
-
-#define IRQ_IXP4XX_NPEA                0
-#define IRQ_IXP4XX_NPEB                1
-#define IRQ_IXP4XX_NPEC                2
-#define IRQ_IXP4XX_QM1         3
-#define IRQ_IXP4XX_QM2         4
-#define IRQ_IXP4XX_TIMER1      5
-#define IRQ_IXP4XX_GPIO0       6
-#define IRQ_IXP4XX_GPIO1       7
-#define IRQ_IXP4XX_PCI_INT     8
-#define IRQ_IXP4XX_PCI_DMA1    9
-#define IRQ_IXP4XX_PCI_DMA2    10
-#define IRQ_IXP4XX_TIMER2      11
-#define IRQ_IXP4XX_USB         12
-#define IRQ_IXP4XX_UART2       13
-#define IRQ_IXP4XX_TIMESTAMP   14
-#define IRQ_IXP4XX_UART1       15
-#define IRQ_IXP4XX_WDOG                16
-#define IRQ_IXP4XX_AHB_PMU     17
-#define IRQ_IXP4XX_XSCALE_PMU  18
-#define IRQ_IXP4XX_GPIO2       19
-#define IRQ_IXP4XX_GPIO3       20
-#define IRQ_IXP4XX_GPIO4       21
-#define IRQ_IXP4XX_GPIO5       22
-#define IRQ_IXP4XX_GPIO6       23
-#define IRQ_IXP4XX_GPIO7       24
-#define IRQ_IXP4XX_GPIO8       25
-#define IRQ_IXP4XX_GPIO9       26
-#define IRQ_IXP4XX_GPIO10      27
-#define IRQ_IXP4XX_GPIO11      28
-#define IRQ_IXP4XX_GPIO12      29
-#define IRQ_IXP4XX_SW_INT1     30
-#define IRQ_IXP4XX_SW_INT2     31
-#define IRQ_IXP4XX_USB_HOST    32
-#define IRQ_IXP4XX_I2C         33
-#define IRQ_IXP4XX_SSP         34
-#define IRQ_IXP4XX_TSYNC       35
-#define IRQ_IXP4XX_EAU_DONE    36
-#define IRQ_IXP4XX_SHA_DONE    37
-#define IRQ_IXP4XX_SWCP_PE     58
-#define IRQ_IXP4XX_QM_PE       60
-#define IRQ_IXP4XX_MCU_ECC     61
-#define IRQ_IXP4XX_EXP_PE      62
-
-#define _IXP4XX_GPIO_IRQ(n)    (IRQ_IXP4XX_GPIO ## n)
-#define IXP4XX_GPIO_IRQ(n)     _IXP4XX_GPIO_IRQ(n)
-
-/*
- * Only first 32 sources are valid if running on IXP42x systems
- */
-#if defined(CONFIG_CPU_IXP46X) || defined(CONFIG_CPU_IXP43X)
-#define NR_IRQS                        64
-#else
-#define NR_IRQS                        32
-#endif
-
-#define        XSCALE_PMU_IRQ          (IRQ_IXP4XX_XSCALE_PMU)
-
-#endif
index b7ddd27..588b766 100644 (file)
@@ -43,8 +43,6 @@
  * Queue Manager
  */
 #define IXP4XX_QMGR_BASE_PHYS          0x60000000
-#define IXP4XX_QMGR_BASE_VIRT          IOMEM(0xFEF15000)
-#define IXP4XX_QMGR_REGION_SIZE                0x00004000
 
 /*
  * Peripheral space, including debug UART. Must be section-aligned so that
 #define IXP4XX_INTC_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
 #define IXP4XX_GPIO_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
 #define IXP4XX_TIMER_BASE_VIRT         (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
-#define IXP4XX_NPEA_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
-#define IXP4XX_NPEB_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
-#define IXP4XX_NPEC_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
 #define IXP4XX_EthB_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
 #define IXP4XX_EthC_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
 #define IXP4XX_USB_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
 #define IXP4XX_SSP_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000)
 
 /*
- * Constants to make it easy to access  Interrupt Controller registers
- */
-#define IXP4XX_ICPR_OFFSET     0x00 /* Interrupt Status */
-#define IXP4XX_ICMR_OFFSET     0x04 /* Interrupt Enable */
-#define IXP4XX_ICLR_OFFSET     0x08 /* Interrupt IRQ/FIQ Select */
-#define IXP4XX_ICIP_OFFSET      0x0C /* IRQ Status */
-#define IXP4XX_ICFP_OFFSET     0x10 /* FIQ Status */
-#define IXP4XX_ICHR_OFFSET     0x14 /* Interrupt Priority */
-#define IXP4XX_ICIH_OFFSET     0x18 /* IRQ Highest Pri Int */
-#define IXP4XX_ICFH_OFFSET     0x1C /* FIQ Highest Pri Int */
-
-/*
- * IXP465-only
- */
-#define        IXP4XX_ICPR2_OFFSET     0x20 /* Interrupt Status 2 */
-#define        IXP4XX_ICMR2_OFFSET     0x24 /* Interrupt Enable 2 */
-#define        IXP4XX_ICLR2_OFFSET     0x28 /* Interrupt IRQ/FIQ Select 2 */
-#define IXP4XX_ICIP2_OFFSET     0x2C /* IRQ Status */
-#define IXP4XX_ICFP2_OFFSET    0x30 /* FIQ Status */
-#define IXP4XX_ICEEN_OFFSET    0x34 /* Error High Pri Enable */
-
-
-/*
- * Interrupt Controller Register Definitions.
- */
-
-#define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
-
-#define IXP4XX_ICPR    IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
-#define IXP4XX_ICMR     IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
-#define IXP4XX_ICLR     IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET)
-#define IXP4XX_ICIP     IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET)
-#define IXP4XX_ICFP     IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET)
-#define IXP4XX_ICHR     IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET)
-#define IXP4XX_ICIH     IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET) 
-#define IXP4XX_ICFH     IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET)
-#define IXP4XX_ICPR2   IXP4XX_INTC_REG(IXP4XX_ICPR2_OFFSET)
-#define IXP4XX_ICMR2    IXP4XX_INTC_REG(IXP4XX_ICMR2_OFFSET)
-#define IXP4XX_ICLR2    IXP4XX_INTC_REG(IXP4XX_ICLR2_OFFSET)
-#define IXP4XX_ICIP2    IXP4XX_INTC_REG(IXP4XX_ICIP2_OFFSET)
-#define IXP4XX_ICFP2    IXP4XX_INTC_REG(IXP4XX_ICFP2_OFFSET)
-#define IXP4XX_ICEEN    IXP4XX_INTC_REG(IXP4XX_ICEEN_OFFSET)
-                                                                                
-/*
- * Constants to make it easy to access GPIO registers
- */
-#define IXP4XX_GPIO_GPOUTR_OFFSET       0x00
-#define IXP4XX_GPIO_GPOER_OFFSET        0x04
-#define IXP4XX_GPIO_GPINR_OFFSET        0x08
-#define IXP4XX_GPIO_GPISR_OFFSET        0x0C
-#define IXP4XX_GPIO_GPIT1R_OFFSET      0x10
-#define IXP4XX_GPIO_GPIT2R_OFFSET      0x14
-#define IXP4XX_GPIO_GPCLKR_OFFSET      0x18
-#define IXP4XX_GPIO_GPDBSELR_OFFSET    0x1C
-
-/* 
- * GPIO Register Definitions.
- * [Only perform 32bit reads/writes]
- */
-#define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
-
-#define IXP4XX_GPIO_GPOUTR     IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
-#define IXP4XX_GPIO_GPOER       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
-#define IXP4XX_GPIO_GPINR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET)
-#define IXP4XX_GPIO_GPISR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET)
-#define IXP4XX_GPIO_GPIT1R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET)
-#define IXP4XX_GPIO_GPIT2R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET)
-#define IXP4XX_GPIO_GPCLKR      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET)
-#define IXP4XX_GPIO_GPDBSELR    IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET)
-
-/*
- * GPIO register bit definitions
- */
-
-/* Interrupt styles
- */
-#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH  0x0
-#define IXP4XX_GPIO_STYLE_ACTIVE_LOW   0x1
-#define IXP4XX_GPIO_STYLE_RISING_EDGE  0x2
-#define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3
-#define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4
-
-/* 
- * Mask used to clear interrupt styles 
- */
-#define IXP4XX_GPIO_STYLE_CLEAR                0x7
-#define IXP4XX_GPIO_STYLE_SIZE         3
-
-/*
  * Constants to make it easy to access Timer Control/Status registers
  */
 #define IXP4XX_OSTS_OFFSET     0x00  /* Continious TimeStamp */
diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
deleted file mode 100644 (file)
index 4de8da5..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl>
- *
- * 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.
- */
-
-#ifndef IXP4XX_QMGR_H
-#define IXP4XX_QMGR_H
-
-#include <linux/io.h>
-#include <linux/kernel.h>
-
-#define DEBUG_QMGR     0
-
-#define HALF_QUEUES    32
-#define QUEUES         64
-#define MAX_QUEUE_LENGTH 4     /* in dwords */
-
-#define QUEUE_STAT1_EMPTY              1 /* queue status bits */
-#define QUEUE_STAT1_NEARLY_EMPTY       2
-#define QUEUE_STAT1_NEARLY_FULL                4
-#define QUEUE_STAT1_FULL               8
-#define QUEUE_STAT2_UNDERFLOW          1
-#define QUEUE_STAT2_OVERFLOW           2
-
-#define QUEUE_WATERMARK_0_ENTRIES      0
-#define QUEUE_WATERMARK_1_ENTRY                1
-#define QUEUE_WATERMARK_2_ENTRIES      2
-#define QUEUE_WATERMARK_4_ENTRIES      3
-#define QUEUE_WATERMARK_8_ENTRIES      4
-#define QUEUE_WATERMARK_16_ENTRIES     5
-#define QUEUE_WATERMARK_32_ENTRIES     6
-#define QUEUE_WATERMARK_64_ENTRIES     7
-
-/* queue interrupt request conditions */
-#define QUEUE_IRQ_SRC_EMPTY            0
-#define QUEUE_IRQ_SRC_NEARLY_EMPTY     1
-#define QUEUE_IRQ_SRC_NEARLY_FULL      2
-#define QUEUE_IRQ_SRC_FULL             3
-#define QUEUE_IRQ_SRC_NOT_EMPTY                4
-#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5
-#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL  6
-#define QUEUE_IRQ_SRC_NOT_FULL         7
-
-struct qmgr_regs {
-       u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */
-       u32 stat1[4];           /* 0x400 - 0x40F */
-       u32 stat2[2];           /* 0x410 - 0x417 */
-       u32 statne_h;           /* 0x418 - queue nearly empty */
-       u32 statf_h;            /* 0x41C - queue full */
-       u32 irqsrc[4];          /* 0x420 - 0x42F IRC source */
-       u32 irqen[2];           /* 0x430 - 0x437 IRQ enabled */
-       u32 irqstat[2];         /* 0x438 - 0x43F - IRQ access only */
-       u32 reserved[1776];
-       u32 sram[2048];         /* 0x2000 - 0x3FFF - config and buffer */
-};
-
-void qmgr_set_irq(unsigned int queue, int src,
-                 void (*handler)(void *pdev), void *pdev);
-void qmgr_enable_irq(unsigned int queue);
-void qmgr_disable_irq(unsigned int queue);
-
-/* request_ and release_queue() must be called from non-IRQ context */
-
-#if DEBUG_QMGR
-extern char qmgr_queue_descs[QUEUES][32];
-
-int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
-                      unsigned int nearly_empty_watermark,
-                      unsigned int nearly_full_watermark,
-                      const char *desc_format, const char* name);
-#else
-int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
-                        unsigned int nearly_empty_watermark,
-                        unsigned int nearly_full_watermark);
-#define qmgr_request_queue(queue, len, nearly_empty_watermark,         \
-                          nearly_full_watermark, desc_format, name)    \
-       __qmgr_request_queue(queue, len, nearly_empty_watermark,        \
-                            nearly_full_watermark)
-#endif
-
-void qmgr_release_queue(unsigned int queue);
-
-
-static inline void qmgr_put_entry(unsigned int queue, u32 val)
-{
-       struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-#if DEBUG_QMGR
-       BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
-
-       printk(KERN_DEBUG "Queue %s(%i) put %X\n",
-              qmgr_queue_descs[queue], queue, val);
-#endif
-       __raw_writel(val, &qmgr_regs->acc[queue][0]);
-}
-
-static inline u32 qmgr_get_entry(unsigned int queue)
-{
-       u32 val;
-       const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-       val = __raw_readl(&qmgr_regs->acc[queue][0]);
-#if DEBUG_QMGR
-       BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
-
-       printk(KERN_DEBUG "Queue %s(%i) get %X\n",
-              qmgr_queue_descs[queue], queue, val);
-#endif
-       return val;
-}
-
-static inline int __qmgr_get_stat1(unsigned int queue)
-{
-       const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-       return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
-               >> ((queue & 7) << 2)) & 0xF;
-}
-
-static inline int __qmgr_get_stat2(unsigned int queue)
-{
-       const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-       BUG_ON(queue >= HALF_QUEUES);
-       return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
-               >> ((queue & 0xF) << 1)) & 0x3;
-}
-
-/**
- * qmgr_stat_empty() - checks if a hardware queue is empty
- * @queue:     queue number
- *
- * Returns non-zero value if the queue is empty.
- */
-static inline int qmgr_stat_empty(unsigned int queue)
-{
-       BUG_ON(queue >= HALF_QUEUES);
-       return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY;
-}
-
-/**
- * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark
- * @queue:     queue number
- *
- * Returns non-zero value if the queue is below low watermark.
- */
-static inline int qmgr_stat_below_low_watermark(unsigned int queue)
-{
-       const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-       if (queue >= HALF_QUEUES)
-               return (__raw_readl(&qmgr_regs->statne_h) >>
-                       (queue - HALF_QUEUES)) & 0x01;
-       return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY;
-}
-
-/**
- * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark
- * @queue:     queue number
- *
- * Returns non-zero value if the queue is above high watermark
- */
-static inline int qmgr_stat_above_high_watermark(unsigned int queue)
-{
-       BUG_ON(queue >= HALF_QUEUES);
-       return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL;
-}
-
-/**
- * qmgr_stat_full() - checks if a hardware queue is full
- * @queue:     queue number
- *
- * Returns non-zero value if the queue is full.
- */
-static inline int qmgr_stat_full(unsigned int queue)
-{
-       const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-       if (queue >= HALF_QUEUES)
-               return (__raw_readl(&qmgr_regs->statf_h) >>
-                       (queue - HALF_QUEUES)) & 0x01;
-       return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL;
-}
-
-/**
- * qmgr_stat_underflow() - checks if a hardware queue experienced underflow
- * @queue:     queue number
- *
- * Returns non-zero value if the queue experienced underflow.
- */
-static inline int qmgr_stat_underflow(unsigned int queue)
-{
-       return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW;
-}
-
-/**
- * qmgr_stat_overflow() - checks if a hardware queue experienced overflow
- * @queue:     queue number
- *
- * Returns non-zero value if the queue experienced overflow.
- */
-static inline int qmgr_stat_overflow(unsigned int queue)
-{
-       return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW;
-}
-
-#endif
diff --git a/arch/arm/mach-ixp4xx/irqs.h b/arch/arm/mach-ixp4xx/irqs.h
new file mode 100644 (file)
index 0000000..6b7f220
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * arch/arm/mach-ixp4xx/include/mach/irqs.h 
+ *
+ * IRQ definitions for IXP4XX based systems
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _ARCH_IXP4XX_IRQS_H_
+#define _ARCH_IXP4XX_IRQS_H_
+
+#define IRQ_IXP4XX_BASE                16
+
+#define IRQ_IXP4XX_NPEA                (IRQ_IXP4XX_BASE + 0)
+#define IRQ_IXP4XX_NPEB                (IRQ_IXP4XX_BASE + 1)
+#define IRQ_IXP4XX_NPEC                (IRQ_IXP4XX_BASE + 2)
+#define IRQ_IXP4XX_QM1         (IRQ_IXP4XX_BASE + 3)
+#define IRQ_IXP4XX_QM2         (IRQ_IXP4XX_BASE + 4)
+#define IRQ_IXP4XX_TIMER1      (IRQ_IXP4XX_BASE + 5)
+#define IRQ_IXP4XX_GPIO0       (IRQ_IXP4XX_BASE + 6)
+#define IRQ_IXP4XX_GPIO1       (IRQ_IXP4XX_BASE + 7)
+#define IRQ_IXP4XX_PCI_INT     (IRQ_IXP4XX_BASE + 8)
+#define IRQ_IXP4XX_PCI_DMA1    (IRQ_IXP4XX_BASE + 9)
+#define IRQ_IXP4XX_PCI_DMA2    (IRQ_IXP4XX_BASE + 10)
+#define IRQ_IXP4XX_TIMER2      (IRQ_IXP4XX_BASE + 11)
+#define IRQ_IXP4XX_USB         (IRQ_IXP4XX_BASE + 12)
+#define IRQ_IXP4XX_UART2       (IRQ_IXP4XX_BASE + 13)
+#define IRQ_IXP4XX_TIMESTAMP   (IRQ_IXP4XX_BASE + 14)
+#define IRQ_IXP4XX_UART1       (IRQ_IXP4XX_BASE + 15)
+#define IRQ_IXP4XX_WDOG                (IRQ_IXP4XX_BASE + 16)
+#define IRQ_IXP4XX_AHB_PMU     (IRQ_IXP4XX_BASE + 17)
+#define IRQ_IXP4XX_XSCALE_PMU  (IRQ_IXP4XX_BASE + 18)
+#define IRQ_IXP4XX_GPIO2       (IRQ_IXP4XX_BASE + 19)
+#define IRQ_IXP4XX_GPIO3       (IRQ_IXP4XX_BASE + 20)
+#define IRQ_IXP4XX_GPIO4       (IRQ_IXP4XX_BASE + 21)
+#define IRQ_IXP4XX_GPIO5       (IRQ_IXP4XX_BASE + 22)
+#define IRQ_IXP4XX_GPIO6       (IRQ_IXP4XX_BASE + 23)
+#define IRQ_IXP4XX_GPIO7       (IRQ_IXP4XX_BASE + 24)
+#define IRQ_IXP4XX_GPIO8       (IRQ_IXP4XX_BASE + 25)
+#define IRQ_IXP4XX_GPIO9       (IRQ_IXP4XX_BASE + 26)
+#define IRQ_IXP4XX_GPIO10      (IRQ_IXP4XX_BASE + 27)
+#define IRQ_IXP4XX_GPIO11      (IRQ_IXP4XX_BASE + 28)
+#define IRQ_IXP4XX_GPIO12      (IRQ_IXP4XX_BASE + 29)
+#define IRQ_IXP4XX_SW_INT1     (IRQ_IXP4XX_BASE + 30)
+#define IRQ_IXP4XX_SW_INT2     (IRQ_IXP4XX_BASE + 31)
+#define IRQ_IXP4XX_USB_HOST    (IRQ_IXP4XX_BASE + 32)
+#define IRQ_IXP4XX_I2C         (IRQ_IXP4XX_BASE + 33)
+#define IRQ_IXP4XX_SSP         (IRQ_IXP4XX_BASE + 34)
+#define IRQ_IXP4XX_TSYNC       (IRQ_IXP4XX_BASE + 35)
+#define IRQ_IXP4XX_EAU_DONE    (IRQ_IXP4XX_BASE + 36)
+#define IRQ_IXP4XX_SHA_DONE    (IRQ_IXP4XX_BASE + 37)
+#define IRQ_IXP4XX_SWCP_PE     (IRQ_IXP4XX_BASE + 58)
+#define IRQ_IXP4XX_QM_PE       (IRQ_IXP4XX_BASE + 60)
+#define IRQ_IXP4XX_MCU_ECC     (IRQ_IXP4XX_BASE + 61)
+#define IRQ_IXP4XX_EXP_PE      (IRQ_IXP4XX_BASE + 62)
+
+#define _IXP4XX_GPIO_IRQ(n)    (IRQ_IXP4XX_GPIO ## n)
+#define IXP4XX_GPIO_IRQ(n)     _IXP4XX_GPIO_IRQ(n)
+
+#define        XSCALE_PMU_IRQ          (IRQ_IXP4XX_XSCALE_PMU)
+
+#endif
index 318424d..c134046 100644 (file)
@@ -24,6 +24,8 @@
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV                4
 #define IRQ_LINES      4
 
index 57d7df7..6f0f7ed 100644 (file)
@@ -32,6 +32,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define IXDP425_SDA_PIN                7
 #define IXDP425_SCL_PIN                6
 
index 1f8717b..ac0e9bc 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init ixdpg425_pci_preinit(void)
 {
        irq_set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW);
diff --git a/arch/arm/mach-ixp4xx/ixp4xx-of.c b/arch/arm/mach-ixp4xx/ixp4xx-of.c
new file mode 100644 (file)
index 0000000..7449b83
--- /dev/null
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * IXP4xx Device Tree boot support
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <mach/hardware.h>
+#include <mach/ixp4xx-regs.h>
+
+static struct map_desc ixp4xx_of_io_desc[] __initdata = {
+       /*
+        * This is needed for runtime system configuration checks,
+        * such as reading if hardware so-and-so is present. This
+        * could eventually be converted into a syscon once all boards
+        * are converted to device tree.
+        */
+       {
+               .virtual = IXP4XX_EXP_CFG_BASE_VIRT,
+               .pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
+               .length = SZ_4K,
+               .type = MT_DEVICE,
+       },
+#ifdef CONFIG_DEBUG_UART_8250
+       /* This is needed for LL-debug/earlyprintk/debug-macro.S */
+       {
+               .virtual = CONFIG_DEBUG_UART_VIRT,
+               .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
+               .length = SZ_4K,
+               .type = MT_DEVICE,
+       },
+#endif
+};
+
+static void __init ixp4xx_of_map_io(void)
+{
+       iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc));
+}
+
+/*
+ * We handle 4 differen SoC families. These compatible strings are enough
+ * to provide the core so that different boards can add their more detailed
+ * specifics.
+ */
+static const char *ixp4xx_of_board_compat[] = {
+       "intel,ixp42x",
+       "intel,ixp43x",
+       "intel,ixp45x",
+       "intel,ixp46x",
+       NULL,
+};
+
+DT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)")
+       .map_io         = ixp4xx_of_map_io,
+       .dt_compat      = ixp4xx_of_board_compat,
+MACHINE_END
index 8f0eba0..925ef80 100644 (file)
@@ -21,6 +21,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV                3
 #define IRQ_LINES      3
 
index 4138d6a..c142cfa 100644 (file)
@@ -34,6 +34,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define NAS100D_SDA_PIN                5
 #define NAS100D_SCL_PIN                6
 
@@ -279,9 +281,6 @@ static void __init nas100d_init(void)
 
        ixp4xx_sys_init();
 
-       /* gpio 14 and 15 are _not_ clocks */
-       *IXP4XX_GPIO_GPCLKR = 0;
-
        nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
        nas100d_flash_resource.end =
                IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
index 032defe..d69ee40 100644 (file)
@@ -21,6 +21,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV                3
 #define IRQ_LINES      3
 
index 341b263..ee1877f 100644 (file)
@@ -32,6 +32,8 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
 
+#include "irqs.h"
+
 #define NSLU2_SDA_PIN          7
 #define NSLU2_SCL_PIN          6
 
@@ -125,10 +127,18 @@ static struct platform_device nslu2_i2c_gpio = {
        },
 };
 
+static struct resource nslu2_beeper_resources[] = {
+       {
+               .start  = IRQ_IXP4XX_TIMER2,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
 static struct platform_device nslu2_beeper = {
        .name                   = "ixp4xx-beeper",
        .id                     = NSLU2_GPIO_BUZZ,
-       .num_resources          = 0,
+       .resource               = nslu2_beeper_resources,
+       .num_resources          = ARRAY_SIZE(nslu2_beeper_resources),
 };
 
 static struct resource nslu2_uart_resources[] = {
index c92e5b8..cf83f7e 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init wg302v2_pci_preinit(void)
 {
        irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
index 90b3c60..8711e29 100644 (file)
@@ -29,6 +29,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 static struct flash_platform_data wg302v2_flash_data = {
        .map_name       = "cfi_probe",
        .width          = 2,
index db12235..cfd39f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_KEYSTONE
        bool "Texas Instruments Keystone Devices"
        depends on ARCH_MULTI_V7
index b3185c0..724d7d0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_KS8695
 
 menu "Kendin/Micrel KS8695 Implementations"
index c9b0beb..cf32eb6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Note: the following conditions must always be true:
 #   ZRELADDR == virt_to_phys(TEXTADDR)
 #   PARAMS_PHYS must be within 4MB of ZRELADDR
index 959c748..877629b 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /*
  * Clocks are derived from MCLK, which is 25MHz
index bd0b7b5..c80d80c 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += board-dt.o
index eacfc3f..cec195d 100644 (file)
@@ -1,3 +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 .
index 79b6b07..3bac1d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index d7392a4..37d09dd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x80008000
 params_phys-y  := 0x80000100
 initrd_phys-y  := 0x82000000
index b3be60a..66701bf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Platform support for LPC32xx SoC
  *
@@ -5,44 +6,14 @@
  *
  * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
  * Copyright (C) 2010 NXP Semiconductors
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
  */
 
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/device.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-#include <linux/amba/bus.h>
-#include <linux/amba/clcd.h>
 #include <linux/amba/pl08x.h>
-#include <linux/amba/mmci.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
-#include <linux/clk.h>
-#include <linux/mtd/lpc32xx_slc.h>
 #include <linux/mtd/lpc32xx_mlc.h>
+#include <linux/mtd/lpc32xx_slc.h>
+#include <linux/of_platform.h>
 
-#include <asm/setup.h>
-#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
-
-#include <mach/hardware.h>
-#include <mach/platform.h>
-#include <mach/board.h>
 #include "common.h"
 
 static struct pl08x_channel_data pl08x_slave_channels[] = {
@@ -90,8 +61,6 @@ static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
 };
 
 static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
-       OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
-       OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
        OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
        OF_DEV_AUXDATA("nxp,lpc3220-slc", 0x20020000, "20020000.flash",
                       &lpc32xx_slc_data),
@@ -104,11 +73,6 @@ static void __init lpc3250_machine_init(void)
 {
        lpc32xx_serial_init();
 
-       /* Test clock needed for UDA1380 initial init */
-       __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
-               LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
-               LPC32XX_CLKPWR_TEST_CLK_SEL);
-
        of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL);
 }
 
index 11ed264..9e0f592 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MEDIATEK
        bool "MediaTek SoC Support"
        depends on ARCH_MULTI_V7
index dadae67..90e08a4 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMP)      += platsmp.o
 obj-y                  += mediatek.o
index b6a81ba..5a9c016 100644 (file)
@@ -15,6 +15,7 @@
  * GNU General Public License for more details.
  */
 #include <linux/init.h>
+#include <linux/io.h>
 #include <asm/mach/arch.h>
 #include <linux/of.h>
 #include <linux/clk-provider.h>
index 15e9cb7..01f0f4b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MESON
        bool "Amlogic Meson SoCs"
        depends on ARCH_MULTI_V7
index bc26c85..49cfbae 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARCH_MESON) += meson.o
 obj-$(CONFIG_SMP) += platsmp.o
index ce5ea06..a95d274 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMP) += platsmp.o
index 94500be..0440109 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MMP
        bool "Marvell PXA168/910/MMP2"
        depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
index a4a91f9..31ada63 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MOXART
        bool "MOXA ART SoC"
        depends on ARCH_MULTI_V4
index fa022eb..ded3e38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Object file lists.
 
 obj-$(CONFIG_MACH_UC7112LX)    += moxart.o
index d686a84..ea52c7f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MV78XX0
        bool "Marvell MV78xx0"
        depends on ARCH_MULTI_V5
index f72e1e9..dd762d1 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
 #include <linux/ata_platform.h>
index 5d6fbad..7a5629b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_MVEBU
        bool "Marvell Engineering Business Unit (MVEBU) SoCs"
        depends on ARCH_MULTI_V7 || ARCH_MULTI_V5
index 0b10acd..d2df5ef 100644 (file)
@@ -136,7 +136,6 @@ static void __init i2c_quirk(void)
 
                of_update_property(np, new_compat);
        }
-       return;
 }
 
 static void __init mvebu_dt_init(void)
index 8b2fbc8..2d962fe 100644 (file)
@@ -66,7 +66,7 @@ ENDPROC(ll_get_coherency_base)
  * fabric registers
  */
 ENTRY(ll_get_coherency_cpumask)
-       mrc     15, 0, r3, cr0, cr0, 5
+       mrc     p15, 0, r3, cr0, cr0, 5
        and     r3, r3, #15
        mov     r2, #(1 << 24)
        lsl     r3, r2, r3
index 9b5f4d6..ceaad6d 100644 (file)
@@ -108,8 +108,6 @@ static void __init kirkwood_dt_eth_fixup(void)
                clk_prepare_enable(clk);
 
                /* store MAC address register contents in local-mac-address */
-               pr_err(FW_INFO "%pOF: local-mac-address is not set\n", np);
-
                pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
                if (!pmac)
                        goto eth_fixup_no_mem;
index db17121..0705525 100644 (file)
@@ -79,7 +79,7 @@ static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd)
 static int __init mvebu_armada_pm_init(void)
 {
        struct device_node *np;
-       struct device_node *gpio_ctrl_np;
+       struct device_node *gpio_ctrl_np = NULL;
        int ret = 0, i;
 
        if (!of_machine_is_compatible("marvell,axp-gp"))
@@ -126,18 +126,23 @@ static int __init mvebu_armada_pm_init(void)
                        goto out;
                }
 
+               if (gpio_ctrl_np)
+                       of_node_put(gpio_ctrl_np);
                gpio_ctrl_np = args.np;
                pic_raw_gpios[i] = args.args[0];
        }
 
        gpio_ctrl = of_iomap(gpio_ctrl_np, 0);
-       if (!gpio_ctrl)
-               return -ENOMEM;
+       if (!gpio_ctrl) {
+               ret = -ENOMEM;
+               goto out;
+       }
 
        mvebu_pm_suspend_init(mvebu_armada_pm_enter);
 
 out:
        of_node_put(np);
+       of_node_put(gpio_ctrl_np);
        return ret;
 }
 
index 8865122..7aae9a2 100644 (file)
@@ -16,7 +16,7 @@
 ENTRY(armada_38x_scu_power_up)
        mrc     p15, 4, r1, c15, c0     @ get SCU base address
        orr     r1, r1, #0x8            @ SCU CPU Power Status Register
-       mrc     15, 0, r0, cr0, cr0, 5  @ get the CPU ID
+       mrc     p15, 0, r0, cr0, cr0, 5 @ get the CPU ID
        and     r0, r0, #15
        add     r1, r1, r0
        mov     r0, #0x0
@@ -56,7 +56,6 @@ ENDPROC(armada_38x_cpu_resume)
 
 /* The following code will be executed from SRAM */
 ENTRY(mvebu_boot_wa_start)
-mvebu_boot_wa_start:
 ARM_BE8(setend be)
        adr     r0, 1f
        ldr     r0, [r0]                @ load the address of the
index cb429bc..be1c138 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SOC_IMX23
        bool
        select ARM_AMBA
index cc2bf67..2bcd5e1 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PM) += pm.o
 obj-$(CONFIG_ARCH_MXS) += mach-mxs.o
index 2da8e5d..1e5d9c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "NetX Implementations"
        depends on ARCH_NETX
 
index 7ce4ba9..44ea83f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 534a4d2..2eb23c0 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
     zreladdr-y                 += 0x80008000
 
index 3ae45b8..e98429b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_NOMADIK
        bool "ST-Ericsson Nomadik"
        depends on ARCH_MULTI_V5
index 1071c3b..27ae201 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 684c9c9..880bc2a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_NPCM
        bool "Nuvoton NPCM Architecture"
        depends on ARCH_MULTI_V7
index f5f6720..1bc3a70 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 AFLAGS_headsmp.o               += -march=armv7-a
 
 obj-$(CONFIG_ARCH_NPCM7XX)     += npcm7xx.o
index d498530..b3d161e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_NSPIRE
        bool "TI-NSPIRE based"
        depends on ARCH_MULTI_V4_V5
index 1bec256..1d568c6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += nspire.o
 obj-y                          += clcd.o
index c4694f2..2a17dc1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_OMAP1
 
 menu "TI OMAP1 specific features"
index 13bda8d..2c77151 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y          += 0x10008000
 params_phys-y          := 0x10000100
 initrd_phys-y          := 0x10800000
index 1b15d59..b6e8141 100644 (file)
@@ -749,7 +749,7 @@ static void __init ams_delta_init(void)
                                ARRAY_SIZE(ams_delta_gpio_tables));
 
        leds_pdev = gpio_led_register_device(PLATFORM_DEVID_NONE, &leds_pdata);
-       if (!IS_ERR(leds_pdev)) {
+       if (!IS_ERR_OR_NULL(leds_pdev)) {
                leds_gpio_table.dev_id = dev_name(&leds_pdev->dev);
                gpiod_add_lookup_table(&leds_gpio_table);
        }
index 5733212..258304e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * HTC Herald board configuration
  * Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com>
@@ -6,22 +7,6 @@
  * Based on the board-htcwizard.c file from the linwizard project:
  * Copyright (C) 2006 Unai Uribarri
  * Copyright (C) 2008 linwizard.sourceforge.net
- *
- * This  program is  free  software; you  can  redistribute it  and/or
- * modify  it under the  terms of  the GNU  General Public  License as
- * published by the Free Software  Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have  received a copy of the  GNU General Public License
- * along  with  this program;  if  not,  write  to the  Free  Software
- * Foundation,  Inc.,  51 Franklin  Street,  Fifth  Floor, Boston,  MA
- * 02110-1301, USA.
- *
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
index 5875a50..e7c8ac7 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef __ASM_ARCH_OMAP_HARDWARE_H
 #define __ASM_ARCH_OMAP_HARDWARE_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #ifndef __ASSEMBLER__
 #include <asm/types.h>
 #include <mach/soc.h>
index 5e33d1a..fdb6743 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "TI OMAP/AM/DM/DRA Family"
        depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
 
index 129455e..6316da3 100644 (file)
@@ -336,6 +336,15 @@ static inline void omap5_secondary_hyp_startup(void)
 }
 #endif
 
+#ifdef CONFIG_SOC_DRA7XX
+extern int dra7xx_pciess_reset(struct omap_hwmod *oh);
+#else
+static inline int dra7xx_pciess_reset(struct omap_hwmod *oh)
+{
+       return 0;
+}
+#endif
+
 void pdata_quirks_init(const struct of_device_id *);
 void omap_auxdata_legacy_init(struct device *dev);
 void omap_pcs_legacy_init(int irq, void (*rearm)(void));
index 37ff25e..1d8efc3 100644 (file)
@@ -53,15 +53,10 @@ int omap_i2c_reset(struct omap_hwmod *oh)
        u16 i2c_con;
        int c = 0;
 
-       if (oh->class->rev == OMAP_I2C_IP_VERSION_2) {
-               i2c_con = OMAP4_I2C_CON_OFFSET;
-       } else if (oh->class->rev == OMAP_I2C_IP_VERSION_1) {
+       if (soc_is_omap24xx() || soc_is_omap34xx() || soc_is_am35xx())
                i2c_con = OMAP2_I2C_CON_OFFSET;
-       } else {
-               WARN(1, "Cannot reset I2C block %s: unsupported revision\n",
-                    oh->name);
-               return -EINVAL;
-       }
+       else
+               i2c_con = OMAP4_I2C_CON_OFFSET;
 
        /* Disable I2C */
        v = omap_hwmod_read(oh, i2c_con);
index bb8e0bb..5e69c8c 100644 (file)
@@ -411,14 +411,9 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 
 static void __init __maybe_unused omap_hwmod_init_postsetup(void)
 {
-       u8 postsetup_state;
+       u8 postsetup_state = _HWMOD_STATE_DEFAULT;
 
        /* Set the default postsetup state for all hwmods */
-#ifdef CONFIG_PM
-       postsetup_state = _HWMOD_STATE_IDLE;
-#else
-       postsetup_state = _HWMOD_STATE_ENABLED;
-#endif
        omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
 }
 
index 9145a6f..7f4e053 100644 (file)
@@ -7,7 +7,15 @@
 #define OMAP4_MMC_REG_OFFSET   0x100
 
 struct omap_hwmod;
+
+#ifdef CONFIG_SOC_OMAP2420
 int omap_msdi_reset(struct omap_hwmod *oh);
+#else
+static inline int omap_msdi_reset(struct omap_hwmod *oh)
+{
+       return 0;
+}
+#endif
 
 /* called from board-specific card detection service routine */
 extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
index 17558be..7dcbe17 100644 (file)
@@ -436,13 +436,13 @@ static int irq_notifier(struct notifier_block *self, unsigned long cmd,   void *v)
 {
        switch (cmd) {
        case CPU_CLUSTER_PM_ENTER:
-               if (omap_type() == OMAP2_DEVICE_TYPE_GP)
+               if (omap_type() == OMAP2_DEVICE_TYPE_GP || soc_is_am43xx())
                        irq_save_context();
                else
                        irq_save_secure_context();
                break;
        case CPU_CLUSTER_PM_EXIT:
-               if (omap_type() == OMAP2_DEVICE_TYPE_GP)
+               if (omap_type() == OMAP2_DEVICE_TYPE_GP || soc_is_am43xx())
                        irq_restore_context();
                break;
        }
index baadddf..405ac24 100644 (file)
 #include "soc.h"
 #include "common.h"
 #include "clockdomain.h"
+#include "hdq1w.h"
+#include "mmc.h"
 #include "powerdomain.h"
 #include "cm2xxx.h"
 #include "cm3xxx.h"
 #include "prm33xx.h"
 #include "prminst44xx.h"
 #include "pm.h"
+#include "wd_timer.h"
 
 /* Name of the OMAP hwmod for the MPU */
 #define MPU_INITIATOR_NAME             "mpu"
@@ -205,6 +208,20 @@ struct clkctrl_provider {
 static LIST_HEAD(clkctrl_providers);
 
 /**
+ * struct omap_hwmod_reset - IP specific reset functions
+ * @match: string to match against the module name
+ * @len: number of characters to match
+ * @reset: IP specific reset function
+ *
+ * Used only in cases where struct omap_hwmod is dynamically allocated.
+ */
+struct omap_hwmod_reset {
+       const char *match;
+       int len;
+       int (*reset)(struct omap_hwmod *oh);
+};
+
+/**
  * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
  * @enable_module: function to enable a module (via MODULEMODE)
  * @disable_module: function to disable a module (via MODULEMODE)
@@ -235,6 +252,7 @@ static struct omap_hwmod_soc_ops soc_ops;
 
 /* omap_hwmod_list contains all registered struct omap_hwmods */
 static LIST_HEAD(omap_hwmod_list);
+static DEFINE_MUTEX(list_lock);
 
 /* mpu_oh: used to add/remove MPU initiator from sleepdep list */
 static struct omap_hwmod *mpu_oh;
@@ -2465,7 +2483,7 @@ static void _setup_iclk_autoidle(struct omap_hwmod *oh)
  */
 static int _setup_reset(struct omap_hwmod *oh)
 {
-       int r;
+       int r = 0;
 
        if (oh->_state != _HWMOD_STATE_INITIALIZED)
                return -EINVAL;
@@ -2624,7 +2642,7 @@ static int _setup(struct omap_hwmod *oh, void *data)
  * that the copy process would be relatively complex due to the large number
  * of substructures.
  */
-static int __init _register(struct omap_hwmod *oh)
+static int _register(struct omap_hwmod *oh)
 {
        if (!oh || !oh->name || !oh->class || !oh->class->name ||
            (oh->_state != _HWMOD_STATE_UNKNOWN))
@@ -2663,7 +2681,7 @@ static int __init _register(struct omap_hwmod *oh)
  * locking in this code.  Changes to this assumption will require
  * additional locking.  Returns 0.
  */
-static int __init _add_link(struct omap_hwmod_ocp_if *oi)
+static int _add_link(struct omap_hwmod_ocp_if *oi)
 {
        pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name,
                 oi->slave->name);
@@ -3241,9 +3259,10 @@ static int omap_hwmod_init_regbits(struct device *dev,
  * @sysc_offs: sysc register offset
  * @syss_offs: syss register offset
  */
-int omap_hwmod_init_reg_offs(struct device *dev,
-                            const struct ti_sysc_module_data *data,
-                            s32 *rev_offs, s32 *sysc_offs, s32 *syss_offs)
+static int omap_hwmod_init_reg_offs(struct device *dev,
+                                   const struct ti_sysc_module_data *data,
+                                   s32 *rev_offs, s32 *sysc_offs,
+                                   s32 *syss_offs)
 {
        *rev_offs = -ENODEV;
        *sysc_offs = 0;
@@ -3267,9 +3286,9 @@ int omap_hwmod_init_reg_offs(struct device *dev,
  * @data: module data
  * @sysc_flags: module configuration
  */
-int omap_hwmod_init_sysc_flags(struct device *dev,
-                              const struct ti_sysc_module_data *data,
-                              u32 *sysc_flags)
+static int omap_hwmod_init_sysc_flags(struct device *dev,
+                                     const struct ti_sysc_module_data *data,
+                                     u32 *sysc_flags)
 {
        *sysc_flags = 0;
 
@@ -3341,9 +3360,9 @@ int omap_hwmod_init_sysc_flags(struct device *dev,
  * @data: module data
  * @idlemodes: module supported idle modes
  */
-int omap_hwmod_init_idlemodes(struct device *dev,
-                             const struct ti_sysc_module_data *data,
-                             u32 *idlemodes)
+static int omap_hwmod_init_idlemodes(struct device *dev,
+                                    const struct ti_sysc_module_data *data,
+                                    u32 *idlemodes)
 {
        *idlemodes = 0;
 
@@ -3434,14 +3453,18 @@ static int omap_hwmod_check_module(struct device *dev,
  *
  * Note that the allocations here cannot use devm as ti-sysc can rebind.
  */
-int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
-                              const struct ti_sysc_module_data *data,
-                              struct sysc_regbits *sysc_fields,
-                              s32 rev_offs, s32 sysc_offs, s32 syss_offs,
-                              u32 sysc_flags, u32 idlemodes)
+static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
+                                     const struct ti_sysc_module_data *data,
+                                     struct sysc_regbits *sysc_fields,
+                                     s32 rev_offs, s32 sysc_offs,
+                                     s32 syss_offs, u32 sysc_flags,
+                                     u32 idlemodes)
 {
        struct omap_hwmod_class_sysconfig *sysc;
-       struct omap_hwmod_class *class;
+       struct omap_hwmod_class *class = NULL;
+       struct omap_hwmod_ocp_if *oi = NULL;
+       struct clockdomain *clkdm = NULL;
+       struct clk *clk = NULL;
        void __iomem *regs = NULL;
        unsigned long flags;
 
@@ -3465,26 +3488,128 @@ int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
        }
 
        /*
-        * We need new oh->class as the other devices in the same class
+        * We may need a new oh->class as the other devices in the same class
         * may not yet have ioremapped their registers.
         */
-       class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL);
-       if (!class)
-               return -ENOMEM;
+       if (oh->class->name && strcmp(oh->class->name, data->name)) {
+               class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL);
+               if (!class)
+                       return -ENOMEM;
+       }
 
-       class->sysc = sysc;
+       if (list_empty(&oh->slave_ports)) {
+               oi = kcalloc(1, sizeof(*oi), GFP_KERNEL);
+               if (!oi)
+                       return -ENOMEM;
+
+               /*
+                * Note that we assume interconnect interface clocks will be
+                * managed by the interconnect driver for OCPIF_SWSUP_IDLE case
+                * on omap24xx and omap3.
+                */
+               oi->slave = oh;
+               oi->user = OCP_USER_MPU | OCP_USER_SDMA;
+       }
+
+       if (!oh->_clk) {
+               struct clk_hw_omap *hwclk;
+
+               clk = of_clk_get_by_name(dev->of_node, "fck");
+               if (!IS_ERR(clk))
+                       clk_prepare(clk);
+               else
+                       clk = NULL;
+
+               /*
+                * Populate clockdomain based on dts clock. It is needed for
+                * clkdm_deny_idle() and clkdm_allow_idle() until we have have
+                * interconnect driver and reset driver capable of blocking
+                * clockdomain idle during reset, enable and idle.
+                */
+               if (clk) {
+                       hwclk = to_clk_hw_omap(__clk_get_hw(clk));
+                       if (hwclk && hwclk->clkdm_name)
+                               clkdm = clkdm_lookup(hwclk->clkdm_name);
+               }
+
+               /*
+                * Note that we assume interconnect driver manages the clocks
+                * and do not need to populate oh->_clk for dynamically
+                * allocated modules.
+                */
+               clk_unprepare(clk);
+               clk_put(clk);
+       }
 
        spin_lock_irqsave(&oh->_lock, flags);
        if (regs)
                oh->_mpu_rt_va = regs;
-       oh->class = class;
+       if (class)
+               oh->class = class;
+       oh->class->sysc = sysc;
+       if (oi)
+               _add_link(oi);
+       if (clkdm)
+               oh->clkdm = clkdm;
        oh->_state = _HWMOD_STATE_INITIALIZED;
+       oh->_postsetup_state = _HWMOD_STATE_DEFAULT;
        _setup(oh, NULL);
        spin_unlock_irqrestore(&oh->_lock, flags);
 
        return 0;
 }
 
+static const struct omap_hwmod_reset omap24xx_reset_quirks[] = {
+       { .match = "msdi", .len = 4, .reset = omap_msdi_reset, },
+};
+
+static const struct omap_hwmod_reset dra7_reset_quirks[] = {
+       { .match = "pcie", .len = 4, .reset = dra7xx_pciess_reset, },
+};
+
+static const struct omap_hwmod_reset omap_reset_quirks[] = {
+       { .match = "dss", .len = 3, .reset = omap_dss_reset, },
+       { .match = "hdq1w", .len = 5, .reset = omap_hdq1w_reset, },
+       { .match = "i2c", .len = 3, .reset = omap_i2c_reset, },
+       { .match = "wd_timer", .len = 8, .reset = omap2_wd_timer_reset, },
+};
+
+static void
+omap_hwmod_init_reset_quirk(struct device *dev, struct omap_hwmod *oh,
+                           const struct ti_sysc_module_data *data,
+                           const struct omap_hwmod_reset *quirks,
+                           int quirks_sz)
+{
+       const struct omap_hwmod_reset *quirk;
+       int i;
+
+       for (i = 0; i < quirks_sz; i++) {
+               quirk = &quirks[i];
+               if (!strncmp(data->name, quirk->match, quirk->len)) {
+                       oh->class->reset = quirk->reset;
+
+                       return;
+               }
+       }
+}
+
+static void
+omap_hwmod_init_reset_quirks(struct device *dev, struct omap_hwmod *oh,
+                            const struct ti_sysc_module_data *data)
+{
+       if (soc_is_omap24xx())
+               omap_hwmod_init_reset_quirk(dev, oh, data,
+                                           omap24xx_reset_quirks,
+                                           ARRAY_SIZE(omap24xx_reset_quirks));
+
+       if (soc_is_dra7xx())
+               omap_hwmod_init_reset_quirk(dev, oh, data, dra7_reset_quirks,
+                                           ARRAY_SIZE(dra7_reset_quirks));
+
+       omap_hwmod_init_reset_quirk(dev, oh, data, omap_reset_quirks,
+                                   ARRAY_SIZE(omap_reset_quirks));
+}
+
 /**
  * omap_hwmod_init_module - initialize new module
  * @dev: struct device
@@ -3505,8 +3630,31 @@ int omap_hwmod_init_module(struct device *dev,
                return -EINVAL;
 
        oh = _lookup(data->name);
-       if (!oh)
-               return -ENODEV;
+       if (!oh) {
+               oh = kzalloc(sizeof(*oh), GFP_KERNEL);
+               if (!oh)
+                       return -ENOMEM;
+
+               oh->name = data->name;
+               oh->_state = _HWMOD_STATE_UNKNOWN;
+               lockdep_register_key(&oh->hwmod_key);
+
+               /* Unused, can be handled by PRM driver handling resets */
+               oh->prcm.omap4.flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT;
+
+               oh->class = kzalloc(sizeof(*oh->class), GFP_KERNEL);
+               if (!oh->class) {
+                       kfree(oh);
+                       return -ENOMEM;
+               }
+
+               omap_hwmod_init_reset_quirks(dev, oh, data);
+
+               oh->class->name = data->name;
+               mutex_lock(&list_lock);
+               error = _register(oh);
+               mutex_unlock(&list_lock);
+       }
 
        cookie->data = oh;
 
@@ -3527,10 +3675,20 @@ int omap_hwmod_init_module(struct device *dev,
        if (error)
                return error;
 
+       if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE)
+               oh->flags |= HWMOD_NO_IDLE;
        if (data->cfg->quirks & SYSC_QUIRK_NO_IDLE_ON_INIT)
                oh->flags |= HWMOD_INIT_NO_IDLE;
        if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
                oh->flags |= HWMOD_INIT_NO_RESET;
+       if (data->cfg->quirks & SYSC_QUIRK_USE_CLOCKACT)
+               oh->flags |= HWMOD_SET_DEFAULT_CLOCKACT;
+       if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE)
+               oh->flags |= HWMOD_SWSUP_SIDLE;
+       if (data->cfg->quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT)
+               oh->flags |= HWMOD_SWSUP_SIDLE_ACT;
+       if (data->cfg->quirks & SYSC_QUIRK_SWSUP_MSTANDBY)
+               oh->flags |= HWMOD_SWSUP_MSTANDBY;
 
        error = omap_hwmod_check_module(dev, oh, data, sysc_fields,
                                        rev_offs, sysc_offs, syss_offs,
index b70cdc2..fca9e07 100644 (file)
@@ -493,11 +493,16 @@ struct omap_hwmod_omap4_prcm {
 #define _HWMOD_STATE_IDLE                      5
 #define _HWMOD_STATE_DISABLED                  6
 
+#ifdef CONFIG_PM
+#define _HWMOD_STATE_DEFAULT                   _HWMOD_STATE_IDLE
+#else
+#define _HWMOD_STATE_DEFAULT                   _HWMOD_STATE_ENABLED
+#endif
+
 /**
  * struct omap_hwmod_class - the type of an IP block
  * @name: name of the hwmod_class
  * @sysc: device SYSCONFIG/SYSSTATUS register data
- * @rev: revision of the IP class
  * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown
  * @reset: ptr to fn to be executed in place of the standard hwmod reset fn
  * @enable_preprogram:  ptr to fn to be executed during device enable
@@ -523,7 +528,6 @@ struct omap_hwmod_omap4_prcm {
 struct omap_hwmod_class {
        const char                              *name;
        struct omap_hwmod_class_sysconfig       *sysc;
-       u32                                     rev;
        int                                     (*pre_shutdown)(struct omap_hwmod *oh);
        int                                     (*reset)(struct omap_hwmod *oh);
        int                                     (*enable_preprogram)(struct omap_hwmod *oh);
index d684fac..8122c8d 100644 (file)
@@ -91,7 +91,6 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
 static struct omap_hwmod_class i2c_class = {
        .name           = "i2c",
        .sysc           = &i2c_sysc,
-       .rev            = OMAP_I2C_IP_VERSION_1,
        .reset          = &omap_i2c_reset,
 };
 
index abef9f6..f27cb60 100644 (file)
@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
 static struct omap_hwmod_class i2c_class = {
        .name           = "i2c",
        .sysc           = &i2c_sysc,
-       .rev            = OMAP_I2C_IP_VERSION_1,
        .reset          = &omap_i2c_reset,
 };
 
index 9b30b6b..e19f620 100644 (file)
@@ -11,7 +11,7 @@
  * XXX handle crossbar/shared link difference for L3?
  * XXX these should be marked initdata for multi-OMAP kernels
  */
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "omap_hwmod.h"
 #include "l3_2xxx.h"
index 5345919..ed5f39d 100644 (file)
@@ -96,7 +96,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_gpio_sysc = {
 struct omap_hwmod_class omap2xxx_gpio_hwmod_class = {
        .name = "gpio",
        .sysc = &omap2xxx_gpio_sysc,
-       .rev = 0,
 };
 
 /* system dma */
index 6f81d7a..aaa6092 100644 (file)
@@ -30,24 +30,16 @@ 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_l4_per__dcan0;
 extern struct omap_hwmod_ocp_if am33xx_l4_per__dcan1;
-extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio1;
-extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio2;
-extern struct omap_hwmod_ocp_if am33xx_l4_per__gpio3;
 extern struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__elm;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2;
 extern struct omap_hwmod_ocp_if am33xx_l3_s__gpmc;
-extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c2;
-extern struct omap_hwmod_ocp_if am33xx_l4_per__i2c3;
 extern struct omap_hwmod_ocp_if am33xx_l4_per__mailbox;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1;
-extern struct omap_hwmod_ocp_if am33xx_l3_s__mmc2;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1;
 extern struct omap_hwmod_ocp_if am33xx_l4_ls__timer2;
@@ -60,11 +52,6 @@ extern struct omap_hwmod_ocp_if am33xx_l3_main__tpcc;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc0;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc1;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__tptc2;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart2;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart3;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart4;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart5;
-extern struct omap_hwmod_ocp_if am33xx_l4_ls__uart6;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__ocmc;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__sha0;
 extern struct omap_hwmod_ocp_if am33xx_l3_main__aes0;
@@ -93,19 +80,10 @@ extern struct omap_hwmod am33xx_elm_hwmod;
 extern struct omap_hwmod am33xx_epwmss0_hwmod;
 extern struct omap_hwmod am33xx_epwmss1_hwmod;
 extern struct omap_hwmod am33xx_epwmss2_hwmod;
-extern struct omap_hwmod am33xx_gpio1_hwmod;
-extern struct omap_hwmod am33xx_gpio2_hwmod;
-extern struct omap_hwmod am33xx_gpio3_hwmod;
 extern struct omap_hwmod am33xx_gpmc_hwmod;
-extern struct omap_hwmod am33xx_i2c1_hwmod;
-extern struct omap_hwmod am33xx_i2c2_hwmod;
-extern struct omap_hwmod am33xx_i2c3_hwmod;
 extern struct omap_hwmod am33xx_mailbox_hwmod;
 extern struct omap_hwmod am33xx_mcasp0_hwmod;
 extern struct omap_hwmod am33xx_mcasp1_hwmod;
-extern struct omap_hwmod am33xx_mmc0_hwmod;
-extern struct omap_hwmod am33xx_mmc1_hwmod;
-extern struct omap_hwmod am33xx_mmc2_hwmod;
 extern struct omap_hwmod am33xx_rtc_hwmod;
 extern struct omap_hwmod am33xx_spi0_hwmod;
 extern struct omap_hwmod am33xx_spi1_hwmod;
@@ -121,19 +99,12 @@ extern struct omap_hwmod am33xx_tpcc_hwmod;
 extern struct omap_hwmod am33xx_tptc0_hwmod;
 extern struct omap_hwmod am33xx_tptc1_hwmod;
 extern struct omap_hwmod am33xx_tptc2_hwmod;
-extern struct omap_hwmod am33xx_uart1_hwmod;
-extern struct omap_hwmod am33xx_uart2_hwmod;
-extern struct omap_hwmod am33xx_uart3_hwmod;
-extern struct omap_hwmod am33xx_uart4_hwmod;
-extern struct omap_hwmod am33xx_uart5_hwmod;
-extern struct omap_hwmod am33xx_uart6_hwmod;
 extern struct omap_hwmod am33xx_wd_timer1_hwmod;
 
 extern struct omap_hwmod_class am33xx_emif_hwmod_class;
 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
 extern struct omap_hwmod_class am33xx_wkup_m3_hwmod_class;
 extern struct omap_hwmod_class am33xx_control_hwmod_class;
-extern struct omap_hwmod_class am33xx_gpio_hwmod_class;
 extern struct omap_hwmod_class am33xx_timer_hwmod_class;
 extern struct omap_hwmod_class am33xx_epwmss_hwmod_class;
 extern struct omap_hwmod_class am33xx_ehrpwm_hwmod_class;
index e000123..47a0e30 100644 (file)
@@ -122,30 +122,6 @@ struct omap_hwmod_ocp_if am33xx_l4_per__dcan1 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4 per/ls -> GPIO2 */
-struct omap_hwmod_ocp_if am33xx_l4_per__gpio1 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_gpio1_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4 per/ls -> gpio3 */
-struct omap_hwmod_ocp_if am33xx_l4_per__gpio2 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_gpio2_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4 per/ls -> gpio4 */
-struct omap_hwmod_ocp_if am33xx_l4_per__gpio3 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_gpio3_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
        .master         = &am33xx_cpgmac0_hwmod,
        .slave          = &am33xx_mdio_hwmod,
@@ -188,21 +164,6 @@ struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
        .user           = OCP_USER_MPU,
 };
 
-/* i2c2 */
-struct omap_hwmod_ocp_if am33xx_l4_per__i2c2 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_i2c2_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_i2c3_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
 /* l4 ls -> mailbox */
 struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = {
        .master         = &am33xx_l4_ls_hwmod,
@@ -235,30 +196,6 @@ struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1 = {
        .user           = OCP_USER_MPU,
 };
 
-/* l4 ls -> mmc0 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__mmc0 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_mmc0_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l4 ls -> mmc1 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__mmc1 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_mmc1_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l3 s -> mmc2 */
-struct omap_hwmod_ocp_if am33xx_l3_s__mmc2 = {
-       .master         = &am33xx_l3_s_hwmod,
-       .slave          = &am33xx_mmc2_hwmod,
-       .clk            = "l3s_gclk",
-       .user           = OCP_USER_MPU,
-};
-
 /* l4 ls -> mcspi0 */
 struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0 = {
        .master         = &am33xx_l4_ls_hwmod,
@@ -355,46 +292,6 @@ struct omap_hwmod_ocp_if am33xx_l3_main__tptc2 = {
        .user           = OCP_USER_MPU,
 };
 
-/* l4 ls -> uart2 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__uart2 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_uart2_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l4 ls -> uart3 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__uart3 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_uart3_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l4 ls -> uart4 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__uart4 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_uart4_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l4 ls -> uart5 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__uart5 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_uart5_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
-/* l4 ls -> uart6 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__uart6 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_uart6_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
 /* l3 main -> ocmc */
 struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = {
        .master         = &am33xx_l3_main_hwmod,
index 9ded7bf..4c3543b 100644 (file)
@@ -16,9 +16,7 @@
 
 #include <linux/types.h>
 
-#include <linux/platform_data/hsmmc-omap.h>
 #include "omap_hwmod.h"
-#include "i2c.h"
 #include "wd_timer.h"
 #include "cm33xx.h"
 #include "prm33xx.h"
@@ -534,7 +532,6 @@ static struct omap_hwmod_class_sysconfig am33xx_gpio_sysc = {
 struct omap_hwmod_class am33xx_gpio_hwmod_class = {
        .name           = "gpio",
        .sysc           = &am33xx_gpio_sysc,
-       .rev            = 2,
 };
 
 /* gpio1 */
@@ -627,68 +624,6 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
        },
 };
 
-/* 'i2c' class */
-static struct omap_hwmod_class_sysconfig am33xx_i2c_sysc = {
-       .rev_offs       = 0,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0090,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
-                         SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
-                         SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                         SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class i2c_class = {
-       .name           = "i2c",
-       .sysc           = &am33xx_i2c_sysc,
-       .rev            = OMAP_I2C_IP_VERSION_2,
-       .reset          = &omap_i2c_reset,
-};
-
-/* i2c1 */
-struct omap_hwmod am33xx_i2c1_hwmod = {
-       .name           = "i2c1",
-       .class          = &i2c_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "dpll_per_m2_div4_wkupdm_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c1 */
-struct omap_hwmod am33xx_i2c2_hwmod = {
-       .name           = "i2c2",
-       .class          = &i2c_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4 = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c3 */
-struct omap_hwmod am33xx_i2c3_hwmod = {
-       .name           = "i2c3",
-       .class          = &i2c_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 /*
  * 'mailbox' class
  * mailbox module allowing communication between the on-chip processors using a
@@ -762,76 +697,6 @@ struct omap_hwmod am33xx_mcasp1_hwmod = {
        },
 };
 
-/* 'mmc' class */
-static struct omap_hwmod_class_sysconfig am33xx_mmc_sysc = {
-       .rev_offs       = 0x2fc,
-       .sysc_offs      = 0x110,
-       .syss_offs      = 0x114,
-       .sysc_flags     = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
-                         SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
-                         SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class am33xx_mmc_hwmod_class = {
-       .name           = "mmc",
-       .sysc           = &am33xx_mmc_sysc,
-};
-
-/* mmc0 */
-static struct omap_hsmmc_dev_attr am33xx_mmc0_dev_attr = {
-       .flags          = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-
-struct omap_hwmod am33xx_mmc0_hwmod = {
-       .name           = "mmc1",
-       .class          = &am33xx_mmc_hwmod_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .main_clk       = "mmc_clk",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .dev_attr       = &am33xx_mmc0_dev_attr,
-};
-
-/* mmc1 */
-static struct omap_hsmmc_dev_attr am33xx_mmc1_dev_attr = {
-       .flags          = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-
-struct omap_hwmod am33xx_mmc1_hwmod = {
-       .name           = "mmc2",
-       .class          = &am33xx_mmc_hwmod_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .main_clk       = "mmc_clk",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .dev_attr       = &am33xx_mmc1_dev_attr,
-};
-
-/* mmc2 */
-static struct omap_hsmmc_dev_attr am33xx_mmc2_dev_attr = {
-       .flags          = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-struct omap_hwmod am33xx_mmc2_hwmod = {
-       .name           = "mmc3",
-       .class          = &am33xx_mmc_hwmod_class,
-       .clkdm_name     = "l3s_clkdm",
-       .main_clk       = "mmc_clk",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .dev_attr       = &am33xx_mmc2_dev_attr,
-};
-
 /*
  * 'rtc' class
  * rtc subsystem
@@ -1132,102 +997,6 @@ struct omap_hwmod am33xx_tptc2_hwmod = {
        },
 };
 
-/* 'uart' class */
-static struct omap_hwmod_class_sysconfig uart_sysc = {
-       .rev_offs       = 0x50,
-       .sysc_offs      = 0x54,
-       .syss_offs      = 0x58,
-       .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
-                         SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                         SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class uart_class = {
-       .name           = "uart",
-       .sysc           = &uart_sysc,
-};
-
-struct omap_hwmod am33xx_uart1_hwmod = {
-       .name           = "uart1",
-       .class          = &uart_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .flags          = DEBUG_AM33XXUART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_wkupdm_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-struct omap_hwmod am33xx_uart2_hwmod = {
-       .name           = "uart2",
-       .class          = &uart_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart3 */
-struct omap_hwmod am33xx_uart3_hwmod = {
-       .name           = "uart3",
-       .class          = &uart_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-struct omap_hwmod am33xx_uart4_hwmod = {
-       .name           = "uart4",
-       .class          = &uart_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-struct omap_hwmod am33xx_uart5_hwmod = {
-       .name           = "uart5",
-       .class          = &uart_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-struct omap_hwmod am33xx_uart6_hwmod = {
-       .name           = "uart6",
-       .class          = &uart_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "dpll_per_m2_div4_ck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 /* 'wd_timer' class */
 static struct omap_hwmod_class_sysconfig wdt_sysc = {
        .rev_offs       = 0x0,
@@ -1265,11 +1034,6 @@ struct omap_hwmod am33xx_wd_timer1_hwmod = {
 
 static void omap_hwmod_am33xx_clkctrl(void)
 {
-       CLKCTRL(am33xx_uart2_hwmod, AM33XX_CM_PER_UART1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart3_hwmod, AM33XX_CM_PER_UART2_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart4_hwmod, AM33XX_CM_PER_UART3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart5_hwmod, AM33XX_CM_PER_UART4_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart6_hwmod, AM33XX_CM_PER_UART5_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_dcan0_hwmod, AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_dcan1_hwmod, AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_elm_hwmod, AM33XX_CM_PER_ELM_CLKCTRL_OFFSET);
@@ -1279,13 +1043,9 @@ static void omap_hwmod_am33xx_clkctrl(void)
        CLKCTRL(am33xx_gpio1_hwmod, AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpio2_hwmod, AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpio3_hwmod, AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c2_hwmod, AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c3_hwmod, AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mailbox_hwmod, AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mcasp0_hwmod, AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mcasp1_hwmod, AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc0_hwmod, AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc1_hwmod, AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spi0_hwmod, AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spi1_hwmod, AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spinlock_hwmod, AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
@@ -1299,13 +1059,10 @@ static void omap_hwmod_am33xx_clkctrl(void)
                AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart1_hwmod, AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_timer1_hwmod, AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET);
        PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_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);
@@ -1340,11 +1097,6 @@ void omap_hwmod_am33xx_reg(void)
 
 static void omap_hwmod_am43xx_clkctrl(void)
 {
-       CLKCTRL(am33xx_uart2_hwmod, AM43XX_CM_PER_UART1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart3_hwmod, AM43XX_CM_PER_UART2_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart4_hwmod, AM43XX_CM_PER_UART3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart5_hwmod, AM43XX_CM_PER_UART4_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_uart6_hwmod, AM43XX_CM_PER_UART5_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_dcan0_hwmod, AM43XX_CM_PER_DCAN0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_dcan1_hwmod, AM43XX_CM_PER_DCAN1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_elm_hwmod, AM43XX_CM_PER_ELM_CLKCTRL_OFFSET);
@@ -1354,13 +1106,9 @@ static void omap_hwmod_am43xx_clkctrl(void)
        CLKCTRL(am33xx_gpio1_hwmod, AM43XX_CM_PER_GPIO1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpio2_hwmod, AM43XX_CM_PER_GPIO2_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpio3_hwmod, AM43XX_CM_PER_GPIO3_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c2_hwmod, AM43XX_CM_PER_I2C1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c3_hwmod, AM43XX_CM_PER_I2C2_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mailbox_hwmod, AM43XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mcasp0_hwmod, AM43XX_CM_PER_MCASP0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_mcasp1_hwmod, AM43XX_CM_PER_MCASP1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc0_hwmod, AM43XX_CM_PER_MMC0_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc1_hwmod, AM43XX_CM_PER_MMC1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spi0_hwmod, AM43XX_CM_PER_SPI0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spi1_hwmod, AM43XX_CM_PER_SPI1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_spinlock_hwmod, AM43XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET);
@@ -1374,12 +1122,9 @@ 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_uart1_hwmod, AM43XX_CM_WKUP_UART0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_timer1_hwmod, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_i2c1_hwmod, AM43XX_CM_WKUP_I2C0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_wd_timer1_hwmod, AM43XX_CM_WKUP_WDT1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_mmc2_hwmod, AM43XX_CM_PER_MMC2_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);
index c9483bc..c965af2 100644 (file)
@@ -14,8 +14,6 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/platform_data/i2c-omap.h>
-
 #include "omap_hwmod.h"
 #include "omap_hwmod_common_data.h"
 
@@ -23,7 +21,6 @@
 #include "cm33xx.h"
 #include "prm33xx.h"
 #include "prm-regbits-33xx.h"
-#include "i2c.h"
 #include "wd_timer.h"
 #include "omap_hwmod_33xx_43xx_common_data.h"
 
@@ -230,27 +227,6 @@ static struct omap_hwmod am33xx_control_hwmod = {
        },
 };
 
-/* gpio0 */
-static struct omap_hwmod_opt_clk gpio0_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio0_dbclk" },
-};
-
-static struct omap_hwmod am33xx_gpio0_hwmod = {
-       .name           = "gpio1",
-       .class          = &am33xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "dpll_core_m4_div2_ck",
-       .prcm           = {
-               .omap4  = {
-                       .clkctrl_offs   = AM33XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET,
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = gpio0_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio0_opt_clks),
-};
-
 /* lcdc */
 static struct omap_hwmod_class_sysconfig lcdc_sysc = {
        .rev_offs       = 0x0,
@@ -388,22 +364,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__control = {
        .user           = OCP_USER_MPU,
 };
 
-/* L4 WKUP -> I2C1 */
-static struct omap_hwmod_ocp_if am33xx_l4_wkup__i2c1 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_i2c1_hwmod,
-       .clk            = "dpll_core_m4_div2_ck",
-       .user           = OCP_USER_MPU,
-};
-
-/* L4 WKUP -> GPIO1 */
-static struct omap_hwmod_ocp_if am33xx_l4_wkup__gpio0 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_gpio0_hwmod,
-       .clk            = "dpll_core_m4_div2_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* L4 WKUP -> ADC_TSC */
 static struct omap_hwmod_ocp_if am33xx_l4_wkup__adc_tsc = {
        .master         = &am33xx_l4_wkup_hwmod,
@@ -434,14 +394,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = {
        .user           = OCP_USER_MPU,
 };
 
-/* l4 wkup -> uart1 */
-static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_uart1_hwmod,
-       .clk            = "dpll_core_m4_div2_ck",
-       .user           = OCP_USER_MPU,
-};
-
 /* l4 wkup -> wd_timer1 */
 static struct omap_hwmod_ocp_if am33xx_l4_wkup__wd_timer1 = {
        .master         = &am33xx_l4_wkup_hwmod,
@@ -479,27 +431,16 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
        &am33xx_l4_wkup__control,
        &am33xx_l4_wkup__smartreflex0,
        &am33xx_l4_wkup__smartreflex1,
-       &am33xx_l4_wkup__uart1,
        &am33xx_l4_wkup__timer1,
        &am33xx_l4_wkup__rtc,
-       &am33xx_l4_wkup__i2c1,
-       &am33xx_l4_wkup__gpio0,
        &am33xx_l4_wkup__adc_tsc,
        &am33xx_l4_wkup__wd_timer1,
        &am33xx_l4_hs__pruss,
        &am33xx_l4_per__dcan0,
        &am33xx_l4_per__dcan1,
-       &am33xx_l4_per__gpio1,
-       &am33xx_l4_per__gpio2,
-       &am33xx_l4_per__gpio3,
-       &am33xx_l4_per__i2c2,
-       &am33xx_l4_per__i2c3,
        &am33xx_l4_per__mailbox,
        &am33xx_l4_ls__mcasp0,
        &am33xx_l4_ls__mcasp1,
-       &am33xx_l4_ls__mmc0,
-       &am33xx_l4_ls__mmc1,
-       &am33xx_l3_s__mmc2,
        &am33xx_l4_ls__timer2,
        &am33xx_l4_ls__timer3,
        &am33xx_l4_ls__timer4,
@@ -507,11 +448,6 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
        &am33xx_l4_ls__timer6,
        &am33xx_l4_ls__timer7,
        &am33xx_l3_main__tpcc,
-       &am33xx_l4_ls__uart2,
-       &am33xx_l4_ls__uart3,
-       &am33xx_l4_ls__uart4,
-       &am33xx_l4_ls__uart5,
-       &am33xx_l4_ls__uart6,
        &am33xx_l4_ls__spinlock,
        &am33xx_l4_ls__elm,
        &am33xx_l4_ls__epwmss0,
index 23e6a41..edff399 100644 (file)
@@ -484,7 +484,6 @@ static struct omap_hwmod am35xx_uart4_hwmod = {
 static struct omap_hwmod_class i2c_class = {
        .name   = "i2c",
        .sysc   = &i2c_sysc,
-       .rev    = OMAP_I2C_IP_VERSION_1,
        .reset  = &omap_i2c_reset,
 };
 
@@ -707,7 +706,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_gpio_sysc = {
 static struct omap_hwmod_class omap3xxx_gpio_hwmod_class = {
        .name = "gpio",
        .sysc = &omap3xxx_gpio_sysc,
-       .rev = 1,
 };
 
 /* gpio1 */
@@ -1029,7 +1027,6 @@ static struct omap_hwmod_class_sysconfig omap34xx_sr_sysc = {
 static struct omap_hwmod_class omap34xx_smartreflex_hwmod_class = {
        .name = "smartreflex",
        .sysc = &omap34xx_sr_sysc,
-       .rev  = 1,
 };
 
 static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = {
@@ -1044,7 +1041,6 @@ static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = {
 static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = {
        .name = "smartreflex",
        .sysc = &omap36xx_sr_sysc,
-       .rev  = 2,
 };
 
 /* SR1 */
index aa271ac..69571ab 100644 (file)
@@ -87,26 +87,6 @@ static struct omap_hwmod am43xx_control_hwmod = {
        },
 };
 
-static struct omap_hwmod_opt_clk gpio0_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio0_dbclk" },
-};
-
-static struct omap_hwmod am43xx_gpio0_hwmod = {
-       .name           = "gpio1",
-       .class          = &am33xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "sys_clkin_ck",
-       .prcm           = {
-               .omap4  = {
-                       .clkctrl_offs   = AM43XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET,
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = gpio0_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio0_opt_clks),
-};
-
 static struct omap_hwmod_class_sysconfig am43xx_synctimer_sysc = {
        .rev_offs       = 0x0,
        .sysc_offs      = 0x4,
@@ -264,46 +244,6 @@ static struct omap_hwmod am43xx_spi4_hwmod = {
        },
 };
 
-static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio4_dbclk" },
-};
-
-static struct omap_hwmod am43xx_gpio4_hwmod = {
-       .name           = "gpio5",
-       .class          = &am33xx_gpio_hwmod_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4ls_gclk",
-       .prcm           = {
-               .omap4  = {
-                       .clkctrl_offs = AM43XX_CM_PER_GPIO4_CLKCTRL_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = gpio4_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio4_opt_clks),
-};
-
-static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio5_dbclk" },
-};
-
-static struct omap_hwmod am43xx_gpio5_hwmod = {
-       .name           = "gpio6",
-       .class          = &am33xx_gpio_hwmod_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4ls_gclk",
-       .prcm           = {
-               .omap4  = {
-                       .clkctrl_offs = AM43XX_CM_PER_GPIO5_CLKCTRL_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = gpio5_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio5_opt_clks),
-};
-
 static struct omap_hwmod_class am43xx_ocp2scp_hwmod_class = {
        .name   = "ocp2scp",
 };
@@ -650,20 +590,6 @@ static struct omap_hwmod_ocp_if am43xx_l4_wkup__control = {
        .user           = OCP_USER_MPU,
 };
 
-static struct omap_hwmod_ocp_if am43xx_l4_wkup__i2c1 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_i2c1_hwmod,
-       .clk            = "sys_clkin_ck",
-       .user           = OCP_USER_MPU,
-};
-
-static struct omap_hwmod_ocp_if am43xx_l4_wkup__gpio0 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am43xx_gpio0_hwmod,
-       .clk            = "sys_clkin_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 static struct omap_hwmod_ocp_if am43xx_l4_wkup__adc_tsc = {
        .master         = &am33xx_l4_wkup_hwmod,
        .slave          = &am43xx_adc_tsc_hwmod,
@@ -685,13 +611,6 @@ static struct omap_hwmod_ocp_if am43xx_l4_wkup__timer1 = {
        .user           = OCP_USER_MPU,
 };
 
-static struct omap_hwmod_ocp_if am43xx_l4_wkup__uart1 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_uart1_hwmod,
-       .clk            = "sys_clkin_ck",
-       .user           = OCP_USER_MPU,
-};
-
 static struct omap_hwmod_ocp_if am43xx_l4_wkup__wd_timer1 = {
        .master         = &am33xx_l4_wkup_hwmod,
        .slave          = &am33xx_wd_timer1_hwmod,
@@ -776,20 +695,6 @@ static struct omap_hwmod_ocp_if am43xx_l4_ls__mcspi4 = {
        .user           = OCP_USER_MPU,
 };
 
-static struct omap_hwmod_ocp_if am43xx_l4_ls__gpio4 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am43xx_gpio4_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-static struct omap_hwmod_ocp_if am43xx_l4_ls__gpio5 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am43xx_gpio5_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 static struct omap_hwmod_ocp_if am43xx_l4_ls__ocp2scp0 = {
        .master         = &am33xx_l4_ls_hwmod,
        .slave          = &am43xx_ocp2scp0_hwmod,
@@ -907,8 +812,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am43xx_l4_ls__mcspi2,
        &am43xx_l4_ls__mcspi3,
        &am43xx_l4_ls__mcspi4,
-       &am43xx_l4_ls__gpio4,
-       &am43xx_l4_ls__gpio5,
        &am43xx_l3_main__pruss,
        &am33xx_mpu__l3_main,
        &am33xx_mpu__prcm,
@@ -927,27 +830,16 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am43xx_l4_wkup__control,
        &am43xx_l4_wkup__smartreflex0,
        &am43xx_l4_wkup__smartreflex1,
-       &am43xx_l4_wkup__uart1,
        &am43xx_l4_wkup__timer1,
-       &am43xx_l4_wkup__i2c1,
-       &am43xx_l4_wkup__gpio0,
        &am43xx_l4_wkup__wd_timer1,
        &am43xx_l4_wkup__adc_tsc,
        &am43xx_l3_s__qspi,
        &am33xx_l4_per__dcan0,
        &am33xx_l4_per__dcan1,
-       &am33xx_l4_per__gpio1,
-       &am33xx_l4_per__gpio2,
-       &am33xx_l4_per__gpio3,
-       &am33xx_l4_per__i2c2,
-       &am33xx_l4_per__i2c3,
        &am33xx_l4_per__mailbox,
        &am33xx_l4_per__rng,
        &am33xx_l4_ls__mcasp0,
        &am33xx_l4_ls__mcasp1,
-       &am33xx_l4_ls__mmc0,
-       &am33xx_l4_ls__mmc1,
-       &am33xx_l3_s__mmc2,
        &am33xx_l4_ls__timer2,
        &am33xx_l4_ls__timer3,
        &am33xx_l4_ls__timer4,
@@ -955,11 +847,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am33xx_l4_ls__timer6,
        &am33xx_l4_ls__timer7,
        &am33xx_l3_main__tpcc,
-       &am33xx_l4_ls__uart2,
-       &am33xx_l4_ls__uart3,
-       &am33xx_l4_ls__uart4,
-       &am33xx_l4_ls__uart5,
-       &am33xx_l4_ls__uart6,
        &am33xx_l4_ls__spinlock,
        &am33xx_l4_ls__elm,
        &am33xx_l4_ls__epwmss0,
index a95dbac..b8de550 100644 (file)
@@ -21,9 +21,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/platform_data/hsmmc-omap.h>
 #include <linux/power/smartreflex.h>
-#include <linux/platform_data/i2c-omap.h>
 
 #include <linux/omap-dma.h>
 
@@ -33,7 +31,6 @@
 #include "cm2_44xx.h"
 #include "prm44xx.h"
 #include "prm-regbits-44xx.h"
-#include "i2c.h"
 #include "wd_timer.h"
 
 /* Base offset for all OMAP4 interrupts external to MPUSS */
@@ -1056,160 +1053,6 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
 };
 
 /*
- * 'gpio' class
- * general purpose io module
- */
-
-static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0114,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap44xx_gpio_hwmod_class = {
-       .name   = "gpio",
-       .sysc   = &omap44xx_gpio_sysc,
-       .rev    = 2,
-};
-
-/* gpio1 */
-static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio1_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio1_hwmod = {
-       .name           = "gpio1",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .main_clk       = "l4_wkup_clk_mux_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_WKUP_GPIO1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_WKUP_GPIO1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio1_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio1_opt_clks),
-};
-
-/* gpio2 */
-static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio2_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio2_hwmod = {
-       .name           = "gpio2",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_div_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_GPIO2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_GPIO2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio2_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio2_opt_clks),
-};
-
-/* gpio3 */
-static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio3_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio3_hwmod = {
-       .name           = "gpio3",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_div_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_GPIO3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_GPIO3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio3_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio3_opt_clks),
-};
-
-/* gpio4 */
-static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio4_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio4_hwmod = {
-       .name           = "gpio4",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_div_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_GPIO4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_GPIO4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio4_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio4_opt_clks),
-};
-
-/* gpio5 */
-static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio5_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio5_hwmod = {
-       .name           = "gpio5",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_div_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_GPIO5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_GPIO5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio5_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio5_opt_clks),
-};
-
-/* gpio6 */
-static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio6_dbclk" },
-};
-
-static struct omap_hwmod omap44xx_gpio6_hwmod = {
-       .name           = "gpio6",
-       .class          = &omap44xx_gpio_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_div_ck",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_GPIO6_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_GPIO6_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio6_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio6_opt_clks),
-};
-
-/*
  * 'gpmc' class
  * general purpose memory controller
  */
@@ -1355,94 +1198,6 @@ static struct omap_hwmod omap44xx_hsi_hwmod = {
 };
 
 /*
- * 'i2c' class
- * multimaster high-speed i2c controller
- */
-
-static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
-       .rev_offs       = 0,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0090,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
-                          SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
-       .name   = "i2c",
-       .sysc   = &omap44xx_i2c_sysc,
-       .rev    = OMAP_I2C_IP_VERSION_2,
-       .reset  = &omap_i2c_reset,
-};
-
-/* i2c1 */
-static struct omap_hwmod omap44xx_i2c1_hwmod = {
-       .name           = "i2c1",
-       .class          = &omap44xx_i2c_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_I2C1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_I2C1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c2 */
-static struct omap_hwmod omap44xx_i2c2_hwmod = {
-       .name           = "i2c2",
-       .class          = &omap44xx_i2c_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_I2C2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_I2C2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c3 */
-static struct omap_hwmod omap44xx_i2c3_hwmod = {
-       .name           = "i2c3",
-       .class          = &omap44xx_i2c_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_I2C3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_I2C3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c4 */
-static struct omap_hwmod omap44xx_i2c4_hwmod = {
-       .name           = "i2c4",
-       .class          = &omap44xx_i2c_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_I2C4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_I2C4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'ipu' class
  * imaging processor unit
  */
@@ -1819,189 +1574,6 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
 };
 
 /*
- * 'mcspi' class
- * multichannel serial port interface (mcspi) / master/slave synchronous serial
- * bus
- */
-
-static struct omap_hwmod_class_sysconfig omap44xx_mcspi_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .sysc_flags     = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type2,
-};
-
-static struct omap_hwmod_class omap44xx_mcspi_hwmod_class = {
-       .name   = "mcspi",
-       .sysc   = &omap44xx_mcspi_sysc,
-};
-
-/* mcspi1 */
-static struct omap_hwmod omap44xx_mcspi1_hwmod = {
-       .name           = "mcspi1",
-       .class          = &omap44xx_mcspi_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MCSPI1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MCSPI1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mcspi2 */
-static struct omap_hwmod omap44xx_mcspi2_hwmod = {
-       .name           = "mcspi2",
-       .class          = &omap44xx_mcspi_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MCSPI2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MCSPI2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mcspi3 */
-static struct omap_hwmod omap44xx_mcspi3_hwmod = {
-       .name           = "mcspi3",
-       .class          = &omap44xx_mcspi_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MCSPI3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MCSPI3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mcspi4 */
-static struct omap_hwmod omap44xx_mcspi4_hwmod = {
-       .name           = "mcspi4",
-       .class          = &omap44xx_mcspi_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MCSPI4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MCSPI4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
- * 'mmc' class
- * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller
- */
-
-static struct omap_hwmod_class_sysconfig omap44xx_mmc_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .sysc_flags     = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
-                          SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
-                          MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type2,
-};
-
-static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
-       .name   = "mmc",
-       .sysc   = &omap44xx_mmc_sysc,
-};
-
-/* mmc1 */
-static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
-       .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-
-static struct omap_hwmod omap44xx_mmc1_hwmod = {
-       .name           = "mmc1",
-       .class          = &omap44xx_mmc_hwmod_class,
-       .clkdm_name     = "l3_init_clkdm",
-       .main_clk       = "hsmmc1_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L3INIT_MMC1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L3INIT_MMC1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .dev_attr       = &mmc1_dev_attr,
-};
-
-/* mmc2 */
-static struct omap_hwmod omap44xx_mmc2_hwmod = {
-       .name           = "mmc2",
-       .class          = &omap44xx_mmc_hwmod_class,
-       .clkdm_name     = "l3_init_clkdm",
-       .main_clk       = "hsmmc2_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L3INIT_MMC2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L3INIT_MMC2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc3 */
-static struct omap_hwmod omap44xx_mmc3_hwmod = {
-       .name           = "mmc3",
-       .class          = &omap44xx_mmc_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MMCSD3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MMCSD3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc4 */
-static struct omap_hwmod omap44xx_mmc4_hwmod = {
-       .name           = "mmc4",
-       .class          = &omap44xx_mmc_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MMCSD4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MMCSD4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc5 */
-static struct omap_hwmod omap44xx_mmc5_hwmod = {
-       .name           = "mmc5",
-       .class          = &omap44xx_mmc_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_MMCSD5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_MMCSD5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'mmu' class
  * The memory management unit performs virtual to physical address translation
  * for its requestors.
@@ -2367,7 +1939,6 @@ static struct omap_hwmod_class_sysconfig omap44xx_smartreflex_sysc = {
 static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = {
        .name   = "smartreflex",
        .sysc   = &omap44xx_smartreflex_sysc,
-       .rev    = 2,
 };
 
 /* smartreflex_core */
@@ -2673,92 +2244,6 @@ static struct omap_hwmod omap44xx_timer11_hwmod = {
 };
 
 /*
- * 'uart' class
- * universal asynchronous receiver/transmitter (uart)
- */
-
-static struct omap_hwmod_class_sysconfig omap44xx_uart_sysc = {
-       .rev_offs       = 0x0050,
-       .sysc_offs      = 0x0054,
-       .syss_offs      = 0x0058,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap44xx_uart_hwmod_class = {
-       .name   = "uart",
-       .sysc   = &omap44xx_uart_sysc,
-};
-
-/* uart1 */
-static struct omap_hwmod omap44xx_uart1_hwmod = {
-       .name           = "uart1",
-       .class          = &omap44xx_uart_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_UART1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_UART1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart2 */
-static struct omap_hwmod omap44xx_uart2_hwmod = {
-       .name           = "uart2",
-       .class          = &omap44xx_uart_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_UART2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_UART2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart3 */
-static struct omap_hwmod omap44xx_uart3_hwmod = {
-       .name           = "uart3",
-       .class          = &omap44xx_uart_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_UART3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_UART3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart4 */
-static struct omap_hwmod omap44xx_uart4_hwmod = {
-       .name           = "uart4",
-       .class          = &omap44xx_uart_hwmod_class,
-       .clkdm_name     = "l4_per_clkdm",
-       .flags          = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP4_CM_L4PER_UART4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP4_RM_L4PER_UART4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'usb_host_fs' class
  * full-speed usb host controller
  */
@@ -3082,22 +2567,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* mmc1 -> l3_main_1 */
-static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = {
-       .master         = &omap44xx_mmc1_hwmod,
-       .slave          = &omap44xx_l3_main_1_hwmod,
-       .clk            = "l3_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* mmc2 -> l3_main_1 */
-static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
-       .master         = &omap44xx_mmc2_hwmod,
-       .slave          = &omap44xx_l3_main_1_hwmod,
-       .clk            = "l3_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* mpu -> l3_main_1 */
 static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
        .master         = &omap44xx_mpu_hwmod,
@@ -3554,54 +3023,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__fdif = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_wkup -> gpio1 */
-static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
-       .master         = &omap44xx_l4_wkup_hwmod,
-       .slave          = &omap44xx_gpio1_hwmod,
-       .clk            = "l4_wkup_clk_mux_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio2 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_gpio2_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio3 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_gpio3_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio4 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_gpio4_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio5 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_gpio5_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio6 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_gpio6_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_2 -> gpmc */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__gpmc = {
        .master         = &omap44xx_l3_main_2_hwmod,
@@ -3634,38 +3055,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__hsi = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per -> i2c1 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_i2c1_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c2 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_i2c2_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c3 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_i2c3_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c4 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_i2c4_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_2 -> ipu */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ipu = {
        .master         = &omap44xx_l3_main_2_hwmod,
@@ -3770,78 +3159,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per -> mcspi1 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mcspi1_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mcspi2 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mcspi2_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mcspi3 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi3 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mcspi3_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mcspi4 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi4 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mcspi4_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc1 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mmc1_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc2 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc2 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mmc2_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc3 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc3 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mmc3_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc4 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc4 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mmc4_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc5 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc5 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_mmc5_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_2 -> ocmc_ram */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ocmc_ram = {
        .master         = &omap44xx_l3_main_2_hwmod,
@@ -4050,38 +3367,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_per__timer11 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per -> uart1 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_uart1_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart2 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_uart2_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart3 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_uart3_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart4 */
-static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = {
-       .master         = &omap44xx_l4_per_hwmod,
-       .slave          = &omap44xx_uart4_hwmod,
-       .clk            = "l4_div_ck",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> usb_host_fs */
 static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = {
        .master         = &omap44xx_l4_cfg_hwmod,
@@ -4164,8 +3449,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_dss__l3_main_1,
        &omap44xx_l3_main_2__l3_main_1,
        &omap44xx_l4_cfg__l3_main_1,
-       &omap44xx_mmc1__l3_main_1,
-       &omap44xx_mmc2__l3_main_1,
        &omap44xx_mpu__l3_main_1,
        &omap44xx_debugss__l3_main_2,
        &omap44xx_dma_system__l3_main_2,
@@ -4222,20 +3505,10 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_l4_per__dss_venc,
        &omap44xx_l4_per__elm,
        &omap44xx_l4_cfg__fdif,
-       &omap44xx_l4_wkup__gpio1,
-       &omap44xx_l4_per__gpio2,
-       &omap44xx_l4_per__gpio3,
-       &omap44xx_l4_per__gpio4,
-       &omap44xx_l4_per__gpio5,
-       &omap44xx_l4_per__gpio6,
        &omap44xx_l3_main_2__gpmc,
        &omap44xx_l3_main_2__gpu,
        &omap44xx_l4_per__hdq1w,
        &omap44xx_l4_cfg__hsi,
-       &omap44xx_l4_per__i2c1,
-       &omap44xx_l4_per__i2c2,
-       &omap44xx_l4_per__i2c3,
-       &omap44xx_l4_per__i2c4,
        &omap44xx_l3_main_2__ipu,
        &omap44xx_l3_main_2__iss,
        /* &omap44xx_iva__sl2if, */
@@ -4249,15 +3522,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_l4_abe__mcbsp3,
        &omap44xx_l4_per__mcbsp4,
        &omap44xx_l4_abe__mcpdm,
-       &omap44xx_l4_per__mcspi1,
-       &omap44xx_l4_per__mcspi2,
-       &omap44xx_l4_per__mcspi3,
-       &omap44xx_l4_per__mcspi4,
-       &omap44xx_l4_per__mmc1,
-       &omap44xx_l4_per__mmc2,
-       &omap44xx_l4_per__mmc3,
-       &omap44xx_l4_per__mmc4,
-       &omap44xx_l4_per__mmc5,
        &omap44xx_l3_main_2__mmu_ipu,
        &omap44xx_l4_cfg__mmu_dsp,
        &omap44xx_l3_main_2__ocmc_ram,
@@ -4286,10 +3550,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
        &omap44xx_l4_per__timer9,
        &omap44xx_l4_per__timer10,
        &omap44xx_l4_per__timer11,
-       &omap44xx_l4_per__uart1,
-       &omap44xx_l4_per__uart2,
-       &omap44xx_l4_per__uart3,
-       &omap44xx_l4_per__uart4,
        /* &omap44xx_l4_cfg__usb_host_fs, */
        &omap44xx_l4_cfg__usb_host_hs,
        &omap44xx_l4_cfg__usb_otg_hs,
index 115473d..29805cc 100644 (file)
@@ -18,9 +18,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/platform_data/hsmmc-omap.h>
 #include <linux/power/smartreflex.h>
-#include <linux/platform_data/i2c-omap.h>
 
 #include <linux/omap-dma.h>
 
@@ -29,7 +27,6 @@
 #include "cm1_54xx.h"
 #include "cm2_54xx.h"
 #include "prm54xx.h"
-#include "i2c.h"
 #include "wd_timer.h"
 
 /* Base offset for all OMAP5 interrupts external to MPUSS */
@@ -601,308 +598,6 @@ static struct omap_hwmod omap54xx_emif2_hwmod = {
 };
 
 /*
- * 'gpio' class
- * general purpose io module
- */
-
-static struct omap_hwmod_class_sysconfig omap54xx_gpio_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0114,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap54xx_gpio_hwmod_class = {
-       .name   = "gpio",
-       .sysc   = &omap54xx_gpio_sysc,
-       .rev    = 2,
-};
-
-/* gpio1 */
-static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio1_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio1_hwmod = {
-       .name           = "gpio1",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "wkupaon_clkdm",
-       .main_clk       = "wkupaon_iclk_mux",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_WKUPAON_GPIO1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_WKUPAON_GPIO1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio1_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio1_opt_clks),
-};
-
-/* gpio2 */
-static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio2_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio2_hwmod = {
-       .name           = "gpio2",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio2_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio2_opt_clks),
-};
-
-/* gpio3 */
-static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio3_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio3_hwmod = {
-       .name           = "gpio3",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio3_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio3_opt_clks),
-};
-
-/* gpio4 */
-static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio4_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio4_hwmod = {
-       .name           = "gpio4",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio4_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio4_opt_clks),
-};
-
-/* gpio5 */
-static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio5_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio5_hwmod = {
-       .name           = "gpio5",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio5_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio5_opt_clks),
-};
-
-/* gpio6 */
-static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio6_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio6_hwmod = {
-       .name           = "gpio6",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO6_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO6_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio6_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio6_opt_clks),
-};
-
-/* gpio7 */
-static struct omap_hwmod_opt_clk gpio7_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio7_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio7_hwmod = {
-       .name           = "gpio7",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO7_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO7_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio7_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio7_opt_clks),
-};
-
-/* gpio8 */
-static struct omap_hwmod_opt_clk gpio8_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio8_dbclk" },
-};
-
-static struct omap_hwmod omap54xx_gpio8_hwmod = {
-       .name           = "gpio8",
-       .class          = &omap54xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l4_root_clk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO8_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_GPIO8_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio8_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio8_opt_clks),
-};
-
-/*
- * 'i2c' class
- * multimaster high-speed i2c controller
- */
-
-static struct omap_hwmod_class_sysconfig omap54xx_i2c_sysc = {
-       .rev_offs       = 0,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0090,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
-                          SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap54xx_i2c_hwmod_class = {
-       .name   = "i2c",
-       .sysc   = &omap54xx_i2c_sysc,
-       .reset  = &omap_i2c_reset,
-       .rev    = OMAP_I2C_IP_VERSION_2,
-};
-
-/* i2c1 */
-static struct omap_hwmod omap54xx_i2c1_hwmod = {
-       .name           = "i2c1",
-       .class          = &omap54xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_I2C1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_I2C1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c2 */
-static struct omap_hwmod omap54xx_i2c2_hwmod = {
-       .name           = "i2c2",
-       .class          = &omap54xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_I2C2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_I2C2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c3 */
-static struct omap_hwmod omap54xx_i2c3_hwmod = {
-       .name           = "i2c3",
-       .class          = &omap54xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_I2C3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_I2C3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c4 */
-static struct omap_hwmod omap54xx_i2c4_hwmod = {
-       .name           = "i2c4",
-       .class          = &omap54xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_I2C4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_I2C4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c5 */
-static struct omap_hwmod omap54xx_i2c5_hwmod = {
-       .name           = "i2c5",
-       .class          = &omap54xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_I2C5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_I2C5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'kbd' class
  * keyboard controller
  */
@@ -1185,115 +880,6 @@ static struct omap_hwmod omap54xx_mcspi4_hwmod = {
 };
 
 /*
- * 'mmc' class
- * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller
- */
-
-static struct omap_hwmod_class_sysconfig omap54xx_mmc_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .sysc_flags     = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
-                          SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
-                          MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type2,
-};
-
-static struct omap_hwmod_class omap54xx_mmc_hwmod_class = {
-       .name   = "mmc",
-       .sysc   = &omap54xx_mmc_sysc,
-};
-
-/* mmc1 */
-static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
-       { .role = "32khz_clk", .clk = "mmc1_32khz_clk" },
-};
-
-/* mmc1 dev_attr */
-static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
-       .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-
-static struct omap_hwmod omap54xx_mmc1_hwmod = {
-       .name           = "mmc1",
-       .class          = &omap54xx_mmc_hwmod_class,
-       .clkdm_name     = "l3init_clkdm",
-       .main_clk       = "mmc1_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L3INIT_MMC1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L3INIT_MMC1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = mmc1_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
-       .dev_attr       = &mmc1_dev_attr,
-};
-
-/* mmc2 */
-static struct omap_hwmod omap54xx_mmc2_hwmod = {
-       .name           = "mmc2",
-       .class          = &omap54xx_mmc_hwmod_class,
-       .clkdm_name     = "l3init_clkdm",
-       .main_clk       = "mmc2_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L3INIT_MMC2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L3INIT_MMC2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc3 */
-static struct omap_hwmod omap54xx_mmc3_hwmod = {
-       .name           = "mmc3",
-       .class          = &omap54xx_mmc_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_MMC3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_MMC3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc4 */
-static struct omap_hwmod omap54xx_mmc4_hwmod = {
-       .name           = "mmc4",
-       .class          = &omap54xx_mmc_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_MMC4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_MMC4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* mmc5 */
-static struct omap_hwmod omap54xx_mmc5_hwmod = {
-       .name           = "mmc5",
-       .class          = &omap54xx_mmc_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_MMC5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_MMC5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'mmu' class
  * The memory management unit performs virtual to physical address translation
  * for its requestors.
@@ -1658,124 +1244,6 @@ static struct omap_hwmod omap54xx_timer11_hwmod = {
 };
 
 /*
- * 'uart' class
- * universal asynchronous receiver/transmitter (uart)
- */
-
-static struct omap_hwmod_class_sysconfig omap54xx_uart_sysc = {
-       .rev_offs       = 0x0050,
-       .sysc_offs      = 0x0054,
-       .syss_offs      = 0x0058,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class omap54xx_uart_hwmod_class = {
-       .name   = "uart",
-       .sysc   = &omap54xx_uart_sysc,
-};
-
-/* uart1 */
-static struct omap_hwmod omap54xx_uart1_hwmod = {
-       .name           = "uart1",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART1_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart2 */
-static struct omap_hwmod omap54xx_uart2_hwmod = {
-       .name           = "uart2",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART2_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart3 */
-static struct omap_hwmod omap54xx_uart3_hwmod = {
-       .name           = "uart3",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = DEBUG_OMAP4UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART3_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart4 */
-static struct omap_hwmod omap54xx_uart4_hwmod = {
-       .name           = "uart4",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = DEBUG_OMAP4UART4_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART4_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart5 */
-static struct omap_hwmod omap54xx_uart5_hwmod = {
-       .name           = "uart5",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART5_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart6 */
-static struct omap_hwmod omap54xx_uart6_hwmod = {
-       .name           = "uart6",
-       .class          = &omap54xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .main_clk       = "func_48m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = OMAP54XX_CM_L4PER_UART6_CLKCTRL_OFFSET,
-                       .context_offs = OMAP54XX_RM_L4PER_UART6_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'usb_host_hs' class
  * high-speed multi-port usb host controller
  */
@@ -2274,110 +1742,6 @@ static struct omap_hwmod_ocp_if omap54xx_mpu__emif2 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_wkup -> gpio1 */
-static struct omap_hwmod_ocp_if omap54xx_l4_wkup__gpio1 = {
-       .master         = &omap54xx_l4_wkup_hwmod,
-       .slave          = &omap54xx_gpio1_hwmod,
-       .clk            = "wkupaon_iclk_mux",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio2 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio2 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio2_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio3 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio3 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio3_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio4 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio4 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio4_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio5 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio5 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio5_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio6 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio6 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio6_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio7 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio7 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio7_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> gpio8 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio8 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_gpio8_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c1 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c1 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_i2c1_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c2 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c2 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_i2c2_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c3 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c3 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_i2c3_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c4 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c4 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_i2c4_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> i2c5 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c5 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_i2c5_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_wkup -> kbd */
 static struct omap_hwmod_ocp_if omap54xx_l4_wkup__kbd = {
        .master         = &omap54xx_l4_wkup_hwmod,
@@ -2458,46 +1822,6 @@ static struct omap_hwmod_ocp_if omap54xx_l4_per__mcspi4 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per -> mmc1 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc1 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_mmc1_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc2 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc2 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_mmc2_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc3 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc3 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_mmc3_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc4 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc4 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_mmc4_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> mmc5 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc5 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_mmc5_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> mpu */
 static struct omap_hwmod_ocp_if omap54xx_l4_cfg__mpu = {
        .master         = &omap54xx_l4_cfg_hwmod,
@@ -2610,54 +1934,6 @@ static struct omap_hwmod_ocp_if omap54xx_l4_per__timer11 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per -> uart1 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart1 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart1_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart2 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart2 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart2_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart3 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart3 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart3_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart4 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart4 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart4_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart5 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart5 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart5_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per -> uart6 */
-static struct omap_hwmod_ocp_if omap54xx_l4_per__uart6 = {
-       .master         = &omap54xx_l4_per_hwmod,
-       .slave          = &omap54xx_uart6_hwmod,
-       .clk            = "l4_root_clk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> usb_host_hs */
 static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_host_hs = {
        .master         = &omap54xx_l4_cfg_hwmod,
@@ -2719,19 +1995,6 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l3_main_2__dss_rfbi,
        &omap54xx_mpu__emif1,
        &omap54xx_mpu__emif2,
-       &omap54xx_l4_wkup__gpio1,
-       &omap54xx_l4_per__gpio2,
-       &omap54xx_l4_per__gpio3,
-       &omap54xx_l4_per__gpio4,
-       &omap54xx_l4_per__gpio5,
-       &omap54xx_l4_per__gpio6,
-       &omap54xx_l4_per__gpio7,
-       &omap54xx_l4_per__gpio8,
-       &omap54xx_l4_per__i2c1,
-       &omap54xx_l4_per__i2c2,
-       &omap54xx_l4_per__i2c3,
-       &omap54xx_l4_per__i2c4,
-       &omap54xx_l4_per__i2c5,
        &omap54xx_l3_main_2__mmu_ipu,
        &omap54xx_l4_wkup__kbd,
        &omap54xx_l4_cfg__mailbox,
@@ -2743,11 +2006,6 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l4_per__mcspi2,
        &omap54xx_l4_per__mcspi3,
        &omap54xx_l4_per__mcspi4,
-       &omap54xx_l4_per__mmc1,
-       &omap54xx_l4_per__mmc2,
-       &omap54xx_l4_per__mmc3,
-       &omap54xx_l4_per__mmc4,
-       &omap54xx_l4_per__mmc5,
        &omap54xx_l4_cfg__mpu,
        &omap54xx_l4_cfg__spinlock,
        &omap54xx_l4_cfg__ocp2scp1,
@@ -2762,12 +2020,6 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l4_per__timer9,
        &omap54xx_l4_per__timer10,
        &omap54xx_l4_per__timer11,
-       &omap54xx_l4_per__uart1,
-       &omap54xx_l4_per__uart2,
-       &omap54xx_l4_per__uart3,
-       &omap54xx_l4_per__uart4,
-       &omap54xx_l4_per__uart5,
-       &omap54xx_l4_per__uart6,
        &omap54xx_l4_cfg__usb_host_hs,
        &omap54xx_l4_cfg__usb_tll_hs,
        &omap54xx_l4_cfg__usb_otg_ss,
index e6c7061..7e85bd2 100644 (file)
@@ -18,9 +18,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/platform_data/hsmmc-omap.h>
 #include <linux/power/smartreflex.h>
-#include <linux/platform_data/i2c-omap.h>
 
 #include <linux/omap-dma.h>
 
@@ -29,7 +27,6 @@
 #include "cm1_7xx.h"
 #include "cm2_7xx.h"
 #include "prm7xx.h"
-#include "i2c.h"
 #include "wd_timer.h"
 #include "soc.h"
 
@@ -693,7 +690,6 @@ static struct omap_hwmod_class_sysconfig dra7xx_aes_sysc = {
 static struct omap_hwmod_class dra7xx_aes_hwmod_class = {
        .name   = "aes",
        .sysc   = &dra7xx_aes_sysc,
-       .rev    = 2,
 };
 
 /* AES1 */
@@ -737,7 +733,6 @@ static struct omap_hwmod_class_sysconfig dra7xx_sha0_sysc = {
 static struct omap_hwmod_class dra7xx_sha0_hwmod_class = {
        .name           = "sham",
        .sysc           = &dra7xx_sha0_sysc,
-       .rev            = 2,
 };
 
 struct omap_hwmod dra7xx_sha0_hwmod = {
@@ -792,205 +787,6 @@ static struct omap_hwmod dra7xx_elm_hwmod = {
 };
 
 /*
- * 'gpio' class
- *
- */
-
-static struct omap_hwmod_class_sysconfig dra7xx_gpio_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0114,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class dra7xx_gpio_hwmod_class = {
-       .name   = "gpio",
-       .sysc   = &dra7xx_gpio_sysc,
-       .rev    = 2,
-};
-
-/* gpio1 */
-static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio1_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio1_hwmod = {
-       .name           = "gpio1",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "wkupaon_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "wkupaon_iclk_mux",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_WKUPAON_GPIO1_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_WKUPAON_GPIO1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio1_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio1_opt_clks),
-};
-
-/* gpio2 */
-static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio2_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio2_hwmod = {
-       .name           = "gpio2",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO2_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio2_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio2_opt_clks),
-};
-
-/* gpio3 */
-static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio3_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio3_hwmod = {
-       .name           = "gpio3",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO3_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio3_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio3_opt_clks),
-};
-
-/* gpio4 */
-static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio4_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio4_hwmod = {
-       .name           = "gpio4",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO4_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio4_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio4_opt_clks),
-};
-
-/* gpio5 */
-static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio5_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio5_hwmod = {
-       .name           = "gpio5",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO5_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio5_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio5_opt_clks),
-};
-
-/* gpio6 */
-static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio6_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio6_hwmod = {
-       .name           = "gpio6",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO6_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO6_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio6_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio6_opt_clks),
-};
-
-/* gpio7 */
-static struct omap_hwmod_opt_clk gpio7_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio7_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio7_hwmod = {
-       .name           = "gpio7",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO7_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO7_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio7_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio7_opt_clks),
-};
-
-/* gpio8 */
-static struct omap_hwmod_opt_clk gpio8_opt_clks[] = {
-       { .role = "dbclk", .clk = "gpio8_dbclk" },
-};
-
-static struct omap_hwmod dra7xx_gpio8_hwmod = {
-       .name           = "gpio8",
-       .class          = &dra7xx_gpio_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .main_clk       = "l3_iclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_GPIO8_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_GPIO8_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_HWCTRL,
-               },
-       },
-       .opt_clks       = gpio8_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(gpio8_opt_clks),
-};
-
-/*
  * 'gpmc' class
  *
  */
@@ -1065,110 +861,6 @@ static struct omap_hwmod dra7xx_hdq1w_hwmod = {
 };
 
 /*
- * 'i2c' class
- *
- */
-
-static struct omap_hwmod_class_sysconfig dra7xx_i2c_sysc = {
-       .rev_offs       = 0,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0090,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
-                          SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class dra7xx_i2c_hwmod_class = {
-       .name   = "i2c",
-       .sysc   = &dra7xx_i2c_sysc,
-       .reset  = &omap_i2c_reset,
-       .rev    = OMAP_I2C_IP_VERSION_2,
-};
-
-/* i2c1 */
-static struct omap_hwmod dra7xx_i2c1_hwmod = {
-       .name           = "i2c1",
-       .class          = &dra7xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_I2C1_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_I2C1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c2 */
-static struct omap_hwmod dra7xx_i2c2_hwmod = {
-       .name           = "i2c2",
-       .class          = &dra7xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_I2C2_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_I2C2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c3 */
-static struct omap_hwmod dra7xx_i2c3_hwmod = {
-       .name           = "i2c3",
-       .class          = &dra7xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_I2C3_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_I2C3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c4 */
-static struct omap_hwmod dra7xx_i2c4_hwmod = {
-       .name           = "i2c4",
-       .class          = &dra7xx_i2c_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_I2C4_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_I2C4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* i2c5 */
-static struct omap_hwmod dra7xx_i2c5_hwmod = {
-       .name           = "i2c5",
-       .class          = &dra7xx_i2c_hwmod_class,
-       .clkdm_name     = "ipu_clkdm",
-       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
-       .main_clk       = "func_96m_fclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_IPU_I2C5_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_IPU_I2C5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/*
  * 'mailbox' class
  *
  */
@@ -1632,118 +1324,6 @@ static struct omap_hwmod dra7xx_mcasp8_hwmod = {
 };
 
 /*
- * 'mmc' class
- *
- */
-
-static struct omap_hwmod_class_sysconfig dra7xx_mmc_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .sysc_flags     = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
-                          SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
-                          SYSC_HAS_SOFTRESET),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
-                          MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type2,
-};
-
-static struct omap_hwmod_class dra7xx_mmc_hwmod_class = {
-       .name   = "mmc",
-       .sysc   = &dra7xx_mmc_sysc,
-};
-
-/* mmc1 */
-static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
-       { .role = "clk32k", .clk = "mmc1_clk32k" },
-};
-
-/* mmc1 dev_attr */
-static struct omap_hsmmc_dev_attr mmc1_dev_attr = {
-       .flags  = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
-};
-
-static struct omap_hwmod dra7xx_mmc1_hwmod = {
-       .name           = "mmc1",
-       .class          = &dra7xx_mmc_hwmod_class,
-       .clkdm_name     = "l3init_clkdm",
-       .main_clk       = "mmc1_fclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L3INIT_MMC1_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L3INIT_MMC1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = mmc1_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(mmc1_opt_clks),
-       .dev_attr       = &mmc1_dev_attr,
-};
-
-/* mmc2 */
-static struct omap_hwmod_opt_clk mmc2_opt_clks[] = {
-       { .role = "clk32k", .clk = "mmc2_clk32k" },
-};
-
-static struct omap_hwmod dra7xx_mmc2_hwmod = {
-       .name           = "mmc2",
-       .class          = &dra7xx_mmc_hwmod_class,
-       .clkdm_name     = "l3init_clkdm",
-       .main_clk       = "mmc2_fclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L3INIT_MMC2_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L3INIT_MMC2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = mmc2_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(mmc2_opt_clks),
-};
-
-/* mmc3 */
-static struct omap_hwmod_opt_clk mmc3_opt_clks[] = {
-       { .role = "clk32k", .clk = "mmc3_clk32k" },
-};
-
-static struct omap_hwmod dra7xx_mmc3_hwmod = {
-       .name           = "mmc3",
-       .class          = &dra7xx_mmc_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "mmc3_gfclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_MMC3_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_MMC3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = mmc3_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(mmc3_opt_clks),
-};
-
-/* mmc4 */
-static struct omap_hwmod_opt_clk mmc4_opt_clks[] = {
-       { .role = "clk32k", .clk = "mmc4_clk32k" },
-};
-
-static struct omap_hwmod dra7xx_mmc4_hwmod = {
-       .name           = "mmc4",
-       .class          = &dra7xx_mmc_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "mmc4_gfclk_div",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_MMC4_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_MMC4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-       .opt_clks       = mmc4_opt_clks,
-       .opt_clks_cnt   = ARRAY_SIZE(mmc4_opt_clks),
-};
-
-/*
  * 'mpu' class
  *
  */
@@ -1832,7 +1412,7 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
  * We use a PCIeSS HWMOD class specific reset handler to deassert the hardreset
  * lines after asserting them.
  */
-static int dra7xx_pciess_reset(struct omap_hwmod *oh)
+int dra7xx_pciess_reset(struct omap_hwmod *oh)
 {
        int i;
 
@@ -2019,7 +1599,6 @@ static struct omap_hwmod_class_sysconfig dra7xx_smartreflex_sysc = {
 static struct omap_hwmod_class dra7xx_smartreflex_hwmod_class = {
        .name   = "smartreflex",
        .sysc   = &dra7xx_smartreflex_sysc,
-       .rev    = 2,
 };
 
 /* smartreflex_core */
@@ -2375,188 +1954,6 @@ static struct omap_hwmod dra7xx_timer16_hwmod = {
        },
 };
 
-/*
- * 'uart' class
- *
- */
-
-static struct omap_hwmod_class_sysconfig dra7xx_uart_sysc = {
-       .rev_offs       = 0x0050,
-       .sysc_offs      = 0x0054,
-       .syss_offs      = 0x0058,
-       .sysc_flags     = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
-                          SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                          SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                          SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class dra7xx_uart_hwmod_class = {
-       .name   = "uart",
-       .sysc   = &dra7xx_uart_sysc,
-};
-
-/* uart1 */
-static struct omap_hwmod dra7xx_uart1_hwmod = {
-       .name           = "uart1",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "uart1_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP2UART1_FLAGS,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_UART1_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_UART1_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart2 */
-static struct omap_hwmod dra7xx_uart2_hwmod = {
-       .name           = "uart2",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "uart2_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_UART2_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_UART2_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart3 */
-static struct omap_hwmod dra7xx_uart3_hwmod = {
-       .name           = "uart3",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "uart3_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP4UART3_FLAGS,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_UART3_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_UART3_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart4 */
-static struct omap_hwmod dra7xx_uart4_hwmod = {
-       .name           = "uart4",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "uart4_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP4UART4_FLAGS,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_UART4_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_UART4_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart5 */
-static struct omap_hwmod dra7xx_uart5_hwmod = {
-       .name           = "uart5",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per_clkdm",
-       .main_clk       = "uart5_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER_UART5_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER_UART5_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart6 */
-static struct omap_hwmod dra7xx_uart6_hwmod = {
-       .name           = "uart6",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "ipu_clkdm",
-       .main_clk       = "uart6_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_IPU_UART6_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_IPU_UART6_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart7 */
-static struct omap_hwmod dra7xx_uart7_hwmod = {
-       .name           = "uart7",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per2_clkdm",
-       .main_clk       = "uart7_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER2_UART7_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER2_UART7_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart8 */
-static struct omap_hwmod dra7xx_uart8_hwmod = {
-       .name           = "uart8",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per2_clkdm",
-       .main_clk       = "uart8_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER2_UART8_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER2_UART8_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart9 */
-static struct omap_hwmod dra7xx_uart9_hwmod = {
-       .name           = "uart9",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "l4per2_clkdm",
-       .main_clk       = "uart9_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_L4PER2_UART9_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_L4PER2_UART9_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-/* uart10 */
-static struct omap_hwmod dra7xx_uart10_hwmod = {
-       .name           = "uart10",
-       .class          = &dra7xx_uart_hwmod_class,
-       .clkdm_name     = "wkupaon_clkdm",
-       .main_clk       = "uart10_gfclk_mux",
-       .flags          = HWMOD_SWSUP_SIDLE_ACT,
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = DRA7XX_CM_WKUPAON_UART10_CLKCTRL_OFFSET,
-                       .context_offs = DRA7XX_RM_WKUPAON_UART10_CONTEXT_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 /* DES (the 'P' (public) device) */
 static struct omap_hwmod_class_sysconfig dra7xx_des_sysc = {
        .rev_offs       = 0x0030,
@@ -3113,70 +2510,6 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__elm = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_wkup -> gpio1 */
-static struct omap_hwmod_ocp_if dra7xx_l4_wkup__gpio1 = {
-       .master         = &dra7xx_l4_wkup_hwmod,
-       .slave          = &dra7xx_gpio1_hwmod,
-       .clk            = "wkupaon_iclk_mux",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio2 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio2 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio2_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio3 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio3 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio3_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio4 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio4 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio4_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio5 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio5 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio5_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio6 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio6 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio6_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio7 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio7 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio7_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> gpio8 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__gpio8 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_gpio8_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l3_main_1 -> gpmc */
 static struct omap_hwmod_ocp_if dra7xx_l3_main_1__gpmc = {
        .master         = &dra7xx_l3_main_1_hwmod,
@@ -3193,46 +2526,6 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__hdq1w = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per1 -> i2c1 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c1 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_i2c1_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> i2c2 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c2 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_i2c2_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> i2c3 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c3 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_i2c3_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> i2c4 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c4 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_i2c4_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> i2c5 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__i2c5 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_i2c5_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> mailbox1 */
 static struct omap_hwmod_ocp_if dra7xx_l4_cfg__mailbox1 = {
        .master         = &dra7xx_l4_cfg_hwmod,
@@ -3369,38 +2662,6 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__mcspi4 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per1 -> mmc1 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__mmc1 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_mmc1_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> mmc2 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__mmc2 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_mmc2_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> mmc3 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__mmc3 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_mmc3_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> mmc4 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__mmc4 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_mmc4_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_cfg -> mpu */
 static struct omap_hwmod_ocp_if dra7xx_l4_cfg__mpu = {
        .master         = &dra7xx_l4_cfg_hwmod,
@@ -3633,62 +2894,6 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per3__timer16 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per1 -> uart1 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart1 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart1_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> uart2 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart2 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart2_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> uart3 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart3 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart3_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> uart4 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart4 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart4_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> uart5 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart5 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart5_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per1 -> uart6 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per1__uart6 = {
-       .master         = &dra7xx_l4_per1_hwmod,
-       .slave          = &dra7xx_uart6_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per2 -> uart7 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart7 = {
-       .master         = &dra7xx_l4_per2_hwmod,
-       .slave          = &dra7xx_uart7_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_per1 -> des */
 static struct omap_hwmod_ocp_if dra7xx_l4_per1__des = {
        .master         = &dra7xx_l4_per1_hwmod,
@@ -3697,30 +2902,6 @@ static struct omap_hwmod_ocp_if dra7xx_l4_per1__des = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-/* l4_per2 -> uart8 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart8 = {
-       .master         = &dra7xx_l4_per2_hwmod,
-       .slave          = &dra7xx_uart8_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_per2 -> uart9 */
-static struct omap_hwmod_ocp_if dra7xx_l4_per2__uart9 = {
-       .master         = &dra7xx_l4_per2_hwmod,
-       .slave          = &dra7xx_uart9_hwmod,
-       .clk            = "l3_iclk_div",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
-/* l4_wkup -> uart10 */
-static struct omap_hwmod_ocp_if dra7xx_l4_wkup__uart10 = {
-       .master         = &dra7xx_l4_wkup_hwmod,
-       .slave          = &dra7xx_uart10_hwmod,
-       .clk            = "wkupaon_iclk_mux",
-       .user           = OCP_USER_MPU | OCP_USER_SDMA,
-};
-
 /* l4_per1 -> rng */
 static struct omap_hwmod_ocp_if dra7xx_l4_per1__rng = {
        .master         = &dra7xx_l4_per1_hwmod,
@@ -3866,21 +3047,8 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
        &dra7xx_l3_main_1__aes2,
        &dra7xx_l3_main_1__sha0,
        &dra7xx_l4_per1__elm,
-       &dra7xx_l4_wkup__gpio1,
-       &dra7xx_l4_per1__gpio2,
-       &dra7xx_l4_per1__gpio3,
-       &dra7xx_l4_per1__gpio4,
-       &dra7xx_l4_per1__gpio5,
-       &dra7xx_l4_per1__gpio6,
-       &dra7xx_l4_per1__gpio7,
-       &dra7xx_l4_per1__gpio8,
        &dra7xx_l3_main_1__gpmc,
        &dra7xx_l4_per1__hdq1w,
-       &dra7xx_l4_per1__i2c1,
-       &dra7xx_l4_per1__i2c2,
-       &dra7xx_l4_per1__i2c3,
-       &dra7xx_l4_per1__i2c4,
-       &dra7xx_l4_per1__i2c5,
        &dra7xx_l4_cfg__mailbox1,
        &dra7xx_l4_per3__mailbox2,
        &dra7xx_l4_per3__mailbox3,
@@ -3898,10 +3066,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
        &dra7xx_l4_per1__mcspi2,
        &dra7xx_l4_per1__mcspi3,
        &dra7xx_l4_per1__mcspi4,
-       &dra7xx_l4_per1__mmc1,
-       &dra7xx_l4_per1__mmc2,
-       &dra7xx_l4_per1__mmc3,
-       &dra7xx_l4_per1__mmc4,
        &dra7xx_l4_cfg__mpu,
        &dra7xx_l4_cfg__ocp2scp1,
        &dra7xx_l4_cfg__ocp2scp3,
@@ -3929,16 +3093,6 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
        &dra7xx_l4_per3__timer14,
        &dra7xx_l4_per3__timer15,
        &dra7xx_l4_per3__timer16,
-       &dra7xx_l4_per1__uart1,
-       &dra7xx_l4_per1__uart2,
-       &dra7xx_l4_per1__uart3,
-       &dra7xx_l4_per1__uart4,
-       &dra7xx_l4_per1__uart5,
-       &dra7xx_l4_per1__uart6,
-       &dra7xx_l4_per2__uart7,
-       &dra7xx_l4_per2__uart8,
-       &dra7xx_l4_per2__uart9,
-       &dra7xx_l4_wkup__uart10,
        &dra7xx_l4_per1__des,
        &dra7xx_l4_per3__usb_otg_ss1,
        &dra7xx_l4_per3__usb_otg_ss2,
index debcd88..83230d9 100644 (file)
@@ -484,7 +484,6 @@ static struct omap_hwmod_class_sysconfig dm81xx_gpio_sysc = {
 static struct omap_hwmod_class dm81xx_gpio_hwmod_class = {
        .name   = "gpio",
        .sysc   = &dm81xx_gpio_sysc,
-       .rev    = 2,
 };
 
 static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
index 724cf57..f11442e 100644 (file)
 #include <asm/suspend.h>
 #include <linux/errno.h>
 #include <linux/platform_data/pm33xx.h>
+#include <linux/clk.h>
+#include <linux/platform_data/gpio-omap.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/wkup_m3_ipc.h>
+#include <linux/of.h>
+#include <linux/rtc.h>
 
 #include "cm33xx.h"
 #include "common.h"
@@ -38,6 +44,29 @@ static int am43xx_map_scu(void)
        return 0;
 }
 
+static int am33xx_check_off_mode_enable(void)
+{
+       if (enable_off_mode)
+               pr_warn("WARNING: This platform does not support off-mode, entering DeepSleep suspend.\n");
+
+       /* off mode not supported on am335x so return 0 always */
+       return 0;
+}
+
+static int am43xx_check_off_mode_enable(void)
+{
+       /*
+        * Check for am437x-gp-evm which has the right Hardware design to
+        * support this mode reliably.
+        */
+       if (of_machine_is_compatible("ti,am437x-gp-evm") && enable_off_mode)
+               return enable_off_mode;
+       else if (enable_off_mode)
+               pr_warn("WARNING: This platform does not support off-mode, entering DeepSleep suspend.\n");
+
+       return 0;
+}
+
 static int amx3_common_init(void)
 {
        gfx_pwrdm = pwrdm_lookup("gfx_pwrdm");
@@ -51,10 +80,12 @@ static int amx3_common_init(void)
 
        /* CEFUSE domain can be turned off post bootup */
        cefuse_pwrdm = pwrdm_lookup("cefuse_pwrdm");
-       if (cefuse_pwrdm)
-               omap_set_pwrdm_state(cefuse_pwrdm, PWRDM_POWER_OFF);
-       else
+       if (!cefuse_pwrdm)
                pr_err("PM: Failed to get cefuse_pwrdm\n");
+       else if (omap_type() != OMAP2_DEVICE_TYPE_GP)
+               pr_info("PM: Leaving EFUSE power domain active\n");
+       else
+               omap_set_pwrdm_state(cefuse_pwrdm, PWRDM_POWER_OFF);
 
        return 0;
 }
@@ -139,7 +170,9 @@ static int am43xx_suspend(unsigned int state, int (*fn)(unsigned long),
        scu_power_mode(scu_base, SCU_PM_POWEROFF);
        ret = cpu_suspend(args, fn);
        scu_power_mode(scu_base, SCU_PM_NORMAL);
-       amx3_post_suspend_common();
+
+       if (!am43xx_check_off_mode_enable())
+               amx3_post_suspend_common();
 
        return ret;
 }
@@ -161,10 +194,48 @@ void __iomem *am43xx_get_rtc_base_addr(void)
        return omap_hwmod_get_mpu_rt_va(rtc_oh);
 }
 
+static void am43xx_save_context(void)
+{
+}
+
+static void am33xx_save_context(void)
+{
+       omap_intc_save_context();
+}
+
+static void am33xx_restore_context(void)
+{
+       omap_intc_restore_context();
+}
+
+static void am43xx_restore_context(void)
+{
+       /*
+        * HACK: restore dpll_per_clkdcoldo register contents, to avoid
+        * breaking suspend-resume
+        */
+       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,
        .soc_suspend = am33xx_suspend,
        .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,
 };
 
@@ -172,6 +243,11 @@ static struct am33xx_pm_platform_data am43xx_ops = {
        .init = am43xx_suspend_init,
        .soc_suspend = am43xx_suspend,
        .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,
 };
 
index 5b9343b..0c10314 100644 (file)
@@ -368,6 +368,9 @@ wait_emif_enable1:
        mov     r1, #AM43XX_EMIF_POWEROFF_DISABLE
        str     r1, [r2, #0x0]
 
+       ldr     r1, [r9, #EMIF_PM_RUN_HW_LEVELING]
+       blx     r1
+
 #ifdef CONFIG_CACHE_L2X0
        ldr     r2, l2_cache_base
        ldr     r0, [r2, #L2X0_CTRL]
index 0854ed9..248f6d9 100644 (file)
@@ -119,7 +119,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
        }
 
        sr_data->name = oh->name;
-       sr_data->ip_type = oh->class->rev;
+       if (cpu_is_omap343x())
+               sr_data->ip_type = 1;
+       else
+               sr_data->ip_type = 2;
        sr_data->senn_mod = 0x1;
        sr_data->senp_mod = 0x1;
 
index 38c45a8..cf9cb3d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_ORION5X
        bool "Marvell Orion"
        depends on MMU && ARCH_MULTI_V5
index c67f92b..7bcb411 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/serial_8250.h>
index e3610c5..bee5f64 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_OXNAS
        bool "Oxford Semiconductor OXNAS Family SoCs"
        select ARCH_HAS_RESET_CONTROLLER
index 61a34e1..0e78ecf 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMP)              += platsmp.o headsmp.o
index 1c8f701..b8eba18 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_PICOXCELL
        bool "Picochip PicoXcell"
        depends on ARCH_MULTI_V6
index 8e39f80..aef0393 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  := common.o
index 7426211..6f66785 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_SIRF
        bool "CSR SiRF"
        depends on ARCH_MULTI_V7
index ffe05c2..e2d158e 100644 (file)
@@ -1,14 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Defines machines for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <linux/of.h>
index 457eb7b..3bab7e5 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * This file contains common function prototypes to avoid externs in the c files.
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef __MACH_PRIMA2_COMMON_H__
index 6cf4fc6..88ea124 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Entry of the second core for CSR Marco dual-core SMP SoCs
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/linkage.h>
index b6cf152..bc0d957 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * CPU hotplug support for CSR Marco dual-core SMP SoCs
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
index d1f8b51..8f7bbb5 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * plat smp support for CSR Marco dual-core SMP SoCs
  *
  * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/init.h>
index b0bcf1f..c24bc89 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * power management entry for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
index bae6d77..0aff6cb 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * arch/arm/mach-prima2/pm.h
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef _MACH_PRIMA2_PM_H_
index 7c251eb..9d56606 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * reset controller for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
index d4852d2..97c0e33 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * RTC I/O Bridge interfaces for CSR SiRFprimaII/atlas7
  * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
index 0745abc..d9bbc5c 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * sleep mode for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/linkage.h>
index 8839c72..f60bc29 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_PXA
 
 menu "Intel PXA2xx/PXA3xx Implementations"
index 2c1ae92..bb6e353 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0xa0008000
 
index 4bcbd3d..1f24e02 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index e68acdd..510625d 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach-types.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <mach/audio.h>
 #include "colibri.h"
index 6a5558d..2f635bd 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/interrupt.h>
 
 #include <asm/mach-types.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
 
index 17067a3..ffcefe6 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/usb/gpio_vbus.h>
 
 #include <asm/mach-types.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
 
index e31a591..0c88e4e 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/etherdevice.h>
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/system_info.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
index 4764acc..eb03283 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index e9f401b..5c03c4f 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index c1bd0d5..8259398 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index d6e17d4..b3f8592 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index c76f1da..99a2ee4 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/memory.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index ab2f892..c4c25a2 100644 (file)
@@ -58,7 +58,7 @@
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/system_info.h>
 
 #include <asm/mach/arch.h>
index 46ed10a..ecbf3c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_QCOM
        bool "Qualcomm Support"
        depends on ARCH_MULTI_V7
index 12878e9..b839201 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMP)      += platsmp.o
index 4df8b8e..4d2e4e0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_RDA
        bool "RDA Micro SoCs"
        depends on ARCH_MULTI_V7
index 6bea3d3..f126d00 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj- += dummy.o
index 1d7c83e..44ebbf9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_REALVIEW
        bool "ARM Ltd. RealView family"
        depends on ARCH_MULTI_V5 || ARCH_MULTI_V6 || ARCH_MULTI_V7
index 6ca6400..e259091 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 8ca9265..b7855cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_ROCKCHIP
        bool "Rockchip RK2928 and RK3xxx SOCs"
        depends on ARCH_MULTI_V7
index 5c3a9b2..62596d5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS_platsmp.o := -march=armv7-a
 
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
index 51984a4..4675d92 100644 (file)
@@ -245,6 +245,7 @@ static int __init rockchip_smp_prepare_pmu(void)
        }
 
        pmu_base = of_iomap(node, 0);
+       of_node_put(node);
        if (!pmu_base) {
                pr_err("%s: could not map pmu registers\n", __func__);
                return -ENOMEM;
index 0592534..065b09e 100644 (file)
@@ -59,7 +59,7 @@ static inline u32 rk3288_l2_config(void)
        return l2ctlr;
 }
 
-static void rk3288_config_bootdata(void)
+static void __init rk3288_config_bootdata(void)
 {
        rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8);
        rkpm_bootdata_cpu_code = __pa_symbol(cpu_resume);
@@ -230,7 +230,7 @@ static void rk3288_suspend_finish(void)
                pr_err("%s: Suspend finish failed\n", __func__);
 }
 
-static int rk3288_suspend_init(struct device_node *np)
+static int __init rk3288_suspend_init(struct device_node *np)
 {
        struct device_node *sram_np;
        struct resource res;
index e41cabc..06ab03b 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/of_platform.h>
 #include <linux/irqchip.h>
 #include <linux/clk-provider.h>
index 2ebc687..056ef54 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index ae2df0d..0ed8e8f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x10008000
 params_phys-y  := 0x10000100
 initrd_phys-y  := 0x18000000
index 1b29757..f28ac6c 100644 (file)
@@ -15,7 +15,7 @@ extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
 
 #endif /* __ASSEMBLY__ */
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach/map.h>
 
 #endif /* __ASM_ARCH_HARDWARE_H */
index 76c4855..937d0a8 100644 (file)
@@ -328,6 +328,8 @@ static const struct {
        int num_i2c_devs;
        const struct spi_board_info *spi_devs;
        int num_spi_devs;
+
+       struct gpiod_lookup_table *gpiod_table;
 } gf_mods[] = {
        { .id = 0x01, .rev = 0xff, .name = "1250-EV1 Springbank" },
        { .id = 0x02, .rev = 0xff, .name = "1251-EV1 Jura" },
@@ -362,13 +364,16 @@ static const struct {
          .i2c_devs = wm1255_devs, .num_i2c_devs = ARRAY_SIZE(wm1255_devs) },
        { .id = 0x3c, .rev = 0xff, .name = "1273-EV1 Longmorn" },
        { .id = 0x3d, .rev = 0xff, .name = "1277-EV1 Littlemill",
-         .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) },
+         .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs),
+         .gpiod_table = &wm8994_gpiod_table },
        { .id = 0x3e, .rev = 0, .name = "WM5102-6271-EV1-CS127 Amrut",
          .spi_devs = wm5102_reva_spi_devs,
-         .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs) },
+         .num_spi_devs = ARRAY_SIZE(wm5102_reva_spi_devs),
+         .gpiod_table = &wm5102_reva_gpiod_table },
        { .id = 0x3e, .rev = -1, .name = "WM5102-6271-EV1-CS127 Amrut",
          .spi_devs = wm5102_spi_devs,
-         .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) },
+         .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs),
+         .gpiod_table = &wm5102_gpiod_table },
        { .id = 0x3f, .rev = -1, .name = "WM2200-6271-CS90-M-REV1",
          .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
 };
@@ -408,6 +413,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c,
 
                spi_register_board_info(gf_mods[i].spi_devs,
                                        gf_mods[i].num_spi_devs);
+
+               if (gf_mods[i].gpiod_table)
+                       gpiod_add_lookup_table(gf_mods[i].gpiod_table);
        } else {
                dev_warn(&i2c->dev, "Unknown module ID 0x%x revision %d\n",
                         id, rev + 1);
index ce41c67..66e79fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_SA1100
 
 menu "SA11x0 Implementations"
index f7951aa..9d8246f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifeq ($(CONFIG_SA1111),y)
    zreladdr-y  += 0xc0208000
 else
index fa5cf47..3b19296 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef __ASM_ARCH_MEMORY_H
 #define __ASM_ARCH_MEMORY_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /*
  * Because of the wide memory address space between physical RAM banks on the
index eb60a71..a671e4c 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
 #include <asm/hardware/sa1111.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <mach/hardware.h>
 #include <mach/assabet.h>
index 8c2a205..e84599d 100644 (file)
@@ -72,6 +72,7 @@ void __init rcar_gen2_pm_init(void)
        }
 
        error = of_address_to_resource(np, 0, &res);
+       of_node_put(np);
        if (error) {
                pr_err("Failed to get smp-sram address: %d\n", error);
                return;
index dc526ef..ee94925 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * R-Car Generation 2 da9063/da9210 regulator quirk
+ * R-Car Generation 2 da9063(L)/da9210 regulator quirk
  *
  * Certain Gen2 development boards have an da9063 and one or more da9210
  * regulators. All of these regulators have their interrupt request lines
@@ -65,6 +65,7 @@ static struct i2c_msg da9210_msg = {
 
 static const struct of_device_id rcar_gen2_quirk_match[] = {
        { .compatible = "dlg,da9063", .data = &da9063_msg },
+       { .compatible = "dlg,da9063l", .data = &da9063_msg },
        { .compatible = "dlg,da9210", .data = &da9210_msg },
        {},
 };
@@ -147,6 +148,7 @@ static int __init rcar_gen2_regulator_quirk(void)
 
        if (!of_machine_is_compatible("renesas,koelsch") &&
            !of_machine_is_compatible("renesas,lager") &&
+           !of_machine_is_compatible("renesas,porter") &&
            !of_machine_is_compatible("renesas,stout") &&
            !of_machine_is_compatible("renesas,gose"))
                return -ENODEV;
@@ -210,7 +212,7 @@ static int __init rcar_gen2_regulator_quirk(void)
                goto err_free;
        }
 
-       pr_info("IRQ2 is asserted, installing da9063/da9210 regulator quirk\n");
+       pr_info("IRQ2 is asserted, installing regulator quirk\n");
 
        bus_register_notifier(&i2c_bus_type, &regulator_quirk_nb);
        return 0;
index cc1745e..22af5e3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_SOCFPGA
        bool "Altera SOCFPGA family"
        depends on ARCH_MULTI_V7
index 816da0e..47ebcc8 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2012-2015 Altera Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
index 1b6cae5..20e2845 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SPEAr Platform configuration file
 #
index f8eeeff..b2d45cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_STI
        bool "STMicroelectronics Consumer Electronics SOCs"
        depends on ARCH_MULTI_V7
index f85ff05..7e2a582 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMP)              += platsmp.o
 obj-$(CONFIG_ARCH_STI)                 += board-dt.o
index 713c068..36e6c68 100644 (file)
@@ -1,9 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_STM32
        bool "STMicroelectronics STM32 family" if ARM_SINGLE_ARMV7M || ARCH_MULTI_V7
        select ARMV7M_SYSTICK if ARM_SINGLE_ARMV7M
        select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7
        select ARM_GIC if ARCH_MULTI_V7
        select ARM_PSCI if ARCH_MULTI_V7
+       select ARM_AMBA
        select ARCH_HAS_RESET_CONTROLLER
        select CLKSRC_STM32
        select PINCTRL
@@ -18,22 +20,18 @@ if ARM_SINGLE_ARMV7M
 
 config MACH_STM32F429
        bool "STMicroelectronics STM32F429"
-       select ARM_AMBA
        default y
 
 config MACH_STM32F469
        bool "STMicroelectronics STM32F469"
-       select ARM_AMBA
        default y
 
 config MACH_STM32F746
        bool "STMicroelectronics STM32F746"
-       select ARM_AMBA
        default y
 
 config MACH_STM32F769
        bool "STMicroelectronics STM32F769"
-       select ARM_AMBA
        default y
 
 config MACH_STM32H743
index bd0b7b5..c80d80c 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += board-dt.o
index eacfc3f..cec195d 100644 (file)
@@ -1,3 +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 .
index 7fa6a3d..eeadb1a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ARCH_SUNXI
        bool "Allwinner SoCs"
        depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
index 71429aa..146e623 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS_mc_smp.o        += -march=armv7-a
 
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
index b4037b6..239084c 100644 (file)
@@ -89,6 +89,7 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster)
 {
        struct device_node *node;
        int cpu = cluster * SUNXI_CPUS_PER_CLUSTER + core;
+       bool is_compatible;
 
        node = of_cpu_device_node_get(cpu);
 
@@ -107,7 +108,9 @@ static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster)
                return false;
        }
 
-       return of_device_is_compatible(node, "arm,cortex-a15");
+       is_compatible = of_device_is_compatible(node, "arm,cortex-a15");
+       of_node_put(node);
+       return is_compatible;
 }
 
 static int sunxi_cpu_power_switch_set(unsigned int cpu, unsigned int cluster,
index 8fb5088..bdde9ef 100644 (file)
@@ -50,6 +50,7 @@ static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus)
        }
 
        prcm_membase = of_iomap(node, 0);
+       of_node_put(node);
        if (!prcm_membase) {
                pr_err("Couldn't map A31 PRCM registers\n");
                return;
@@ -63,6 +64,7 @@ static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus)
        }
 
        cpucfg_membase = of_iomap(node, 0);
+       of_node_put(node);
        if (!cpucfg_membase)
                pr_err("Couldn't map A31 CPU config registers\n");
 
@@ -133,6 +135,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus)
        }
 
        prcm_membase = of_iomap(node, 0);
+       of_node_put(node);
        if (!prcm_membase) {
                pr_err("Couldn't map A23 PRCM registers\n");
                return;
@@ -146,6 +149,7 @@ static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus)
        }
 
        cpucfg_membase = of_iomap(node, 0);
+       of_node_put(node);
        if (!cpucfg_membase)
                pr_err("Couldn't map A23 CPU config registers\n");
 
index 7f3b83e..3a06ba2 100644 (file)
@@ -2,7 +2,7 @@
 menuconfig ARCH_TEGRA
        bool "NVIDIA Tegra"
        depends on ARCH_MULTI_V7
-       select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
+       select ARCH_HAS_RESET_CONTROLLER
        select ARM_AMBA
        select ARM_GIC
        select CLKSRC_MMIO
@@ -10,8 +10,8 @@ menuconfig ARCH_TEGRA
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
        select PINCTRL
+       select PM
        select PM_OPP
-       select ARCH_HAS_RESET_CONTROLLER
        select RESET_CONTROLLER
        select SOC_BUS
        select ZONE_DMA if ARM_LPAE
index e3fbcfe..43c695d 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 
+#include <linux/firmware/trusted_foundations.h>
+
 #include <asm/cpuidle.h>
 #include <asm/smp_plat.h>
 #include <asm/suspend.h>
@@ -46,7 +48,7 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev,
        tegra_set_cpu_in_lp2();
        cpu_pm_enter();
 
-       call_firmware_op(prepare_idle);
+       call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
 
        /* Do suspend by ourselves if the firmware does not implement it */
        if (call_firmware_op(do_idle, 0) == -ENOSYS)
index 3f24add..6620d61 100644 (file)
@@ -61,7 +61,8 @@ static struct cpuidle_driver tegra_idle_driver = {
                        .exit_latency     = 5000,
                        .target_residency = 10000,
                        .power_usage      = 0,
-                       .flags            = CPUIDLE_FLAG_COUPLED,
+                       .flags            = CPUIDLE_FLAG_COUPLED |
+                                           CPUIDLE_FLAG_TIMER_STOP,
                        .name             = "powered-down",
                        .desc             = "CPU power gated",
                },
@@ -136,12 +137,8 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
        if (tegra20_reset_cpu_1() || !tegra_cpu_rail_off_ready())
                return false;
 
-       tick_broadcast_enter();
-
        tegra_idle_lp2_last();
 
-       tick_broadcast_exit();
-
        if (cpu_online(1))
                tegra20_wake_cpu1_from_reset();
 
@@ -153,14 +150,10 @@ static bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
                                         struct cpuidle_driver *drv,
                                         int index)
 {
-       tick_broadcast_enter();
-
        cpu_suspend(0, tegra20_sleep_cpu_secondary_finish);
 
        tegra20_cpu_clear_resettable();
 
-       tick_broadcast_exit();
-
        return true;
 }
 #else
index c141736..c8fe044 100644 (file)
@@ -56,6 +56,7 @@ static struct cpuidle_driver tegra_idle_driver = {
                        .exit_latency           = 2000,
                        .target_residency       = 2200,
                        .power_usage            = 0,
+                       .flags                  = CPUIDLE_FLAG_TIMER_STOP,
                        .name                   = "powered-down",
                        .desc                   = "CPU power gated",
                },
@@ -76,12 +77,8 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
                return false;
        }
 
-       tick_broadcast_enter();
-
        tegra_idle_lp2_last();
 
-       tick_broadcast_exit();
-
        return true;
 }
 
@@ -90,14 +87,10 @@ static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
                                        struct cpuidle_driver *drv,
                                        int index)
 {
-       tick_broadcast_enter();
-
        smp_wmb();
 
        cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
 
-       tick_broadcast_exit();
-
        return true;
 }
 #else
index 9bc291e..ba61db7 100644 (file)
@@ -20,7 +20,7 @@
 #define __MACH_TEGRA_IOMAP_H
 
 #include <asm/pgtable.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #define TEGRA_IRAM_BASE                        0x40000000
 #define TEGRA_IRAM_SIZE                        SZ_256K
 #define TEGRA_PMC_BASE                 0x7000E400
 #define TEGRA_PMC_SIZE                 SZ_256
 
-#define TEGRA_MC_BASE                  0x7000F000
-#define TEGRA_MC_SIZE                  SZ_1K
-
 #define TEGRA_EMC_BASE                 0x7000F400
 #define TEGRA_EMC_SIZE                 SZ_1K
 
-#define TEGRA114_MC_BASE               0x70019000
-#define TEGRA114_MC_SIZE               SZ_4K
-
 #define TEGRA_EMC0_BASE                        0x7001A000
 #define TEGRA_EMC0_SIZE                        SZ_2K
 
 #define TEGRA_EMC1_BASE                        0x7001A800
 #define TEGRA_EMC1_SIZE                        SZ_2K
 
-#define TEGRA124_MC_BASE               0x70019000
-#define TEGRA124_MC_SIZE               SZ_4K
-
 #define TEGRA124_EMC_BASE              0x7001B000
 #define TEGRA124_EMC_SIZE              SZ_2K
 
index e32e174..6a7bb88 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __MACH_TEGRA_IRAMMAP_H
 #define __MACH_TEGRA_IRAMMAP_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /* The first 1K of IRAM is permanently reserved for the CPU reset handler */
 #define TEGRA_IRAM_RESET_HANDLER_OFFSET        0
index 1ad5719..1b0ade0 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/suspend.h>
 
+#include <linux/firmware/trusted_foundations.h>
+
 #include <soc/tegra/flowctrl.h>
 #include <soc/tegra/fuse.h>
 #include <soc/tegra/pm.h>
 #include <soc/tegra/pmc.h>
 
 #include <asm/cacheflush.h>
+#include <asm/firmware.h>
 #include <asm/idmap.h>
 #include <asm/proc-fns.h>
 #include <asm/smp_plat.h>
@@ -159,6 +162,28 @@ int tegra_cpu_do_idle(void)
 
 static int tegra_sleep_cpu(unsigned long v2p)
 {
+       /*
+        * L2 cache disabling using kernel API only allowed when all
+        * secondary CPU's are offline. Cache have to be disabled with
+        * MMU-on if cache maintenance is done via Trusted Foundations
+        * firmware. Note that CPUIDLE won't ever enter powergate on Tegra30
+        * if any of secondary CPU's is online and this is the LP2-idle
+        * code-path only for Tegra20/30.
+        */
+       if (trusted_foundations_registered())
+               outer_disable();
+
+       /*
+        * Note that besides of setting up CPU reset vector this firmware
+        * call may also do the following, depending on the FW version:
+        *  1) Disable L2. But this doesn't matter since we already
+        *     disabled the L2.
+        *  2) Disable D-cache. This need to be taken into account in
+        *     particular by the tegra_disable_clean_inv_dcache() which
+        *     shall avoid the re-disable.
+        */
+       call_firmware_op(prepare_idle, TF_PM_MODE_LP2);
+
        setup_mm_for_reboot();
        tegra_sleep_cpu_finish(v2p);
 
@@ -197,6 +222,14 @@ void tegra_idle_lp2_last(void)
 
        cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
 
+       /*
+        * Resume L2 cache if it wasn't re-enabled early during resume,
+        * which is the case for Tegra30 that has to re-enable the cache
+        * via firmware call. In other cases cache is already enabled and
+        * hence re-enabling is a no-op. This is always a no-op on Tegra114+.
+        */
+       outer_resume();
+
        restore_cpu_complex();
        cpu_cluster_pm_exit();
 }
@@ -215,6 +248,15 @@ enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
 
 static int tegra_sleep_core(unsigned long v2p)
 {
+       /*
+        * Cache have to be disabled with MMU-on if cache maintenance is done
+        * via Trusted Foundations firmware. This is a no-op on Tegra114+.
+        */
+       if (trusted_foundations_registered())
+               outer_disable();
+
+       call_firmware_op(prepare_idle, TF_PM_MODE_LP1);
+
        setup_mm_for_reboot();
        tegra_sleep_core_finish(v2p);
 
@@ -342,6 +384,14 @@ static int tegra_suspend_enter(suspend_state_t state)
 
        cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, tegra_sleep_func);
 
+       /*
+        * Resume L2 cache if it wasn't re-enabled early during resume,
+        * which is the case for Tegra30 that has to re-enable the cache
+        * via firmware call. In other cases cache is already enabled and
+        * hence re-enabling is a no-op.
+        */
+       outer_resume();
+
        switch (mode) {
        case TEGRA_SUSPEND_LP1:
                tegra_suspend_exit_lp1();
index e22ccf8..cd94d7c 100644 (file)
@@ -20,6 +20,7 @@
 #include <soc/tegra/flowctrl.h>
 #include <soc/tegra/fuse.h>
 
+#include <asm/assembler.h>
 #include <asm/asm-offsets.h>
 #include <asm/cache.h>
 
@@ -29,8 +30,6 @@
 
 #define PMC_SCRATCH41  0x140
 
-#define RESET_DATA(x)  ((TEGRA_RESET_##x)*4)
-
 #ifdef CONFIG_PM_SLEEP
 /*
  *     tegra_resume
@@ -78,6 +77,7 @@ ENTRY(tegra_resume)
        orr     r1, r1, #1
        str     r1, [r0]
 #endif
+       bl      tegra_resume_trusted_foundations
 
 #ifdef CONFIG_CACHE_L2X0
        /* L2 cache resume & re-enable */
@@ -90,6 +90,30 @@ end_ca9_scu_l2_resume:
 
        b       cpu_resume
 ENDPROC(tegra_resume)
+
+/*
+ *     tegra_resume_trusted_foundations
+ *
+ *       Trusted Foundations firmware initialization.
+ *
+ *     Doesn't return if firmware presents.
+ *     Corrupted registers: r1, r2
+ */
+ENTRY(tegra_resume_trusted_foundations)
+       /* Check whether Trusted Foundations firmware presents. */
+       mov32   r2, TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET
+       ldr     r1, =__tegra_cpu_reset_handler_data_offset + \
+                                                       RESET_DATA(TF_PRESENT)
+       ldr     r1, [r2, r1]
+       cmp     r1, #0
+       reteq   lr
+
+ .arch_extension sec
+       /* First call after suspend wakes firmware. No arguments required. */
+       smc     #0
+
+       b       cpu_resume
+ENDPROC(tegra_resume_trusted_foundations)
 #endif
 
        .align L1_CACHE_SHIFT
@@ -115,12 +139,19 @@ ENTRY(__tegra_cpu_reset_handler_start)
  *       must be position-independent.
  */
 
+       .arm
        .align L1_CACHE_SHIFT
 ENTRY(__tegra_cpu_reset_handler)
 
        cpsid   aif, 0x13                       @ SVC mode, interrupts disabled
 
        tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
+
+       adr     r12, __tegra_cpu_reset_handler_data
+       ldr     r5, [r12, #RESET_DATA(TF_PRESENT)]
+       cmp     r5, #0
+       bne     after_errata
+
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
 t20_check:
        cmp     r6, #TEGRA20
@@ -155,7 +186,6 @@ after_errata:
        and     r10, r10, #0x3                  @ R10 = CPU number
        mov     r11, #1
        mov     r11, r11, lsl r10               @ R11 = CPU mask
-       adr     r12, __tegra_cpu_reset_handler_data
 
 #ifdef CONFIG_SMP
        /* Does the OS know about this CPU? */
@@ -169,10 +199,9 @@ after_errata:
        cmp     r6, #TEGRA20
        bne     1f
        /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
-       mov32   r5, TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET
        mov     r0, #CPU_NOT_RESETTABLE
        cmp     r10, #0
-       strbne  r0, [r5, #__tegra20_cpu1_resettable_status_offset]
+       strbne  r0, [r12, #RESET_DATA(RESETTABLE_STATUS)]
 1:
 #endif
 
@@ -277,14 +306,13 @@ ENDPROC(__tegra_cpu_reset_handler)
        .align L1_CACHE_SHIFT
        .type   __tegra_cpu_reset_handler_data, %object
        .globl  __tegra_cpu_reset_handler_data
+       .globl  __tegra_cpu_reset_handler_data_offset
+       .equ    __tegra_cpu_reset_handler_data_offset, \
+                                       . - __tegra_cpu_reset_handler_start
 __tegra_cpu_reset_handler_data:
-       .rept   TEGRA_RESET_DATA_SIZE
-       .long   0
+       .rept   TEGRA_RESET_DATA_SIZE
+       .long   0
        .endr
-       .globl  __tegra20_cpu1_resettable_status_offset
-       .equ    __tegra20_cpu1_resettable_status_offset, \
-                                       . - __tegra_cpu_reset_handler_start
-       .byte   0
        .align L1_CACHE_SHIFT
 
 ENTRY(__tegra_cpu_reset_handler_end)
index dc55889..35dc5d4 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
+#include <linux/firmware/trusted_foundations.h>
+
 #include <soc/tegra/fuse.h>
 
 #include <asm/cacheflush.h>
@@ -89,6 +91,8 @@ static void __init tegra_cpu_reset_handler_enable(void)
 
 void __init tegra_cpu_reset_handler_init(void)
 {
+       __tegra_cpu_reset_handler_data[TEGRA_RESET_TF_PRESENT] =
+               trusted_foundations_registered();
 
 #ifdef CONFIG_SMP
        __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
index 9c479c7..db0e6b3 100644 (file)
 #define TEGRA_RESET_STARTUP_SECONDARY  3
 #define TEGRA_RESET_STARTUP_LP2                4
 #define TEGRA_RESET_STARTUP_LP1                5
-#define TEGRA_RESET_DATA_SIZE          6
+#define TEGRA_RESET_RESETTABLE_STATUS  6
+#define TEGRA_RESET_TF_PRESENT         7
+#define TEGRA_RESET_DATA_SIZE          8
+
+#define RESET_DATA(x)  ((TEGRA_RESET_##x)*4)
 
 #ifndef __ASSEMBLY__
 
@@ -49,7 +53,8 @@ void __tegra_cpu_reset_handler_end(void);
         (u32)__tegra_cpu_reset_handler_start)))
 #define tegra20_cpu1_resettable_status \
        (IO_ADDRESS(TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET + \
-        (u32)__tegra20_cpu1_resettable_status_offset))
+       ((u32)&__tegra_cpu_reset_handler_data[TEGRA_RESET_RESETTABLE_STATUS] - \
+        (u32)__tegra_cpu_reset_handler_start)))
 #endif
 
 #define tegra_cpu_reset_handler_offset \
index dedeebf..50d51d3 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/cache.h>
 
 #include "irammap.h"
+#include "reset.h"
 #include "sleep.h"
 
 #define EMC_CFG                                0xc
@@ -53,6 +54,9 @@
 #define APB_MISC_XM2CFGCPADCTRL2       0x8e4
 #define APB_MISC_XM2CFGDPADCTRL2       0x8e8
 
+#define __tegra20_cpu1_resettable_status_offset \
+       (__tegra_cpu_reset_handler_data_offset + RESET_DATA(RESETTABLE_STATUS))
+
 .macro pll_enable, rd, r_car_base, pll_base
        ldr     \rd, [\r_car_base, #\pll_base]
        tst     \rd, #(1 << 30)
index d0b4c48..7727e00 100644 (file)
@@ -44,8 +44,6 @@
 #define EMC_XM2VTTGENPADCTRL           0x310
 #define EMC_XM2VTTGENPADCTRL2          0x314
 
-#define MC_EMEM_ARB_CFG                        0x90
-
 #define PMC_CTRL                       0x0
 #define PMC_CTRL_SIDE_EFFECT_LP0 (1 << 14) /* enter LP0 when CPU pwr gated */
 
@@ -420,22 +418,6 @@ _pll_m_c_x_done:
        movweq  r0, #:lower16:TEGRA124_EMC_BASE
        movteq  r0, #:upper16:TEGRA124_EMC_BASE
 
-       cmp     r10, #TEGRA30
-       moveq   r2, #0x20
-       movweq  r4, #:lower16:TEGRA_MC_BASE
-       movteq  r4, #:upper16:TEGRA_MC_BASE
-       cmp     r10, #TEGRA114
-       moveq   r2, #0x34
-       movweq  r4, #:lower16:TEGRA114_MC_BASE
-       movteq  r4, #:upper16:TEGRA114_MC_BASE
-       cmp     r10, #TEGRA124
-       moveq   r2, #0x20
-       movweq  r4, #:lower16:TEGRA124_MC_BASE
-       movteq  r4, #:upper16:TEGRA124_MC_BASE
-
-       ldr     r1, [r5, r2]            @ restore MC_EMEM_ARB_CFG
-       str     r1, [r4, #MC_EMEM_ARB_CFG]
-
 exit_self_refresh:
        ldr     r1, [r5, #0xC]          @ restore EMC_XM2VTTGENPADCTRL
        str     r1, [r0, #EMC_XM2VTTGENPADCTRL]
@@ -564,7 +546,6 @@ tegra30_sdram_pad_address:
        .word   TEGRA_PMC_BASE + PMC_IO_DPD_STATUS                      @0x14
        .word   TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT     @0x18
        .word   TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST             @0x1c
-       .word   TEGRA_MC_BASE + MC_EMEM_ARB_CFG                         @0x20
 tegra30_sdram_pad_address_end:
 
 tegra114_sdram_pad_address:
@@ -581,7 +562,6 @@ tegra114_sdram_pad_address:
        .word   TEGRA_EMC1_BASE + EMC_AUTO_CAL_INTERVAL                 @0x28
        .word   TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL                  @0x2c
        .word   TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2                 @0x30
-       .word   TEGRA114_MC_BASE + MC_EMEM_ARB_CFG                      @0x34
 tegra114_sdram_pad_adress_end:
 
 tegra124_sdram_pad_address:
@@ -593,7 +573,6 @@ tegra124_sdram_pad_address:
        .word   TEGRA_PMC_BASE + PMC_IO_DPD_STATUS                      @0x14
        .word   TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT     @0x18
        .word   TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST             @0x1c
-       .word   TEGRA124_MC_BASE + MC_EMEM_ARB_CFG                      @0x20
 tegra124_sdram_pad_address_end:
 
 tegra30_sdram_pad_size:
index 5e34967..8f88944 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * arch/arm/mach-tegra/sleep.S
  *
@@ -6,20 +7,6 @@
  *
  * Author: Colin Cross <ccross@android.com>
  *         Gary King <gking@nvidia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #include <linux/linkage.h>
@@ -49,8 +36,9 @@ ENTRY(tegra_disable_clean_inv_dcache)
 
        /* Disable the D-cache */
        mrc     p15, 0, r2, c1, c0, 0
+       tst     r2, #CR_C                       @ see tegra_sleep_cpu()
        bic     r2, r2, #CR_C
-       mcr     p15, 0, r2, c1, c0, 0
+       mcrne   p15, 0, r2, c1, c0, 0
        isb
 
        /* Flush the D-cache */
@@ -132,10 +120,13 @@ ENTRY(tegra_shut_off_mmu)
 #ifdef CONFIG_CACHE_L2X0
        /* Disable L2 cache */
        check_cpu_part_num 0xc09, r9, r10
-       movweq  r2, #:lower16:(TEGRA_ARM_PERIF_BASE + 0x3000)
-       movteq  r2, #:upper16:(TEGRA_ARM_PERIF_BASE + 0x3000)
-       moveq   r3, #0
-       streq   r3, [r2, #L2X0_CTRL]
+       retne   r0
+
+       mov32   r2, TEGRA_ARM_PERIF_BASE + 0x3000
+       ldr     r3, [r2, #L2X0_CTRL]
+       tst     r3, #L2X0_CTRL_EN               @ see tegra_sleep_cpu()
+       mov     r3, #0
+       strne   r3, [r2, #L2X0_CTRL]
 #endif
        ret     r0
 ENDPROC(tegra_shut_off_mmu)
index f9587be..3e88f67 100644 (file)
 #include <linux/sys_soc.h>
 #include <linux/usb/tegra_usb_phy.h>
 
+#include <linux/firmware/trusted_foundations.h>
+
 #include <soc/tegra/fuse.h>
 #include <soc/tegra/pmc.h>
 
+#include <asm/firmware.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach-types.h>
 #include <asm/setup.h>
-#include <asm/trusted_foundations.h>
 
 #include "board.h"
 #include "common.h"
@@ -74,6 +76,7 @@ static void __init tegra_init_early(void)
 {
        of_register_trusted_foundations();
        tegra_cpu_reset_handler_init();
+       call_firmware_op(l2x0_init);
 }
 
 static void __init tegra_dt_init_irq(void)
index 5a8804f..67f71ae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel, U300 machine.
 #
index 595b574..96ec72b 100644 (file)
@@ -130,3 +130,5 @@ static int __init u300_init_boardpower(void)
 }
 
 device_initcall(u300_init_boardpower);
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Linus Walleij");
index a9a3453..5e90324 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel, U8500 machine.
 #
index 41b124b..2b90771 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index eacfc3f..cec195d 100644 (file)
@@ -1,3 +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 .
index 4c8a846..ccf9a3b 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARCH_VT8500) += vt8500.o
index b79c41c..883985f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
    zreladdr-y  += 0x00008000
 params_phys-y  := 0x00000100
 initrd_phys-y  := 0x01000000
index 6c3d421..07d1b3b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 zreladdr-y     += 0x00008000
 params_phys-y  := 0x00000100
 
index fe3c626..2e6555d 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach/map.h>
 
 #endif /* __ASM_ARCH_HARDWARE_H */
index a4b4864..6f8930c 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SOC_ZX296702) += zx296702.o zx296702-pm-domain.o
 obj-$(CONFIG_SMP) += headsmp.o platsmp.o
index b03a97e..9df74cd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 6aba9eb..7f634ea 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/cpumask.h>
 #include <linux/platform_device.h>
index fa44fc1..8ba450a 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Zynq power management
  *
  *  Copyright (C) 2012 - 2014 Xilinx
  *
  *  Sören Brinkmann <soren.brinkmann@xilinx.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/io.h>
index 68dcd5f..be0b429 100644 (file)
@@ -182,21 +182,6 @@ int pfn_valid(unsigned long pfn)
 EXPORT_SYMBOL(pfn_valid);
 #endif
 
-#ifndef CONFIG_SPARSEMEM
-static void __init arm_memory_present(void)
-{
-}
-#else
-static void __init arm_memory_present(void)
-{
-       struct memblock_region *reg;
-
-       for_each_memblock(memory, reg)
-               memory_present(0, memblock_region_memory_base_pfn(reg),
-                              memblock_region_memory_end_pfn(reg));
-}
-#endif
-
 static bool arm_memblock_steal_permitted = true;
 
 phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
@@ -293,7 +278,7 @@ void __init bootmem_init(void)
         * Sparsemem tries to allocate bootmem in memory_present(),
         * so must be done after the fixed reservations
         */
-       arm_memory_present();
+       memblocks_present();
 
        /*
         * sparse_init() needs the bootmem allocator up and running.
index 5bf9443..d42b933 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/arch/arm/mm/ioremap.c
  *
index 7d67c70..24ecf8d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/arch/arm/mm/nommu.c
  *
index c2c1084..3354b3e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ARM-specific networking code
 
 obj-$(CONFIG_BPF_JIT) += bpf_jit_32.o
index 7215ada..371f2ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 9433605..4e3f25d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index da53395..6f7a0a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if PLAT_PXA
 
 config PXA_SSP
index 2f06a2e..349ea0a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for code common across different PXA processor families
 #
index f519199..bf25f78 100644 (file)
@@ -183,18 +183,12 @@ static int pxa_ssp_probe(struct platform_device *pdev)
 
 static int pxa_ssp_remove(struct platform_device *pdev)
 {
-       struct resource *res;
        struct ssp_device *ssp;
 
        ssp = platform_get_drvdata(pdev);
        if (ssp == NULL)
                return -ENODEV;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       release_mem_region(res->start, resource_size(res));
-
-       clk_put(ssp->clk);
-
        mutex_lock(&ssp_lock);
        list_del(&ssp->node);
        mutex_unlock(&ssp_lock);
index 98b9b8e..748238f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if PLAT_VERSATILE
 
 config PLAT_VERSATILE_SCHED_CLOCK
index b2f0ddf..e856f0a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
 
 obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
index e1dc3d0..57fffd7 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_UPROBES)          += core.o actions-arm.o
index 0393917..aaf479a 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index f4efff9..fadf554 100644 (file)
@@ -10,12 +10,12 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
 ccflags-y += -DDISABLE_BRANCH_PROFILING
 
-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
-VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
-VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
-VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)
+ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
+           -z max-page-size=4096 -z common-page-size=4096 \
+           -nostdlib -shared \
+           $(call ld-option, --hash-style=sysv) \
+           $(call ld-option, --build-id) \
+           -T
 
 obj-$(CONFIG_VDSO) += vdso.o
 extra-$(CONFIG_VDSO) += vdso.lds
@@ -37,8 +37,8 @@ KCOV_INSTRUMENT := n
 $(obj)/vdso.o : $(obj)/vdso.so
 
 # Link rule for the .so file
-$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
-       $(call if_changed,vdsold)
+$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+       $(call if_changed,ld)
 
 $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
        $(call if_changed,vdsomunge)
@@ -48,11 +48,6 @@ $(obj)/%.so: OBJCOPYFLAGS := -S
 $(obj)/%.so: $(obj)/%.so.dbg FORCE
        $(call if_changed,objcopy)
 
-# Actual build commands
-quiet_cmd_vdsold = VDSO    $@
-      cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
-                   -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
-
 quiet_cmd_vdsomunge = MUNGE   $@
       cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
 
index 94516c4..9975b63 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # linux/arch/arm/vfp/Makefile
 #
index 2279521..7ed2898 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y          := enlighten.o hypercall.o grant-table.o p2m.o mm.o
 obj-$(CONFIG_XEN_EFI) += efi.o
index b4d7895..d687a73 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015, Linaro Limited, Shannon Zhao
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/efi.h>
index 17e4789..1e57692 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <xen/xen.h>
 #include <xen/events.h>
 #include <xen/grant_table.h>
index e1d44b9..d33b77e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/cpu.h>
 #include <linux/dma-mapping.h>
 #include <linux/gfp.h>
index e70a49f..e52950a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/memblock.h>
 #include <linux/gfp.h>
 #include <linux/export.h>
@@ -70,8 +71,9 @@ unsigned long __pfn_to_mfn(unsigned long pfn)
                entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys);
                if (entry->pfn <= pfn &&
                                entry->pfn + entry->nr_pages > pfn) {
+                       unsigned long mfn = entry->mfn + (pfn - entry->pfn);
                        read_unlock_irqrestore(&p2m_lock, irqflags);
-                       return entry->mfn + (pfn - entry->pfn);
+                       return mfn;
                }
                if (pfn < entry->pfn)
                        n = n->rb_left;
@@ -156,6 +158,7 @@ bool __set_phys_to_machine_multi(unsigned long pfn,
        rc = xen_add_phys_to_mach_entry(p2m_entry);
        if (rc < 0) {
                write_unlock_irqrestore(&p2m_lock, irqflags);
+               kfree(p2m_entry);
                return false;
        }
        write_unlock_irqrestore(&p2m_lock, irqflags);
index 69a59a5..ca9c175 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARM64
        def_bool y
        select ACPI_CCA_REQUIRED if ACPI
@@ -68,7 +69,7 @@ config ARM64
        select ARCH_SUPPORTS_ATOMIC_RMW
        select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG
        select ARCH_SUPPORTS_NUMA_BALANCING
-       select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
+       select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARM_AMBA
@@ -1341,6 +1342,7 @@ menu "ARMv8.3 architectural features"
 config ARM64_PTR_AUTH
        bool "Enable support for pointer authentication"
        default y
+       depends on !KVM || ARM64_VHE
        help
          Pointer authentication (part of the ARMv8.3 Extensions) provides
          instructions for signing and authenticating pointers against secret
@@ -1354,8 +1356,9 @@ config ARM64_PTR_AUTH
          context-switched along with the process.
 
          The feature is detected at runtime. If the feature is not present in
-         hardware it will not be advertised to userspace nor will it be
-         enabled.
+         hardware it will not be advertised to userspace/KVM guest nor will it
+         be enabled. However, KVM guest also require VHE mode and hence
+         CONFIG_ARM64_VHE=y option to use this feature.
 
 endmenu
 
index 69c9170..cf09010 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config ARM64_PTDUMP_CORE
        def_bool n
index b5ca9c5..c7ad684 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Platform selection"
 
 config ARCH_ACTIONS
@@ -7,6 +8,11 @@ config ARCH_ACTIONS
        help
          This enables support for the Actions Semiconductor S900 SoC family.
 
+config ARCH_AGILEX
+       bool "Intel's Agilex SoCFPGA Family"
+       help
+         This enables support for Intel's Agilex SoCFPGA Family.
+
 config ARCH_SUNXI
        bool "Allwinner sunxi 64-bit SoC Family"
        select ARCH_HAS_RESET_CONTROLLER
@@ -82,6 +88,11 @@ config ARCH_EXYNOS
 config ARCH_K3
        bool "Texas Instruments Inc. K3 multicore SoC architecture"
        select PM_GENERIC_DOMAINS if PM
+       select MAILBOX
+       select TI_MESSAGE_MANAGER
+       select TI_SCI_PROTOCOL
+       select TI_SCI_INTR_IRQCHIP
+       select TI_SCI_INTA_IRQCHIP
        help
          This enables support for Texas Instruments' K3 multicore SoC
          architecture.
@@ -210,6 +221,7 @@ config ARCH_SYNQUACER
 config ARCH_TEGRA
        bool "NVIDIA Tegra SoC Family"
        select ARCH_HAS_RESET_CONTROLLER
+       select ARM_GIC_PM
        select CLKDEV_LOOKUP
        select CLKSRC_MMIO
        select TIMER_OF
index 5bc7533..f19b762 100644 (file)
@@ -13,6 +13,7 @@ subdir-y += cavium
 subdir-y += exynos
 subdir-y += freescale
 subdir-y += hisilicon
+subdir-y += intel
 subdir-y += lg
 subdir-y += marvell
 subdir-y += mediatek
index 036e387..d79822d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_ARCH_ALPINE)      += alpine-v2-evp.dtb
index 0b09171..f6db061 100644 (file)
@@ -2,6 +2,7 @@
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-amarula-relic.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-bananapi-m64.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-nanopi-a64.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-oceanic-5205-5inmfd.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-olinuxino.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-orangepi-win.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-lts.dtb
@@ -19,6 +20,8 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-beelink-gs1.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-3.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-lite2.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-one-plus.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-pine-h64.dtb
index 6cb2b7f..019ae09 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
+       i2c {
+               compatible = "i2c-gpio";
+               sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>;
+               scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>;
+               i2c-gpio,delay-us = <5>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ov5640: camera@3c {
+                       compatible = "ovti,ov5640";
+                       reg = <0x3c>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&csi_mclk_pin>;
+                       clocks = <&ccu CLK_CSI_MCLK>;
+                       clock-names = "xclk";
+
+                       AVDD-supply = <&reg_aldo1>;
+                       DOVDD-supply = <&reg_dldo3>;
+                       DVDD-supply = <&reg_eldo3>;
+                       reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE14 */
+                       powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE15 */
+
+                       port {
+                               ov5640_ep: endpoint {
+                                       remote-endpoint = <&csi_ep>;
+                                       bus-width = <8>;
+                                       hsync-active = <1>; /* Active high */
+                                       vsync-active = <0>; /* Active low */
+                                       data-active = <1>;  /* Active high */
+                                       pclk-sample = <1>;  /* Rising */
+                               };
+                       };
+               };
+       };
+
        wifi_pwrseq: wifi-pwrseq {
                compatible = "mmc-pwrseq-simple";
                clocks = <&rtc 1>;
        };
 };
 
+&csi {
+       status = "okay";
+
+       port {
+               csi_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 */
+               };
+       };
+};
+
 &ehci0 {
        status = "okay";
 };
 
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins>;
+       status = "okay";
+
+       sensor@48 {
+               compatible = "st,stlm75";
+               reg = <0x48>;
+       };
+};
+
+&i2c0_pins {
+       bias-pull-up;
+};
+
 &mmc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&mmc1_pins>;
index 7793ebb..0a56c0c 100644 (file)
 };
 
 &codec_analog {
-       hpvcc-supply = <&reg_eldo1>;
+       cpvdd-supply = <&reg_eldo1>;
        status = "okay";
 };
 
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-oceanic-5205-5inmfd.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-oceanic-5205-5inmfd.dts
new file mode 100644 (file)
index 0000000..6a21545
--- /dev/null
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2019 Oceanic Systems (UK) Ltd.
+ * Copyright (C) 2019 Amarula Solutions B.V.
+ * Author: Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64-sopine.dtsi"
+
+/ {
+       model = "Oceanic 5205 5inMFD";
+       compatible = "oceanic,5205-5inmfd", "allwinner,sun50i-a64";
+
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       phy-mode = "rgmii";
+       phy-handle = <&ext_rgmii_phy>;
+       phy-supply = <&reg_dc1sw>;
+       allwinner,tx-delay-ps = <600>;
+       status = "okay";
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&reg_dc1sw {
+       regulator-name = "vcc-phy";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pb_pins>;
+       status = "okay";
+};
+
+&usb_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
index c0b9cc7..b7ac637 100644 (file)
@@ -80,7 +80,7 @@
 };
 
 &codec_analog {
-       hpvcc-supply = <&reg_eldo1>;
+       cpvdd-supply = <&reg_eldo1>;
        status = "okay";
 };
 
index d22736a..2b6345d 100644 (file)
@@ -94,7 +94,7 @@
 };
 
 &codec_analog {
-       hpvcc-supply = <&reg_eldo1>;
+       cpvdd-supply = <&reg_eldo1>;
        status = "okay";
 };
 
 
 &ehci0 {
        phys = <&usbphy 0>;
-       phy-names = "usb";
        status = "okay";
 };
 
 
 &ohci0 {
        phys = <&usbphy 0>;
-       phy-names = "usb";
        status = "okay";
 };
 
index d2651f2..9d20e13 100644 (file)
@@ -48,7 +48,7 @@
 #include <dt-bindings/gpio/gpio.h>
 
 &codec_analog {
-       hpvcc-supply = <&reg_eldo1>;
+       cpvdd-supply = <&reg_eldo1>;
 };
 
 &mmc0 {
index 7b7b14b..0ec46b9 100644 (file)
                serial0 = &uart0;
        };
 
+       backlight: backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm 0 50000 0>;
+               power-supply = <&reg_dcdc1>;
+               brightness-levels = <0 5 7 10 14 20 28 40 56 80 112>;
+               default-brightness-level = <5>;
+               enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
+       };
+
        chosen {
                stdout-path = "serial0:115200n8";
 
        status = "okay";
 };
 
+&pwm {
+       status = "okay";
+};
+
 &r_rsb {
        status = "okay";
 
index e628d06..8c5b521 100644 (file)
                #size-cells = <1>;
                ranges;
 
-               de2@1000000 {
+               bus@1000000 {
                        compatible = "allwinner,sun50i-a64-de2";
                        reg = <0x1000000 0x400000>;
                        allwinner,sram = <&de2_sram 1>;
                                        #size-cells = <0>;
 
                                        mixer0_out: port@1 {
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
                                                reg = <1>;
 
-                                               mixer0_out_tcon0: endpoint {
+                                               mixer0_out_tcon0: endpoint@0 {
+                                                       reg = <0>;
                                                        remote-endpoint = <&tcon0_in_mixer0>;
                                                };
+
+                                               mixer0_out_tcon1: endpoint@1 {
+                                                       reg = <1>;
+                                                       remote-endpoint = <&tcon1_in_mixer0>;
+                                               };
                                        };
                                };
                        };
                                        #size-cells = <0>;
 
                                        mixer1_out: port@1 {
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
                                                reg = <1>;
 
-                                               mixer1_out_tcon1: endpoint {
+                                               mixer1_out_tcon0: endpoint@0 {
+                                                       reg = <0>;
+                                                       remote-endpoint = <&tcon0_in_mixer1>;
+                                               };
+
+                                               mixer1_out_tcon1: endpoint@1 {
+                                                       reg = <1>;
                                                        remote-endpoint = <&tcon1_in_mixer1>;
                                                };
                                        };
                        clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
                        clock-names = "ahb", "tcon-ch0";
                        clock-output-names = "tcon-pixel-clock";
+                       #clock-cells = <0>;
                        resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
                        reset-names = "lcd", "lvds";
 
                                                reg = <0>;
                                                remote-endpoint = <&mixer0_out_tcon0>;
                                        };
+
+                                       tcon0_in_mixer1: endpoint@1 {
+                                               reg = <1>;
+                                               remote-endpoint = <&mixer1_out_tcon0>;
+                                       };
                                };
 
                                tcon0_out: port@1 {
                                #size-cells = <0>;
 
                                tcon1_in: port@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <0>;
 
-                                       tcon1_in_mixer1: endpoint {
+                                       tcon1_in_mixer0: endpoint@0 {
+                                               reg = <0>;
+                                               remote-endpoint = <&mixer0_out_tcon1>;
+                                       };
+
+                                       tcon1_in_mixer1: endpoint@1 {
+                                               reg = <1>;
                                                remote-endpoint = <&mixer1_out_tcon1>;
                                        };
                                };
                        phys = <&usbphy 0>;
                        phy-names = "usb";
                        extcon = <&usbphy 0>;
+                       dr_mode = "otg";
                        status = "disabled";
                };
 
                        resets = <&ccu RST_BUS_OHCI1>,
                                 <&ccu RST_BUS_EHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI1>;
                        resets = <&ccu RST_BUS_OHCI1>;
                        phys = <&usbphy 1>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&ccu 58>;
+                       clocks = <&ccu 58>, <&osc24M>, <&rtc 0>;
+                       clock-names = "apb", "hosc", "losc";
                        gpio-controller;
                        #gpio-cells = <3>;
                        interrupt-controller;
                                function = "csi";
                        };
 
-                       i2c0_pins: i2c0_pins {
+                       /omit-if-no-ref/
+                       csi_mclk_pin: csi-mclk-pin {
+                               pins = "PE1";
+                               function = "csi";
+                       };
+
+                       i2c0_pins: i2c0-pins {
                                pins = "PH0", "PH1";
                                function = "i2c0";
                        };
 
-                       i2c1_pins: i2c1_pins {
+                       i2c1_pins: i2c1-pins {
                                pins = "PH2", "PH3";
                                function = "i2c1";
                        };
                                bias-pull-up;
                        };
 
-                       pwm_pin: pwm_pin {
+                       pwm_pin: pwm-pin {
                                pins = "PD22";
                                function = "pwm";
                        };
 
-                       rmii_pins: rmii_pins {
+                       rmii_pins: rmii-pins {
                                pins = "PD10", "PD11", "PD13", "PD14", "PD17",
                                       "PD18", "PD19", "PD20", "PD22", "PD23";
                                function = "emac";
                                drive-strength = <40>;
                        };
 
-                       rgmii_pins: rgmii_pins {
+                       rgmii_pins: rgmii-pins {
                                pins = "PD8", "PD9", "PD10", "PD11", "PD12",
                                       "PD13", "PD15", "PD16", "PD17", "PD18",
                                       "PD19", "PD20", "PD21", "PD22", "PD23";
                                drive-strength = <40>;
                        };
 
-                       spdif_tx_pin: spdif {
+                       spdif_tx_pin: spdif-tx-pin {
                                pins = "PH8";
                                function = "spdif";
                        };
 
-                       spi0_pins: spi0 {
+                       spi0_pins: spi0-pins {
                                pins = "PC0", "PC1", "PC2", "PC3";
                                function = "spi0";
                        };
 
-                       spi1_pins: spi1 {
+                       spi1_pins: spi1-pins {
                                pins = "PD0", "PD1", "PD2", "PD3";
                                function = "spi1";
                        };
                                function = "uart0";
                        };
 
-                       uart1_pins: uart1_pins {
+                       uart1_pins: uart1-pins {
                                pins = "PG6", "PG7";
                                function = "uart1";
                        };
 
-                       uart1_rts_cts_pins: uart1_rts_cts_pins {
+                       uart1_rts_cts_pins: uart1-rts-cts-pins {
                                pins = "PG8", "PG9";
                                function = "uart1";
                        };
                        clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
                        clock-names = "apb", "mod";
                        resets = <&ccu RST_BUS_CODEC>;
-                       reset-names = "rst";
                        dmas = <&dma 15>, <&dma 15>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                                function = "s_i2c";
                        };
 
-                       r_pwm_pin: pwm {
+                       r_pwm_pin: r-pwm-pin {
                                pins = "PL10";
                                function = "s_pwm";
                        };
 
-                       r_rsb_pins: rsb {
+                       r_rsb_pins: r-rsb-pins {
                                pins = "PL0", "PL1";
                                function = "s_rsb";
                        };
index 85e7993..62409af 100644 (file)
@@ -46,7 +46,6 @@
 
        vdd_cpux: gpio-regulator {
                compatible = "regulator-gpio";
-               pinctrl-names = "default";
                regulator-name = "vdd-cpux";
                regulator-type = "voltage";
                regulator-boot-on;
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index e4d5037..82f4b44 100644 (file)
@@ -21,7 +21,6 @@
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&pio 2 7 GPIO_ACTIVE_LOW>; /* PC7 */
                post-power-on-delay-ms = <200>;
        };
index 506e25b..9887948 100644 (file)
@@ -78,7 +78,6 @@
 
        reg_gmac_3v3: gmac-3v3 {
                compatible = "regulator-fixed";
-               pinctrl-names = "default";
                regulator-name = "gmac-3v3";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
@@ -96,7 +95,6 @@
 
        vdd_cpux: gpio-regulator {
                compatible = "regulator-gpio";
-               pinctrl-names = "default";
                regulator-name = "vdd-cpux";
                regulator-type = "voltage";
                regulator-boot-on;
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
                post-power-on-delay-ms = <200>;
        };
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index cc268a6..57a6f45 100644 (file)
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 3e0d5a9..e126c1c 100644 (file)
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index b75ca4d..d9b3ed2 100644 (file)
 
 &ir {
        pinctrl-names = "default";
-       pinctrl-0 = <&ir_pins_a>;
+       pinctrl-0 = <&r_ir_rx_pin>;
        status = "okay";
 };
 
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 1238de2..db6ea7b 100644 (file)
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 53c8c11..dacf613 100644 (file)
@@ -78,7 +78,6 @@
 
        wifi_pwrseq: wifi_pwrseq {
                compatible = "mmc-pwrseq-simple";
-               pinctrl-names = "default";
                reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
                post-power-on-delay-ms = <200>;
        };
 
 &uart0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&uart0_pins_a>;
+       pinctrl-0 = <&uart0_pa_pins>;
        status = "okay";
 };
 
index 96acafd..f002a49 100644 (file)
 &rtc {
        compatible = "allwinner,sun50i-h5-rtc";
 };
+
+&sid {
+       compatible = "allwinner,sun50i-h5-sid";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts
new file mode 100644 (file)
index 0000000..0dc33c9
--- /dev/null
@@ -0,0 +1,260 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2019 Clément Péron <peron.clem@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "sun50i-h6.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "Beelink GS1";
+       compatible = "azw,beelink-gs1", "allwinner,sun50i-h6";
+
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_con_in: endpoint {
+                               remote-endpoint = <&hdmi_out_con>;
+                       };
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       label = "beelink:white:power";
+                       gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
+                       default-state = "on";
+               };
+       };
+
+       reg_vcc5v: vcc5v {
+               /* board wide 5V supply directly from the DC jack */
+               compatible = "regulator-fixed";
+               regulator-name = "vcc-5v";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+};
+
+&de {
+       status = "okay";
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&emac {
+       pinctrl-names = "default";
+       pinctrl-0 = <&ext_rgmii_pins>;
+       phy-mode = "rgmii";
+       phy-handle = <&ext_rgmii_phy>;
+       phy-supply = <&reg_aldo2>;
+       status = "okay";
+};
+
+&hdmi {
+       status = "okay";
+};
+
+&hdmi_out {
+       hdmi_out_con: endpoint {
+               remote-endpoint = <&hdmi_con_in>;
+       };
+};
+
+&mdio {
+       ext_rgmii_phy: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&mmc0 {
+       vmmc-supply = <&reg_cldo1>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&mmc2 {
+       vmmc-supply = <&reg_cldo1>;
+       vqmmc-supply = <&reg_bldo2>;
+       non-removable;
+       cap-mmc-hw-reset;
+       bus-width = <8>;
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&pio {
+       vcc-pd-supply = <&reg_cldo1>;
+       vcc-pg-supply = <&reg_aldo1>;
+};
+
+&r_i2c {
+       status = "okay";
+
+       axp805: pmic@36 {
+               compatible = "x-powers,axp805", "x-powers,axp806";
+               reg = <0x36>;
+               interrupt-parent = <&r_intc>;
+               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               x-powers,self-working-mode;
+               vina-supply = <&reg_vcc5v>;
+               vinb-supply = <&reg_vcc5v>;
+               vinc-supply = <&reg_vcc5v>;
+               vind-supply = <&reg_vcc5v>;
+               vine-supply = <&reg_vcc5v>;
+               aldoin-supply = <&reg_vcc5v>;
+               bldoin-supply = <&reg_vcc5v>;
+               cldoin-supply = <&reg_vcc5v>;
+
+               regulators {
+                       reg_aldo1: aldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-pl";
+                       };
+
+                       reg_aldo2: aldo2 {
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-ac200";
+                               regulator-enable-ramp-delay = <100000>;
+                       };
+
+                       reg_aldo3: aldo3 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc25-dram";
+                       };
+
+                       reg_bldo1: bldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-name = "vcc-bias-pll";
+                       };
+
+                       reg_bldo2: bldo2 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-name = "vcc-efuse-pcie-hdmi-io";
+                       };
+
+                       reg_bldo3: bldo3 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-name = "vcc-dcxoio";
+                       };
+
+                       bldo4 {
+                               /* unused */
+                       };
+
+                       reg_cldo1: cldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-3v3";
+                       };
+
+                       reg_cldo2: cldo2 {
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-wifi-1";
+                       };
+
+                       reg_cldo3: cldo3 {
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-wifi-2";
+                       };
+
+                       reg_dcdca: dcdca {
+                               regulator-always-on;
+                               regulator-min-microvolt = <810000>;
+                               regulator-max-microvolt = <1080000>;
+                               regulator-name = "vdd-cpu";
+                       };
+
+                       reg_dcdcc: dcdcc {
+                               regulator-min-microvolt = <810000>;
+                               regulator-max-microvolt = <1080000>;
+                               regulator-name = "vdd-gpu";
+                       };
+
+                       reg_dcdcd: dcdcd {
+                               regulator-always-on;
+                               regulator-min-microvolt = <960000>;
+                               regulator-max-microvolt = <960000>;
+                               regulator-name = "vdd-sys";
+                       };
+
+                       reg_dcdce: dcdce {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-name = "vcc-dram";
+                       };
+
+                       sw {
+                               /* unused */
+                       };
+               };
+       };
+};
+
+&r_pio {
+       /*
+        * PL0 and PL1 are used for PMIC I2C
+        * don't enable the pl-supply else
+        * it will fail at boot
+        *
+        * vcc-pl-supply = <&reg_aldo1>;
+        */
+       vcc-pm-supply = <&reg_aldo1>;
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_ph_pins>;
+       status = "okay";
+};
+
+&usb2otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usb2phy {
+       usb0_vbus-supply = <&reg_vcc5v>;
+       status = "okay";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
new file mode 100644 (file)
index 0000000..17d4969
--- /dev/null
@@ -0,0 +1,215 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2019 Ondřej Jirman <megous@megous.com>
+ */
+
+/dts-v1/;
+
+#include "sun50i-h6.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "OrangePi 3";
+       compatible = "xunlong,orangepi-3", "allwinner,sun50i-h6";
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       label = "orangepi:red:power";
+                       gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
+                       default-state = "on";
+               };
+
+               status {
+                       label = "orangepi:green:status";
+                       gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
+               };
+       };
+
+       reg_vcc5v: vcc5v {
+               /* board wide 5V supply directly from the DC jack */
+               compatible = "regulator-fixed";
+               regulator-name = "vcc-5v";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+};
+
+&cpu0 {
+       cpu-supply = <&reg_dcdca>;
+};
+
+&ehci0 {
+       status = "okay";
+};
+
+&ehci3 {
+       status = "okay";
+};
+
+&mmc0 {
+       vmmc-supply = <&reg_cldo1>;
+       cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+       bus-width = <4>;
+       status = "okay";
+};
+
+&ohci0 {
+       status = "okay";
+};
+
+&ohci3 {
+       status = "okay";
+};
+
+&pio {
+       vcc-pc-supply = <&reg_bldo2>;
+       vcc-pd-supply = <&reg_cldo1>;
+};
+
+&r_i2c {
+       status = "okay";
+
+       axp805: pmic@36 {
+               compatible = "x-powers,axp805", "x-powers,axp806";
+               reg = <0x36>;
+               interrupt-parent = <&r_intc>;
+               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               x-powers,self-working-mode;
+               vina-supply = <&reg_vcc5v>;
+               vinb-supply = <&reg_vcc5v>;
+               vinc-supply = <&reg_vcc5v>;
+               vind-supply = <&reg_vcc5v>;
+               vine-supply = <&reg_vcc5v>;
+               aldoin-supply = <&reg_vcc5v>;
+               bldoin-supply = <&reg_vcc5v>;
+               cldoin-supply = <&reg_vcc5v>;
+
+               regulators {
+                       reg_aldo1: aldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc-pl-led-ir";
+                       };
+
+                       reg_aldo2: aldo2 {
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc33-audio-tv-ephy-mac";
+                       };
+
+                       /* ALDO3 is shorted to CLDO1 */
+                       reg_aldo3: aldo3 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
+                       };
+
+                       reg_bldo1: bldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-name = "vcc18-dram-bias-pll";
+                       };
+
+                       reg_bldo2: bldo2 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-name = "vcc-efuse-pcie-hdmi-pc";
+                       };
+
+                       bldo3 {
+                               /* unused */
+                       };
+
+                       bldo4 {
+                               /* unused */
+                       };
+
+                       reg_cldo1: cldo1 {
+                               regulator-always-on;
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
+                       };
+
+                       cldo2 {
+                               /* unused */
+                       };
+
+                       cldo3 {
+                               /* unused */
+                       };
+
+                       reg_dcdca: dcdca {
+                               regulator-always-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1160000>;
+                               regulator-name = "vdd-cpu";
+                       };
+
+                       reg_dcdcc: dcdcc {
+                               regulator-min-microvolt = <810000>;
+                               regulator-max-microvolt = <1080000>;
+                               regulator-name = "vdd-gpu";
+                       };
+
+                       reg_dcdcd: dcdcd {
+                               regulator-always-on;
+                               regulator-min-microvolt = <960000>;
+                               regulator-max-microvolt = <960000>;
+                               regulator-name = "vdd-sys";
+                       };
+
+                       reg_dcdce: dcdce {
+                               regulator-always-on;
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1200000>;
+                               regulator-name = "vcc-dram";
+                       };
+
+                       sw {
+                               /* unused */
+                       };
+               };
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_ph_pins>;
+       status = "okay";
+};
+
+&usb2otg {
+       /*
+        * This board doesn't have a controllable VBUS even though it
+        * does have an ID pin. Using it as anything but a USB host is
+        * unsafe.
+        */
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usb2phy {
+       usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
+       usb0_vbus-supply = <&reg_vcc5v>;
+       usb3_vbus-supply = <&reg_vcc5v>;
+       status = "okay";
+};
index b2526da..62e2794 100644 (file)
@@ -56,8 +56,6 @@
 };
 
 &mmc0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc0_pins>;
        vmmc-supply = <&reg_cldo1>;
        cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
        bus-width = <4>;
index bdb8470..4802902 100644 (file)
 };
 
 &mmc0 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc0_pins>;
        vmmc-supply = <&reg_cldo1>;
        cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
        bus-width = <4>;
 };
 
 &mmc2 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mmc2_pins>;
        vmmc-supply = <&reg_cldo1>;
        vqmmc-supply = <&reg_bldo2>;
        non-removable;
index c9e861a..16c5c3d 100644 (file)
                #size-cells = <1>;
                ranges;
 
-               display-engine@1000000 {
+               bus@1000000 {
                        compatible = "allwinner,sun50i-h6-de3",
                                     "allwinner,sun50i-a64-de2";
                        reg = <0x1000000 0x400000>;
                        };
                };
 
+               video-codec@1c0e000 {
+                       compatible = "allwinner,sun50i-h6-video-engine";
+                       reg = <0x01c0e000 0x2000>;
+                       clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
+                                <&ccu CLK_MBUS_VE>;
+                       clock-names = "ahb", "mod", "ram";
+                       resets = <&ccu RST_BUS_VE>;
+                       interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+                       allwinner,sram = <&ve_sram 1>;
+               };
+
                syscon: syscon@3000000 {
                        compatible = "allwinner,sun50i-h6-system-control",
                                     "allwinner,sun50i-a64-system-control";
                        #reset-cells = <1>;
                };
 
+               sid: sid@3006000 {
+                       compatible = "allwinner,sun50i-h6-sid";
+                       reg = <0x03006000 0x400>;
+               };
+
                pio: pinctrl@300b000 {
                        compatible = "allwinner,sun50i-h6-pinctrl";
                        reg = <0x0300b000 0x400>;
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
-                       ext_rgmii_pins: rgmii_pins {
+                       ext_rgmii_pins: rgmii-pins {
                                pins = "PD0", "PD1", "PD2", "PD3", "PD4",
                                       "PD5", "PD7", "PD8", "PD9", "PD10",
                                       "PD11", "PD12", "PD13", "PD19", "PD20";
                                bias-pull-up;
                        };
 
+                       /omit-if-no-ref/
+                       mmc1_pins: mmc1-pins {
+                               pins = "PG0", "PG1", "PG2", "PG3",
+                                      "PG4", "PG5";
+                               function = "mmc1";
+                               drive-strength = <30>;
+                               bias-pull-up;
+                       };
+
                        mmc2_pins: mmc2-pins {
                                pins = "PC1", "PC4", "PC5", "PC6",
                                       "PC7", "PC8", "PC9", "PC10",
                                bias-pull-up;
                        };
 
-                       uart0_ph_pins: uart0-ph {
+                       uart0_ph_pins: uart0-ph-pins {
                                pins = "PH0", "PH1";
                                function = "uart0";
                        };
                        resets = <&ccu RST_BUS_MMC0>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mmc0_pins>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        resets = <&ccu RST_BUS_MMC1>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mmc1_pins>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        resets = <&ccu RST_BUS_MMC2>;
                        reset-names = "ahb";
                        interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mmc2_pins>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        resets = <&ccu RST_BUS_OHCI3>,
                                 <&ccu RST_BUS_EHCI3>;
                        phys = <&usb2phy 3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                                 <&ccu CLK_USB_OHCI3>;
                        resets = <&ccu RST_BUS_OHCI3>;
                        phys = <&usb2phy 3>;
-                       phy-names = "usb";
                        status = "disabled";
                };
 
                        interrupt-controller;
                        #interrupt-cells = <3>;
 
-                       r_i2c_pins: r-i2c {
+                       r_i2c_pins: r-i2c-pins {
                                pins = "PL0", "PL1";
                                function = "s_i2c";
                        };
index 68ba088..27bb925 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_ARCH_STRATIX10) += socfpga_stratix10_socdk.dtb
index 2e3863e..d037563 100644 (file)
 &mmc {
        status = "okay";
        cap-sd-highspeed;
+       cap-mmc-highspeed;
        broken-cd;
        bus-width = <4>;
 };
                #size-cells = <1>;
                compatible = "n25q00a";
                reg = <0>;
-               spi-max-frequency = <50000000>;
+               spi-max-frequency = <100000000>;
 
                m25p,fast-read;
                cdns,page-size = <256>;
index 0821fed..e129c03 100644 (file)
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
new file mode 100644 (file)
index 0000000..34b4058
--- /dev/null
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre SAS. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+
+/ {
+       compatible = "seirobotics,sei510", "amlogic,g12a";
+       model = "SEI Robotics SEI510";
+
+       aliases {
+               serial0 = &uart_AO;
+       };
+
+       adc_keys {
+               compatible = "adc-keys";
+               io-channels = <&saradc 0>;
+               io-channel-names = "buttons";
+               keyup-threshold-microvolt = <1800000>;
+
+               button-onoff {
+                       label = "On/Off";
+                       linux,code = <KEY_POWER>;
+                       press-threshold-microvolt = <1700000>;
+               };
+       };
+
+       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;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       dc_in: regulator-dc_in {
+               compatible = "regulator-fixed";
+               regulator-name = "DC_IN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       emmc_1v8: regulator-emmc_1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "EMMC_1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vddao_3v3>;
+               regulator-always-on;
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x0 0x0 0x40000000>;
+       };
+
+       reserved-memory {
+               /* TEE Reserved Memory */
+               bl32_reserved: bl32@5000000 {
+                       reg = <0x0 0x05300000 0x0 0x2000000>;
+                       no-map;
+               };
+       };
+
+       vddao_3v3: regulator-vddao_3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_3V3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&dc_in>;
+               regulator-always-on;
+       };
+
+       vddao_3v3_t: regultor-vddao_3v3_t {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDAO_3V3_T";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vddao_3v3>;
+               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+               enable-active-high;
+       };
+
+       vddio_ao1v8: regulator-vddio_ao1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "VDDIO_AO1V8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vddao_3v3>;
+               regulator-always-on;
+       };
+};
+
+&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>;
+};
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&saradc {
+       status = "okay";
+       vref-supply = <&vddio_ao1v8>;
+};
+
+&uart_A {
+       status = "okay";
+       pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+       pinctrl-names = "default";
+       uart-has-rtscts;
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+       };
+};
+
+&hdmi_tx {
+       status = "okay";
+       pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+       pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+       hdmi_tx_tmds_out: endpoint {
+               remote-endpoint = <&hdmi_connector_in>;
+       };
+};
+
+&uart_AO {
+       status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb {
+       status = "okay";
+       dr_mode = "host";
+};
index c44dbdd..0e8045b 100644 (file)
@@ -6,6 +6,8 @@
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
 
 / {
        compatible = "amlogic,u200", "amlogic,g12a";
                device_type = "memory";
                reg = <0x0 0x0 0x0 0x40000000>;
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       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;
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       main_12v: regulator-main_12v {
+               compatible = "regulator-fixed";
+               regulator-name = "12V";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               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 = <&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 */
+       };
+
+       vcc_5v: regulator-vcc_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&main_12v>;
+
+               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+               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>;
+
+               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;
+       };
+
+};
+
+&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>;
+};
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&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>;
+       };
 };
 
 &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 {
+       phy-supply = <&vcc_5v>;
+};
index c62d3d5..b3d913f 100644 (file)
@@ -6,6 +6,8 @@
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
 
 / {
        compatible = "amediatech,x96-max", "amlogic,u200", "amlogic,g12a";
                device_type = "memory";
                reg = <0x0 0x0 0x0 0x40000000>;
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
+
+       hdmi-connector {
+               compatible = "hdmi-connector";
+               type = "a";
+
+               port {
+                       hdmi_connector_in: endpoint {
+                               remote-endpoint = <&hdmi_tx_tmds_out>;
+                       };
+               };
+       };
+
+       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;
+       };
+
+       dc_in: regulator-dc_in {
+               compatible = "regulator-fixed";
+               regulator-name = "DC_IN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               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 = <&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 */
+       };
+
+       vcc_5v: regulator-vcc_5v {
+               compatible = "regulator-fixed";
+               regulator-name = "VCC_5V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_in>;
+
+               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+               enable-active-low;
+       };
+
+       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 = <&dc_in>;
+               regulator-always-on;
+       };
+};
+
+&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>;
+};
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
+
+&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>;
+       };
+};
+
+&uart_A {
+       status = "okay";
+       pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+       pinctrl-names = "default";
+       uart-has-rtscts;
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+       };
 };
 
 &uart_AO {
        status = "okay";
+       pinctrl-0 = <&uart_ao_a_pins>;
+       pinctrl-names = "default";
+};
+
+&usb {
+       status = "okay";
+       dr_mode = "host";
 };
index 17c6217..9f72396 100644 (file)
@@ -3,9 +3,13 @@
  * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
  */
 
+#include <dt-bindings/phy/phy.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/g12a-clkc.h>
+#include <dt-bindings/clock/g12a-aoclkc.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/reset/amlogic,meson-g12a-reset.h>
 
 / {
        compatible = "amlogic,g12a";
                };
        };
 
+       efuse: efuse {
+               compatible = "amlogic,meson-gxbb-efuse";
+               clocks = <&clkc CLKID_EFUSE>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               read-only;
+       };
+
        psci {
                compatible = "arm,psci-1.0";
                method = "smc";
                        reg = <0x0 0x05000000 0x0 0x300000>;
                        no-map;
                };
+
+               linux,cma {
+                       compatible = "shared-dma-pool";
+                       reusable;
+                       size = <0x0 0x10000000>;
+                       alignment = <0x0 0x400000>;
+                       linux,cma-default;
+               };
+       };
+
+       sm: secure-monitor {
+               compatible = "amlogic,meson-gxbb-sm";
        };
 
        soc {
                        #size-cells = <2>;
                        ranges = <0x0 0x0 0x0 0xff600000 0x0 0x200000>;
 
+                       hdmi_tx: hdmi-tx@0 {
+                               compatible = "amlogic,meson-g12a-dw-hdmi";
+                               reg = <0x0 0x0 0x0 0x10000>;
+                               interrupts = <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
+                               resets = <&reset RESET_HDMITX_CAPB3>,
+                                        <&reset RESET_HDMITX_PHY>,
+                                        <&reset RESET_HDMITX>;
+                               reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
+                               clocks = <&clkc CLKID_HDMI>,
+                                        <&clkc CLKID_HTX_PCLK>,
+                                        <&clkc CLKID_VPU_INTR>;
+                               clock-names = "isfr", "iahb", "venci";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               status = "disabled";
+
+                               /* VPU VENC Input */
+                               hdmi_tx_venc_port: port@0 {
+                                       reg = <0>;
+
+                                       hdmi_tx_in: endpoint {
+                                               remote-endpoint = <&hdmi_tx_out>;
+                                       };
+                               };
+
+                               /* TMDS Output */
+                               hdmi_tx_tmds_port: port@1 {
+                                       reg = <1>;
+                               };
+                       };
+
                        periphs: bus@34400 {
                                compatible = "simple-bus";
                                reg = <0x0 0x34400 0x0 0x400>;
                                #address-cells = <2>;
                                #size-cells = <2>;
                                ranges = <0x0 0x0 0x0 0x34400 0x0 0x400>;
+
+                               periphs_pinctrl: pinctrl@40 {
+                                       compatible = "amlogic,meson-g12a-periphs-pinctrl";
+                                       #address-cells = <2>;
+                                       #size-cells = <2>;
+                                       ranges;
+
+                                       gpio: bank@40 {
+                                               reg = <0x0 0x40  0x0 0x4c>,
+                                                     <0x0 0xe8  0x0 0x18>,
+                                                     <0x0 0x120 0x0 0x18>,
+                                                     <0x0 0x2c0 0x0 0x40>,
+                                                     <0x0 0x340 0x0 0x1c>;
+                                               reg-names = "gpio",
+                                                           "pull",
+                                                           "pull-enable",
+                                                           "mux",
+                                                           "ds";
+                                               gpio-controller;
+                                               #gpio-cells = <2>;
+                                               gpio-ranges = <&periphs_pinctrl 0 0 86>;
+                                       };
+
+                                       cec_ao_a_h_pins: cec_ao_a_h {
+                                               mux {
+                                                       groups = "cec_ao_a_h";
+                                                       function = "cec_ao_a_h";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       cec_ao_b_h_pins: cec_ao_b_h {
+                                               mux {
+                                                       groups = "cec_ao_b_h";
+                                                       function = "cec_ao_b_h";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       hdmitx_ddc_pins: hdmitx_ddc {
+                                               mux {
+                                                       groups = "hdmitx_sda",
+                                                                "hdmitx_sck";
+                                                       function = "hdmitx";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       hdmitx_hpd_pins: hdmitx_hpd {
+                                               mux {
+                                                       groups = "hdmitx_hpd_in";
+                                                       function = "hdmitx";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_a_pins: uart-a {
+                                               mux {
+                                                       groups = "uart_a_tx",
+                                                                "uart_a_rx";
+                                                       function = "uart_a";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_a_cts_rts_pins: uart-a-cts-rts {
+                                               mux {
+                                                       groups = "uart_a_cts",
+                                                                "uart_a_rts";
+                                                       function = "uart_a";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_b_pins: uart-b {
+                                               mux {
+                                                       groups = "uart_b_tx",
+                                                                "uart_b_rx";
+                                                       function = "uart_b";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_c_pins: uart-c {
+                                               mux {
+                                                       groups = "uart_c_tx",
+                                                                "uart_c_rx";
+                                                       function = "uart_c";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_c_cts_rts_pins: uart-c-cts-rts {
+                                               mux {
+                                                       groups = "uart_c_cts",
+                                                                "uart_c_rts";
+                                                       function = "uart_c";
+                                                       bias-disable;
+                                               };
+                                       };
+                               };
+                       };
+
+                       usb2_phy0: phy@36000 {
+                               compatible = "amlogic,g12a-usb2-phy";
+                               reg = <0x0 0x36000 0x0 0x2000>;
+                               clocks = <&xtal>;
+                               clock-names = "xtal";
+                               resets = <&reset RESET_USB_PHY20>;
+                               reset-names = "phy";
+                               #phy-cells = <0>;
+                       };
+
+                       dmc: bus@38000 {
+                               compatible = "simple-bus";
+                               reg = <0x0 0x38000 0x0 0x400>;
+                               #address-cells = <2>;
+                               #size-cells = <2>;
+                               ranges = <0x0 0x0 0x0 0x38000 0x0 0x400>;
+
+                               canvas: video-lut@48 {
+                                       compatible = "amlogic,canvas";
+                                       reg = <0x0 0x48 0x0 0x14>;
+                               };
+                       };
+
+                       usb2_phy1: phy@3a000 {
+                               compatible = "amlogic,g12a-usb2-phy";
+                               reg = <0x0 0x3a000 0x0 0x2000>;
+                               clocks = <&xtal>;
+                               clock-names = "xtal";
+                               resets = <&reset RESET_USB_PHY21>;
+                               reset-names = "phy";
+                               #phy-cells = <0>;
                        };
 
                        hiu: bus@3c000 {
                                        };
                                };
                        };
+
+                       usb3_pcie_phy: phy@46000 {
+                               compatible = "amlogic,g12a-usb3-pcie-phy";
+                               reg = <0x0 0x46000 0x0 0x2000>;
+                               clocks = <&clkc CLKID_PCIE_PLL>;
+                               clock-names = "ref_clk";
+                               resets = <&reset RESET_PCIE_PHY>;
+                               reset-names = "phy";
+                               assigned-clocks = <&clkc CLKID_PCIE_PLL>;
+                               assigned-clock-rates = <100000000>;
+                               #phy-cells = <1>;
+                       };
                };
 
                aobus: bus@ff800000 {
                        #size-cells = <2>;
                        ranges = <0x0 0x0 0x0 0xff800000 0x0 0x100000>;
 
+                       rti: sys-ctrl@0 {
+                               compatible = "amlogic,meson-gx-ao-sysctrl",
+                                            "simple-mfd", "syscon";
+                               reg = <0x0 0x0 0x0 0x100>;
+                               #address-cells = <2>;
+                               #size-cells = <2>;
+                               ranges = <0x0 0x0 0x0 0x0 0x0 0x100>;
+
+                               clkc_AO: clock-controller {
+                                       compatible = "amlogic,meson-g12a-aoclkc";
+                                       #clock-cells = <1>;
+                                       #reset-cells = <1>;
+                                       clocks = <&xtal>, <&clkc CLKID_CLK81>;
+                                       clock-names = "xtal", "mpeg-clk";
+                               };
+
+                               pwrc_vpu: power-controller-vpu {
+                                       compatible = "amlogic,meson-g12a-pwrc-vpu";
+                                       #power-domain-cells = <0>;
+                                       amlogic,hhi-sysctrl = <&hhi>;
+                                       resets = <&reset RESET_VIU>,
+                                                <&reset RESET_VENC>,
+                                                <&reset RESET_VCBUS>,
+                                                <&reset RESET_BT656>,
+                                                <&reset RESET_RDMA>,
+                                                <&reset RESET_VENCI>,
+                                                <&reset RESET_VENCP>,
+                                                <&reset RESET_VDAC>,
+                                                <&reset RESET_VDI6>,
+                                                <&reset RESET_VENCL>,
+                                                <&reset RESET_VID_LOCK>;
+                                       clocks = <&clkc CLKID_VPU>,
+                                                <&clkc CLKID_VAPB>;
+                                       clock-names = "vpu", "vapb";
+                                       /*
+                                        * VPU clocking is provided by two identical clock paths
+                                        * VPU_0 and VPU_1 muxed to a single clock by a glitch
+                                        * free mux to safely change frequency while running.
+                                        * Same for VAPB but with a final gate after the glitch free mux.
+                                        */
+                                       assigned-clocks = <&clkc CLKID_VPU_0_SEL>,
+                                                         <&clkc CLKID_VPU_0>,
+                                                         <&clkc CLKID_VPU>, /* Glitch free mux */
+                                                         <&clkc CLKID_VAPB_0_SEL>,
+                                                         <&clkc CLKID_VAPB_0>,
+                                                         <&clkc CLKID_VAPB_SEL>; /* Glitch free mux */
+                                       assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
+                                                                <0>, /* Do Nothing */
+                                                                <&clkc CLKID_VPU_0>,
+                                                                <&clkc CLKID_FCLK_DIV4>,
+                                                                <0>, /* Do Nothing */
+                                                                <&clkc CLKID_VAPB_0>;
+                                       assigned-clock-rates = <0>, /* Do Nothing */
+                                                              <666666666>,
+                                                              <0>, /* Do Nothing */
+                                                              <0>, /* Do Nothing */
+                                                              <250000000>,
+                                                              <0>; /* Do Nothing */
+                               };
+
+                               ao_pinctrl: pinctrl@14 {
+                                       compatible = "amlogic,meson-g12a-aobus-pinctrl";
+                                       #address-cells = <2>;
+                                       #size-cells = <2>;
+                                       ranges;
+
+                                       gpio_ao: bank@14 {
+                                               reg = <0x0 0x14 0x0 0x8>,
+                                                     <0x0 0x1c 0x0 0x8>,
+                                                     <0x0 0x24 0x0 0x14>;
+                                               reg-names = "mux",
+                                                           "ds",
+                                                           "gpio";
+                                               gpio-controller;
+                                               #gpio-cells = <2>;
+                                               gpio-ranges = <&ao_pinctrl 0 0 15>;
+                                       };
+
+                                       uart_ao_a_pins: uart-a-ao {
+                                               mux {
+                                                       groups = "uart_ao_a_tx",
+                                                                "uart_ao_a_rx";
+                                                       function = "uart_ao_a";
+                                                       bias-disable;
+                                               };
+                                       };
+
+                                       uart_ao_a_cts_rts_pins: uart-ao-a-cts-rts {
+                                               mux {
+                                                       groups = "uart_ao_a_cts",
+                                                                "uart_ao_a_rts";
+                                                       function = "uart_ao_a";
+                                                       bias-disable;
+                                               };
+                                       };
+                               };
+                       };
+
+                       cec_AO: cec@100 {
+                               compatible = "amlogic,meson-gx-ao-cec";
+                               reg = <0x0 0x00100 0x0 0x14>;
+                               interrupts = <GIC_SPI 199 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&clkc_AO CLKID_AO_CEC>;
+                               clock-names = "core";
+                               status = "disabled";
+                       };
+
+                       sec_AO: ao-secure@140 {
+                               compatible = "amlogic,meson-gx-ao-secure", "syscon";
+                               reg = <0x0 0x140 0x0 0x140>;
+                               amlogic,has-chip-id;
+                       };
+
+                       cecb_AO: cec@280 {
+                               compatible = "amlogic,meson-g12a-ao-cec";
+                               reg = <0x0 0x00280 0x0 0x1c>;
+                               interrupts = <GIC_SPI 203 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&clkc_AO CLKID_AO_CTS_OSCIN>;
+                               clock-names = "oscin";
+                               status = "disabled";
+                       };
+
                        uart_AO: serial@3000 {
                                compatible = "amlogic,meson-gx-uart",
                                             "amlogic,meson-ao-uart";
                                clock-names = "xtal", "pclk", "baud";
                                status = "disabled";
                        };
+
+                       saradc: adc@9000 {
+                               compatible = "amlogic,meson-g12a-saradc",
+                                            "amlogic,meson-saradc";
+                               reg = <0x0 0x9000 0x0 0x48>;
+                               #io-channel-cells = <1>;
+                               interrupts = <GIC_SPI 200 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>,
+                                        <&clkc_AO CLKID_AO_SAR_ADC>,
+                                        <&clkc_AO CLKID_AO_SAR_ADC_CLK>,
+                                        <&clkc_AO CLKID_AO_SAR_ADC_SEL>;
+                               clock-names = "clkin", "core", "adc_clk", "adc_sel";
+                               status = "disabled";
+                       };
+               };
+
+               vpu: vpu@ff900000 {
+                       compatible = "amlogic,meson-g12a-vpu";
+                       reg = <0x0 0xff900000 0x0 0x100000>,
+                             <0x0 0xff63c000 0x0 0x1000>;
+                       reg-names = "vpu", "hhi";
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       amlogic,canvas = <&canvas>;
+                       power-domains = <&pwrc_vpu>;
+
+                       /* CVBS VDAC output port */
+                       cvbs_vdac_port: port@0 {
+                               reg = <0>;
+                       };
+
+                       /* HDMI-TX output port */
+                       hdmi_tx_port: port@1 {
+                               reg = <1>;
+
+                               hdmi_tx_out: endpoint {
+                                       remote-endpoint = <&hdmi_tx_in>;
+                               };
+                       };
                };
 
                gic: interrupt-controller@ffc01000 {
                        #size-cells = <2>;
                        ranges = <0x0 0x0 0x0 0xffd00000 0x0 0x100000>;
 
+                       reset: reset-controller@1004 {
+                               compatible = "amlogic,meson-g12a-reset",
+                                            "amlogic,meson-axg-reset";
+                               reg = <0x0 0x1004 0x0 0x9c>;
+                               #reset-cells = <1>;
+                       };
+
                        clk_msr: clock-measure@18000 {
                                compatible = "amlogic,meson-g12a-clk-measure";
                                reg = <0x0 0x18000 0x0 0x10>;
                        };
+
+                       uart_C: serial@22000 {
+                               compatible = "amlogic,meson-gx-uart";
+                               reg = <0x0 0x22000 0x0 0x18>;
+                               interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>;
+                               clock-names = "xtal", "pclk", "baud";
+                               status = "disabled";
+                       };
+
+                       uart_B: serial@23000 {
+                               compatible = "amlogic,meson-gx-uart";
+                               reg = <0x0 0x23000 0x0 0x18>;
+                               interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>;
+                               clock-names = "xtal", "pclk", "baud";
+                               status = "disabled";
+                       };
+
+                       uart_A: serial@24000 {
+                               compatible = "amlogic,meson-gx-uart";
+                               reg = <0x0 0x24000 0x0 0x18>;
+                               interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
+                               clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
+                               clock-names = "xtal", "pclk", "baud";
+                               status = "disabled";
+                       };
+               };
+
+               usb: usb@ffe09000 {
+                       status = "disabled";
+                       compatible = "amlogic,meson-g12a-usb-ctrl";
+                       reg = <0x0 0xffe09000 0x0 0xa0>;
+                       interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+                       #address-cells = <2>;
+                       #size-cells = <2>;
+                       ranges;
+
+                       clocks = <&clkc CLKID_USB>;
+                       resets = <&reset RESET_USB>;
+
+                       dr_mode = "otg";
+
+                       phys = <&usb2_phy0>, <&usb2_phy1>,
+                              <&usb3_pcie_phy PHY_TYPE_USB3>;
+                       phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0";
+
+                       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_DDR_BRIDGE>;
+                               clock-names = "ddr";
+                               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";
+                               snps,dis_u2_susphy_quirk;
+                               snps,quirk-frame-length-adjustment;
+                       };
+               };
+
+               mali: gpu@ffe40000 {
+                       compatible = "amlogic,meson-g12a-mali", "arm,mali-bifrost";
+                       reg = <0x0 0xffe40000 0x0 0x40000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "gpu", "mmu", "job";
+                       clocks = <&clkc CLKID_MALI>;
+                       resets = <&reset RESET_DVALIN_CAPB3>, <&reset RESET_DVALIN>;
+
+                       /*
+                        * Mali clocking is provided by two identical clock paths
+                        * MALI_0 and MALI_1 muxed to a single clock by a glitch
+                        * free mux to safely change frequency while running.
+                        */
+                       assigned-clocks = <&clkc CLKID_MALI_0_SEL>,
+                                         <&clkc CLKID_MALI_0>,
+                                         <&clkc CLKID_MALI>; /* Glitch free mux */
+                       assigned-clock-parents = <&clkc CLKID_FCLK_DIV2P5>,
+                                                <0>, /* Do Nothing */
+                                                <&clkc CLKID_MALI_0>;
+                       assigned-clock-rates = <0>, /* Do Nothing */
+                                              <800000000>,
+                                              <0>; /* Do Nothing */
                };
        };
 
index 9a8a8a7..b5667f1 100644 (file)
        cvbs-connector {
                status = "disabled";
        };
+
+       leds {
+               compatible = "gpio-leds";
+
+               status {
+                       label = "n1:white:status";
+                       gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+       };
 };
 
 &cvbs_vdac_port {
index 8acfd40..25f3b6b 100644 (file)
        pinctrl-0 = <&uart_ao_a_pins>;
        pinctrl-names = "default";
 };
+
+&usb0 {
+       status = "okay";
+};
index ed3a3d5..7a85a82 100644 (file)
                reset-names = "phy";
                status = "okay";
        };
+
+       mali: gpu@c0000 {
+               compatible = "amlogic,meson-gxm-mali", "arm,mali-t820";
+               reg = <0x0 0xc0000 0x0 0x40000>;
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "gpu", "mmu", "job";
+               clocks = <&clkc CLKID_MALI>;
+               resets = <&reset RESET_MALI_CAPB3>, <&reset RESET_MALI>;
+
+               /*
+                * Mali clocking is provided by two identical clock paths
+                * MALI_0 and MALI_1 muxed to a single clock by a glitch
+                * free mux to safely change frequency while running.
+                */
+               assigned-clocks = <&clkc CLKID_MALI_0_SEL>,
+                                 <&clkc CLKID_MALI_0>,
+                                 <&clkc CLKID_MALI>; /* Glitch free mux */
+               assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
+                                        <0>, /* Do Nothing */
+                                        <&clkc CLKID_MALI_0>;
+               assigned-clock-rates = <0>, /* Do Nothing */
+                                      <666666666>,
+                                      <0>; /* Do Nothing */
+       };
 };
 
 &clkc_AO {
index 6a32555..3e8c707 100644 (file)
@@ -8,6 +8,28 @@
 
 #include "bm1880.dtsi"
 
+/*
+ * 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 "sophon-edge-schematics"
+ * version, 1.0210.
+ *
+ * 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. 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.
+ */
+
 / {
        compatible = "bitmain,sophon-edge", "bitmain,bm1880";
        model = "Sophon Edge";
                clock-frequency = <500000000>;
                #clock-cells = <0>;
        };
+
+       soc {
+               gpio0: gpio@50027000 {
+                       porta: gpio-controller@0 {
+                               gpio-line-names =
+                                       "GPIO-A", /* GPIO0, LSEC pin 23 */
+                                       "GPIO-C", /* GPIO1, LSEC pin 25 */
+                                       "[GPIO2_PHY0_RST]", /* GPIO2 */
+                                       "GPIO-E", /* GPIO3, LSEC pin 27 */
+                                       "[USB_DET]", /* GPIO4 */
+                                       "[EN_P5V]", /* GPIO5 */
+                                       "[VDDIO_MS1_SEL]", /* GPIO6 */
+                                       "GPIO-G", /* GPIO7, LSEC pin 29 */
+                                       "[BM_TUSB_RST_L]", /* GPIO8 */
+                                       "[EN_P5V_USBHUB]", /* GPIO9 */
+                                       "NC",
+                                       "LED_WIFI", /* GPIO11 */
+                                       "LED_BT", /* GPIO12 */
+                                       "[BM_BLM8221_EN_L]", /* GPIO13 */
+                                       "NC", /* GPIO14 */
+                                       "NC", /* GPIO15 */
+                                       "NC", /* GPIO16 */
+                                       "NC", /* GPIO17 */
+                                       "NC", /* GPIO18 */
+                                       "NC", /* GPIO19 */
+                                       "NC", /* GPIO20 */
+                                       "NC", /* GPIO21 */
+                                       "NC", /* GPIO22 */
+                                       "NC", /* GPIO23 */
+                                       "NC", /* GPIO24 */
+                                       "NC", /* GPIO25 */
+                                       "NC", /* GPIO26 */
+                                       "NC", /* GPIO27 */
+                                       "NC", /* GPIO28 */
+                                       "NC", /* GPIO29 */
+                                       "NC", /* GPIO30 */
+                                       "NC"; /* GPIO31 */
+                       };
+               };
+
+               gpio1: gpio@50027400 {
+                       portb: gpio-controller@0 {
+                               gpio-line-names =
+                                       "NC", /* GPIO32 */
+                                       "NC", /* GPIO33 */
+                                       "[I2C0_SDA]", /* GPIO34, LSEC pin 17 */
+                                       "[I2C0_SCL]", /* GPIO35, LSEC pin 15 */
+                                       "[JTAG0_TDO]", /* GPIO36 */
+                                       "[JTAG0_TCK]", /* GPIO37 */
+                                       "[JTAG0_TDI]", /* GPIO38 */
+                                       "[JTAG0_TMS]", /* GPIO39 */
+                                       "[JTAG0_TRST_X]", /* GPIO40 */
+                                       "[JTAG1_TDO]", /* GPIO41 */
+                                       "[JTAG1_TCK]", /* GPIO42 */
+                                       "[JTAG1_TDI]", /* GPIO43 */
+                                       "[CPU_TX]", /* GPIO44 */
+                                       "[CPU_RX]", /* GPIO45 */
+                                       "[UART1_TXD]", /* GPIO46 */
+                                       "[UART1_RXD]", /* GPIO47 */
+                                       "[UART0_TXD]", /* GPIO48 */
+                                       "[UART0_RXD]", /* GPIO49 */
+                                       "GPIO-I", /* GPIO50, LSEC pin 31 */
+                                       "GPIO-K", /* GPIO51, LSEC pin 33 */
+                                       "USER_LED2", /* GPIO52 */
+                                       "USER_LED1", /* GPIO53 */
+                                       "[UART0_RTS]", /* GPIO54 */
+                                       "[UART0_CTS]", /* GPIO55 */
+                                       "USER_LED4", /* GPIO56, JTAG1_TRST_X */
+                                       "USER_LED3", /* GPIO57, JTAG1_TMS */
+                                       "[I2S0_SCLK]", /* GPIO58 */
+                                       "[I2S0_FS]", /* GPIO59 */
+                                       "[I2S0_SDI]", /* GPIO60 */
+                                       "[I2S0_SDO]", /* GPIO61 */
+                                       "GPIO-B", /* GPIO62, LSEC pin 24 */
+                                       "GPIO-F"; /* GPIO63, I2S1_SCLK, LSEC pin 28 */
+                       };
+               };
+
+               gpio2: gpio@50027800 {
+                       portc: gpio-controller@0 {
+                               gpio-line-names =
+                                       "GPIO-D", /* GPIO64, I2S1_FS, LSEC pin 26 */
+                                       "GPIO-J", /* GPIO65, I2S1_SDI, LSEC pin 32 */
+                                       "GPIO-H", /* GPIO66, I2S1_SDO, LSEC pin 30 */
+                                       "GPIO-L", /* GPIO67, LSEC pin 34 */
+                                       "[SPI0_CS]", /* GPIO68, SPI1_CS, LSEC pin 12 */
+                                       "[SPI0_DIN]", /* GPIO69, SPI1_SDI, LSEC pin 10 */
+                                       "[SPI0_DOUT]", /* GPIO70, SPI1_SDO, LSEC pin 14 */
+                                       "[SPI0_SCLK]"; /* GPIO71, SPI1_SCK, LSEC pin 8 */
+                       };
+               };
+       };
+};
+
+&pinctrl {
+       pinctrl_uart0_default: pinctrl-uart0-default {
+               pinmux {
+                       groups = "uart0_grp";
+                       function = "uart0";
+               };
+       };
+
+       pinctrl_uart1_default: pinctrl-uart1-default {
+               pinmux {
+                       groups = "uart1_grp";
+                       function = "uart1";
+               };
+       };
+
+       pinctrl_uart2_default: pinctrl-uart2-default {
+               pinmux {
+                       groups = "uart2_grp";
+                       function = "uart2";
+               };
+       };
 };
 
 &uart0 {
        status = "okay";
        clocks = <&uart_clk>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart0_default>;
 };
 
 &uart1 {
        status = "okay";
        clocks = <&uart_clk>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1_default>;
 };
 
 &uart2 {
        status = "okay";
        clocks = <&uart_clk>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2_default>;
 };
index 55a4769..7726fd4 100644 (file)
                        #interrupt-cells = <3>;
                };
 
+               sctrl: system-controller@50010000 {
+                       compatible = "bitmain,bm1880-sctrl", "syscon",
+                                    "simple-mfd";
+                       reg = <0x0 0x50010000 0x0 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0x0 0x0 0x50010000 0x1000>;
+
+                       pinctrl: pinctrl@50 {
+                               compatible = "bitmain,bm1880-pinctrl";
+                               reg = <0x50 0x4B0>;
+                       };
+               };
+
+               gpio0: gpio@50027000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,dw-apb-gpio";
+                       reg = <0x0 0x50027000 0x0 0x400>;
+
+                       porta: gpio-controller@0 {
+                               compatible = "snps,dw-apb-gpio-port";
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               snps,nr-gpios = <32>;
+                               reg = <0>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
+               gpio1: gpio@50027400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,dw-apb-gpio";
+                       reg = <0x0 0x50027400 0x0 0x400>;
+
+                       portb: gpio-controller@0 {
+                               compatible = "snps,dw-apb-gpio-port";
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               snps,nr-gpios = <32>;
+                               reg = <0>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
+               gpio2: gpio@50027800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,dw-apb-gpio";
+                       reg = <0x0 0x50027800 0x0 0x400>;
+
+                       portc: gpio-controller@0 {
+                               compatible = "snps,dw-apb-gpio-port";
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               snps,nr-gpios = <8>;
+                               reg = <0>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
                uart0: serial@58018000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x0 0x58018000 0x0 0x2000>;
index 8373600..601e1e6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb
 dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-xmc.dtb
index d88e2f0..d2de166 100644 (file)
        assigned-clock-parents = <&cmu_top CLK_ACLK_MFC_400>;
 };
 
+&cmu_mif {
+       assigned-clocks = <&cmu_mif CLK_MOUT_SCLK_DSD_A>, <&cmu_mif CLK_DIV_SCLK_DSD>;
+       assigned-clock-parents = <&cmu_mif CLK_MOUT_MFC_PLL_DIV2>;
+       assigned-clock-rates = <0>, <333000000>;
+};
+
 &cmu_mscl {
        assigned-clocks = <&cmu_mscl CLK_MOUT_ACLK_MSCL_400_USER>,
                          <&cmu_mscl CLK_MOUT_SCLK_JPEG_USER>,
index 3d7e0a7..dda5d27 100644 (file)
@@ -33,7 +33,8 @@
                          <&cmu_disp CLK_MOUT_DISP_PLL>,
                          <&cmu_mif CLK_MOUT_SCLK_DECON_TV_ECLK_A>,
                          <&cmu_disp CLK_MOUT_SCLK_DECON_TV_ECLK_USER>,
-                         <&cmu_disp CLK_MOUT_SCLK_DECON_TV_ECLK>;
+                         <&cmu_disp CLK_MOUT_SCLK_DECON_TV_ECLK>,
+                         <&cmu_disp CLK_MOUT_SCLK_DSD_USER>;
        assigned-clock-parents = <0>, <0>,
                                 <&cmu_mif CLK_ACLK_DISP_333>,
                                 <&cmu_mif CLK_SCLK_DSIM0_DISP>,
@@ -45,7 +46,8 @@
                                 <&cmu_disp CLK_FOUT_DISP_PLL>,
                                 <&cmu_mif CLK_MOUT_BUS_PLL_DIV2>,
                                 <&cmu_mif CLK_SCLK_DECON_TV_ECLK_DISP>,
-                                <&cmu_disp CLK_MOUT_SCLK_DECON_TV_ECLK_USER>;
+                                <&cmu_disp CLK_MOUT_SCLK_DECON_TV_ECLK_USER>,
+                                <&cmu_mif CLK_SCLK_DSD_DISP>;
        assigned-clock-rates = <250000000>, <400000000>;
 };
 
index a04e803..d29d13f 100644 (file)
 
        interrupt-parent = <&gic>;
 
+       arm_a53_pmu {
+               compatible = "arm,cortex-a53-pmu", "arm,armv8-pmuv3";
+               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+       };
+
+       arm_a57_pmu {
+               compatible = "arm,cortex-a57-pmu", "arm,armv8-pmuv3";
+               interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-affinity = <&cpu4>, <&cpu5>, <&cpu6>, <&cpu7>;
+       };
+
+       xxti: clock {
+               /* XXTI */
+               compatible = "fixed-clock";
+               clock-output-names = "oscclk";
+               #clock-cells = <0>;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                #size-cells = <1>;
                ranges;
 
-               arm_a53_pmu {
-                       compatible = "arm,cortex-a53-pmu", "arm,armv8-pmuv3";
-                       interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
-               };
-
-               arm_a57_pmu {
-                       compatible = "arm,cortex-a57-pmu", "arm,armv8-pmuv3";
-                       interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
-                                    <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
-                       interrupt-affinity = <&cpu4>, <&cpu5>, <&cpu6>, <&cpu7>;
-               };
-
                chipid@10000000 {
                        compatible = "samsung,exynos4210-chipid";
                        reg = <0x10000000 0x100>;
                };
 
-               xxti: xxti {
-                       compatible = "fixed-clock";
-                       clock-output-names = "oscclk";
-                       #clock-cells = <0>;
-               };
-
                cmu_top: clock-controller@10030000 {
                        compatible = "samsung,exynos5433-cmu-top";
                        reg = <0x10030000 0x1000>;
                                <&cmu_top CLK_DIV_ACLK_IMEM_200>;
                };
 
+               slim_sss: slim-sss@11140000 {
+                       compatible = "samsung,exynos5433-slim-sss";
+                       reg = <0x11140000 0x1000>;
+                       interrupts = <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>;
+                       clock-names = "aclk", "pclk";
+                       clocks = <&cmu_imem CLK_ACLK_SLIMSSS>,
+                                <&cmu_imem CLK_PCLK_SLIMSSS>;
+               };
+
                pd_gscl: power-domain@105c4000 {
                        compatible = "samsung,exynos5433-pd";
                        reg = <0x105c4000 0x20>;
                                <&cmu_disp CLK_ACLK_XIU_DECON1X>,
                                <&cmu_disp CLK_PCLK_SMMU_DECON1X>,
                                <&cmu_disp CLK_SCLK_DECON_VCLK>,
-                               <&cmu_disp CLK_SCLK_DECON_ECLK>;
+                               <&cmu_disp CLK_SCLK_DECON_ECLK>,
+                               <&cmu_disp CLK_SCLK_DSD>;
                        clock-names = "pclk", "aclk_decon", "aclk_smmu_decon0x",
                                "aclk_xiu_decon0x", "pclk_smmu_decon0x",
                                "aclk_smmu_decon1x", "aclk_xiu_decon1x",
                                "pclk_smmu_decon1x", "sclk_decon_vclk",
-                               "sclk_decon_eclk";
+                               "sclk_decon_eclk", "dsd";
                        power-domains = <&pd_disp>;
                        interrupt-names = "fifo", "vsync", "lcd_sys";
                        interrupts = <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>,
                                 <&cmu_disp CLK_ACLK_XIU_TV1X>,
                                 <&cmu_disp CLK_PCLK_SMMU_TV1X>,
                                 <&cmu_disp CLK_SCLK_DECON_TV_VCLK>,
-                                <&cmu_disp CLK_SCLK_DECON_TV_ECLK>;
+                                <&cmu_disp CLK_SCLK_DECON_TV_ECLK>,
+                                <&cmu_disp CLK_SCLK_DSD>;
                        clock-names = "pclk", "aclk_decon", "aclk_smmu_decon0x",
                                      "aclk_xiu_decon0x", "pclk_smmu_decon0x",
                                      "aclk_smmu_decon1x", "aclk_xiu_decon1x",
                                      "pclk_smmu_decon1x", "sclk_decon_vclk",
-                                     "sclk_decon_eclk";
+                                     "sclk_decon_eclk", "dsd";
                        samsung,disp-sysreg = <&syscon_disp>;
                        power-domains = <&pd_disp>;
                        interrupt-names = "fifo", "vsync", "lcd_sys";
                        reg = <0x13c00000 0x1000>;
                        interrupts = <GIC_SPI 297 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "pclk", "aclk", "aclk_xiu",
-                                     "aclk_gsclbend";
+                                     "aclk_gsclbend", "gsd";
                        clocks = <&cmu_gscl CLK_PCLK_GSCL0>,
                                 <&cmu_gscl CLK_ACLK_GSCL0>,
                                 <&cmu_gscl CLK_ACLK_XIU_GSCLX>,
-                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>;
+                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>,
+                                <&cmu_gscl CLK_ACLK_GSD>;
                        iommus = <&sysmmu_gscl0>;
                        power-domains = <&pd_gscl>;
                };
                        reg = <0x13c10000 0x1000>;
                        interrupts = <GIC_SPI 298 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "pclk", "aclk", "aclk_xiu",
-                                     "aclk_gsclbend";
+                                     "aclk_gsclbend", "gsd";
                        clocks = <&cmu_gscl CLK_PCLK_GSCL1>,
                                 <&cmu_gscl CLK_ACLK_GSCL1>,
                                 <&cmu_gscl CLK_ACLK_XIU_GSCLX>,
-                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>;
+                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>,
+                                <&cmu_gscl CLK_ACLK_GSD>;
                        iommus = <&sysmmu_gscl1>;
                        power-domains = <&pd_gscl>;
                };
                        reg = <0x13c20000 0x1000>;
                        interrupts = <GIC_SPI 299 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "pclk", "aclk", "aclk_xiu",
-                                     "aclk_gsclbend";
+                                     "aclk_gsclbend", "gsd";
                        clocks = <&cmu_gscl CLK_PCLK_GSCL2>,
                                 <&cmu_gscl CLK_ACLK_GSCL2>,
                                 <&cmu_gscl CLK_ACLK_XIU_GSCLX>,
-                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>;
+                                <&cmu_gscl CLK_ACLK_GSCLBEND_333>,
+                                <&cmu_gscl CLK_ACLK_GSD>;
                        iommus = <&sysmmu_gscl2>;
                        power-domains = <&pd_gscl>;
                };
index 967558a..077d234 100644 (file)
                tmuctrl0 = &tmuctrl_0;
        };
 
+       arm-pmu {
+               compatible = "arm,cortex-a57-pmu", "arm,armv8-pmuv3";
+               interrupts = <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>;
+               interrupt-affinity = <&cpu_atlas0>, <&cpu_atlas1>,
+                                    <&cpu_atlas2>, <&cpu_atlas3>;
+       };
+
+       fin_pll: clock {
+               /* XXTI */
+               compatible = "fixed-clock";
+               clock-output-names = "fin_pll";
+               #clock-cells = <0>;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        reg = <0x10000000 0x100>;
                };
 
-               fin_pll: xxti {
-                       compatible = "fixed-clock";
-                       clock-output-names = "fin_pll";
-                       #clock-cells = <0>;
-               };
-
                gic: interrupt-controller@11001000 {
                        compatible = "arm,gic-400";
                        #interrupt-cells = <3>;
                        status = "disabled";
                };
 
-               arm-pmu {
-                       compatible = "arm,cortex-a57-pmu", "arm,armv8-pmuv3";
-                       interrupts = <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>;
-                       interrupt-affinity = <&cpu_atlas0>, <&cpu_atlas1>,
-                                            <&cpu_atlas2>, <&cpu_atlas3>;
-               };
-
-               timer {
-                       compatible = "arm,armv8-timer";
-                       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)>;
-               };
-
                pmu_system_controller: system-controller@105c0000 {
                        compatible = "samsung,exynos7-pmu", "syscon";
                        reg = <0x105c0000 0x5000>;
                        };
                };
        };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               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)>;
+       };
 };
 
 #include "exynos7-pinctrl.dtsi"
index 13604e5..0bd122f 100644 (file)
@@ -20,5 +20,8 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-rdb.dtb
 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb
 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
 
+dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mq-evk.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mq-zii-ultra-rmb3.dtb
+dtb-$(CONFIG_ARCH_MXC) += imx8mq-zii-ultra-zest.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8qxp-mek.dtb
index 7c72626..9927b09 100644 (file)
        status = "okay";
 };
 
+&pcie {
+       status = "okay";
+};
+
 &sai2 {
        status = "okay";
 };
index 1ce0042..ec6257a 100644 (file)
                        interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>;
                };
 
-               pcie@3400000 {
+               pcie: pcie@3400000 {
                        compatible = "fsl,ls1012a-pcie";
                        reg = <0x00 0x03400000 0x0 0x00100000   /* controller registers */
                               0x40 0x00000000 0x0 0x00002000>; /* configuration space */
index 14c79f4..b359068 100644 (file)
                device_type = "memory";
                reg = <0x0 0x80000000 0x1 0x00000000>;
        };
+
+       sys_mclk: clock-mclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <25000000>;
+       };
+
+       reg_1p8v: regulator-1p8v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+
+       sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,widgets =
+                       "Microphone", "Microphone Jack",
+                       "Headphone", "Headphone Jack",
+                       "Speaker", "Speaker Ext",
+                       "Line", "Line In Jack";
+               simple-audio-card,routing =
+                       "MIC_IN", "Microphone Jack",
+                       "Microphone Jack", "Mic Bias",
+                       "LINE_IN", "Line In Jack",
+                       "Headphone Jack", "HP_OUT",
+                       "Speaker Ext", "LINE_OUT";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai1>;
+                       frame-master;
+                       bitclock-master;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&sgtl5000>;
+                       frame-master;
+                       bitclock-master;
+                       system-clock-frequency = <25000000>;
+               };
+       };
 };
 
 &duart0 {
                                reg = <0x57>;
                        };
                };
+
+               i2c@5 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x5>;
+
+                       sgtl5000: audio-codec@a {
+                               #sound-dai-cells = <0>;
+                               compatible = "fsl,sgtl5000";
+                               reg = <0xa>;
+                               VDDA-supply = <&reg_1p8v>;
+                               VDDIO-supply = <&reg_1p8v>;
+                               clocks = <&sys_mclk>;
+                       };
+               };
        };
 };
+
+&sai1 {
+       status = "okay";
+};
index f86b054..f9c272f 100644 (file)
                device_type = "memory";
                reg = <0x0 0x80000000 0x1 0x0000000>;
        };
+
+       sys_mclk: clock-mclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <25000000>;
+       };
+
+       reg_1p8v: regulator-1p8v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+
+       sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,widgets =
+                       "Microphone", "Microphone Jack",
+                       "Headphone", "Headphone Jack",
+                       "Speaker", "Speaker Ext",
+                       "Line", "Line In Jack";
+               simple-audio-card,routing =
+                       "MIC_IN", "Microphone Jack",
+                       "Microphone Jack", "Mic Bias",
+                       "LINE_IN", "Line In Jack",
+                       "Headphone Jack", "HP_OUT",
+                       "Speaker Ext", "LINE_OUT";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sai4>;
+                       frame-master;
+                       bitclock-master;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&sgtl5000>;
+                       frame-master;
+                       bitclock-master;
+                       system-clock-frequency = <25000000>;
+               };
+       };
 };
 
 &i2c0 {
                #address-cells = <1>;
                #size-cells = <0>;
 
+               i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x1>;
+
+                       sgtl5000: audio-codec@a {
+                               #sound-dai-cells = <0>;
+                               compatible = "fsl,sgtl5000";
+                               reg = <0xa>;
+                               VDDA-supply = <&reg_1p8v>;
+                               VDDIO-supply = <&reg_1p8v>;
+                               clocks = <&sys_mclk>;
+                               sclk-strength = <3>;
+                       };
+               };
+
                i2c@2 {
                        #address-cells = <1>;
                        #size-cells = <0>;
 &enetc_port1 {
        status = "disabled";
 };
+
+&sai4 {
+       status = "okay";
+};
index 2896bbc..b045812 100644 (file)
                                          IRQ_TYPE_LEVEL_LOW)>;
        };
 
+       pmu {
+               compatible = "arm,cortex-a72-pmu";
+               interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
        gic: interrupt-controller@6000000 {
                compatible= "arm,gic-v3";
                #address-cells = <2>;
                        status = "disabled";
                };
 
+               edma0: dma-controller@22c0000 {
+                       #dma-cells = <2>;
+                       compatible = "fsl,vf610-edma";
+                       reg = <0x0 0x22c0000 0x0 0x10000>,
+                             <0x0 0x22d0000 0x0 0x10000>,
+                             <0x0 0x22e0000 0x0 0x10000>;
+                       interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "edma-tx", "edma-err";
+                       dma-channels = <32>;
+                       clock-names = "dmamux0", "dmamux1";
+                       clocks = <&clockgen 4 1>,
+                                <&clockgen 4 1>;
+               };
+
                gpio1: gpio@2300000 {
                        compatible = "fsl,qoriq-gpio";
                        reg = <0x0 0x2300000 0x0 0x10000>;
                sata: sata@3200000 {
                        compatible = "fsl,ls1028a-ahci";
                        reg = <0x0 0x3200000 0x0 0x10000>,
-                               <0x0 0x20140520 0x0 0x4>;
+                               <0x7 0x100520 0x0 0x4>;
                        reg-names = "ahci", "sata-ecc";
                        interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clockgen 4 1>;
                                     <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 209 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               sai1: audio-controller@f100000 {
+                       #sound-dai-cells = <0>;
+                       compatible = "fsl,vf610-sai";
+                       reg = <0x0 0xf100000 0x0 0x10000>;
+                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+                                <&clockgen 4 1>, <&clockgen 4 1>;
+                       clock-names = "bus", "mclk1", "mclk2", "mclk3";
+                       dma-names = "tx", "rx";
+                       dmas = <&edma0 1 4>,
+                              <&edma0 1 3>;
+                       status = "disabled";
+               };
+
+               sai2: audio-controller@f110000 {
+                       #sound-dai-cells = <0>;
+                       compatible = "fsl,vf610-sai";
+                       reg = <0x0 0xf110000 0x0 0x10000>;
+                       interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+                                <&clockgen 4 1>, <&clockgen 4 1>;
+                       clock-names = "bus", "mclk1", "mclk2", "mclk3";
+                       dma-names = "tx", "rx";
+                       dmas = <&edma0 1 6>,
+                              <&edma0 1 5>;
+                       status = "disabled";
+               };
+
+               sai4: audio-controller@f130000 {
+                       #sound-dai-cells = <0>;
+                       compatible = "fsl,vf610-sai";
+                       reg = <0x0 0xf130000 0x0 0x10000>;
+                       interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 1>, <&clockgen 4 1>,
+                                <&clockgen 4 1>, <&clockgen 4 1>;
+                       clock-names = "bus", "mclk1", "mclk2", "mclk3";
+                       dma-names = "tx", "rx";
+                       dmas = <&edma0 1 10>,
+                              <&edma0 1 9>;
+                       status = "disabled";
+               };
+
                pcie@1f0000000 { /* Integrated Endpoint Root Complex */
                        compatible = "pci-host-ecam-generic";
                        reg = <0x01 0xf0000000 0x0 0x100000>;
index 17ca357..4223a23 100644 (file)
@@ -15,7 +15,6 @@
        model = "LS1043A RDB Board";
 
        aliases {
-               crypto = &crypto;
                serial0 = &duart0;
                serial1 = &duart1;
                serial2 = &duart2;
index 6fd6116..71d9ed9 100644 (file)
@@ -18,6 +18,7 @@
        #size-cells = <2>;
 
        aliases {
+               crypto = &crypto;
                fman0 = &fman0;
                ethernet0 = &enet0;
                ethernet1 = &enet1;
                        interrupts = <0 99 0x4>;
                        clock-names = "qspi_en", "qspi";
                        clocks = <&clockgen 4 0>, <&clockgen 4 0>;
-                       big-endian;
                        status = "disabled";
                };
 
index cb71850..b0ef08b 100644 (file)
                        interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "qspi_en", "qspi";
                        clocks = <&clockgen 4 1>, <&clockgen 4 1>;
-                       big-endian;
-                       fsl,qspi-has-second-chip;
                        status = "disabled";
                };
 
index 99a22ab..1a5acf6 100644 (file)
        };
 };
 
+&sata0 {
+       status = "okay";
+};
+
+&sata1 {
+       status = "okay";
+};
+
+&sata2 {
+       status = "okay";
+};
+
+&sata3 {
+       status = "okay";
+};
+
 &uart0 {
        status = "okay";
 };
index 9df37b1..c2817b7 100644 (file)
        };
 };
 
+&sata0 {
+       status = "okay";
+};
+
+&sata1 {
+       status = "okay";
+};
+
+&sata2 {
+       status = "okay";
+};
+
+&sata3 {
+       status = "okay";
+};
+
 &uart0 {
        status = "okay";
 };
index fe87204..125a8cc 100644 (file)
@@ -33,6 +33,7 @@
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster0_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@1 {
@@ -48,6 +49,7 @@
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster0_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@100 {
@@ -63,6 +65,7 @@
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster1_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@101 {
@@ -78,6 +81,7 @@
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster1_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@200 {
@@ -93,6 +97,7 @@
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster2_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@201 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster2_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@300 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster3_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@301 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster3_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@400 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster4_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@401 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster4_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@500 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster5_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@501 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster5_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@600 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster6_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@601 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster6_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@700 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster7_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cpu@701 {
                        i-cache-line-size = <64>;
                        i-cache-sets = <192>;
                        next-level-cache = <&cluster7_l2>;
+                       cpu-idle-states = <&cpu_pw20>;
                };
 
                cluster0_l2: l2-cache0 {
                        cache-sets = <1024>;
                        cache-level = <2>;
                };
+
+               cpu_pw20: cpu-pw20 {
+                       compatible = "arm,idle-state";
+                       idle-state-name = "PW20";
+                       arm,psci-suspend-param = <0x0>;
+                       entry-latency-us = <2000>;
+                       exit-latency-us = <2000>;
+                       min-residency-us = <6000>;
+                 };
        };
 
        gic: interrupt-controller@6000000 {
                        status = "disabled";
                };
 
+               sata0: sata@3200000 {
+                       compatible = "fsl,lx2160a-ahci";
+                       reg = <0x0 0x3200000 0x0 0x10000>,
+                             <0x7 0x100520 0x0 0x4>;
+                       reg-names = "ahci", "sata-ecc";
+                       interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 3>;
+                       dma-coherent;
+                       status = "disabled";
+               };
+
+               sata1: sata@3210000 {
+                       compatible = "fsl,lx2160a-ahci";
+                       reg = <0x0 0x3210000 0x0 0x10000>,
+                             <0x7 0x100520 0x0 0x4>;
+                       reg-names = "ahci", "sata-ecc";
+                       interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 3>;
+                       dma-coherent;
+                       status = "disabled";
+               };
+
+               sata2: sata@3220000 {
+                       compatible = "fsl,lx2160a-ahci";
+                       reg = <0x0 0x3220000 0x0 0x10000>,
+                             <0x7 0x100520 0x0 0x4>;
+                       reg-names = "ahci", "sata-ecc";
+                       interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 3>;
+                       dma-coherent;
+                       status = "disabled";
+               };
+
+               sata3: sata@3230000 {
+                       compatible = "fsl,lx2160a-ahci";
+                       reg = <0x0 0x3230000 0x0 0x10000>,
+                             <0x7 0x100520 0x0 0x4>;
+                       reg-names = "ahci", "sata-ecc";
+                       interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clockgen 4 3>;
+                       dma-coherent;
+                       status = "disabled";
+               };
+
                smmu: iommu@5000000 {
                        compatible = "arm,mmu-500";
                        reg = <0 0x5000000 0 0x800000>;
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts
new file mode 100644 (file)
index 0000000..2d5d894
--- /dev/null
@@ -0,0 +1,235 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019 NXP
+ */
+
+/dts-v1/;
+
+#include "imx8mm.dtsi"
+
+/ {
+       model = "FSL i.MX8MM EVK board";
+       compatible = "fsl,imx8mm-evk", "fsl,imx8mm";
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       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;
+       };
+};
+
+&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>;
+                       at803x,led-act-blind-workaround;
+                       at803x,eee-okay;
+                       at803x,vddio-1p8v;
+               };
+       };
+};
+
+&uart2 { /* console */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usdhc2 {
+       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 {
+       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-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_reg_usdhc2_vmmc: regusdhc2vmmc {
+               fsl,pins = <
+                       MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19     0x41
+               >;
+       };
+
+       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
+               >;
+       };
+
+       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
+               >;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
new file mode 100644 (file)
index 0000000..6b407a9
--- /dev/null
@@ -0,0 +1,733 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <dt-bindings/clock/imx8mm-clock.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/thermal/thermal.h>
+
+#include "imx8mm-pinfunc.h"
+
+/ {
+       compatible = "fsl,imx8mm";
+       interrupt-parent = <&gic>;
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       aliases {
+               ethernet0 = &fec1;
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               i2c2 = &i2c3;
+               i2c3 = &i2c4;
+               serial0 = &uart1;
+               serial1 = &uart2;
+               serial2 = &uart3;
+               serial3 = &uart4;
+               spi0 = &ecspi1;
+               spi1 = &ecspi2;
+               spi2 = &ecspi3;
+               mmc0 = &usdhc1;
+               mmc1 = &usdhc2;
+               mmc2 = &usdhc3;
+               gpio0 = &gpio1;
+               gpio1 = &gpio2;
+               gpio2 = &gpio3;
+               gpio3 = &gpio4;
+               gpio4 = &gpio5;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               A53_0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x0>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MM_CLK_ARM>;
+                       enable-method = "psci";
+                       next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+               };
+
+               A53_1: cpu@1 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x1>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MM_CLK_ARM>;
+                       enable-method = "psci";
+                       next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+               };
+
+               A53_2: cpu@2 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x2>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MM_CLK_ARM>;
+                       enable-method = "psci";
+                       next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+               };
+
+               A53_3: cpu@3 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a53";
+                       reg = <0x3>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MM_CLK_ARM>;
+                       enable-method = "psci";
+                       next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+               };
+
+               A53_L2: l2-cache0 {
+                       compatible = "cache";
+               };
+       };
+
+       a53_opp_table: opp-table {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp-1200000000 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <850000>;
+                       clock-latency-ns = <150000>;
+               };
+
+               opp-1600000000 {
+                       opp-hz = /bits/ 64 <1600000000>;
+                       opp-microvolt = <900000>;
+                       clock-latency-ns = <150000>;
+                       opp-suspend;
+               };
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x0 0x40000000 0 0x80000000>;
+       };
+
+       osc_32k: clock-osc-32k {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               clock-output-names = "osc_32k";
+       };
+
+       osc_24m: clock-osc-24m {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <24000000>;
+               clock-output-names = "osc_24m";
+       };
+
+       clk_ext1: clock-ext1 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <133000000>;
+               clock-output-names = "clk_ext1";
+       };
+
+       clk_ext2: clock-ext2 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <133000000>;
+               clock-output-names = "clk_ext2";
+       };
+
+       clk_ext3: clock-ext3 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <133000000>;
+               clock-output-names = "clk_ext3";
+       };
+
+       clk_ext4: clock-ext4 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency= <133000000>;
+               clock-output-names = "clk_ext4";
+       };
+
+       gic: interrupt-controller@38800000 {
+               compatible = "arm,gic-v3";
+               reg = <0x0 0x38800000 0 0x10000>, /* GIC Dist */
+                     <0x0 0x38880000 0 0xC0000>; /* GICR (RD_base + SGI_base) */
+               #interrupt-cells = <3>;
+               interrupt-controller;
+               interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       pmu {
+               compatible = "arm,armv8-pmuv3";
+               interrupts = <GIC_PPI 7
+                            (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_HIGH)>;
+               interrupt-affinity = <&A53_0>, <&A53_1>, <&A53_2>, <&A53_3>;
+       };
+
+       timer {
+               compatible = "arm,armv8-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>, /* Physical Secure */
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>, /* Physical Non-Secure */
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>, /* Virtual */
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(6) | IRQ_TYPE_LEVEL_LOW)>; /* Hypervisor */
+               clock-frequency = <8000000>;
+               arm,no-tick-in-suspend;
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0x0 0x0 0x0 0x3e000000>;
+
+               aips1: bus@30000000 {
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       gpio1: gpio@30200000 {
+                               compatible = "fsl,imx8mm-gpio", "fsl,imx35-gpio";
+                               reg = <0x30200000 0x10000>;
+                               interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio2: gpio@30210000 {
+                               compatible = "fsl,imx8mm-gpio", "fsl,imx35-gpio";
+                               reg = <0x30210000 0x10000>;
+                               interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio3: gpio@30220000 {
+                               compatible = "fsl,imx8mm-gpio", "fsl,imx35-gpio";
+                               reg = <0x30220000 0x10000>;
+                               interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio4: gpio@30230000 {
+                               compatible = "fsl,imx8mm-gpio", "fsl,imx35-gpio";
+                               reg = <0x30230000 0x10000>;
+                               interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio5: gpio@30240000 {
+                               compatible = "fsl,imx8mm-gpio", "fsl,imx35-gpio";
+                               reg = <0x30240000 0x10000>;
+                               interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+                                            <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       wdog1: watchdog@30280000 {
+                               compatible = "fsl,imx8mm-wdt", "fsl,imx21-wdt";
+                               reg = <0x30280000 0x10000>;
+                               interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_WDOG1_ROOT>;
+                               status = "disabled";
+                       };
+
+                       wdog2: watchdog@30290000 {
+                               compatible = "fsl,imx8mm-wdt", "fsl,imx21-wdt";
+                               reg = <0x30290000 0x10000>;
+                               interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_WDOG2_ROOT>;
+                               status = "disabled";
+                       };
+
+                       wdog3: watchdog@302a0000 {
+                               compatible = "fsl,imx8mm-wdt", "fsl,imx21-wdt";
+                               reg = <0x302a0000 0x10000>;
+                               interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_WDOG3_ROOT>;
+                               status = "disabled";
+                       };
+
+                       sdma2: dma-controller@302c0000 {
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               reg = <0x302c0000 0x10000>;
+                               interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_SDMA2_ROOT>,
+                                        <&clk IMX8MM_CLK_SDMA2_ROOT>;
+                               clock-names = "ipg", "ahb";
+                               #dma-cells = <3>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+                       };
+
+                       sdma3: dma-controller@302b0000 {
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               reg = <0x302b0000 0x10000>;
+                               interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_SDMA3_ROOT>,
+                                <&clk IMX8MM_CLK_SDMA3_ROOT>;
+                               clock-names = "ipg", "ahb";
+                               #dma-cells = <3>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+                       };
+
+                       iomuxc: pinctrl@30330000 {
+                               compatible = "fsl,imx8mm-iomuxc";
+                               reg = <0x30330000 0x10000>;
+                       };
+
+                       gpr: iomuxc-gpr@30340000 {
+                               compatible = "fsl,imx8mm-iomuxc-gpr", "syscon";
+                               reg = <0x30340000 0x10000>;
+                       };
+
+                       ocotp: ocotp-ctrl@30350000 {
+                               compatible = "fsl,imx8mm-ocotp", "fsl,imx7d-ocotp", "syscon";
+                               reg = <0x30350000 0x10000>;
+                               clocks = <&clk IMX8MM_CLK_OCOTP_ROOT>;
+                               /* For nvmem subnodes */
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                       };
+
+                       anatop: anatop@30360000 {
+                               compatible = "fsl,imx8mm-anatop", "syscon", "simple-bus";
+                               reg = <0x30360000 0x10000>;
+                       };
+
+                       snvs: snvs@30370000 {
+                               compatible = "fsl,sec-v4.0-mon","syscon", "simple-mfd";
+                               reg = <0x30370000 0x10000>;
+
+                               snvs_rtc: snvs-rtc-lp {
+                                       compatible = "fsl,sec-v4.0-mon-rtc-lp";
+                                       regmap = <&snvs>;
+                                       offset = <0x34>;
+                                       interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
+                                                    <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+                               };
+
+                               snvs_pwrkey: snvs-powerkey {
+                                       compatible = "fsl,sec-v4.0-pwrkey";
+                                       regmap = <&snvs>;
+                                       interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+                                       linux,keycode = <KEY_POWER>;
+                                       wakeup-source;
+                               };
+                       };
+
+                       clk: clock-controller@30380000 {
+                               compatible = "fsl,imx8mm-ccm";
+                               reg = <0x30380000 0x10000>;
+                               #clock-cells = <1>;
+                               clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
+                                        <&clk_ext3>, <&clk_ext4>;
+                               clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
+                                             "clk_ext3", "clk_ext4";
+                       };
+
+                       src: reset-controller@30390000 {
+                               compatible = "fsl,imx8mm-src", "syscon";
+                               reg = <0x30390000 0x10000>;
+                               interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
+                               #reset-cells = <1>;
+                       };
+               };
+
+               aips2: bus@30400000 {
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       pwm1: pwm@30660000 {
+                               compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
+                               reg = <0x30660000 0x10000>;
+                               interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_PWM1_ROOT>,
+                                       <&clk IMX8MM_CLK_PWM1_ROOT>;
+                               clock-names = "ipg", "per";
+                               #pwm-cells = <2>;
+                               status = "disabled";
+                       };
+
+                       pwm2: pwm@30670000 {
+                               compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
+                               reg = <0x30670000 0x10000>;
+                               interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_PWM2_ROOT>,
+                                        <&clk IMX8MM_CLK_PWM2_ROOT>;
+                               clock-names = "ipg", "per";
+                               #pwm-cells = <2>;
+                               status = "disabled";
+                       };
+
+                       pwm3: pwm@30680000 {
+                               compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
+                               reg = <0x30680000 0x10000>;
+                               interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_PWM3_ROOT>,
+                                        <&clk IMX8MM_CLK_PWM3_ROOT>;
+                               clock-names = "ipg", "per";
+                               #pwm-cells = <2>;
+                               status = "disabled";
+                       };
+
+                       pwm4: pwm@30690000 {
+                               compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
+                               reg = <0x30690000 0x10000>;
+                               interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_PWM4_ROOT>,
+                                        <&clk IMX8MM_CLK_PWM4_ROOT>;
+                               clock-names = "ipg", "per";
+                               #pwm-cells = <2>;
+                               status = "disabled";
+                       };
+               };
+
+               aips3: bus@30800000 {
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       ecspi1: spi@30820000 {
+                               compatible = "fsl,imx8mm-ecspi", "fsl,imx51-ecspi";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30820000 0x10000>;
+                               interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_ECSPI1_ROOT>,
+                                        <&clk IMX8MM_CLK_ECSPI1_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 0 7 1>, <&sdma1 1 7 2>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       ecspi2: spi@30830000 {
+                               compatible = "fsl,imx8mm-ecspi", "fsl,imx51-ecspi";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30830000 0x10000>;
+                               interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_ECSPI2_ROOT>,
+                                        <&clk IMX8MM_CLK_ECSPI2_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 2 7 1>, <&sdma1 3 7 2>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       ecspi3: spi@30840000 {
+                               compatible = "fsl,imx8mm-ecspi", "fsl,imx51-ecspi";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30840000 0x10000>;
+                               interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_ECSPI3_ROOT>,
+                                        <&clk IMX8MM_CLK_ECSPI3_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 4 7 1>, <&sdma1 5 7 2>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       uart1: serial@30860000 {
+                               compatible = "fsl,imx8mm-uart", "fsl,imx6q-uart";
+                               reg = <0x30860000 0x10000>;
+                               interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_UART1_ROOT>,
+                                        <&clk IMX8MM_CLK_UART1_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 22 4 0>, <&sdma1 23 4 0>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       uart3: serial@30880000 {
+                               compatible = "fsl,imx8mm-uart", "fsl,imx6q-uart";
+                               reg = <0x30880000 0x10000>;
+                               interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_UART3_ROOT>,
+                                        <&clk IMX8MM_CLK_UART3_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 26 4 0>, <&sdma1 27 4 0>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       uart2: serial@30890000 {
+                               compatible = "fsl,imx8mm-uart", "fsl,imx6q-uart";
+                               reg = <0x30890000 0x10000>;
+                               interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_UART2_ROOT>,
+                                        <&clk IMX8MM_CLK_UART2_ROOT>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       i2c1: i2c@30a20000 {
+                               compatible = "fsl,imx8mm-i2c", "fsl,imx21-i2c";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30a20000 0x10000>;
+                               interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_I2C1_ROOT>;
+                               status = "disabled";
+                       };
+
+                       i2c2: i2c@30a30000 {
+                               compatible = "fsl,imx8mm-i2c", "fsl,imx21-i2c";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30a30000 0x10000>;
+                               interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_I2C2_ROOT>;
+                               status = "disabled";
+                       };
+
+                       i2c3: i2c@30a40000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx8mm-i2c", "fsl,imx21-i2c";
+                               reg = <0x30a40000 0x10000>;
+                               interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_I2C3_ROOT>;
+                               status = "disabled";
+                       };
+
+                       i2c4: i2c@30a50000 {
+                               compatible = "fsl,imx8mm-i2c", "fsl,imx21-i2c";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x30a50000 0x10000>;
+                               interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_I2C4_ROOT>;
+                               status = "disabled";
+                       };
+
+                       uart4: serial@30a60000 {
+                               compatible = "fsl,imx8mm-uart", "fsl,imx6q-uart";
+                               reg = <0x30a60000 0x10000>;
+                               interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_UART4_ROOT>,
+                                        <&clk IMX8MM_CLK_UART4_ROOT>;
+                               clock-names = "ipg", "per";
+                               dmas = <&sdma1 28 4 0>, <&sdma1 29 4 0>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
+                       usdhc1: mmc@30b40000 {
+                               compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+                               reg = <0x30b40000 0x10000>;
+                               interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_DUMMY>,
+                                        <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+                                        <&clk IMX8MM_CLK_USDHC1_ROOT>;
+                               clock-names = "ipg", "ahb", "per";
+                               assigned-clocks = <&clk IMX8MM_CLK_USDHC1>;
+                               assigned-clock-rates = <400000000>;
+                               fsl,tuning-start-tap = <20>;
+                               fsl,tuning-step= <2>;
+                               bus-width = <4>;
+                               status = "disabled";
+                       };
+
+                       usdhc2: mmc@30b50000 {
+                               compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+                               reg = <0x30b50000 0x10000>;
+                               interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_DUMMY>,
+                                        <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+                                        <&clk IMX8MM_CLK_USDHC2_ROOT>;
+                               clock-names = "ipg", "ahb", "per";
+                               fsl,tuning-start-tap = <20>;
+                               fsl,tuning-step= <2>;
+                               bus-width = <4>;
+                               status = "disabled";
+                       };
+
+                       usdhc3: mmc@30b60000 {
+                               compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+                               reg = <0x30b60000 0x10000>;
+                               interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_DUMMY>,
+                                        <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+                                        <&clk IMX8MM_CLK_USDHC3_ROOT>;
+                               clock-names = "ipg", "ahb", "per";
+                               assigned-clocks = <&clk IMX8MM_CLK_USDHC3_ROOT>;
+                               assigned-clock-rates = <400000000>;
+                               fsl,tuning-start-tap = <20>;
+                               fsl,tuning-step= <2>;
+                               bus-width = <4>;
+                               status = "disabled";
+                       };
+
+                       sdma1: dma-controller@30bd0000 {
+                               compatible = "fsl,imx8mm-sdma", "fsl,imx7d-sdma";
+                               reg = <0x30bd0000 0x10000>;
+                               interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>,
+                                        <&clk IMX8MM_CLK_SDMA1_ROOT>;
+                               clock-names = "ipg", "ahb";
+                               #dma-cells = <3>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+                       };
+
+                       fec1: ethernet@30be0000 {
+                               compatible = "fsl,imx8mm-fec", "fsl,imx6sx-fec";
+                               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>;
+                               clocks = <&clk IMX8MM_CLK_ENET1_ROOT>,
+                                        <&clk IMX8MM_CLK_ENET1_ROOT>,
+                                        <&clk IMX8MM_CLK_ENET_TIMER>,
+                                        <&clk IMX8MM_CLK_ENET_REF>,
+                                        <&clk IMX8MM_CLK_ENET_PHY_REF>;
+                               clock-names = "ipg", "ahb", "ptp",
+                                             "enet_clk_ref", "enet_out";
+                               assigned-clocks = <&clk IMX8MM_CLK_ENET_AXI>,
+                                                 <&clk IMX8MM_CLK_ENET_TIMER>,
+                                                 <&clk IMX8MM_CLK_ENET_REF>,
+                                                 <&clk IMX8MM_CLK_ENET_TIMER>;
+                               assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_266M>,
+                                                        <&clk IMX8MM_SYS_PLL2_100M>,
+                                                        <&clk IMX8MM_SYS_PLL2_125M>;
+                               assigned-clock-rates = <0>, <0>, <125000000>, <100000000>;
+                               fsl,num-tx-queues = <3>;
+                               fsl,num-rx-queues = <3>;
+                               status = "disabled";
+                       };
+
+               };
+
+               aips4: bus@32c00000 {
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       usbotg1: usb@32e40000 {
+                               compatible = "fsl,imx8mm-usb", "fsl,imx7d-usb";
+                               reg = <0x32e40000 0x200>;
+                               interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_USB1_CTRL_ROOT>;
+                               clock-names = "usb1_ctrl_root_clk";
+                               assigned-clocks = <&clk IMX8MM_CLK_USB_BUS>,
+                                                 <&clk IMX8MM_CLK_USB_CORE_REF>;
+                               assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>,
+                                                        <&clk IMX8MM_SYS_PLL1_100M>;
+                               fsl,usbphy = <&usbphynop1>;
+                               fsl,usbmisc = <&usbmisc1 0>;
+                               status = "disabled";
+                       };
+
+                       usbphynop1: usbphynop1 {
+                               compatible = "usb-nop-xceiv";
+                               clocks = <&clk IMX8MM_CLK_USB_PHY_REF>;
+                               assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>;
+                               assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>;
+                               clock-names = "main_clk";
+                       };
+
+                       usbmisc1: usbmisc@32e40200 {
+                               compatible = "fsl,imx8mm-usbmisc", "fsl,imx7d-usbmisc";
+                               #index-cells = <1>;
+                               reg = <0x32e40200 0x200>;
+                       };
+
+                       usbotg2: usb@32e50000 {
+                               compatible = "fsl,imx8mm-usb", "fsl,imx7d-usb";
+                               reg = <0x32e50000 0x200>;
+                               interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MM_CLK_USB1_CTRL_ROOT>;
+                               clock-names = "usb1_ctrl_root_clk";
+                               assigned-clocks = <&clk IMX8MM_CLK_USB_BUS>,
+                                                 <&clk IMX8MM_CLK_USB_CORE_REF>;
+                               assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>,
+                                                        <&clk IMX8MM_SYS_PLL1_100M>;
+                               fsl,usbphy = <&usbphynop2>;
+                               fsl,usbmisc = <&usbmisc2 0>;
+                               status = "disabled";
+                       };
+
+                       usbphynop2: usbphynop2 {
+                               compatible = "usb-nop-xceiv";
+                               clocks = <&clk IMX8MM_CLK_USB_PHY_REF>;
+                               assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>;
+                               assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>;
+                               clock-names = "main_clk";
+                       };
+
+                       usbmisc2: usbmisc@32e50200 {
+                               compatible = "fsl,imx8mm-usbmisc", "fsl,imx7d-usbmisc";
+                               #index-cells = <1>;
+                               reg = <0x32e50200 0x200>;
+                       };
+
+               };
+
+               dma_apbh: dma-controller@33000000 {
+                       compatible = "fsl,imx7d-dma-apbh", "fsl,imx28-dma-apbh";
+                       reg = <0x33000000 0x2000>;
+                       interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3";
+                       #dma-cells = <1>;
+                       dma-channels = <4>;
+                       clocks = <&clk IMX8MM_CLK_NAND_USDHC_BUS_RAWNAND_CLK>;
+               };
+
+               gpmi: nand-controller@33002000{
+                       compatible = "fsl,imx8mm-gpmi-nand", "fsl,imx7d-gpmi-nand";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x33002000 0x2000>, <0x33004000 0x4000>;
+                       reg-names = "gpmi-nand", "bch";
+                       interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "bch";
+                       clocks = <&clk IMX8MM_CLK_NAND_ROOT>,
+                                <&clk IMX8MM_CLK_NAND_USDHC_BUS_RAWNAND_CLK>;
+                       clock-names = "gpmi_io", "gpmi_bch_apb";
+                       dmas = <&dma_apbh 0>;
+                       dma-names = "rx-tx";
+                       status = "disabled";
+               };
+       };
+};
index 54737bf..b2038be 100644 (file)
                reg = <0x00000000 0x40000000 0 0xc0000000>;
        };
 
+       pcie0_refclk: pcie0-refclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <100000000>;
+       };
+
        reg_usdhc2_vmmc: regulator-vsd-3v3 {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_usdhc2>;
                gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
                enable-active-high;
        };
+
+       buck2_reg: regulator-buck2 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_buck2>;
+               compatible = "regulator-gpio";
+               regulator-name = "vdd_arm";
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <1000000>;
+               gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+               states = <1000000 0x0
+                         900000 0x1>;
+       };
+
+       wm8524: audio-codec {
+               #sound-dai-cells = <0>;
+               compatible = "wlf,wm8524";
+               wlf,mute-gpios = <&gpio1 8 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 = <&sai2>;
+               };
+
+               link_codec: simple-audio-card,codec {
+                       sound-dai = <&wm8524>;
+                       clocks = <&clk IMX8MQ_CLK_SAI2_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 {
        };
 };
 
+&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>;
+       status = "okay";
+};
+
+&gpio5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wifi_reset>;
+
+       wl-reg-on {
+               gpio-hog;
+               gpios = <29 GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+};
+
 &i2c1 {
        clock-frequency = <100000>;
        pinctrl-names = "default";
        };
 };
 
+&pcie0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie0>;
+       reset-gpio = <&gpio5 28 GPIO_ACTIVE_LOW>;
+       clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>,
+                <&clk IMX8MQ_CLK_PCIE1_AUX>,
+                <&clk IMX8MQ_CLK_PCIE1_PHY>,
+                <&pcie0_refclk>;
+       clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+       status = "okay";
+};
+
+&pgc_gpu {
+       power-supply = <&sw1a_reg>;
+};
+
 &uart1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart1>;
 };
 
 &iomuxc {
+       pinctrl_buck2: vddarmgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO13_GPIO1_IO13              0x19
+               >;
+
+       };
+
        pinctrl_fec1: fec1grp {
                fsl,pins = <
                        MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
                >;
        };
 
+       pinctrl_pcie0: pcie0grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C4_SCL_PCIE1_CLKREQ_B            0x76
+                       MX8MQ_IOMUXC_UART4_RXD_GPIO5_IO28               0x16
+               >;
+       };
+
        pinctrl_qspi: qspigrp {
                fsl,pins = <
                        MX8MQ_IOMUXC_NAND_ALE_QSPI_A_SCLK       0x82
                >;
        };
 
+       pinctrl_sai2: sai2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC     0xd6
+                       MX8MQ_IOMUXC_SAI2_TXC_SAI2_TX_BCLK      0xd6
+                       MX8MQ_IOMUXC_SAI2_MCLK_SAI2_MCLK        0xd6
+                       MX8MQ_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0    0xd6
+                       MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8       0xd6
+               >;
+       };
+
        pinctrl_uart1: uart1grp {
                fsl,pins = <
                        MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX             0x49
                        MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B            0xc6
                >;
        };
+
+       pinctrl_wifi_reset: wifiresetgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART4_TXD_GPIO5_IO29               0x16
+               >;
+       };
 };
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts b/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts
new file mode 100644 (file)
index 0000000..d2a6da4
--- /dev/null
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+
+/dts-v1/;
+
+#include "imx8mq-zii-ultra.dtsi"
+
+/ {
+       model = "ZII i.MX8MQ Ultra RMB3 Board";
+       compatible = "zii,imx8mq-ultra-rmb3", "zii,imx8mq-ultra", "fsl,imx8mq";
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       nor_flash: flash@0 {
+               compatible = "st,n25q128a13", "jedec,spi-nor";
+               spi-max-frequency = <20000000>;
+               reg = <0>;
+       };
+};
+
+&i2c2 {
+       temp-sense@48 {
+               compatible = "national,lm75";
+               reg = <0x48>;
+       };
+};
+
+&i2c4 {
+       touchscreen@20 {
+               compatible = "syna,rmi4-i2c";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ts>;
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
+
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rmi4-f01@1 {
+                       reg = <0x1>;
+                       syna,nosleep-mode = <2>;
+               };
+
+               rmi4-f11@11 {
+                       reg = <0x11>;
+                       touchscreen-inverted-x;
+                       touchscreen-swapped-x-y;
+                       syna,sensor-type = <1>;
+               };
+
+               rmi4-f12@12 {
+                       reg = <0x12>;
+                       touchscreen-inverted-x;
+                       touchscreen-swapped-x-y;
+                       syna,sensor-type = <1>;
+               };
+       };
+
+       touchscreen@2a {
+               compatible = "eeti,exc3000";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ts>;
+               reg = <0x2a>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
+               touchscreen-inverted-x;
+               touchscreen-swapped-x-y;
+               status = "disabled";
+       };
+};
+
+&usbhub {
+       swap-dx-lanes = <0>;
+};
+
+&iomuxc {
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9       0x19
+                       MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK    0x82
+                       MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO    0x82
+                       MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI    0x82
+               >;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-zest.dts b/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-zest.dts
new file mode 100644 (file)
index 0000000..1084d93
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+
+/dts-v1/;
+
+#include "imx8mq-zii-ultra.dtsi"
+
+/ {
+       model = "ZII i.MX8MQ Ultra Zest Board";
+       compatible = "zii,imx8mq-ultra-zest", "zii,imx8mq-ultra", "fsl,imx8mq";
+};
+
+&i2c4 {
+       touchscreen@4a {
+               compatible = "atmel,maxtouch";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_ts>;
+               reg = <0x4a>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
+       };
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi
new file mode 100644 (file)
index 0000000..7a1706f
--- /dev/null
@@ -0,0 +1,725 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+
+#include "imx8mq.dtsi"
+
+/ {
+       aliases {
+               mdio-gpio0 = &mdio0;
+               rtc0 = &ds1341;
+       };
+
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       mdio0: bitbang-mdio {
+               compatible = "virtual,mdio-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_mdio_bitbang>, <&pinctrl_fec1_phy_reset>;
+               gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>, /* MDC */
+                       <&gpio1 14 GPIO_ACTIVE_HIGH>; /* MDIO */
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy0: ethernet-phy@0 {
+                       reg = <0>;
+                       reset-gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       pcie0_refclk: clock-pcie0-refclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <100000000>;
+       };
+
+       pcie1_refclk: clock-pcie1-refclk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <100000000>;
+       };
+
+       reg_12p0_main: regulator-12p0-main {
+               compatible = "regulator-fixed";
+               regulator-name = "12V_MAIN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_5p0_main: regulator-5p0-main {
+               compatible = "regulator-fixed";
+               vin-supply = <&reg_12p0_main>;
+               regulator-name = "5V_MAIN";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3_main: regulator-3p3-main {
+               compatible = "regulator-fixed";
+               vin-supply = <&reg_12p0_main>;
+               regulator-name = "3V3V_MAIN";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0_user_usb: regulator-5p0-user-usb {
+               compatible = "regulator-fixed";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_user_usb>;
+               vin-supply = <&reg_5p0_main>;
+               regulator-name = "5V_USER_USB";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 12 GPIO_ACTIVE_LOW>;
+               startup-delay-us = <1000>;
+       };
+
+       reg_usdhc2_vmmc: regulator-vsd-3v3 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_usdhc2>;
+               compatible = "regulator-fixed";
+               vin-supply = <&reg_3p3_main>;
+               regulator-name = "3V3_SD";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_arm: regulator-arm {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_arm>;
+               compatible = "regulator-gpio";
+               vin-supply = <&reg_12p0_main>;
+               regulator-name = "0V9_ARM";
+               regulator-min-microvolt = <900000>;
+               regulator-max-microvolt = <1000000>;
+               gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+               states = <1000000 0x0
+                          900000 0x1>;
+               regulator-always-on;
+       };
+};
+
+&A53_0 {
+       cpu-supply = <&reg_arm>;
+};
+
+&A53_1 {
+       cpu-supply = <&reg_arm>;
+};
+
+&A53_2 {
+       cpu-supply = <&reg_arm>;
+};
+
+&A53_3 {
+       cpu-supply = <&reg_arm>;
+};
+
+&fec1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
+
+       phy-handle = <&phy0>;
+       phy-mode = "rmii";
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               status = "okay";
+
+               switch: switch@0 {
+                       compatible = "marvell,mv88e6085";
+                       pinctrl-0 = <&pinctrl_switch_irq>;
+                       pinctrl-names = "default";
+                       reg = <0>;
+                       dsa,member = <0 0>;
+                       eeprom-length = <512>;
+                       interrupt-parent = <&gpio1>;
+                       interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       label = "gigabit_proc";
+                                       phy-handle = <&switchphy0>;
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       label = "netaux";
+                                       phy-handle = <&switchphy1>;
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       label = "cpu";
+                                       ethernet = <&fec1>;
+
+                                       fixed-link {
+                                               speed = <100>;
+                                               full-duplex;
+                                       };
+                               };
+
+                               port@3 {
+                                       reg = <3>;
+                                       label = "netright";
+                                       phy-handle = <&switchphy3>;
+                               };
+
+                               port@4 {
+                                       reg = <4>;
+                                       label = "netleft";
+                                       phy-handle = <&switchphy4>;
+                               };
+                       };
+
+                       mdio {
+                               #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>;
+                               };
+                       };
+               };
+       };
+};
+
+&gpio3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpio3_hog>;
+
+       usb-emulation {
+               gpio-hog;
+               gpios = <10 GPIO_ACTIVE_HIGH>;
+               output-low;
+               line-name = "usb-emulation";
+       };
+
+       usb-mode1 {
+               gpio-hog;
+               gpios = <11 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "usb-mode1";
+       };
+
+       usb-mode2 {
+               gpio-hog;
+               gpios = <13 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "usb-mode2";
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pmic@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x8>;
+
+               regulators {
+                       sw1a_reg: sw1ab {
+                               regulator-min-microvolt = <825000>;
+                               regulator-max-microvolt = <1100000>;
+                       };
+
+                       sw1c_reg: sw1c {
+                               regulator-min-microvolt = <825000>;
+                               regulator-max-microvolt = <1100000>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3ab {
+                               regulator-min-microvolt = <825000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: sw4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-always-on;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vgen1 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen2_reg: vgen2 {
+                               regulator-min-microvolt = <850000>;
+                               regulator-max-microvolt = <975000>;
+                               regulator-always-on;
+                       };
+
+                       vgen3_reg: vgen3 {
+                               regulator-min-microvolt = <1675000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-always-on;
+                       };
+
+                       vgen4_reg: vgen4 {
+                               regulator-min-microvolt = <1625000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vgen5 {
+                               regulator-min-microvolt = <3075000>;
+                               regulator-max-microvolt = <3625000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vgen6 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+               };
+       };
+
+       eeprom@54 {
+               compatible = "atmel,24c128";
+               reg = <0x54>;
+       };
+
+       ds1341: rtc@68 {
+               compatible = "dallas,ds1341";
+               reg = <0x68>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       usbhub: usbhub@2c {
+               compatible ="microchip,usb2513b";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_usbhub>;
+               reg = <0x2c>;
+               reset-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&i2c4 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c4>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+
+       rave-sp {
+               compatible = "zii,rave-sp-rdu2";
+               current-speed = <1000000>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               watchdog {
+                       compatible = "zii,rave-sp-watchdog";
+               };
+
+               backlight {
+                       compatible = "zii,rave-sp-backlight";
+               };
+
+               pwrbutton {
+                       compatible = "zii,rave-sp-pwrbutton";
+               };
+
+               eeprom@a3 {
+                       compatible = "zii,rave-sp-eeprom";
+                       reg = <0xa3 0x4000>;
+                       zii,eeprom-name = "dds-eeprom";
+               };
+
+               eeprom@a4 {
+                       compatible = "zii,rave-sp-eeprom";
+                       reg = <0xa4 0x4000>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       zii,eeprom-name = "main-eeprom";
+               };
+       };
+};
+
+&usb3_phy0 {
+       vbus-supply = <&reg_5p0_user_usb>;
+       status = "okay";
+};
+
+&usb_dwc3_0 {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usb3_phy1 {
+       vbus-supply = <&reg_5p0_main>;
+       status = "okay";
+};
+
+&usb_dwc3_1 {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&pcie0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie0>;
+       reset-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+       clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>,
+                <&clk IMX8MQ_CLK_PCIE1_AUX>,
+                <&clk IMX8MQ_CLK_PCIE1_PHY>,
+                <&pcie0_refclk>;
+       clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+       status = "okay";
+};
+
+&pcie1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie1>;
+       reset-gpio = <&gpio1 6 GPIO_ACTIVE_LOW>;
+       clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>,
+                <&clk IMX8MQ_CLK_PCIE2_AUX>,
+                <&clk IMX8MQ_CLK_PCIE2_PHY>,
+                <&pcie1_refclk>;
+       clock-names = "pcie", "pcie_aux", "pcie_phy", "pcie_bus";
+       status = "okay";
+};
+
+&pgc_gpu {
+       power-supply = <&sw1a_reg>;
+};
+
+&pgc_vpu {
+       power-supply = <&sw1c_reg>;
+};
+
+&usdhc1 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
+       vqmmc-supply = <&sw4_reg>;
+       bus-width = <8>;
+       non-removable;
+       no-sd;
+       no-sdio;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+       cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_usdhc2_vmmc>;
+       status = "okay";
+};
+
+&snvs_rtc {
+       status = "disabled";
+};
+
+&iomuxc {
+       pinctrl_fec1: fec1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC                 0x3
+                       MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO               0x23
+                       MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1           0x1f
+                       MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0           0x1f
+                       MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1           0x91
+                       MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0           0x91
+                       MX8MQ_IOMUXC_ENET_TD2_ENET1_TX_CLK              0x1f
+                       MX8MQ_IOMUXC_ENET_RXC_ENET1_RX_ER               0x91
+                       MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL     0x91
+                       MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL     0x1f
+               >;
+       };
+
+       pinctrl_fec1_phy_reset: fec1phyresetgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_ENET_RD3_GPIO1_IO29                0x11
+               >;
+       };
+
+       pinctrl_gpio3_hog: gpio3hoggrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_DATA04_GPIO3_IO10             0x6
+                       MX8MQ_IOMUXC_NAND_DATA05_GPIO3_IO11             0x6
+                       MX8MQ_IOMUXC_NAND_DATA07_GPIO3_IO13             0x6
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL                  0x4000007f
+                       MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA                  0x4000007f
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL                  0x4000007f
+                       MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA                  0x4000007f
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C3_SCL_I2C3_SCL                  0x4000007f
+                       MX8MQ_IOMUXC_I2C3_SDA_I2C3_SDA                  0x4000007f
+               >;
+       };
+
+       pinctrl_i2c4: i2c4grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_I2C4_SCL_I2C4_SCL                  0x4000007f
+                       MX8MQ_IOMUXC_I2C4_SDA_I2C4_SDA                  0x4000007f
+               >;
+       };
+
+       pinctrl_mdio_bitbang: bitbangmdiogrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO13_GPIO1_IO13              0x44
+                       MX8MQ_IOMUXC_GPIO1_IO14_GPIO1_IO14              0x64
+               >;
+       };
+
+       pinctrl_pcie0: pcie0grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART4_RXD_PCIE1_CLKREQ_B           0x66
+                       MX8MQ_IOMUXC_GPIO1_IO03_GPIO1_IO3               0x6
+               >;
+       };
+
+       pinctrl_pcie1: pcie1grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_UART4_TXD_PCIE2_CLKREQ_B           0x66
+                       MX8MQ_IOMUXC_GPIO1_IO06_GPIO1_IO6               0x6
+               >;
+       };
+
+       pinctrl_reg_arm: regarmgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_READY_B_GPIO3_IO16            0x19
+               >;
+       };
+
+       pinctrl_reg_usdhc2: regusdhc2grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19             0x41
+               >;
+       };
+
+       pinctrl_reg_user_usb: reguserusbgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_DATA06_GPIO3_IO12             0x6
+               >;
+       };
+
+       pinctrl_switch_irq: switchgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO15_GPIO1_IO15              0x41
+               >;
+       };
+
+       pinctrl_ts: tsgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_GPIO1_IO11_GPIO1_IO11              0x96
+                       MX8MQ_IOMUXC_GPIO1_IO12_GPIO1_IO12              0x96
+               >;
+       };
+
+       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_RXD_UART2_DCE_RX             0x49
+                       MX8MQ_IOMUXC_UART2_TXD_UART2_DCE_TX             0x49
+               >;
+       };
+
+       pinctrl_usbhub: usbhubgrp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SAI5_MCLK_GPIO3_IO25               0x41
+               >;
+       };
+
+       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: usdhc1-100grp {
+               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: usdhc1-200grp {
+               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_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_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2-100grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x85
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc5
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2             0xc5
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3             0xc5
+                       MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2-200grp {
+               fsl,pins = <
+                       MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK                 0x87
+                       MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD                 0xc7
+                       MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2             0xc7
+                       MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3             0xc7
+                       MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT          0xc1
+               >;
+       };
+};
index 9155bd4..6d635ba 100644 (file)
@@ -6,8 +6,10 @@
 
 #include <dt-bindings/clock/imx8mq-clock.h>
 #include <dt-bindings/power/imx8mq-power.h>
+#include <dt-bindings/reset/imx8mq-reset.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/thermal/thermal.h>
 #include "imx8mq-pinfunc.h"
 
 / {
                        device_type = "cpu";
                        compatible = "arm,cortex-a53";
                        reg = <0x0>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MQ_CLK_ARM>;
                        enable-method = "psci";
                        next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A53_1: cpu@1 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a53";
                        reg = <0x1>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MQ_CLK_ARM>;
                        enable-method = "psci";
                        next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A53_2: cpu@2 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a53";
                        reg = <0x2>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MQ_CLK_ARM>;
                        enable-method = "psci";
                        next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A53_3: cpu@3 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a53";
                        reg = <0x3>;
+                       clock-latency = <61036>; /* two CLK32 periods */
+                       clocks = <&clk IMX8MQ_CLK_ARM>;
                        enable-method = "psci";
                        next-level-cache = <&A53_L2>;
+                       operating-points-v2 = <&a53_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A53_L2: l2-cache0 {
                };
        };
 
+       a53_opp_table: opp-table {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp-800000000 {
+                       opp-hz = /bits/ 64 <800000000>;
+                       opp-microvolt = <900000>;
+                       clock-latency-ns = <150000>;
+               };
+
+               opp-1300000000 {
+                       opp-hz = /bits/ 64 <1300000000>;
+                       opp-microvolt = <1000000>;
+                       clock-latency-ns = <150000>;
+                       opp-suspend;
+               };
+       };
+
        pmu {
                compatible = "arm,cortex-a53-pmu";
                interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
                method = "smc";
        };
 
+       thermal-zones {
+               cpu-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <2000>;
+                       thermal-sensors = <&tmu 0>;
+
+                       trips {
+                               cpu_alert: cpu-alert {
+                                       temperature = <80000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+
+                               cpu-crit {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu_alert>;
+                                       cooling-device =
+                                               <&A53_0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&A53_1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&A53_2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+                                               <&A53_3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                               };
+                       };
+               };
+
+               gpu-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <2000>;
+                       thermal-sensors = <&tmu 1>;
+
+                       trips {
+                               gpu-crit {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+
+               vpu-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <2000>;
+                       thermal-sensors = <&tmu 2>;
+
+                       trips {
+                               vpu-crit {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                       };
+               };
+       };
+
        timer {
                compatible = "arm,armv8-timer";
                interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>, /* Physical Secure */
                                reg = <0x30200000 0x10000>;
                                interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_GPIO1_ROOT>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                                reg = <0x30210000 0x10000>;
                                interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_GPIO2_ROOT>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                                reg = <0x30220000 0x10000>;
                                interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_GPIO3_ROOT>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                                reg = <0x30230000 0x10000>;
                                interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_GPIO4_ROOT>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                                reg = <0x30240000 0x10000>;
                                interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
                                             <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_GPIO5_ROOT>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                                #interrupt-cells = <2>;
                        };
 
+                       tmu: tmu@30260000 {
+                               compatible = "fsl,imx8mq-tmu";
+                               reg = <0x30260000 0x10000>;
+                               interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+                               little-endian;
+                               fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>;
+                               fsl,tmu-calibration = <0x00000000 0x00000023
+                                                      0x00000001 0x00000029
+                                                      0x00000002 0x0000002f
+                                                      0x00000003 0x00000035
+                                                      0x00000004 0x0000003d
+                                                      0x00000005 0x00000043
+                                                      0x00000006 0x0000004b
+                                                      0x00000007 0x00000051
+                                                      0x00000008 0x00000057
+                                                      0x00000009 0x0000005f
+                                                      0x0000000a 0x00000067
+                                                      0x0000000b 0x0000006f
+
+                                                      0x00010000 0x0000001b
+                                                      0x00010001 0x00000023
+                                                      0x00010002 0x0000002b
+                                                      0x00010003 0x00000033
+                                                      0x00010004 0x0000003b
+                                                      0x00010005 0x00000043
+                                                      0x00010006 0x0000004b
+                                                      0x00010007 0x00000055
+                                                      0x00010008 0x0000005d
+                                                      0x00010009 0x00000067
+                                                      0x0001000a 0x00000070
+
+                                                      0x00020000 0x00000017
+                                                      0x00020001 0x00000023
+                                                      0x00020002 0x0000002d
+                                                      0x00020003 0x00000037
+                                                      0x00020004 0x00000041
+                                                      0x00020005 0x0000004b
+                                                      0x00020006 0x00000057
+                                                      0x00020007 0x00000063
+                                                      0x00020008 0x0000006f
+
+                                                      0x00030000 0x00000015
+                                                      0x00030001 0x00000021
+                                                      0x00030002 0x0000002d
+                                                      0x00030003 0x00000039
+                                                      0x00030004 0x00000045
+                                                      0x00030005 0x00000053
+                                                      0x00030006 0x0000005f
+                                                      0x00030007 0x00000071>;
+                               #thermal-sensor-cells =  <1>;
+                       };
+
                        wdog1: watchdog@30280000 {
                                compatible = "fsl,imx8mq-wdt", "fsl,imx21-wdt";
                                reg = <0x30280000 0x10000>;
                                status = "disabled";
                        };
 
+                       sdma2: sdma@302c0000 {
+                               compatible = "fsl,imx8mq-sdma","fsl,imx7d-sdma";
+                               reg = <0x302c0000 0x10000>;
+                               interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_SDMA2_ROOT>,
+                                        <&clk IMX8MQ_CLK_SDMA2_ROOT>;
+                               clock-names = "ipg", "ahb";
+                               #dma-cells = <3>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+                       };
+
                        iomuxc: iomuxc@30330000 {
                                compatible = "fsl,imx8mq-iomuxc";
                                reg = <0x30330000 0x10000>;
                        };
 
                        iomuxc_gpr: syscon@30340000 {
-                               compatible = "fsl,imx8mq-iomuxc-gpr", "syscon";
+                               compatible = "fsl,imx8mq-iomuxc-gpr", "fsl,imx6q-iomuxc-gpr", "syscon";
                                reg = <0x30340000 0x10000>;
                        };
 
+                       ocotp: ocotp-ctrl@30350000 {
+                               compatible = "fsl,imx8mq-ocotp", "syscon";
+                               reg = <0x30350000 0x10000>;
+                               clocks = <&clk IMX8MQ_CLK_OCOTP_ROOT>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                       };
+
                        anatop: syscon@30360000 {
                                compatible = "fsl,imx8mq-anatop", "syscon";
                                reg = <0x30360000 0x10000>;
                                              "clk_ext3", "clk_ext4";
                        };
 
+                       src: reset-controller@30390000 {
+                               compatible = "fsl,imx8mq-src", "syscon";
+                               reg = <0x30390000 0x10000>;
+                               #reset-cells = <1>;
+                       };
+
                        gpc: gpc@303a0000 {
                                compatible = "fsl,imx8mq-gpc";
                                reg = <0x303a0000 0x10000>;
                                                reg = <IMX8M_POWER_DOMAIN_MIPI>;
                                        };
 
-                                       pgc_pcie1: power-domain@1 {
+                                       /*
+                                        * As per comment in ATF source code:
+                                        *
+                                        * PCIE1 and PCIE2 share the
+                                        * same reset signal, if we
+                                        * power down PCIE2, PCIE1
+                                        * will be held in reset too.
+                                        *
+                                        * So instead of creating two
+                                        * separate power domains for
+                                        * PCIE1 and PCIE2 we create a
+                                        * link between both and use
+                                        * it as a shared PCIE power
+                                        * domain.
+                                        */
+                                       pgc_pcie: power-domain@1 {
                                                #power-domain-cells = <0>;
                                                reg = <IMX8M_POWER_DOMAIN_PCIE1>;
+                                               power-domains = <&pgc_pcie2>;
                                        };
 
                                        pgc_otg1: power-domain@2 {
                                status = "disabled";
                        };
 
+                       sai2: sai@308b0000 {
+                               #sound-dai-cells = <0>;
+                               compatible = "fsl,imx8mq-sai",
+                                            "fsl,imx6sx-sai";
+                               reg = <0x308b0000 0x10000>;
+                               interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_SAI2_IPG>,
+                                        <&clk IMX8MQ_CLK_SAI2_ROOT>,
+                                        <&clk IMX8MQ_CLK_DUMMY>, <&clk IMX8MQ_CLK_DUMMY>;
+                               clock-names = "bus", "mclk1", "mclk2", "mclk3";
+                               dmas = <&sdma1 10 24 0>, <&sdma1 11 24 0>;
+                               dma-names = "rx", "tx";
+                               status = "disabled";
+                       };
+
                        i2c1: i2c@30a20000 {
                                compatible = "fsl,imx8mq-i2c", "fsl,imx21-i2c";
                                reg = <0x30a20000 0x10000>;
                                status = "disabled";
                        };
 
+                       sdma1: sdma@30bd0000 {
+                               compatible = "fsl,imx8mq-sdma","fsl,imx7d-sdma";
+                               reg = <0x30bd0000 0x10000>;
+                               interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MQ_CLK_SDMA1_ROOT>,
+                                        <&clk IMX8MQ_CLK_AHB>;
+                               clock-names = "ipg", "ahb";
+                               #dma-cells = <3>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+                       };
+
                        fec1: ethernet@30be0000 {
                                compatible = "fsl,imx8mq-fec", "fsl,imx6sx-fec";
                                reg = <0x30be0000 0x10000>;
                        };
                };
 
+               gpu: gpu@38000000 {
+                       compatible = "vivante,gc";
+                       reg = <0x38000000 0x40000>;
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&clk IMX8MQ_CLK_GPU_ROOT>,
+                                <&clk IMX8MQ_CLK_GPU_SHADER_DIV>,
+                                <&clk IMX8MQ_CLK_GPU_AXI>,
+                                <&clk IMX8MQ_CLK_GPU_AHB>;
+                       clock-names = "core", "shader", "bus", "reg";
+                       assigned-clocks = <&clk IMX8MQ_CLK_GPU_CORE_SRC>,
+                                         <&clk IMX8MQ_CLK_GPU_SHADER_SRC>,
+                                         <&clk IMX8MQ_CLK_GPU_AXI>,
+                                         <&clk IMX8MQ_CLK_GPU_AHB>,
+                                         <&clk IMX8MQ_GPU_PLL_BYPASS>;
+                       assigned-clock-parents = <&clk IMX8MQ_GPU_PLL_OUT>,
+                                                <&clk IMX8MQ_GPU_PLL_OUT>,
+                                                <&clk IMX8MQ_GPU_PLL_OUT>,
+                                                <&clk IMX8MQ_GPU_PLL_OUT>,
+                                                <&clk IMX8MQ_GPU_PLL>;
+                       assigned-clock-rates = <800000000>, <800000000>,
+                                              <800000000>, <800000000>, <0>;
+                       power-domains = <&pgc_gpu>;
+               };
+
                usb_dwc3_0: usb@38100000 {
                        compatible = "fsl,imx8mq-dwc3", "snps,dwc3";
                        reg = <0x38100000 0x10000>;
                        status = "disabled";
                };
 
+
+               pcie0: pcie@33800000 {
+                       compatible = "fsl,imx8mq-pcie";
+                       reg = <0x33800000 0x400000>,
+                             <0x1ff00000 0x80000>;
+                       reg-names = "dbi", "config";
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       device_type = "pci";
+                       bus-range = <0x00 0xff>;
+                       ranges = <0x81000000 0 0x00000000 0x1ff80000 0 0x00010000 /* downstream I/O 64KB */
+                                 0x82000000 0 0x18000000 0x18000000 0 0x07f00000>; /* non-prefetchable memory */
+                       num-lanes = <1>;
+                       num-viewport = <4>;
+                       interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "msi";
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 0x7>;
+                       interrupt-map = <0 0 0 1 &gic GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 2 &gic GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 3 &gic GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 4 &gic GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+                       fsl,max-link-speed = <2>;
+                       power-domains = <&pgc_pcie>;
+                       resets = <&src IMX8MQ_RESET_PCIEPHY>,
+                                <&src IMX8MQ_RESET_PCIE_CTRL_APPS_EN>,
+                                <&src IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF>;
+                       reset-names = "pciephy", "apps", "turnoff";
+                       status = "disabled";
+               };
+
+               pcie1: pcie@33c00000 {
+                       compatible = "fsl,imx8mq-pcie";
+                       reg = <0x33c00000 0x400000>,
+                             <0x27f00000 0x80000>;
+                       reg-names = "dbi", "config";
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       device_type = "pci";
+                       ranges =  <0x81000000 0 0x00000000 0x27f80000 0 0x00010000 /* downstream I/O 64KB */
+                                  0x82000000 0 0x20000000 0x20000000 0 0x07f00000>; /* non-prefetchable memory */
+                       num-lanes = <1>;
+                       num-viewport = <4>;
+                       interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "msi";
+                       #interrupt-cells = <1>;
+                       interrupt-map-mask = <0 0 0 0x7>;
+                       interrupt-map = <0 0 0 1 &gic GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 2 &gic GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 3 &gic GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>,
+                                       <0 0 0 4 &gic GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+                       fsl,max-link-speed = <2>;
+                       power-domains = <&pgc_pcie>;
+                       resets = <&src IMX8MQ_RESET_PCIEPHY2>,
+                                <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_EN>,
+                                <&src IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF>;
+                       reset-names = "pciephy", "apps", "turnoff";
+                       status = "disabled";
+               };
+
                gic: interrupt-controller@38800000 {
                        compatible = "arm,gic-v3";
                        reg = <0x38800000 0x10000>,     /* GIC Dist */
index 03aad66..bfdada2 100644 (file)
        };
 };
 
+&adma_i2c1 {
+       #address-cells = <1>;
+       #size-cells = <0>;
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_lpi2c1 &pinctrl_ioexp_rst>;
+       status = "okay";
+
+       i2c-switch@71 {
+               compatible = "nxp,pca9646", "nxp,pca9546";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x71>;
+               reset-gpios = <&lsio_gpio1 1 GPIO_ACTIVE_LOW>;
+
+               i2c@0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0>;
+
+                       max7322: gpio@68 {
+                               compatible = "maxim,max7322";
+                               reg = <0x68>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                       };
+               };
+
+               i2c@1 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <1>;
+               };
+
+               i2c@2 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <2>;
+
+                       pressure-sensor@60 {
+                               compatible = "fsl,mpl3115";
+                               reg = <0x60>;
+                       };
+               };
+
+               i2c@3 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <3>;
+
+                       pca9557_a: gpio@1a {
+                               compatible = "nxp,pca9557";
+                               reg = <0x1a>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                       };
+
+                       pca9557_b: gpio@1d {
+                               compatible = "nxp,pca9557";
+                               reg = <0x1d>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                       };
+
+                       light-sensor@44 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_isl29023>;
+                               compatible = "isil,isl29023";
+                               reg = <0x44>;
+                               interrupt-parent = <&lsio_gpio1>;
+                               interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+                       };
+               };
+       };
+};
+
 &usdhc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usdhc1>;
                >;
        };
 
+       pinctrl_ioexp_rst: ioexp_rst_grp {
+               fsl,pins = <
+                       IMX8QXP_SPI2_SDO_LSIO_GPIO1_IO01                        0x06000021
+               >;
+       };
+
+       pinctrl_isl29023: isl29023grp {
+               fsl,pins = <
+                       IMX8QXP_SPI2_SDI_LSIO_GPIO1_IO02                        0x00000021
+               >;
+       };
+
+       pinctrl_lpi2c1: lpi2c1grp {
+               fsl,pins = <
+                       IMX8QXP_USB_SS3_TC1_ADMA_I2C1_SCL                       0x06000021
+                       IMX8QXP_USB_SS3_TC3_ADMA_I2C1_SDA                       0x06000021
+               >;
+       };
+
        pinctrl_lpuart0: lpuart0grp {
                fsl,pins = <
                        IMX8QXP_UART0_RX_ADMA_UART0_RX                          0x06000020
index 4c3dd95..0683ee2 100644 (file)
@@ -21,6 +21,7 @@
                mmc1 = &usdhc2;
                mmc2 = &usdhc3;
                serial0 = &adma_lpuart0;
+               mu1 = &lsio_mu1;
        };
 
        cpus {
@@ -34,6 +35,9 @@
                        reg = <0x0 0x0>;
                        enable-method = "psci";
                        next-level-cache = <&A35_L2>;
+                       clocks = <&clk IMX_A35_CLK>;
+                       operating-points-v2 = <&a35_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A35_1: cpu@1 {
@@ -42,6 +46,9 @@
                        reg = <0x0 0x1>;
                        enable-method = "psci";
                        next-level-cache = <&A35_L2>;
+                       clocks = <&clk IMX_A35_CLK>;
+                       operating-points-v2 = <&a35_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A35_2: cpu@2 {
@@ -50,6 +57,9 @@
                        reg = <0x0 0x2>;
                        enable-method = "psci";
                        next-level-cache = <&A35_L2>;
+                       clocks = <&clk IMX_A35_CLK>;
+                       operating-points-v2 = <&a35_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A35_3: cpu@3 {
@@ -58,6 +68,9 @@
                        reg = <0x0 0x3>;
                        enable-method = "psci";
                        next-level-cache = <&A35_L2>;
+                       clocks = <&clk IMX_A35_CLK>;
+                       operating-points-v2 = <&a35_opp_table>;
+                       #cooling-cells = <2>;
                };
 
                A35_L2: l2-cache0 {
                };
        };
 
+       a35_opp_table: opp-table {
+               compatible = "operating-points-v2";
+               opp-shared;
+
+               opp-900000000 {
+                       opp-hz = /bits/ 64 <900000000>;
+                       opp-microvolt = <1000000>;
+                       clock-latency-ns = <150000>;
+               };
+
+               opp-1200000000 {
+                       opp-hz = /bits/ 64 <1200000000>;
+                       opp-microvolt = <1100000>;
+                       clock-latency-ns = <150000>;
+                       opp-suspend;
+               };
+       };
+
        gic: interrupt-controller@51a00000 {
                compatible = "arm,gic-v3";
                reg = <0x0 0x51a00000 0 0x10000>, /* GIC Dist */
        scu {
                compatible = "fsl,imx-scu";
                mbox-names = "tx0", "tx1", "tx2", "tx3",
-                            "rx0", "rx1", "rx2", "rx3";
+                            "rx0", "rx1", "rx2", "rx3",
+                            "gip3";
                mboxes = <&lsio_mu1 0 0
                          &lsio_mu1 0 1
                          &lsio_mu1 0 2
                          &lsio_mu1 1 0
                          &lsio_mu1 1 1
                          &lsio_mu1 1 2
-                         &lsio_mu1 1 3>;
+                         &lsio_mu1 1 3
+                         &lsio_mu1 3 3>;
 
                clk: clock-controller {
                        compatible = "fsl,imx8qxp-clk";
                        status = "disabled";
                };
 
+               adma_lpuart1: serial@5a070000 {
+                       compatible = "fsl,imx8qxp-lpuart", "fsl,imx7ulp-lpuart";
+                       reg = <0x5a070000 0x1000>;
+                       interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-parent = <&gic>;
+                       clocks = <&adma_lpcg IMX_ADMA_LPCG_UART1_BAUD_CLK>;
+                       clock-names = "ipg";
+                       power-domains = <&pd IMX_SC_R_UART_1>;
+                       status = "disabled";
+               };
+
+               adma_lpuart2: serial@5a080000 {
+                       compatible = "fsl,imx8qxp-lpuart", "fsl,imx7ulp-lpuart";
+                       reg = <0x5a080000 0x1000>;
+                       interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-parent = <&gic>;
+                       clocks = <&adma_lpcg IMX_ADMA_LPCG_UART2_BAUD_CLK>;
+                       clock-names = "ipg";
+                       power-domains = <&pd IMX_SC_R_UART_2>;
+                       status = "disabled";
+               };
+
+               adma_lpuart3: serial@5a090000 {
+                       compatible = "fsl,imx8qxp-lpuart", "fsl,imx7ulp-lpuart";
+                       reg = <0x5a090000 0x1000>;
+                       interrupts = <GIC_SPI 228 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-parent = <&gic>;
+                       clocks = <&adma_lpcg IMX_ADMA_LPCG_UART3_BAUD_CLK>;
+                       clock-names = "ipg";
+                       power-domains = <&pd IMX_SC_R_UART_3>;
+                       status = "disabled";
+               };
+
                adma_i2c0: i2c@5a800000 {
                        compatible = "fsl,imx8qxp-lpi2c", "fsl,imx7ulp-lpi2c";
                        reg = <0x5a800000 0x4000>;
                        compatible = "fsl,imx8qxp-mu", "fsl,imx6sx-mu";
                        reg = <0x5d1b0000 0x10000>;
                        interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
-                       #mbox-cells = <0>;
+                       #mbox-cells = <2>;
                        status = "disabled";
                };
 
                        #mbox-cells = <2>;
                };
 
+               lsio_mu2: mailbox@5d1d0000 {
+                       compatible = "fsl,imx8qxp-mu", "fsl,imx6sx-mu";
+                       reg = <0x5d1d0000 0x10000>;
+                       interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
+                       #mbox-cells = <2>;
+                       status = "disabled";
+               };
+
                lsio_mu3: mailbox@5d1e0000 {
                        compatible = "fsl,imx8qxp-mu", "fsl,imx6sx-mu";
                        reg = <0x5d1e0000 0x10000>;
                        interrupts = <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
-                       #mbox-cells = <0>;
+                       #mbox-cells = <2>;
                        status = "disabled";
                };
 
                        compatible = "fsl,imx8qxp-mu", "fsl,imx6sx-mu";
                        reg = <0x5d1f0000 0x10000>;
                        interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>;
-                       #mbox-cells = <0>;
+                       #mbox-cells = <2>;
                        status = "disabled";
                };
 
                        power-domains = <&pd IMX_SC_R_GPIO_7>;
                };
        };
+
+       watchdog {
+               compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
+               timeout-sec = <60>;
+       };
 };
index 2f19e0e..aa6a8ad 100644 (file)
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x0 0xfdf00000 0x0 0x1000>;
                        interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+                       dma-names = "rx", "tx";
+                       dmas =  <&dma0 2 &dma0 3>;
                        clocks = <&crg_ctrl HI3660_CLK_GATE_UART1>,
                                 <&crg_ctrl HI3660_CLK_GATE_UART1>;
                        clock-names = "uartclk", "apb_pclk";
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x0 0xfdf03000 0x0 0x1000>;
                        interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+                       dma-names = "rx", "tx";
+                       dmas =  <&dma0 4 &dma0 5>;
                        clocks = <&crg_ctrl HI3660_CLK_GATE_UART2>,
                                 <&crg_ctrl HI3660_PCLK>;
                        clock-names = "uartclk", "apb_pclk";
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x0 0xfdf01000 0x0 0x1000>;
                        interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+                       dma-names = "rx", "tx";
+                       dmas =  <&dma0 6 &dma0 7>;
                        clocks = <&crg_ctrl HI3660_CLK_GATE_UART4>,
                                 <&crg_ctrl HI3660_CLK_GATE_UART4>;
                        clock-names = "uartclk", "apb_pclk";
                        compatible = "arm,pl011", "arm,primecell";
                        reg = <0x0 0xfdf05000 0x0 0x1000>;
                        interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+                       dma-names = "rx", "tx";
+                       dmas =  <&dma0 8 &dma0 9>;
                        clocks = <&crg_ctrl HI3660_CLK_GATE_UART5>,
                                 <&crg_ctrl HI3660_CLK_GATE_UART5>;
                        clock-names = "uartclk", "apb_pclk";
                        #dma-cells = <1>;
                        dma-channels = <16>;
                        dma-requests = <32>;
-                       dma-min-chan = <1>;
+                       dma-channel-mask = <0xfffe>;
                        interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&crg_ctrl HI3660_CLK_GATE_DMAC>;
                        dma-no-cci;
                        dma-type = "hi3660_dma";
                };
 
+               asp_dmac: dma-controller@e804b000 {
+                       compatible = "hisilicon,hisi-pcm-asp-dma-1.0";
+                       reg = <0x0 0xe804b000 0x0 0x1000>;
+                       #dma-cells = <1>;
+                       dma-channels = <16>;
+                       dma-requests = <32>;
+                       interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "asp_dma_irq";
+               };
+
                rtc0: rtc@fff04000 {
                        compatible = "arm,pl031", "arm,primecell";
                        reg = <0x0 0Xfff04000 0x0 0x1000>;
index c9775b6..7dac33d 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 
 #include "hi3670.dtsi"
 #include "hikey970-pinctrl.dtsi"
@@ -17,6 +18,8 @@
        compatible = "hisilicon,hi3670-hikey970", "hisilicon,hi3670";
 
        aliases {
+               mshc1 = &dwmmc1;
+               mshc2 = &dwmmc2;
                serial0 = &uart0;
                serial1 = &uart1;
                serial2 = &uart2;
                /* expect bootloader to fill in this region */
                reg = <0x0 0x0 0x0 0x0>;
        };
+
+       sd_1v8: regulator-1v8 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-1.8V";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               regulator-always-on;
+       };
+
+       sd_3v3: regulator-3v3 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       wlan_en: wlan-en-1-8v {
+               compatible = "regulator-fixed";
+               regulator-name = "wlan-en-regulator";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+
+               /* GPIO_051_WIFI_EN */
+               gpio = <&gpio6 3 0>;
+
+               /* WLAN card specific delay */
+               startup-delay-us = <70000>;
+               enable-active-high;
+       };
 };
 
 /*
                "GPIO_231_HDMI_INT";
 };
 
+&dwmmc1 {
+       bus-width = <0x4>;
+       sd-uhs-sdr12;
+       sd-uhs-sdr25;
+       sd-uhs-sdr50;
+       sd-uhs-sdr104;
+       cap-sd-highspeed;
+       disable-wp;
+       cd-inverted;
+       cd-gpios = <&gpio25 5 GPIO_ACTIVE_HIGH>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sd_pmx_func
+                    &sd_clk_cfg_func
+                    &sd_cfg_func>;
+       vmmc-supply = <&sd_3v3>;
+       vqmmc-supply = <&sd_1v8>;
+       status = "okay";
+};
+
+&dwmmc2 { /* WIFI */
+       bus-width = <0x4>;
+       non-removable;
+       broken-cd;
+       cap-power-off-card;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio_pmx_func
+                    &sdio_clk_cfg_func
+                    &sdio_cfg_func>;
+       /* WL_EN */
+       vmmc-supply = <&wlan_en>;
+       status = "ok";
+
+       wlcore: wlcore@2 {
+               compatible = "ti,wl1837";
+               reg = <2>;      /* sdio func num */
+               /* WL_IRQ, GPIO_177_WL_WAKEUP_AP */
+               interrupt-parent = <&gpio22>;
+               interrupts = <1 IRQ_TYPE_EDGE_RISING>;
+       };
+};
+
 &uart0 {
        /* On High speed expansion header */
        label = "HS-UART0";
index 2ed06e4..2dcffa3 100644 (file)
                        #clock-cells = <1>;
                };
 
+               crg_rst: crg_rst_controller {
+                       compatible = "hisilicon,hi3670-reset",
+                                    "hisilicon,hi3660-reset";
+                       #reset-cells = <2>;
+                       hisi,rst-syscon = <&crg_ctrl>;
+               };
+
                pctrl: pctrl@e8a09000 {
                        compatible = "hisilicon,hi3670-pctrl", "syscon";
                        reg = <0x0 0xe8a09000 0x0 0x1000>;
                        clocks = <&sctrl HI3670_PCLK_AO_GPIO6>;
                        clock-names = "apb_pclk";
                };
+
+               /* UFS */
+               ufs: ufs@ff3c0000 {
+                       compatible = "hisilicon,hi3670-ufs", "jedec,ufs-2.1";
+                       /* 0: HCI standard */
+                       /* 1: UFS SYS CTRL */
+                       reg = <0x0 0xff3c0000 0x0 0x1000>,
+                               <0x0 0xff3e0000 0x0 0x1000>;
+                       interrupt-parent = <&gic>;
+                       interrupts = <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3670_CLK_GATE_UFSIO_REF>,
+                               <&crg_ctrl HI3670_CLK_GATE_UFS_SUBSYS>;
+                       clock-names = "ref_clk", "phy_clk";
+                       freq-table-hz = <0 0>, <0 0>;
+                       /* offset: 0x84; bit: 12 */
+                       resets = <&crg_rst 0x84 12>;
+                       reset-names = "rst";
+               };
+
+               /* SD */
+               dwmmc1: dwmmc1@ff37f000 {
+                       compatible = "hisilicon,hi3670-dw-mshc",
+                                    "hisilicon,hi3660-dw-mshc";
+                       reg = <0x0 0xff37f000 0x0 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3670_CLK_GATE_SD>,
+                               <&crg_ctrl HI3670_HCLK_GATE_SD>;
+                       clock-names = "ciu", "biu";
+                       clock-frequency = <3200000>;
+                       resets = <&crg_rst 0x94 18>;
+                       reset-names = "reset";
+                       hisilicon,peripheral-syscon = <&sctrl>;
+                       card-detect-delay = <200>;
+                       status = "disabled";
+               };
+
+               /* SDIO */
+               dwmmc2: dwmmc2@fc183000 {
+                       compatible = "hisilicon,hi3670-dw-mshc",
+                                    "hisilicon,hi3660-dw-mshc";
+                       reg = <0x0 0xfc183000 0x0 0x1000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&crg_ctrl HI3670_CLK_GATE_SDIO>,
+                               <&crg_ctrl HI3670_HCLK_GATE_SDIO>;
+                       clock-names = "ciu", "biu";
+                       clock-frequency = <3200000>;
+                       resets = <&crg_rst 0x94 20>;
+                       reset-names = "reset";
+                       card-detect-delay = <200>;
+                       status = "disabled";
+               };
        };
 };
index 67bb52d..d456b0a 100644 (file)
                        /* pin base, nr pins & gpio function */
                        pinctrl-single,gpio-range = <&range 0 10 0>;
 
+                       sdio_pmx_func: sdio_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x000 MUX_M1 /* SDIO_CLK */
+                                       0x004 MUX_M1 /* SDIO_CMD */
+                                       0x008 MUX_M1 /* SDIO_DATA0 */
+                                       0x00c MUX_M1 /* SDIO_DATA1 */
+                                       0x010 MUX_M1 /* SDIO_DATA2 */
+                                       0x014 MUX_M1 /* SDIO_DATA3 */
+                               >;
+                       };
                };
 
                pmx6: pinmux@fc182800 {
                        reg = <0x0 0xfc182800 0x0 0x028>;
                        #pinctrl-cells = <1>;
                        pinctrl-single,register-width = <0x20>;
+
+                       sdio_clk_cfg_func: sdio_clk_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x000 0x0 /* SDIO_CLK */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_32MA DRIVE6_MASK
+                               >;
+                       };
+
+                       sdio_cfg_func: sdio_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x004 0x0 /* SDIO_CMD */
+                                       0x008 0x0 /* SDIO_DATA0 */
+                                       0x00c 0x0 /* SDIO_DATA1 */
+                                       0x010 0x0 /* SDIO_DATA2 */
+                                       0x014 0x0 /* SDIO_DATA3 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_19MA DRIVE6_MASK
+                               >;
+                       };
                };
 
                pmx7: pinmux@ff37e000 {
                        pinctrl-single,function-mask = <7>;
                        /* pin base, nr pins & gpio function */
                        pinctrl-single,gpio-range = <&range 0 12 0>;
+
+                       sd_pmx_func: sd_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x000 MUX_M1 /* SD_CLK */
+                                       0x004 MUX_M1 /* SD_CMD */
+                                       0x008 MUX_M1 /* SD_DATA0 */
+                                       0x00c MUX_M1 /* SD_DATA1 */
+                                       0x010 MUX_M1 /* SD_DATA2 */
+                                       0x014 MUX_M1 /* SD_DATA3 */
+                               >;
+                       };
                };
 
                pmx8: pinmux@ff37e800 {
                        reg = <0x0 0xff37e800 0x0 0x030>;
                        #pinctrl-cells = <1>;
                        pinctrl-single,register-width = <0x20>;
+
+                       sd_clk_cfg_func: sd_clk_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x000 0x0 /* SD_CLK */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_DIS
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_32MA
+                                       DRIVE6_MASK
+                               >;
+                       };
+
+                       sd_cfg_func: sd_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x004 0x0 /* SD_CMD */
+                                       0x008 0x0 /* SD_DATA0 */
+                                       0x00c 0x0 /* SD_DATA1 */
+                                       0x010 0x0 /* SD_DATA2 */
+                                       0x014 0x0 /* SD_DATA3 */
+                               >;
+                               pinctrl-single,bias-pulldown = <
+                                       PULL_DIS
+                                       PULL_DOWN
+                                       PULL_DIS
+                                       PULL_DOWN
+                               >;
+                               pinctrl-single,bias-pullup = <
+                                       PULL_UP
+                                       PULL_UP
+                                       PULL_DIS
+                                       PULL_UP
+                               >;
+                               pinctrl-single,drive-strength = <
+                                       DRIVE6_19MA
+                                       DRIVE6_MASK
+                               >;
+                       };
                };
 
                pmx1: pinmux@fff11000 {
diff --git a/arch/arm64/boot/dts/intel/Makefile b/arch/arm64/boot/dts/intel/Makefile
new file mode 100644 (file)
index 0000000..1253af3
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+dtb-$(CONFIG_ARCH_AGILEX) += socfpga_agilex_socdk.dtb
diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
new file mode 100644 (file)
index 0000000..e4ceb3a
--- /dev/null
@@ -0,0 +1,444 @@
+// SPDX-License-Identifier:     GPL-2.0
+/*
+ * Copyright (C) 2019, Intel Corporation
+ */
+
+/dts-v1/;
+#include <dt-bindings/reset/altr,rst-mgr-s10.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       compatible = "intel,socfpga-agilex";
+       #address-cells = <2>;
+       #size-cells = <2>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu0: cpu@0 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       reg = <0x0>;
+               };
+
+               cpu1: cpu@1 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       reg = <0x1>;
+               };
+
+               cpu2: cpu@2 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       reg = <0x2>;
+               };
+
+               cpu3: cpu@3 {
+                       compatible = "arm,cortex-a53";
+                       device_type = "cpu";
+                       enable-method = "psci";
+                       reg = <0x3>;
+               };
+       };
+
+       pmu {
+               compatible = "arm,armv8-pmuv3";
+               interrupts = <0 120 8>,
+                            <0 121 8>,
+                            <0 122 8>,
+                            <0 123 8>;
+               interrupt-affinity = <&cpu0>,
+                                    <&cpu1>,
+                                    <&cpu2>,
+                                    <&cpu3>;
+               interrupt-parent = <&intc>;
+       };
+
+       psci {
+               compatible = "arm,psci-0.2";
+               method = "smc";
+       };
+
+       intc: intc@fffc1000 {
+               compatible = "arm,gic-400", "arm,cortex-a15-gic";
+               #interrupt-cells = <3>;
+               interrupt-controller;
+               reg = <0x0 0xfffc1000 0x0 0x1000>,
+                     <0x0 0xfffc2000 0x0 0x2000>,
+                     <0x0 0xfffc4000 0x0 0x2000>,
+                     <0x0 0xfffc6000 0x0 0x2000>;
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               device_type = "soc";
+               interrupt-parent = <&intc>;
+               ranges = <0 0 0 0xffffffff>;
+
+               gmac0: ethernet@ff800000 {
+                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       reg = <0xff800000 0x2000>;
+                       interrupts = <0 90 4>;
+                       interrupt-names = "macirq";
+                       mac-address = [00 00 00 00 00 00];
+                       resets = <&rst EMAC0_RESET>, <&rst EMAC0_OCP_RESET>;
+                       reset-names = "stmmaceth", "stmmaceth-ocp";
+                       tx-fifo-depth = <16384>;
+                       rx-fifo-depth = <16384>;
+                       snps,multicast-filter-bins = <256>;
+                       iommus = <&smmu 1>;
+                       status = "disabled";
+               };
+
+               gmac1: ethernet@ff802000 {
+                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       reg = <0xff802000 0x2000>;
+                       interrupts = <0 91 4>;
+                       interrupt-names = "macirq";
+                       mac-address = [00 00 00 00 00 00];
+                       resets = <&rst EMAC1_RESET>, <&rst EMAC1_OCP_RESET>;
+                       reset-names = "stmmaceth", "stmmaceth-ocp";
+                       tx-fifo-depth = <16384>;
+                       rx-fifo-depth = <16384>;
+                       snps,multicast-filter-bins = <256>;
+                       iommus = <&smmu 2>;
+                       status = "disabled";
+               };
+
+               gmac2: ethernet@ff804000 {
+                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       reg = <0xff804000 0x2000>;
+                       interrupts = <0 92 4>;
+                       interrupt-names = "macirq";
+                       mac-address = [00 00 00 00 00 00];
+                       resets = <&rst EMAC2_RESET>, <&rst EMAC2_OCP_RESET>;
+                       reset-names = "stmmaceth", "stmmaceth-ocp";
+                       tx-fifo-depth = <16384>;
+                       rx-fifo-depth = <16384>;
+                       snps,multicast-filter-bins = <256>;
+                       iommus = <&smmu 3>;
+                       status = "disabled";
+               };
+
+               gpio0: gpio@ffc03200 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,dw-apb-gpio";
+                       reg = <0xffc03200 0x100>;
+                       resets = <&rst GPIO0_RESET>;
+                       status = "disabled";
+
+                       porta: gpio-controller@0 {
+                               compatible = "snps,dw-apb-gpio-port";
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               snps,nr-gpios = <24>;
+                               reg = <0>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <0 110 4>;
+                       };
+               };
+
+               gpio1: gpio@ffc03300 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,dw-apb-gpio";
+                       reg = <0xffc03300 0x100>;
+                       resets = <&rst GPIO1_RESET>;
+                       status = "disabled";
+
+                       portb: gpio-controller@0 {
+                               compatible = "snps,dw-apb-gpio-port";
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               snps,nr-gpios = <24>;
+                               reg = <0>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <0 111 4>;
+                       };
+               };
+
+               i2c0: i2c@ffc02800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,designware-i2c";
+                       reg = <0xffc02800 0x100>;
+                       interrupts = <0 103 4>;
+                       resets = <&rst I2C0_RESET>;
+                       status = "disabled";
+               };
+
+               i2c1: i2c@ffc02900 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,designware-i2c";
+                       reg = <0xffc02900 0x100>;
+                       interrupts = <0 104 4>;
+                       resets = <&rst I2C1_RESET>;
+                       status = "disabled";
+               };
+
+               i2c2: i2c@ffc02a00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,designware-i2c";
+                       reg = <0xffc02a00 0x100>;
+                       interrupts = <0 105 4>;
+                       resets = <&rst I2C2_RESET>;
+                       status = "disabled";
+               };
+
+               i2c3: i2c@ffc02b00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,designware-i2c";
+                       reg = <0xffc02b00 0x100>;
+                       interrupts = <0 106 4>;
+                       resets = <&rst I2C3_RESET>;
+                       status = "disabled";
+               };
+
+               i2c4: i2c@ffc02c00 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "snps,designware-i2c";
+                       reg = <0xffc02c00 0x100>;
+                       interrupts = <0 107 4>;
+                       resets = <&rst I2C4_RESET>;
+                       status = "disabled";
+               };
+
+               mmc: dwmmc0@ff808000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "altr,socfpga-dw-mshc";
+                       reg = <0xff808000 0x1000>;
+                       interrupts = <0 96 4>;
+                       fifo-depth = <0x400>;
+                       resets = <&rst SDMMC_RESET>;
+                       reset-names = "reset";
+                       iommus = <&smmu 5>;
+                       status = "disabled";
+               };
+
+               ocram: sram@ffe00000 {
+                       compatible = "mmio-sram";
+                       reg = <0xffe00000 0x40000>;
+               };
+
+               pdma: pdma@ffda0000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0xffda0000 0x1000>;
+                       interrupts = <0 81 4>,
+                                    <0 82 4>,
+                                    <0 83 4>,
+                                    <0 84 4>,
+                                    <0 85 4>,
+                                    <0 86 4>,
+                                    <0 87 4>,
+                                    <0 88 4>,
+                                    <0 89 4>;
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
+               };
+
+               rst: rstmgr@ffd11000 {
+                       #reset-cells = <1>;
+                       compatible = "altr,stratix10-rst-mgr";
+                       reg = <0xffd11000 0x100>;
+               };
+
+               smmu: iommu@fa000000 {
+                       compatible = "arm,mmu-500", "arm,smmu-v2";
+                       reg = <0xfa000000 0x40000>;
+                       #global-interrupts = <2>;
+                       #iommu-cells = <1>;
+                       interrupt-parent = <&intc>;
+                       interrupts = <0 128 4>, /* Global Secure Fault */
+                               <0 129 4>, /* Global Non-secure Fault */
+                               /* Non-secure Context Interrupts (32) */
+                               <0 138 4>, <0 139 4>, <0 140 4>, <0 141 4>,
+                               <0 142 4>, <0 143 4>, <0 144 4>, <0 145 4>,
+                               <0 146 4>, <0 147 4>, <0 148 4>, <0 149 4>,
+                               <0 150 4>, <0 151 4>, <0 152 4>, <0 153 4>,
+                               <0 154 4>, <0 155 4>, <0 156 4>, <0 157 4>,
+                               <0 158 4>, <0 159 4>, <0 160 4>, <0 161 4>,
+                               <0 162 4>, <0 163 4>, <0 164 4>, <0 165 4>,
+                               <0 166 4>, <0 167 4>, <0 168 4>, <0 169 4>;
+                       stream-match-mask = <0x7ff0>;
+                       status = "disabled";
+               };
+
+               spi0: spi@ffda4000 {
+                       compatible = "snps,dw-apb-ssi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0xffda4000 0x1000>;
+                       interrupts = <0 99 4>;
+                       resets = <&rst SPIM0_RESET>;
+                       reg-io-width = <4>;
+                       num-cs = <4>;
+                       status = "disabled";
+               };
+
+               spi1: spi@ffda5000 {
+                       compatible = "snps,dw-apb-ssi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0xffda5000 0x1000>;
+                       interrupts = <0 100 4>;
+                       resets = <&rst SPIM1_RESET>;
+                       reg-io-width = <4>;
+                       num-cs = <4>;
+                       status = "disabled";
+               };
+
+               sysmgr: sysmgr@ffd12000 {
+                       compatible = "altr,sys-mgr", "syscon";
+                       reg = <0xffd12000 0x500>;
+               };
+
+               /* Local timer */
+               timer {
+                       compatible = "arm,armv8-timer";
+                       interrupts = <1 13 0xf08>,
+                                    <1 14 0xf08>,
+                                    <1 11 0xf08>,
+                                    <1 10 0xf08>;
+               };
+
+               timer0: timer0@ffc03000 {
+                       compatible = "snps,dw-apb-timer";
+                       interrupts = <0 113 4>;
+                       reg = <0xffc03000 0x100>;
+               };
+
+               timer1: timer1@ffc03100 {
+                       compatible = "snps,dw-apb-timer";
+                       interrupts = <0 114 4>;
+                       reg = <0xffc03100 0x100>;
+               };
+
+               timer2: timer2@ffd00000 {
+                       compatible = "snps,dw-apb-timer";
+                       interrupts = <0 115 4>;
+                       reg = <0xffd00000 0x100>;
+               };
+
+               timer3: timer3@ffd00100 {
+                       compatible = "snps,dw-apb-timer";
+                       interrupts = <0 116 4>;
+                       reg = <0xffd00100 0x100>;
+               };
+
+               uart0: serial0@ffc02000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0xffc02000 0x100>;
+                       interrupts = <0 108 4>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       resets = <&rst UART0_RESET>;
+                       status = "disabled";
+               };
+
+               uart1: serial1@ffc02100 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0xffc02100 0x100>;
+                       interrupts = <0 109 4>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       resets = <&rst UART1_RESET>;
+                       status = "disabled";
+               };
+
+               usbphy0: usbphy@0 {
+                       #phy-cells = <0>;
+                       compatible = "usb-nop-xceiv";
+                       status = "okay";
+               };
+
+               usb0: usb@ffb00000 {
+                       compatible = "snps,dwc2";
+                       reg = <0xffb00000 0x40000>;
+                       interrupts = <0 93 4>;
+                       phys = <&usbphy0>;
+                       phy-names = "usb2-phy";
+                       resets = <&rst USB0_RESET>, <&rst USB0_OCP_RESET>;
+                       reset-names = "dwc2", "dwc2-ecc";
+                       iommus = <&smmu 6>;
+                       status = "disabled";
+               };
+
+               usb1: usb@ffb40000 {
+                       compatible = "snps,dwc2";
+                       reg = <0xffb40000 0x40000>;
+                       interrupts = <0 94 4>;
+                       phys = <&usbphy0>;
+                       phy-names = "usb2-phy";
+                       resets = <&rst USB1_RESET>, <&rst USB1_OCP_RESET>;
+                       reset-names = "dwc2", "dwc2-ecc";
+                       iommus = <&smmu 7>;
+                       status = "disabled";
+               };
+
+               watchdog0: watchdog@ffd00200 {
+                       compatible = "snps,dw-wdt";
+                       reg = <0xffd00200 0x100>;
+                       interrupts = <0 117 4>;
+                       resets = <&rst WATCHDOG0_RESET>;
+                       status = "disabled";
+               };
+
+               watchdog1: watchdog@ffd00300 {
+                       compatible = "snps,dw-wdt";
+                       reg = <0xffd00300 0x100>;
+                       interrupts = <0 118 4>;
+                       resets = <&rst WATCHDOG1_RESET>;
+                       status = "disabled";
+               };
+
+               watchdog2: watchdog@ffd00400 {
+                       compatible = "snps,dw-wdt";
+                       reg = <0xffd00400 0x100>;
+                       interrupts = <0 125 4>;
+                       resets = <&rst WATCHDOG2_RESET>;
+                       status = "disabled";
+               };
+
+               watchdog3: watchdog@ffd00500 {
+                       compatible = "snps,dw-wdt";
+                       reg = <0xffd00500 0x100>;
+                       interrupts = <0 126 4>;
+                       resets = <&rst WATCHDOG3_RESET>;
+                       status = "disabled";
+               };
+
+               sdr: sdr@f8011100 {
+                       compatible = "altr,sdr-ctl", "syscon";
+                       reg = <0xf8011100 0xc0>;
+               };
+
+               qspi: spi@ff8d2000 {
+                       compatible = "cdns,qspi-nor";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0xff8d2000 0x100>,
+                             <0xff900000 0x100000>;
+                       interrupts = <0 3 4>;
+                       cdns,fifo-depth = <128>;
+                       cdns,fifo-width = <4>;
+                       cdns,trigger-address = <0x00000000>;
+
+                       status = "disabled";
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts b/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts
new file mode 100644 (file)
index 0000000..7814a9e
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier:     GPL-2.0
+/*
+ * Copyright (C) 2019, Intel Corporation
+ */
+#include "socfpga_agilex.dtsi"
+
+/ {
+       model = "SoCFPGA Agilex SoCDK";
+
+       aliases {
+               serial0 = &uart0;
+               ethernet0 = &gmac0;
+               ethernet1 = &gmac1;
+               ethernet2 = &gmac2;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory {
+               device_type = "memory";
+               /* We expect the bootloader to fill in the reg */
+               reg = <0 0 0 0>;
+       };
+};
+
+&gpio1 {
+       status = "okay";
+};
+
+&gmac0 {
+       status = "okay";
+       phy-mode = "rgmii";
+       phy-handle = <&phy0>;
+
+       max-frame-size = <9000>;
+
+       mdio0 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "snps,dwmac-mdio";
+               phy0: ethernet-phy@0 {
+                       reg = <4>;
+
+                       txd0-skew-ps = <0>; /* -420ps */
+                       txd1-skew-ps = <0>; /* -420ps */
+                       txd2-skew-ps = <0>; /* -420ps */
+                       txd3-skew-ps = <0>; /* -420ps */
+                       rxd0-skew-ps = <420>; /* 0ps */
+                       rxd1-skew-ps = <420>; /* 0ps */
+                       rxd2-skew-ps = <420>; /* 0ps */
+                       rxd3-skew-ps = <420>; /* 0ps */
+                       txen-skew-ps = <0>; /* -420ps */
+                       txc-skew-ps = <900>; /* 0ps */
+                       rxdv-skew-ps = <420>; /* 0ps */
+                       rxc-skew-ps = <1680>; /* 780ps */
+               };
+       };
+};
+
+&mmc {
+       status = "okay";
+       cap-sd-highspeed;
+       broken-cd;
+       bus-width = <4>;
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&watchdog0 {
+       status = "okay";
+};
index 2468762..9143aa1 100644 (file)
                marvell,function = "gpio";
        };
 
+       cp0_wlan_disable_pins: wlan-disable-pins {
+               marvell,pins = "mpp51";
+               marvell,function = "gpio";
+       };
+
        cp0_sdhci_pins: sdhci-pins {
                marvell,pins = "mpp55", "mpp56", "mpp57", "mpp58", "mpp59",
                               "mpp60", "mpp61";
 
 &cp0_pcie0 {
        pinctrl-names = "default";
-       pinctrl-0 = <&cp0_pci0_reset_pins>;
+       pinctrl-0 = <&cp0_pci0_reset_pins &cp0_wlan_disable_pins>;
        reset-gpios = <&cp0_gpio2 0 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
                output-low;
        };
 
+       wlan_disable {
+               gpio-hog;
+               gpios = <19 GPIO_ACTIVE_LOW>;
+               output-low;
+       };
+
        lte_disable {
                gpio-hog;
                gpios = <21 GPIO_ACTIVE_LOW>;
index c3c3601..15f1842 100644 (file)
 
                cpu2: cpu@100 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a57";
+                       compatible = "arm,cortex-a72";
                        reg = <0x100>;
                        enable-method = "psci";
                        cpu-idle-states = <&CPU_SLEEP_0>;
                        #cooling-cells = <2>;
-                       clocks = <&infracfg CLK_INFRA_CA57SEL>,
+                       clocks = <&infracfg CLK_INFRA_CA72SEL>,
                                 <&apmixedsys CLK_APMIXED_MAINPLL>;
                        clock-names = "cpu", "intermediate";
                        operating-points-v2 = <&cluster1_opp>;
 
                cpu3: cpu@101 {
                        device_type = "cpu";
-                       compatible = "arm,cortex-a57";
+                       compatible = "arm,cortex-a72";
                        reg = <0x101>;
                        enable-method = "psci";
                        cpu-idle-states = <&CPU_SLEEP_0>;
                        #cooling-cells = <2>;
-                       clocks = <&infracfg CLK_INFRA_CA57SEL>,
+                       clocks = <&infracfg CLK_INFRA_CA72SEL>,
                                 <&apmixedsys CLK_APMIXED_MAINPLL>;
                        clock-names = "cpu", "intermediate";
                        operating-points-v2 = <&cluster1_opp>;
                };
        };
 
+       pmu_a53 {
+               compatible = "arm,cortex-a53-pmu";
+               interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 9 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-affinity = <&cpu0>, <&cpu1>;
+       };
+
+       pmu_a72 {
+               compatible = "arm,cortex-a72-pmu";
+               interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_SPI 13 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-affinity = <&cpu2>, <&cpu3>;
+       };
+
        psci {
                compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
                method = "smc";
                                      "vencpll",
                                      "venc_lt_sel",
                                      "vdec_bus_clk_src";
+                       assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>,
+                                         <&topckgen CLK_TOP_CCI400_SEL>,
+                                         <&topckgen CLK_TOP_VDEC_SEL>,
+                                         <&apmixedsys CLK_APMIXED_VCODECPLL>,
+                                         <&apmixedsys CLK_APMIXED_VENCPLL>;
+                       assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL_370P5>,
+                                                <&topckgen CLK_TOP_UNIVPLL_D2>,
+                                                <&topckgen CLK_TOP_VCODECPLL>;
+                       assigned-clock-rates = <0>, <0>, <0>, <1482000000>, <800000000>;
                };
 
                larb1: larb@16010000 {
                                      "venc_sel",
                                      "venc_lt_sel_src",
                                      "venc_lt_sel";
+                       assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>,
+                                         <&topckgen CLK_TOP_VENC_LT_SEL>;
+                       assigned-clock-parents = <&topckgen CLK_TOP_VENCPLL_D2>,
+                                                <&topckgen CLK_TOP_UNIVPLL1_D2>;
                };
 
                vencltsys: clock-controller@19000000 {
diff --git a/arch/arm64/boot/dts/mediatek/mt8183-pinfunc.h b/arch/arm64/boot/dts/mediatek/mt8183-pinfunc.h
new file mode 100644 (file)
index 0000000..6221cd7
--- /dev/null
@@ -0,0 +1,1120 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 MediaTek Inc.
+ * Author: Zhiyong Tao <zhiyong.tao@mediatek.com>
+ *
+ */
+
+#ifndef __MT8183_PINFUNC_H
+#define __MT8183_PINFUNC_H
+
+#include <dt-bindings/pinctrl/mt65xx.h>
+
+#define PINMUX_GPIO0__FUNC_GPIO0 (MTK_PIN_NO(0) | 0)
+#define PINMUX_GPIO0__FUNC_MRG_SYNC (MTK_PIN_NO(0) | 1)
+#define PINMUX_GPIO0__FUNC_PCM0_SYNC (MTK_PIN_NO(0) | 2)
+#define PINMUX_GPIO0__FUNC_TP_GPIO0_AO (MTK_PIN_NO(0) | 3)
+#define PINMUX_GPIO0__FUNC_SRCLKENAI0 (MTK_PIN_NO(0) | 4)
+#define PINMUX_GPIO0__FUNC_SCP_SPI2_CS (MTK_PIN_NO(0) | 5)
+#define PINMUX_GPIO0__FUNC_I2S3_MCK (MTK_PIN_NO(0) | 6)
+#define PINMUX_GPIO0__FUNC_SPI2_CSB (MTK_PIN_NO(0) | 7)
+
+#define PINMUX_GPIO1__FUNC_GPIO1 (MTK_PIN_NO(1) | 0)
+#define PINMUX_GPIO1__FUNC_MRG_CLK (MTK_PIN_NO(1) | 1)
+#define PINMUX_GPIO1__FUNC_PCM0_CLK (MTK_PIN_NO(1) | 2)
+#define PINMUX_GPIO1__FUNC_TP_GPIO1_AO (MTK_PIN_NO(1) | 3)
+#define PINMUX_GPIO1__FUNC_CLKM3 (MTK_PIN_NO(1) | 4)
+#define PINMUX_GPIO1__FUNC_SCP_SPI2_MO (MTK_PIN_NO(1) | 5)
+#define PINMUX_GPIO1__FUNC_I2S3_BCK (MTK_PIN_NO(1) | 6)
+#define PINMUX_GPIO1__FUNC_SPI2_MO (MTK_PIN_NO(1) | 7)
+
+#define PINMUX_GPIO2__FUNC_GPIO2 (MTK_PIN_NO(2) | 0)
+#define PINMUX_GPIO2__FUNC_MRG_DO (MTK_PIN_NO(2) | 1)
+#define PINMUX_GPIO2__FUNC_PCM0_DO (MTK_PIN_NO(2) | 2)
+#define PINMUX_GPIO2__FUNC_TP_GPIO2_AO (MTK_PIN_NO(2) | 3)
+#define PINMUX_GPIO2__FUNC_SCL6 (MTK_PIN_NO(2) | 4)
+#define PINMUX_GPIO2__FUNC_SCP_SPI2_CK (MTK_PIN_NO(2) | 5)
+#define PINMUX_GPIO2__FUNC_I2S3_LRCK (MTK_PIN_NO(2) | 6)
+#define PINMUX_GPIO2__FUNC_SPI2_CLK (MTK_PIN_NO(2) | 7)
+
+#define PINMUX_GPIO3__FUNC_GPIO3 (MTK_PIN_NO(3) | 0)
+#define PINMUX_GPIO3__FUNC_MRG_DI (MTK_PIN_NO(3) | 1)
+#define PINMUX_GPIO3__FUNC_PCM0_DI (MTK_PIN_NO(3) | 2)
+#define PINMUX_GPIO3__FUNC_TP_GPIO3_AO (MTK_PIN_NO(3) | 3)
+#define PINMUX_GPIO3__FUNC_SDA6 (MTK_PIN_NO(3) | 4)
+#define PINMUX_GPIO3__FUNC_TDM_MCK (MTK_PIN_NO(3) | 5)
+#define PINMUX_GPIO3__FUNC_I2S3_DO (MTK_PIN_NO(3) | 6)
+#define PINMUX_GPIO3__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(3) | 7)
+
+#define PINMUX_GPIO4__FUNC_GPIO4 (MTK_PIN_NO(4) | 0)
+#define PINMUX_GPIO4__FUNC_PWM_B (MTK_PIN_NO(4) | 1)
+#define PINMUX_GPIO4__FUNC_I2S0_MCK (MTK_PIN_NO(4) | 2)
+#define PINMUX_GPIO4__FUNC_SSPM_UTXD_AO (MTK_PIN_NO(4) | 3)
+#define PINMUX_GPIO4__FUNC_MD_URXD1 (MTK_PIN_NO(4) | 4)
+#define PINMUX_GPIO4__FUNC_TDM_BCK (MTK_PIN_NO(4) | 5)
+#define PINMUX_GPIO4__FUNC_TP_GPIO4_AO (MTK_PIN_NO(4) | 6)
+#define PINMUX_GPIO4__FUNC_DAP_MD32_SWD (MTK_PIN_NO(4) | 7)
+
+#define PINMUX_GPIO5__FUNC_GPIO5 (MTK_PIN_NO(5) | 0)
+#define PINMUX_GPIO5__FUNC_PWM_C (MTK_PIN_NO(5) | 1)
+#define PINMUX_GPIO5__FUNC_I2S0_BCK (MTK_PIN_NO(5) | 2)
+#define PINMUX_GPIO5__FUNC_SSPM_URXD_AO (MTK_PIN_NO(5) | 3)
+#define PINMUX_GPIO5__FUNC_MD_UTXD1 (MTK_PIN_NO(5) | 4)
+#define PINMUX_GPIO5__FUNC_TDM_LRCK (MTK_PIN_NO(5) | 5)
+#define PINMUX_GPIO5__FUNC_TP_GPIO5_AO (MTK_PIN_NO(5) | 6)
+#define PINMUX_GPIO5__FUNC_DAP_MD32_SWCK (MTK_PIN_NO(5) | 7)
+
+#define PINMUX_GPIO6__FUNC_GPIO6 (MTK_PIN_NO(6) | 0)
+#define PINMUX_GPIO6__FUNC_PWM_A (MTK_PIN_NO(6) | 1)
+#define PINMUX_GPIO6__FUNC_I2S0_LRCK (MTK_PIN_NO(6) | 2)
+#define PINMUX_GPIO6__FUNC_IDDIG (MTK_PIN_NO(6) | 3)
+#define PINMUX_GPIO6__FUNC_MD_URXD0 (MTK_PIN_NO(6) | 4)
+#define PINMUX_GPIO6__FUNC_TDM_DATA0 (MTK_PIN_NO(6) | 5)
+#define PINMUX_GPIO6__FUNC_TP_GPIO6_AO (MTK_PIN_NO(6) | 6)
+#define PINMUX_GPIO6__FUNC_CMFLASH (MTK_PIN_NO(6) | 7)
+
+#define PINMUX_GPIO7__FUNC_GPIO7 (MTK_PIN_NO(7) | 0)
+#define PINMUX_GPIO7__FUNC_SPI1_B_MI (MTK_PIN_NO(7) | 1)
+#define PINMUX_GPIO7__FUNC_I2S0_DI (MTK_PIN_NO(7) | 2)
+#define PINMUX_GPIO7__FUNC_USB_DRVVBUS (MTK_PIN_NO(7) | 3)
+#define PINMUX_GPIO7__FUNC_MD_UTXD0 (MTK_PIN_NO(7) | 4)
+#define PINMUX_GPIO7__FUNC_TDM_DATA1 (MTK_PIN_NO(7) | 5)
+#define PINMUX_GPIO7__FUNC_TP_GPIO7_AO (MTK_PIN_NO(7) | 6)
+#define PINMUX_GPIO7__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(7) | 7)
+
+#define PINMUX_GPIO8__FUNC_GPIO8 (MTK_PIN_NO(8) | 0)
+#define PINMUX_GPIO8__FUNC_SPI1_B_CSB (MTK_PIN_NO(8) | 1)
+#define PINMUX_GPIO8__FUNC_ANT_SEL3 (MTK_PIN_NO(8) | 2)
+#define PINMUX_GPIO8__FUNC_SCL7 (MTK_PIN_NO(8) | 3)
+#define PINMUX_GPIO8__FUNC_CONN_MCU_TRST_B (MTK_PIN_NO(8) | 4)
+#define PINMUX_GPIO8__FUNC_TDM_DATA2 (MTK_PIN_NO(8) | 5)
+#define PINMUX_GPIO8__FUNC_MD_INT0 (MTK_PIN_NO(8) | 6)
+#define PINMUX_GPIO8__FUNC_JTRSTN_SEL1 (MTK_PIN_NO(8) | 7)
+
+#define PINMUX_GPIO9__FUNC_GPIO9 (MTK_PIN_NO(9) | 0)
+#define PINMUX_GPIO9__FUNC_SPI1_B_MO (MTK_PIN_NO(9) | 1)
+#define PINMUX_GPIO9__FUNC_ANT_SEL4 (MTK_PIN_NO(9) | 2)
+#define PINMUX_GPIO9__FUNC_CMMCLK2 (MTK_PIN_NO(9) | 3)
+#define PINMUX_GPIO9__FUNC_CONN_MCU_DBGACK_N (MTK_PIN_NO(9) | 4)
+#define PINMUX_GPIO9__FUNC_SSPM_JTAG_TRSTN (MTK_PIN_NO(9) | 5)
+#define PINMUX_GPIO9__FUNC_IO_JTAG_TRSTN (MTK_PIN_NO(9) | 6)
+#define PINMUX_GPIO9__FUNC_DBG_MON_B10 (MTK_PIN_NO(9) | 7)
+
+#define PINMUX_GPIO10__FUNC_GPIO10 (MTK_PIN_NO(10) | 0)
+#define PINMUX_GPIO10__FUNC_SPI1_B_CLK (MTK_PIN_NO(10) | 1)
+#define PINMUX_GPIO10__FUNC_ANT_SEL5 (MTK_PIN_NO(10) | 2)
+#define PINMUX_GPIO10__FUNC_CMMCLK3 (MTK_PIN_NO(10) | 3)
+#define PINMUX_GPIO10__FUNC_CONN_MCU_DBGI_N (MTK_PIN_NO(10) | 4)
+#define PINMUX_GPIO10__FUNC_TDM_DATA3 (MTK_PIN_NO(10) | 5)
+#define PINMUX_GPIO10__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(10) | 6)
+#define PINMUX_GPIO10__FUNC_DBG_MON_B11 (MTK_PIN_NO(10) | 7)
+
+#define PINMUX_GPIO11__FUNC_GPIO11 (MTK_PIN_NO(11) | 0)
+#define PINMUX_GPIO11__FUNC_TP_URXD1_AO (MTK_PIN_NO(11) | 1)
+#define PINMUX_GPIO11__FUNC_IDDIG (MTK_PIN_NO(11) | 2)
+#define PINMUX_GPIO11__FUNC_SCL6 (MTK_PIN_NO(11) | 3)
+#define PINMUX_GPIO11__FUNC_UCTS1 (MTK_PIN_NO(11) | 4)
+#define PINMUX_GPIO11__FUNC_UCTS0 (MTK_PIN_NO(11) | 5)
+#define PINMUX_GPIO11__FUNC_SRCLKENAI1 (MTK_PIN_NO(11) | 6)
+#define PINMUX_GPIO11__FUNC_I2S5_MCK (MTK_PIN_NO(11) | 7)
+
+#define PINMUX_GPIO12__FUNC_GPIO12 (MTK_PIN_NO(12) | 0)
+#define PINMUX_GPIO12__FUNC_TP_UTXD1_AO (MTK_PIN_NO(12) | 1)
+#define PINMUX_GPIO12__FUNC_USB_DRVVBUS (MTK_PIN_NO(12) | 2)
+#define PINMUX_GPIO12__FUNC_SDA6 (MTK_PIN_NO(12) | 3)
+#define PINMUX_GPIO12__FUNC_URTS1 (MTK_PIN_NO(12) | 4)
+#define PINMUX_GPIO12__FUNC_URTS0 (MTK_PIN_NO(12) | 5)
+#define PINMUX_GPIO12__FUNC_I2S2_DI2 (MTK_PIN_NO(12) | 6)
+#define PINMUX_GPIO12__FUNC_I2S5_BCK (MTK_PIN_NO(12) | 7)
+
+#define PINMUX_GPIO13__FUNC_GPIO13 (MTK_PIN_NO(13) | 0)
+#define PINMUX_GPIO13__FUNC_DBPI_D0 (MTK_PIN_NO(13) | 1)
+#define PINMUX_GPIO13__FUNC_SPI5_MI (MTK_PIN_NO(13) | 2)
+#define PINMUX_GPIO13__FUNC_PCM0_SYNC (MTK_PIN_NO(13) | 3)
+#define PINMUX_GPIO13__FUNC_MD_URXD0 (MTK_PIN_NO(13) | 4)
+#define PINMUX_GPIO13__FUNC_ANT_SEL3 (MTK_PIN_NO(13) | 5)
+#define PINMUX_GPIO13__FUNC_I2S0_MCK (MTK_PIN_NO(13) | 6)
+#define PINMUX_GPIO13__FUNC_DBG_MON_B15 (MTK_PIN_NO(13) | 7)
+
+#define PINMUX_GPIO14__FUNC_GPIO14 (MTK_PIN_NO(14) | 0)
+#define PINMUX_GPIO14__FUNC_DBPI_D1 (MTK_PIN_NO(14) | 1)
+#define PINMUX_GPIO14__FUNC_SPI5_CSB (MTK_PIN_NO(14) | 2)
+#define PINMUX_GPIO14__FUNC_PCM0_CLK (MTK_PIN_NO(14) | 3)
+#define PINMUX_GPIO14__FUNC_MD_UTXD0 (MTK_PIN_NO(14) | 4)
+#define PINMUX_GPIO14__FUNC_ANT_SEL4 (MTK_PIN_NO(14) | 5)
+#define PINMUX_GPIO14__FUNC_I2S0_BCK (MTK_PIN_NO(14) | 6)
+#define PINMUX_GPIO14__FUNC_DBG_MON_B16 (MTK_PIN_NO(14) | 7)
+
+#define PINMUX_GPIO15__FUNC_GPIO15 (MTK_PIN_NO(15) | 0)
+#define PINMUX_GPIO15__FUNC_DBPI_D2 (MTK_PIN_NO(15) | 1)
+#define PINMUX_GPIO15__FUNC_SPI5_MO (MTK_PIN_NO(15) | 2)
+#define PINMUX_GPIO15__FUNC_PCM0_DO (MTK_PIN_NO(15) | 3)
+#define PINMUX_GPIO15__FUNC_MD_URXD1 (MTK_PIN_NO(15) | 4)
+#define PINMUX_GPIO15__FUNC_ANT_SEL5 (MTK_PIN_NO(15) | 5)
+#define PINMUX_GPIO15__FUNC_I2S0_LRCK (MTK_PIN_NO(15) | 6)
+#define PINMUX_GPIO15__FUNC_DBG_MON_B17 (MTK_PIN_NO(15) | 7)
+
+#define PINMUX_GPIO16__FUNC_GPIO16 (MTK_PIN_NO(16) | 0)
+#define PINMUX_GPIO16__FUNC_DBPI_D3 (MTK_PIN_NO(16) | 1)
+#define PINMUX_GPIO16__FUNC_SPI5_CLK (MTK_PIN_NO(16) | 2)
+#define PINMUX_GPIO16__FUNC_PCM0_DI (MTK_PIN_NO(16) | 3)
+#define PINMUX_GPIO16__FUNC_MD_UTXD1 (MTK_PIN_NO(16) | 4)
+#define PINMUX_GPIO16__FUNC_ANT_SEL6 (MTK_PIN_NO(16) | 5)
+#define PINMUX_GPIO16__FUNC_I2S0_DI (MTK_PIN_NO(16) | 6)
+#define PINMUX_GPIO16__FUNC_DBG_MON_B23 (MTK_PIN_NO(16) | 7)
+
+#define PINMUX_GPIO17__FUNC_GPIO17 (MTK_PIN_NO(17) | 0)
+#define PINMUX_GPIO17__FUNC_DBPI_D4 (MTK_PIN_NO(17) | 1)
+#define PINMUX_GPIO17__FUNC_SPI4_MI (MTK_PIN_NO(17) | 2)
+#define PINMUX_GPIO17__FUNC_CONN_MCU_TRST_B (MTK_PIN_NO(17) | 3)
+#define PINMUX_GPIO17__FUNC_MD_INT0 (MTK_PIN_NO(17) | 4)
+#define PINMUX_GPIO17__FUNC_ANT_SEL7 (MTK_PIN_NO(17) | 5)
+#define PINMUX_GPIO17__FUNC_I2S3_MCK (MTK_PIN_NO(17) | 6)
+#define PINMUX_GPIO17__FUNC_DBG_MON_A1 (MTK_PIN_NO(17) | 7)
+
+#define PINMUX_GPIO18__FUNC_GPIO18 (MTK_PIN_NO(18) | 0)
+#define PINMUX_GPIO18__FUNC_DBPI_D5 (MTK_PIN_NO(18) | 1)
+#define PINMUX_GPIO18__FUNC_SPI4_CSB (MTK_PIN_NO(18) | 2)
+#define PINMUX_GPIO18__FUNC_CONN_MCU_DBGI_N (MTK_PIN_NO(18) | 3)
+#define PINMUX_GPIO18__FUNC_MD_INT0 (MTK_PIN_NO(18) | 4)
+#define PINMUX_GPIO18__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(18) | 5)
+#define PINMUX_GPIO18__FUNC_I2S3_BCK (MTK_PIN_NO(18) | 6)
+#define PINMUX_GPIO18__FUNC_DBG_MON_A2 (MTK_PIN_NO(18) | 7)
+
+#define PINMUX_GPIO19__FUNC_GPIO19 (MTK_PIN_NO(19) | 0)
+#define PINMUX_GPIO19__FUNC_DBPI_D6 (MTK_PIN_NO(19) | 1)
+#define PINMUX_GPIO19__FUNC_SPI4_MO (MTK_PIN_NO(19) | 2)
+#define PINMUX_GPIO19__FUNC_CONN_MCU_TDO (MTK_PIN_NO(19) | 3)
+#define PINMUX_GPIO19__FUNC_MD_INT2_C2K_UIM1_HOT_PLUG (MTK_PIN_NO(19) | 4)
+#define PINMUX_GPIO19__FUNC_URXD1 (MTK_PIN_NO(19) | 5)
+#define PINMUX_GPIO19__FUNC_I2S3_LRCK (MTK_PIN_NO(19) | 6)
+#define PINMUX_GPIO19__FUNC_DBG_MON_A3 (MTK_PIN_NO(19) | 7)
+
+#define PINMUX_GPIO20__FUNC_GPIO20 (MTK_PIN_NO(20) | 0)
+#define PINMUX_GPIO20__FUNC_DBPI_D7 (MTK_PIN_NO(20) | 1)
+#define PINMUX_GPIO20__FUNC_SPI4_CLK (MTK_PIN_NO(20) | 2)
+#define PINMUX_GPIO20__FUNC_CONN_MCU_DBGACK_N (MTK_PIN_NO(20) | 3)
+#define PINMUX_GPIO20__FUNC_MD_INT1_C2K_UIM0_HOT_PLUG (MTK_PIN_NO(20) | 4)
+#define PINMUX_GPIO20__FUNC_UTXD1 (MTK_PIN_NO(20) | 5)
+#define PINMUX_GPIO20__FUNC_I2S3_DO (MTK_PIN_NO(20) | 6)
+#define PINMUX_GPIO20__FUNC_DBG_MON_A19 (MTK_PIN_NO(20) | 7)
+
+#define PINMUX_GPIO21__FUNC_GPIO21 (MTK_PIN_NO(21) | 0)
+#define PINMUX_GPIO21__FUNC_DBPI_D8 (MTK_PIN_NO(21) | 1)
+#define PINMUX_GPIO21__FUNC_SPI3_MI (MTK_PIN_NO(21) | 2)
+#define PINMUX_GPIO21__FUNC_CONN_MCU_TMS (MTK_PIN_NO(21) | 3)
+#define PINMUX_GPIO21__FUNC_DAP_MD32_SWD (MTK_PIN_NO(21) | 4)
+#define PINMUX_GPIO21__FUNC_CONN_MCU_AICE_TMSC (MTK_PIN_NO(21) | 5)
+#define PINMUX_GPIO21__FUNC_I2S2_MCK (MTK_PIN_NO(21) | 6)
+#define PINMUX_GPIO21__FUNC_DBG_MON_B5 (MTK_PIN_NO(21) | 7)
+
+#define PINMUX_GPIO22__FUNC_GPIO22 (MTK_PIN_NO(22) | 0)
+#define PINMUX_GPIO22__FUNC_DBPI_D9 (MTK_PIN_NO(22) | 1)
+#define PINMUX_GPIO22__FUNC_SPI3_CSB (MTK_PIN_NO(22) | 2)
+#define PINMUX_GPIO22__FUNC_CONN_MCU_TCK (MTK_PIN_NO(22) | 3)
+#define PINMUX_GPIO22__FUNC_DAP_MD32_SWCK (MTK_PIN_NO(22) | 4)
+#define PINMUX_GPIO22__FUNC_CONN_MCU_AICE_TCKC (MTK_PIN_NO(22) | 5)
+#define PINMUX_GPIO22__FUNC_I2S2_BCK (MTK_PIN_NO(22) | 6)
+#define PINMUX_GPIO22__FUNC_DBG_MON_B6 (MTK_PIN_NO(22) | 7)
+
+#define PINMUX_GPIO23__FUNC_GPIO23 (MTK_PIN_NO(23) | 0)
+#define PINMUX_GPIO23__FUNC_DBPI_D10 (MTK_PIN_NO(23) | 1)
+#define PINMUX_GPIO23__FUNC_SPI3_MO (MTK_PIN_NO(23) | 2)
+#define PINMUX_GPIO23__FUNC_CONN_MCU_TDI (MTK_PIN_NO(23) | 3)
+#define PINMUX_GPIO23__FUNC_UCTS1 (MTK_PIN_NO(23) | 4)
+#define PINMUX_GPIO23__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(23) | 5)
+#define PINMUX_GPIO23__FUNC_I2S2_LRCK (MTK_PIN_NO(23) | 6)
+#define PINMUX_GPIO23__FUNC_DBG_MON_B7 (MTK_PIN_NO(23) | 7)
+
+#define PINMUX_GPIO24__FUNC_GPIO24 (MTK_PIN_NO(24) | 0)
+#define PINMUX_GPIO24__FUNC_DBPI_D11 (MTK_PIN_NO(24) | 1)
+#define PINMUX_GPIO24__FUNC_SPI3_CLK (MTK_PIN_NO(24) | 2)
+#define PINMUX_GPIO24__FUNC_SRCLKENAI0 (MTK_PIN_NO(24) | 3)
+#define PINMUX_GPIO24__FUNC_URTS1 (MTK_PIN_NO(24) | 4)
+#define PINMUX_GPIO24__FUNC_IO_JTAG_TCK (MTK_PIN_NO(24) | 5)
+#define PINMUX_GPIO24__FUNC_I2S2_DI (MTK_PIN_NO(24) | 6)
+#define PINMUX_GPIO24__FUNC_DBG_MON_B31 (MTK_PIN_NO(24) | 7)
+
+#define PINMUX_GPIO25__FUNC_GPIO25 (MTK_PIN_NO(25) | 0)
+#define PINMUX_GPIO25__FUNC_DBPI_HSYNC (MTK_PIN_NO(25) | 1)
+#define PINMUX_GPIO25__FUNC_ANT_SEL0 (MTK_PIN_NO(25) | 2)
+#define PINMUX_GPIO25__FUNC_SCL6 (MTK_PIN_NO(25) | 3)
+#define PINMUX_GPIO25__FUNC_KPCOL2 (MTK_PIN_NO(25) | 4)
+#define PINMUX_GPIO25__FUNC_IO_JTAG_TMS (MTK_PIN_NO(25) | 5)
+#define PINMUX_GPIO25__FUNC_I2S1_MCK (MTK_PIN_NO(25) | 6)
+#define PINMUX_GPIO25__FUNC_DBG_MON_B0 (MTK_PIN_NO(25) | 7)
+
+#define PINMUX_GPIO26__FUNC_GPIO26 (MTK_PIN_NO(26) | 0)
+#define PINMUX_GPIO26__FUNC_DBPI_VSYNC (MTK_PIN_NO(26) | 1)
+#define PINMUX_GPIO26__FUNC_ANT_SEL1 (MTK_PIN_NO(26) | 2)
+#define PINMUX_GPIO26__FUNC_SDA6 (MTK_PIN_NO(26) | 3)
+#define PINMUX_GPIO26__FUNC_KPROW2 (MTK_PIN_NO(26) | 4)
+#define PINMUX_GPIO26__FUNC_IO_JTAG_TDI (MTK_PIN_NO(26) | 5)
+#define PINMUX_GPIO26__FUNC_I2S1_BCK (MTK_PIN_NO(26) | 6)
+#define PINMUX_GPIO26__FUNC_DBG_MON_B1 (MTK_PIN_NO(26) | 7)
+
+#define PINMUX_GPIO27__FUNC_GPIO27 (MTK_PIN_NO(27) | 0)
+#define PINMUX_GPIO27__FUNC_DBPI_DE (MTK_PIN_NO(27) | 1)
+#define PINMUX_GPIO27__FUNC_ANT_SEL2 (MTK_PIN_NO(27) | 2)
+#define PINMUX_GPIO27__FUNC_SCL7 (MTK_PIN_NO(27) | 3)
+#define PINMUX_GPIO27__FUNC_DMIC_CLK (MTK_PIN_NO(27) | 4)
+#define PINMUX_GPIO27__FUNC_IO_JTAG_TDO (MTK_PIN_NO(27) | 5)
+#define PINMUX_GPIO27__FUNC_I2S1_LRCK (MTK_PIN_NO(27) | 6)
+#define PINMUX_GPIO27__FUNC_DBG_MON_B9 (MTK_PIN_NO(27) | 7)
+
+#define PINMUX_GPIO28__FUNC_GPIO28 (MTK_PIN_NO(28) | 0)
+#define PINMUX_GPIO28__FUNC_DBPI_CK (MTK_PIN_NO(28) | 1)
+#define PINMUX_GPIO28__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(28) | 2)
+#define PINMUX_GPIO28__FUNC_SDA7 (MTK_PIN_NO(28) | 3)
+#define PINMUX_GPIO28__FUNC_DMIC_DAT (MTK_PIN_NO(28) | 4)
+#define PINMUX_GPIO28__FUNC_IO_JTAG_TRSTN (MTK_PIN_NO(28) | 5)
+#define PINMUX_GPIO28__FUNC_I2S1_DO (MTK_PIN_NO(28) | 6)
+#define PINMUX_GPIO28__FUNC_DBG_MON_B32 (MTK_PIN_NO(28) | 7)
+
+#define PINMUX_GPIO29__FUNC_GPIO29 (MTK_PIN_NO(29) | 0)
+#define PINMUX_GPIO29__FUNC_MSDC1_CLK (MTK_PIN_NO(29) | 1)
+#define PINMUX_GPIO29__FUNC_IO_JTAG_TCK (MTK_PIN_NO(29) | 2)
+#define PINMUX_GPIO29__FUNC_UDI_TCK (MTK_PIN_NO(29) | 3)
+#define PINMUX_GPIO29__FUNC_CONN_DSP_JCK (MTK_PIN_NO(29) | 4)
+#define PINMUX_GPIO29__FUNC_SSPM_JTAG_TCK (MTK_PIN_NO(29) | 5)
+#define PINMUX_GPIO29__FUNC_PCM1_CLK (MTK_PIN_NO(29) | 6)
+#define PINMUX_GPIO29__FUNC_DBG_MON_A6 (MTK_PIN_NO(29) | 7)
+
+#define PINMUX_GPIO30__FUNC_GPIO30 (MTK_PIN_NO(30) | 0)
+#define PINMUX_GPIO30__FUNC_MSDC1_DAT3 (MTK_PIN_NO(30) | 1)
+#define PINMUX_GPIO30__FUNC_DAP_MD32_SWD (MTK_PIN_NO(30) | 2)
+#define PINMUX_GPIO30__FUNC_CONN_MCU_AICE_TMSC (MTK_PIN_NO(30) | 3)
+#define PINMUX_GPIO30__FUNC_CONN_DSP_JINTP (MTK_PIN_NO(30) | 4)
+#define PINMUX_GPIO30__FUNC_SSPM_JTAG_TRSTN (MTK_PIN_NO(30) | 5)
+#define PINMUX_GPIO30__FUNC_PCM1_DI (MTK_PIN_NO(30) | 6)
+#define PINMUX_GPIO30__FUNC_DBG_MON_A7 (MTK_PIN_NO(30) | 7)
+
+#define PINMUX_GPIO31__FUNC_GPIO31 (MTK_PIN_NO(31) | 0)
+#define PINMUX_GPIO31__FUNC_MSDC1_CMD (MTK_PIN_NO(31) | 1)
+#define PINMUX_GPIO31__FUNC_IO_JTAG_TMS (MTK_PIN_NO(31) | 2)
+#define PINMUX_GPIO31__FUNC_UDI_TMS (MTK_PIN_NO(31) | 3)
+#define PINMUX_GPIO31__FUNC_CONN_DSP_JMS (MTK_PIN_NO(31) | 4)
+#define PINMUX_GPIO31__FUNC_SSPM_JTAG_TMS (MTK_PIN_NO(31) | 5)
+#define PINMUX_GPIO31__FUNC_PCM1_SYNC (MTK_PIN_NO(31) | 6)
+#define PINMUX_GPIO31__FUNC_DBG_MON_A8 (MTK_PIN_NO(31) | 7)
+
+#define PINMUX_GPIO32__FUNC_GPIO32 (MTK_PIN_NO(32) | 0)
+#define PINMUX_GPIO32__FUNC_MSDC1_DAT0 (MTK_PIN_NO(32) | 1)
+#define PINMUX_GPIO32__FUNC_IO_JTAG_TDI (MTK_PIN_NO(32) | 2)
+#define PINMUX_GPIO32__FUNC_UDI_TDI (MTK_PIN_NO(32) | 3)
+#define PINMUX_GPIO32__FUNC_CONN_DSP_JDI (MTK_PIN_NO(32) | 4)
+#define PINMUX_GPIO32__FUNC_SSPM_JTAG_TDI (MTK_PIN_NO(32) | 5)
+#define PINMUX_GPIO32__FUNC_PCM1_DO0 (MTK_PIN_NO(32) | 6)
+#define PINMUX_GPIO32__FUNC_DBG_MON_A9 (MTK_PIN_NO(32) | 7)
+
+#define PINMUX_GPIO33__FUNC_GPIO33 (MTK_PIN_NO(33) | 0)
+#define PINMUX_GPIO33__FUNC_MSDC1_DAT2 (MTK_PIN_NO(33) | 1)
+#define PINMUX_GPIO33__FUNC_IO_JTAG_TRSTN (MTK_PIN_NO(33) | 2)
+#define PINMUX_GPIO33__FUNC_UDI_NTRST (MTK_PIN_NO(33) | 3)
+#define PINMUX_GPIO33__FUNC_DAP_MD32_SWCK (MTK_PIN_NO(33) | 4)
+#define PINMUX_GPIO33__FUNC_CONN_MCU_AICE_TCKC (MTK_PIN_NO(33) | 5)
+#define PINMUX_GPIO33__FUNC_PCM1_DO2 (MTK_PIN_NO(33) | 6)
+#define PINMUX_GPIO33__FUNC_DBG_MON_A10 (MTK_PIN_NO(33) | 7)
+
+#define PINMUX_GPIO34__FUNC_GPIO34 (MTK_PIN_NO(34) | 0)
+#define PINMUX_GPIO34__FUNC_MSDC1_DAT1 (MTK_PIN_NO(34) | 1)
+#define PINMUX_GPIO34__FUNC_IO_JTAG_TDO (MTK_PIN_NO(34) | 2)
+#define PINMUX_GPIO34__FUNC_UDI_TDO (MTK_PIN_NO(34) | 3)
+#define PINMUX_GPIO34__FUNC_CONN_DSP_JDO (MTK_PIN_NO(34) | 4)
+#define PINMUX_GPIO34__FUNC_SSPM_JTAG_TDO (MTK_PIN_NO(34) | 5)
+#define PINMUX_GPIO34__FUNC_PCM1_DO1 (MTK_PIN_NO(34) | 6)
+#define PINMUX_GPIO34__FUNC_DBG_MON_A11 (MTK_PIN_NO(34) | 7)
+
+#define PINMUX_GPIO35__FUNC_GPIO35 (MTK_PIN_NO(35) | 0)
+#define PINMUX_GPIO35__FUNC_MD1_SIM2_SIO (MTK_PIN_NO(35) | 1)
+#define PINMUX_GPIO35__FUNC_CCU_JTAG_TDO (MTK_PIN_NO(35) | 2)
+#define PINMUX_GPIO35__FUNC_MD1_SIM1_SIO (MTK_PIN_NO(35) | 3)
+#define PINMUX_GPIO35__FUNC_SCP_JTAG_TDO (MTK_PIN_NO(35) | 5)
+#define PINMUX_GPIO35__FUNC_CONN_DSP_JMS (MTK_PIN_NO(35) | 6)
+#define PINMUX_GPIO35__FUNC_DBG_MON_A28 (MTK_PIN_NO(35) | 7)
+
+#define PINMUX_GPIO36__FUNC_GPIO36 (MTK_PIN_NO(36) | 0)
+#define PINMUX_GPIO36__FUNC_MD1_SIM2_SRST (MTK_PIN_NO(36) | 1)
+#define PINMUX_GPIO36__FUNC_CCU_JTAG_TMS (MTK_PIN_NO(36) | 2)
+#define PINMUX_GPIO36__FUNC_MD1_SIM1_SRST (MTK_PIN_NO(36) | 3)
+#define PINMUX_GPIO36__FUNC_CONN_MCU_AICE_TMSC (MTK_PIN_NO(36) | 4)
+#define PINMUX_GPIO36__FUNC_SCP_JTAG_TMS (MTK_PIN_NO(36) | 5)
+#define PINMUX_GPIO36__FUNC_CONN_DSP_JINTP (MTK_PIN_NO(36) | 6)
+#define PINMUX_GPIO36__FUNC_DBG_MON_A29 (MTK_PIN_NO(36) | 7)
+
+#define PINMUX_GPIO37__FUNC_GPIO37 (MTK_PIN_NO(37) | 0)
+#define PINMUX_GPIO37__FUNC_MD1_SIM2_SCLK (MTK_PIN_NO(37) | 1)
+#define PINMUX_GPIO37__FUNC_CCU_JTAG_TDI (MTK_PIN_NO(37) | 2)
+#define PINMUX_GPIO37__FUNC_MD1_SIM1_SCLK (MTK_PIN_NO(37) | 3)
+#define PINMUX_GPIO37__FUNC_SCP_JTAG_TDI (MTK_PIN_NO(37) | 5)
+#define PINMUX_GPIO37__FUNC_CONN_DSP_JDO (MTK_PIN_NO(37) | 6)
+#define PINMUX_GPIO37__FUNC_DBG_MON_A30 (MTK_PIN_NO(37) | 7)
+
+#define PINMUX_GPIO38__FUNC_GPIO38 (MTK_PIN_NO(38) | 0)
+#define PINMUX_GPIO38__FUNC_MD1_SIM1_SCLK (MTK_PIN_NO(38) | 1)
+#define PINMUX_GPIO38__FUNC_MD1_SIM2_SCLK (MTK_PIN_NO(38) | 3)
+#define PINMUX_GPIO38__FUNC_CONN_MCU_AICE_TCKC (MTK_PIN_NO(38) | 4)
+#define PINMUX_GPIO38__FUNC_DBG_MON_A20 (MTK_PIN_NO(38) | 7)
+
+#define PINMUX_GPIO39__FUNC_GPIO39 (MTK_PIN_NO(39) | 0)
+#define PINMUX_GPIO39__FUNC_MD1_SIM1_SRST (MTK_PIN_NO(39) | 1)
+#define PINMUX_GPIO39__FUNC_CCU_JTAG_TCK (MTK_PIN_NO(39) | 2)
+#define PINMUX_GPIO39__FUNC_MD1_SIM2_SRST (MTK_PIN_NO(39) | 3)
+#define PINMUX_GPIO39__FUNC_SCP_JTAG_TCK (MTK_PIN_NO(39) | 5)
+#define PINMUX_GPIO39__FUNC_CONN_DSP_JCK (MTK_PIN_NO(39) | 6)
+#define PINMUX_GPIO39__FUNC_DBG_MON_A31 (MTK_PIN_NO(39) | 7)
+
+#define PINMUX_GPIO40__FUNC_GPIO40 (MTK_PIN_NO(40) | 0)
+#define PINMUX_GPIO40__FUNC_MD1_SIM1_SIO (MTK_PIN_NO(40) | 1)
+#define PINMUX_GPIO40__FUNC_CCU_JTAG_TRST (MTK_PIN_NO(40) | 2)
+#define PINMUX_GPIO40__FUNC_MD1_SIM2_SIO (MTK_PIN_NO(40) | 3)
+#define PINMUX_GPIO40__FUNC_SCP_JTAG_TRSTN (MTK_PIN_NO(40) | 5)
+#define PINMUX_GPIO40__FUNC_CONN_DSP_JDI (MTK_PIN_NO(40) | 6)
+#define PINMUX_GPIO40__FUNC_DBG_MON_A32 (MTK_PIN_NO(40) | 7)
+
+#define PINMUX_GPIO41__FUNC_GPIO41 (MTK_PIN_NO(41) | 0)
+#define PINMUX_GPIO41__FUNC_IDDIG (MTK_PIN_NO(41) | 1)
+#define PINMUX_GPIO41__FUNC_URXD1 (MTK_PIN_NO(41) | 2)
+#define PINMUX_GPIO41__FUNC_UCTS0 (MTK_PIN_NO(41) | 3)
+#define PINMUX_GPIO41__FUNC_SSPM_UTXD_AO (MTK_PIN_NO(41) | 4)
+#define PINMUX_GPIO41__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(41) | 5)
+#define PINMUX_GPIO41__FUNC_DMIC_CLK (MTK_PIN_NO(41) | 6)
+
+#define PINMUX_GPIO42__FUNC_GPIO42 (MTK_PIN_NO(42) | 0)
+#define PINMUX_GPIO42__FUNC_USB_DRVVBUS (MTK_PIN_NO(42) | 1)
+#define PINMUX_GPIO42__FUNC_UTXD1 (MTK_PIN_NO(42) | 2)
+#define PINMUX_GPIO42__FUNC_URTS0 (MTK_PIN_NO(42) | 3)
+#define PINMUX_GPIO42__FUNC_SSPM_URXD_AO (MTK_PIN_NO(42) | 4)
+#define PINMUX_GPIO42__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(42) | 5)
+#define PINMUX_GPIO42__FUNC_DMIC_DAT (MTK_PIN_NO(42) | 6)
+
+#define PINMUX_GPIO43__FUNC_GPIO43 (MTK_PIN_NO(43) | 0)
+#define PINMUX_GPIO43__FUNC_DISP_PWM (MTK_PIN_NO(43) | 1)
+
+#define PINMUX_GPIO44__FUNC_GPIO44 (MTK_PIN_NO(44) | 0)
+#define PINMUX_GPIO44__FUNC_DSI_TE (MTK_PIN_NO(44) | 1)
+
+#define PINMUX_GPIO45__FUNC_GPIO45 (MTK_PIN_NO(45) | 0)
+#define PINMUX_GPIO45__FUNC_LCM_RST (MTK_PIN_NO(45) | 1)
+
+#define PINMUX_GPIO46__FUNC_GPIO46 (MTK_PIN_NO(46) | 0)
+#define PINMUX_GPIO46__FUNC_MD_INT2_C2K_UIM1_HOT_PLUG (MTK_PIN_NO(46) | 1)
+#define PINMUX_GPIO46__FUNC_URXD1 (MTK_PIN_NO(46) | 2)
+#define PINMUX_GPIO46__FUNC_UCTS1 (MTK_PIN_NO(46) | 3)
+#define PINMUX_GPIO46__FUNC_CCU_UTXD_AO (MTK_PIN_NO(46) | 4)
+#define PINMUX_GPIO46__FUNC_TP_UCTS1_AO (MTK_PIN_NO(46) | 5)
+#define PINMUX_GPIO46__FUNC_IDDIG (MTK_PIN_NO(46) | 6)
+#define PINMUX_GPIO46__FUNC_I2S5_LRCK (MTK_PIN_NO(46) | 7)
+
+#define PINMUX_GPIO47__FUNC_GPIO47 (MTK_PIN_NO(47) | 0)
+#define PINMUX_GPIO47__FUNC_MD_INT1_C2K_UIM0_HOT_PLUG (MTK_PIN_NO(47) | 1)
+#define PINMUX_GPIO47__FUNC_UTXD1 (MTK_PIN_NO(47) | 2)
+#define PINMUX_GPIO47__FUNC_URTS1 (MTK_PIN_NO(47) | 3)
+#define PINMUX_GPIO47__FUNC_CCU_URXD_AO (MTK_PIN_NO(47) | 4)
+#define PINMUX_GPIO47__FUNC_TP_URTS1_AO (MTK_PIN_NO(47) | 5)
+#define PINMUX_GPIO47__FUNC_USB_DRVVBUS (MTK_PIN_NO(47) | 6)
+#define PINMUX_GPIO47__FUNC_I2S5_DO (MTK_PIN_NO(47) | 7)
+
+#define PINMUX_GPIO48__FUNC_GPIO48 (MTK_PIN_NO(48) | 0)
+#define PINMUX_GPIO48__FUNC_SCL5 (MTK_PIN_NO(48) | 1)
+
+#define PINMUX_GPIO49__FUNC_GPIO49 (MTK_PIN_NO(49) | 0)
+#define PINMUX_GPIO49__FUNC_SDA5 (MTK_PIN_NO(49) | 1)
+
+#define PINMUX_GPIO50__FUNC_GPIO50 (MTK_PIN_NO(50) | 0)
+#define PINMUX_GPIO50__FUNC_SCL3 (MTK_PIN_NO(50) | 1)
+
+#define PINMUX_GPIO51__FUNC_GPIO51 (MTK_PIN_NO(51) | 0)
+#define PINMUX_GPIO51__FUNC_SDA3 (MTK_PIN_NO(51) | 1)
+
+#define PINMUX_GPIO52__FUNC_GPIO52 (MTK_PIN_NO(52) | 0)
+#define PINMUX_GPIO52__FUNC_BPI_ANT2 (MTK_PIN_NO(52) | 1)
+
+#define PINMUX_GPIO53__FUNC_GPIO53 (MTK_PIN_NO(53) | 0)
+#define PINMUX_GPIO53__FUNC_BPI_ANT0 (MTK_PIN_NO(53) | 1)
+
+#define PINMUX_GPIO54__FUNC_GPIO54 (MTK_PIN_NO(54) | 0)
+#define PINMUX_GPIO54__FUNC_BPI_OLAT1 (MTK_PIN_NO(54) | 1)
+
+#define PINMUX_GPIO55__FUNC_GPIO55 (MTK_PIN_NO(55) | 0)
+#define PINMUX_GPIO55__FUNC_BPI_BUS8 (MTK_PIN_NO(55) | 1)
+
+#define PINMUX_GPIO56__FUNC_GPIO56 (MTK_PIN_NO(56) | 0)
+#define PINMUX_GPIO56__FUNC_BPI_BUS9 (MTK_PIN_NO(56) | 1)
+#define PINMUX_GPIO56__FUNC_SCL_6306 (MTK_PIN_NO(56) | 2)
+
+#define PINMUX_GPIO57__FUNC_GPIO57 (MTK_PIN_NO(57) | 0)
+#define PINMUX_GPIO57__FUNC_BPI_BUS10 (MTK_PIN_NO(57) | 1)
+#define PINMUX_GPIO57__FUNC_SDA_6306 (MTK_PIN_NO(57) | 2)
+
+#define PINMUX_GPIO58__FUNC_GPIO58 (MTK_PIN_NO(58) | 0)
+#define PINMUX_GPIO58__FUNC_RFIC0_BSI_D2 (MTK_PIN_NO(58) | 1)
+#define PINMUX_GPIO58__FUNC_SPM_BSI_D2 (MTK_PIN_NO(58) | 2)
+#define PINMUX_GPIO58__FUNC_PWM_B (MTK_PIN_NO(58) | 3)
+
+#define PINMUX_GPIO59__FUNC_GPIO59 (MTK_PIN_NO(59) | 0)
+#define PINMUX_GPIO59__FUNC_RFIC0_BSI_D1 (MTK_PIN_NO(59) | 1)
+#define PINMUX_GPIO59__FUNC_SPM_BSI_D1 (MTK_PIN_NO(59) | 2)
+
+#define PINMUX_GPIO60__FUNC_GPIO60 (MTK_PIN_NO(60) | 0)
+#define PINMUX_GPIO60__FUNC_RFIC0_BSI_D0 (MTK_PIN_NO(60) | 1)
+#define PINMUX_GPIO60__FUNC_SPM_BSI_D0 (MTK_PIN_NO(60) | 2)
+
+#define PINMUX_GPIO61__FUNC_GPIO61 (MTK_PIN_NO(61) | 0)
+#define PINMUX_GPIO61__FUNC_MIPI1_SDATA (MTK_PIN_NO(61) | 1)
+
+#define PINMUX_GPIO62__FUNC_GPIO62 (MTK_PIN_NO(62) | 0)
+#define PINMUX_GPIO62__FUNC_MIPI1_SCLK (MTK_PIN_NO(62) | 1)
+
+#define PINMUX_GPIO63__FUNC_GPIO63 (MTK_PIN_NO(63) | 0)
+#define PINMUX_GPIO63__FUNC_MIPI0_SDATA (MTK_PIN_NO(63) | 1)
+
+#define PINMUX_GPIO64__FUNC_GPIO64 (MTK_PIN_NO(64) | 0)
+#define PINMUX_GPIO64__FUNC_MIPI0_SCLK (MTK_PIN_NO(64) | 1)
+
+#define PINMUX_GPIO65__FUNC_GPIO65 (MTK_PIN_NO(65) | 0)
+#define PINMUX_GPIO65__FUNC_MIPI3_SDATA (MTK_PIN_NO(65) | 1)
+#define PINMUX_GPIO65__FUNC_BPI_OLAT2 (MTK_PIN_NO(65) | 2)
+
+#define PINMUX_GPIO66__FUNC_GPIO66 (MTK_PIN_NO(66) | 0)
+#define PINMUX_GPIO66__FUNC_MIPI3_SCLK (MTK_PIN_NO(66) | 1)
+#define PINMUX_GPIO66__FUNC_BPI_OLAT3 (MTK_PIN_NO(66) | 2)
+
+#define PINMUX_GPIO67__FUNC_GPIO67 (MTK_PIN_NO(67) | 0)
+#define PINMUX_GPIO67__FUNC_MIPI2_SDATA (MTK_PIN_NO(67) | 1)
+
+#define PINMUX_GPIO68__FUNC_GPIO68 (MTK_PIN_NO(68) | 0)
+#define PINMUX_GPIO68__FUNC_MIPI2_SCLK (MTK_PIN_NO(68) | 1)
+
+#define PINMUX_GPIO69__FUNC_GPIO69 (MTK_PIN_NO(69) | 0)
+#define PINMUX_GPIO69__FUNC_BPI_BUS7 (MTK_PIN_NO(69) | 1)
+
+#define PINMUX_GPIO70__FUNC_GPIO70 (MTK_PIN_NO(70) | 0)
+#define PINMUX_GPIO70__FUNC_BPI_BUS6 (MTK_PIN_NO(70) | 1)
+
+#define PINMUX_GPIO71__FUNC_GPIO71 (MTK_PIN_NO(71) | 0)
+#define PINMUX_GPIO71__FUNC_BPI_BUS5 (MTK_PIN_NO(71) | 1)
+
+#define PINMUX_GPIO72__FUNC_GPIO72 (MTK_PIN_NO(72) | 0)
+#define PINMUX_GPIO72__FUNC_BPI_BUS4 (MTK_PIN_NO(72) | 1)
+
+#define PINMUX_GPIO73__FUNC_GPIO73 (MTK_PIN_NO(73) | 0)
+#define PINMUX_GPIO73__FUNC_BPI_BUS3 (MTK_PIN_NO(73) | 1)
+
+#define PINMUX_GPIO74__FUNC_GPIO74 (MTK_PIN_NO(74) | 0)
+#define PINMUX_GPIO74__FUNC_BPI_BUS2 (MTK_PIN_NO(74) | 1)
+
+#define PINMUX_GPIO75__FUNC_GPIO75 (MTK_PIN_NO(75) | 0)
+#define PINMUX_GPIO75__FUNC_BPI_BUS1 (MTK_PIN_NO(75) | 1)
+
+#define PINMUX_GPIO76__FUNC_GPIO76 (MTK_PIN_NO(76) | 0)
+#define PINMUX_GPIO76__FUNC_BPI_BUS0 (MTK_PIN_NO(76) | 1)
+
+#define PINMUX_GPIO77__FUNC_GPIO77 (MTK_PIN_NO(77) | 0)
+#define PINMUX_GPIO77__FUNC_BPI_ANT1 (MTK_PIN_NO(77) | 1)
+
+#define PINMUX_GPIO78__FUNC_GPIO78 (MTK_PIN_NO(78) | 0)
+#define PINMUX_GPIO78__FUNC_BPI_OLAT0 (MTK_PIN_NO(78) | 1)
+
+#define PINMUX_GPIO79__FUNC_GPIO79 (MTK_PIN_NO(79) | 0)
+#define PINMUX_GPIO79__FUNC_BPI_PA_VM1 (MTK_PIN_NO(79) | 1)
+#define PINMUX_GPIO79__FUNC_MIPI4_SDATA (MTK_PIN_NO(79) | 2)
+
+#define PINMUX_GPIO80__FUNC_GPIO80 (MTK_PIN_NO(80) | 0)
+#define PINMUX_GPIO80__FUNC_BPI_PA_VM0 (MTK_PIN_NO(80) | 1)
+#define PINMUX_GPIO80__FUNC_MIPI4_SCLK (MTK_PIN_NO(80) | 2)
+
+#define PINMUX_GPIO81__FUNC_GPIO81 (MTK_PIN_NO(81) | 0)
+#define PINMUX_GPIO81__FUNC_SDA1 (MTK_PIN_NO(81) | 1)
+
+#define PINMUX_GPIO82__FUNC_GPIO82 (MTK_PIN_NO(82) | 0)
+#define PINMUX_GPIO82__FUNC_SDA0 (MTK_PIN_NO(82) | 1)
+
+#define PINMUX_GPIO83__FUNC_GPIO83 (MTK_PIN_NO(83) | 0)
+#define PINMUX_GPIO83__FUNC_SCL0 (MTK_PIN_NO(83) | 1)
+
+#define PINMUX_GPIO84__FUNC_GPIO84 (MTK_PIN_NO(84) | 0)
+#define PINMUX_GPIO84__FUNC_SCL1 (MTK_PIN_NO(84) | 1)
+
+#define PINMUX_GPIO85__FUNC_GPIO85 (MTK_PIN_NO(85) | 0)
+#define PINMUX_GPIO85__FUNC_SPI0_MI (MTK_PIN_NO(85) | 1)
+#define PINMUX_GPIO85__FUNC_SCP_SPI0_MI (MTK_PIN_NO(85) | 2)
+#define PINMUX_GPIO85__FUNC_CLKM3 (MTK_PIN_NO(85) | 3)
+#define PINMUX_GPIO85__FUNC_I2S1_BCK (MTK_PIN_NO(85) | 4)
+#define PINMUX_GPIO85__FUNC_MFG_DFD_JTAG_TDO (MTK_PIN_NO(85) | 5)
+#define PINMUX_GPIO85__FUNC_DFD_TDO (MTK_PIN_NO(85) | 6)
+#define PINMUX_GPIO85__FUNC_JTDO_SEL1 (MTK_PIN_NO(85) | 7)
+
+#define PINMUX_GPIO86__FUNC_GPIO86 (MTK_PIN_NO(86) | 0)
+#define PINMUX_GPIO86__FUNC_SPI0_CSB (MTK_PIN_NO(86) | 1)
+#define PINMUX_GPIO86__FUNC_SCP_SPI0_CS (MTK_PIN_NO(86) | 2)
+#define PINMUX_GPIO86__FUNC_CLKM0 (MTK_PIN_NO(86) | 3)
+#define PINMUX_GPIO86__FUNC_I2S1_LRCK (MTK_PIN_NO(86) | 4)
+#define PINMUX_GPIO86__FUNC_MFG_DFD_JTAG_TMS (MTK_PIN_NO(86) | 5)
+#define PINMUX_GPIO86__FUNC_DFD_TMS (MTK_PIN_NO(86) | 6)
+#define PINMUX_GPIO86__FUNC_JTMS_SEL1 (MTK_PIN_NO(86) | 7)
+
+#define PINMUX_GPIO87__FUNC_GPIO87 (MTK_PIN_NO(87) | 0)
+#define PINMUX_GPIO87__FUNC_SPI0_MO (MTK_PIN_NO(87) | 1)
+#define PINMUX_GPIO87__FUNC_SCP_SPI0_MO (MTK_PIN_NO(87) | 2)
+#define PINMUX_GPIO87__FUNC_SDA1 (MTK_PIN_NO(87) | 3)
+#define PINMUX_GPIO87__FUNC_I2S1_DO (MTK_PIN_NO(87) | 4)
+#define PINMUX_GPIO87__FUNC_MFG_DFD_JTAG_TDI (MTK_PIN_NO(87) | 5)
+#define PINMUX_GPIO87__FUNC_DFD_TDI (MTK_PIN_NO(87) | 6)
+#define PINMUX_GPIO87__FUNC_JTDI_SEL1 (MTK_PIN_NO(87) | 7)
+
+#define PINMUX_GPIO88__FUNC_GPIO88 (MTK_PIN_NO(88) | 0)
+#define PINMUX_GPIO88__FUNC_SPI0_CLK (MTK_PIN_NO(88) | 1)
+#define PINMUX_GPIO88__FUNC_SCP_SPI0_CK (MTK_PIN_NO(88) | 2)
+#define PINMUX_GPIO88__FUNC_SCL1 (MTK_PIN_NO(88) | 3)
+#define PINMUX_GPIO88__FUNC_I2S1_MCK (MTK_PIN_NO(88) | 4)
+#define PINMUX_GPIO88__FUNC_MFG_DFD_JTAG_TCK (MTK_PIN_NO(88) | 5)
+#define PINMUX_GPIO88__FUNC_DFD_TCK_XI (MTK_PIN_NO(88) | 6)
+#define PINMUX_GPIO88__FUNC_JTCK_SEL1 (MTK_PIN_NO(88) | 7)
+
+#define PINMUX_GPIO89__FUNC_GPIO89 (MTK_PIN_NO(89) | 0)
+#define PINMUX_GPIO89__FUNC_SRCLKENAI0 (MTK_PIN_NO(89) | 1)
+#define PINMUX_GPIO89__FUNC_PWM_C (MTK_PIN_NO(89) | 2)
+#define PINMUX_GPIO89__FUNC_I2S5_BCK (MTK_PIN_NO(89) | 3)
+#define PINMUX_GPIO89__FUNC_ANT_SEL6 (MTK_PIN_NO(89) | 4)
+#define PINMUX_GPIO89__FUNC_SDA8 (MTK_PIN_NO(89) | 5)
+#define PINMUX_GPIO89__FUNC_CMVREF0 (MTK_PIN_NO(89) | 6)
+#define PINMUX_GPIO89__FUNC_DBG_MON_A21 (MTK_PIN_NO(89) | 7)
+
+#define PINMUX_GPIO90__FUNC_GPIO90 (MTK_PIN_NO(90) | 0)
+#define PINMUX_GPIO90__FUNC_PWM_A (MTK_PIN_NO(90) | 1)
+#define PINMUX_GPIO90__FUNC_CMMCLK2 (MTK_PIN_NO(90) | 2)
+#define PINMUX_GPIO90__FUNC_I2S5_LRCK (MTK_PIN_NO(90) | 3)
+#define PINMUX_GPIO90__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(90) | 4)
+#define PINMUX_GPIO90__FUNC_SCL8 (MTK_PIN_NO(90) | 5)
+#define PINMUX_GPIO90__FUNC_PTA_RXD (MTK_PIN_NO(90) | 6)
+#define PINMUX_GPIO90__FUNC_DBG_MON_A22 (MTK_PIN_NO(90) | 7)
+
+#define PINMUX_GPIO91__FUNC_GPIO91 (MTK_PIN_NO(91) | 0)
+#define PINMUX_GPIO91__FUNC_KPROW1 (MTK_PIN_NO(91) | 1)
+#define PINMUX_GPIO91__FUNC_PWM_B (MTK_PIN_NO(91) | 2)
+#define PINMUX_GPIO91__FUNC_I2S5_DO (MTK_PIN_NO(91) | 3)
+#define PINMUX_GPIO91__FUNC_ANT_SEL7 (MTK_PIN_NO(91) | 4)
+#define PINMUX_GPIO91__FUNC_CMMCLK3 (MTK_PIN_NO(91) | 5)
+#define PINMUX_GPIO91__FUNC_PTA_TXD (MTK_PIN_NO(91) | 6)
+
+#define PINMUX_GPIO92__FUNC_GPIO92 (MTK_PIN_NO(92) | 0)
+#define PINMUX_GPIO92__FUNC_KPROW0 (MTK_PIN_NO(92) | 1)
+
+#define PINMUX_GPIO93__FUNC_GPIO93 (MTK_PIN_NO(93) | 0)
+#define PINMUX_GPIO93__FUNC_KPCOL0 (MTK_PIN_NO(93) | 1)
+#define PINMUX_GPIO93__FUNC_DBG_MON_B27 (MTK_PIN_NO(93) | 7)
+
+#define PINMUX_GPIO94__FUNC_GPIO94 (MTK_PIN_NO(94) | 0)
+#define PINMUX_GPIO94__FUNC_KPCOL1 (MTK_PIN_NO(94) | 1)
+#define PINMUX_GPIO94__FUNC_I2S2_DI2 (MTK_PIN_NO(94) | 2)
+#define PINMUX_GPIO94__FUNC_I2S5_MCK (MTK_PIN_NO(94) | 3)
+#define PINMUX_GPIO94__FUNC_CMMCLK2 (MTK_PIN_NO(94) | 4)
+#define PINMUX_GPIO94__FUNC_SCP_SPI2_MI (MTK_PIN_NO(94) | 5)
+#define PINMUX_GPIO94__FUNC_SRCLKENAI1 (MTK_PIN_NO(94) | 6)
+#define PINMUX_GPIO94__FUNC_SPI2_MI (MTK_PIN_NO(94) | 7)
+
+#define PINMUX_GPIO95__FUNC_GPIO95 (MTK_PIN_NO(95) | 0)
+#define PINMUX_GPIO95__FUNC_URXD0 (MTK_PIN_NO(95) | 1)
+#define PINMUX_GPIO95__FUNC_UTXD0 (MTK_PIN_NO(95) | 2)
+#define PINMUX_GPIO95__FUNC_MD_URXD0 (MTK_PIN_NO(95) | 3)
+#define PINMUX_GPIO95__FUNC_MD_URXD1 (MTK_PIN_NO(95) | 4)
+#define PINMUX_GPIO95__FUNC_SSPM_URXD_AO (MTK_PIN_NO(95) | 5)
+#define PINMUX_GPIO95__FUNC_CCU_URXD_AO (MTK_PIN_NO(95) | 6)
+
+#define PINMUX_GPIO96__FUNC_GPIO96 (MTK_PIN_NO(96) | 0)
+#define PINMUX_GPIO96__FUNC_UTXD0 (MTK_PIN_NO(96) | 1)
+#define PINMUX_GPIO96__FUNC_URXD0 (MTK_PIN_NO(96) | 2)
+#define PINMUX_GPIO96__FUNC_MD_UTXD0 (MTK_PIN_NO(96) | 3)
+#define PINMUX_GPIO96__FUNC_MD_UTXD1 (MTK_PIN_NO(96) | 4)
+#define PINMUX_GPIO96__FUNC_SSPM_UTXD_AO (MTK_PIN_NO(96) | 5)
+#define PINMUX_GPIO96__FUNC_CCU_UTXD_AO (MTK_PIN_NO(96) | 6)
+#define PINMUX_GPIO96__FUNC_DBG_MON_B2 (MTK_PIN_NO(96) | 7)
+
+#define PINMUX_GPIO97__FUNC_GPIO97 (MTK_PIN_NO(97) | 0)
+#define PINMUX_GPIO97__FUNC_UCTS0 (MTK_PIN_NO(97) | 1)
+#define PINMUX_GPIO97__FUNC_I2S2_MCK (MTK_PIN_NO(97) | 2)
+#define PINMUX_GPIO97__FUNC_IDDIG (MTK_PIN_NO(97) | 3)
+#define PINMUX_GPIO97__FUNC_CONN_MCU_TDO (MTK_PIN_NO(97) | 4)
+#define PINMUX_GPIO97__FUNC_SSPM_JTAG_TDO (MTK_PIN_NO(97) | 5)
+#define PINMUX_GPIO97__FUNC_IO_JTAG_TDO (MTK_PIN_NO(97) | 6)
+#define PINMUX_GPIO97__FUNC_DBG_MON_B3 (MTK_PIN_NO(97) | 7)
+
+#define PINMUX_GPIO98__FUNC_GPIO98 (MTK_PIN_NO(98) | 0)
+#define PINMUX_GPIO98__FUNC_URTS0 (MTK_PIN_NO(98) | 1)
+#define PINMUX_GPIO98__FUNC_I2S2_BCK (MTK_PIN_NO(98) | 2)
+#define PINMUX_GPIO98__FUNC_USB_DRVVBUS (MTK_PIN_NO(98) | 3)
+#define PINMUX_GPIO98__FUNC_CONN_MCU_TMS (MTK_PIN_NO(98) | 4)
+#define PINMUX_GPIO98__FUNC_SSPM_JTAG_TMS (MTK_PIN_NO(98) | 5)
+#define PINMUX_GPIO98__FUNC_IO_JTAG_TMS (MTK_PIN_NO(98) | 6)
+#define PINMUX_GPIO98__FUNC_DBG_MON_B4 (MTK_PIN_NO(98) | 7)
+
+#define PINMUX_GPIO99__FUNC_GPIO99 (MTK_PIN_NO(99) | 0)
+#define PINMUX_GPIO99__FUNC_CMMCLK0 (MTK_PIN_NO(99) | 1)
+#define PINMUX_GPIO99__FUNC_CONN_MCU_AICE_TMSC (MTK_PIN_NO(99) | 4)
+#define PINMUX_GPIO99__FUNC_DBG_MON_B28 (MTK_PIN_NO(99) | 7)
+
+#define PINMUX_GPIO100__FUNC_GPIO100 (MTK_PIN_NO(100) | 0)
+#define PINMUX_GPIO100__FUNC_CMMCLK1 (MTK_PIN_NO(100) | 1)
+#define PINMUX_GPIO100__FUNC_PWM_C (MTK_PIN_NO(100) | 2)
+#define PINMUX_GPIO100__FUNC_MD_INT1_C2K_UIM0_HOT_PLUG (MTK_PIN_NO(100) | 3)
+#define PINMUX_GPIO100__FUNC_CONN_MCU_AICE_TCKC (MTK_PIN_NO(100) | 4)
+#define PINMUX_GPIO100__FUNC_DBG_MON_B29 (MTK_PIN_NO(100) | 7)
+
+#define PINMUX_GPIO101__FUNC_GPIO101 (MTK_PIN_NO(101) | 0)
+#define PINMUX_GPIO101__FUNC_CLKM2 (MTK_PIN_NO(101) | 1)
+#define PINMUX_GPIO101__FUNC_I2S2_LRCK (MTK_PIN_NO(101) | 2)
+#define PINMUX_GPIO101__FUNC_CMVREF1 (MTK_PIN_NO(101) | 3)
+#define PINMUX_GPIO101__FUNC_CONN_MCU_TCK (MTK_PIN_NO(101) | 4)
+#define PINMUX_GPIO101__FUNC_SSPM_JTAG_TCK (MTK_PIN_NO(101) | 5)
+#define PINMUX_GPIO101__FUNC_IO_JTAG_TCK (MTK_PIN_NO(101) | 6)
+
+#define PINMUX_GPIO102__FUNC_GPIO102 (MTK_PIN_NO(102) | 0)
+#define PINMUX_GPIO102__FUNC_CLKM1 (MTK_PIN_NO(102) | 1)
+#define PINMUX_GPIO102__FUNC_I2S2_DI (MTK_PIN_NO(102) | 2)
+#define PINMUX_GPIO102__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(102) | 3)
+#define PINMUX_GPIO102__FUNC_CONN_MCU_TDI (MTK_PIN_NO(102) | 4)
+#define PINMUX_GPIO102__FUNC_SSPM_JTAG_TDI (MTK_PIN_NO(102) | 5)
+#define PINMUX_GPIO102__FUNC_IO_JTAG_TDI (MTK_PIN_NO(102) | 6)
+#define PINMUX_GPIO102__FUNC_DBG_MON_B8 (MTK_PIN_NO(102) | 7)
+
+#define PINMUX_GPIO103__FUNC_GPIO103 (MTK_PIN_NO(103) | 0)
+#define PINMUX_GPIO103__FUNC_SCL2 (MTK_PIN_NO(103) | 1)
+
+#define PINMUX_GPIO104__FUNC_GPIO104 (MTK_PIN_NO(104) | 0)
+#define PINMUX_GPIO104__FUNC_SDA2 (MTK_PIN_NO(104) | 1)
+
+#define PINMUX_GPIO105__FUNC_GPIO105 (MTK_PIN_NO(105) | 0)
+#define PINMUX_GPIO105__FUNC_SCL4 (MTK_PIN_NO(105) | 1)
+
+#define PINMUX_GPIO106__FUNC_GPIO106 (MTK_PIN_NO(106) | 0)
+#define PINMUX_GPIO106__FUNC_SDA4 (MTK_PIN_NO(106) | 1)
+
+#define PINMUX_GPIO107__FUNC_GPIO107 (MTK_PIN_NO(107) | 0)
+#define PINMUX_GPIO107__FUNC_DMIC_CLK (MTK_PIN_NO(107) | 1)
+#define PINMUX_GPIO107__FUNC_ANT_SEL0 (MTK_PIN_NO(107) | 2)
+#define PINMUX_GPIO107__FUNC_CLKM0 (MTK_PIN_NO(107) | 3)
+#define PINMUX_GPIO107__FUNC_SDA7 (MTK_PIN_NO(107) | 4)
+#define PINMUX_GPIO107__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(107) | 5)
+#define PINMUX_GPIO107__FUNC_PWM_A (MTK_PIN_NO(107) | 6)
+#define PINMUX_GPIO107__FUNC_DBG_MON_B12 (MTK_PIN_NO(107) | 7)
+
+#define PINMUX_GPIO108__FUNC_GPIO108 (MTK_PIN_NO(108) | 0)
+#define PINMUX_GPIO108__FUNC_CMMCLK2 (MTK_PIN_NO(108) | 1)
+#define PINMUX_GPIO108__FUNC_ANT_SEL1 (MTK_PIN_NO(108) | 2)
+#define PINMUX_GPIO108__FUNC_CLKM1 (MTK_PIN_NO(108) | 3)
+#define PINMUX_GPIO108__FUNC_SCL8 (MTK_PIN_NO(108) | 4)
+#define PINMUX_GPIO108__FUNC_DAP_MD32_SWD (MTK_PIN_NO(108) | 5)
+#define PINMUX_GPIO108__FUNC_PWM_B (MTK_PIN_NO(108) | 6)
+#define PINMUX_GPIO108__FUNC_DBG_MON_B13 (MTK_PIN_NO(108) | 7)
+
+#define PINMUX_GPIO109__FUNC_GPIO109 (MTK_PIN_NO(109) | 0)
+#define PINMUX_GPIO109__FUNC_DMIC_DAT (MTK_PIN_NO(109) | 1)
+#define PINMUX_GPIO109__FUNC_ANT_SEL2 (MTK_PIN_NO(109) | 2)
+#define PINMUX_GPIO109__FUNC_CLKM2 (MTK_PIN_NO(109) | 3)
+#define PINMUX_GPIO109__FUNC_SDA8 (MTK_PIN_NO(109) | 4)
+#define PINMUX_GPIO109__FUNC_DAP_MD32_SWCK (MTK_PIN_NO(109) | 5)
+#define PINMUX_GPIO109__FUNC_PWM_C (MTK_PIN_NO(109) | 6)
+#define PINMUX_GPIO109__FUNC_DBG_MON_B14 (MTK_PIN_NO(109) | 7)
+
+#define PINMUX_GPIO110__FUNC_GPIO110 (MTK_PIN_NO(110) | 0)
+#define PINMUX_GPIO110__FUNC_SCL7 (MTK_PIN_NO(110) | 1)
+#define PINMUX_GPIO110__FUNC_ANT_SEL0 (MTK_PIN_NO(110) | 2)
+#define PINMUX_GPIO110__FUNC_TP_URXD1_AO (MTK_PIN_NO(110) | 3)
+#define PINMUX_GPIO110__FUNC_USB_DRVVBUS (MTK_PIN_NO(110) | 4)
+#define PINMUX_GPIO110__FUNC_SRCLKENAI1 (MTK_PIN_NO(110) | 5)
+#define PINMUX_GPIO110__FUNC_KPCOL2 (MTK_PIN_NO(110) | 6)
+#define PINMUX_GPIO110__FUNC_URXD1 (MTK_PIN_NO(110) | 7)
+
+#define PINMUX_GPIO111__FUNC_GPIO111 (MTK_PIN_NO(111) | 0)
+#define PINMUX_GPIO111__FUNC_CMMCLK3 (MTK_PIN_NO(111) | 1)
+#define PINMUX_GPIO111__FUNC_ANT_SEL1 (MTK_PIN_NO(111) | 2)
+#define PINMUX_GPIO111__FUNC_SRCLKENAI0 (MTK_PIN_NO(111) | 3)
+#define PINMUX_GPIO111__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(111) | 4)
+#define PINMUX_GPIO111__FUNC_MD_INT2_C2K_UIM1_HOT_PLUG (MTK_PIN_NO(111) | 5)
+#define PINMUX_GPIO111__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(111) | 7)
+
+#define PINMUX_GPIO112__FUNC_GPIO112 (MTK_PIN_NO(112) | 0)
+#define PINMUX_GPIO112__FUNC_SDA7 (MTK_PIN_NO(112) | 1)
+#define PINMUX_GPIO112__FUNC_ANT_SEL2 (MTK_PIN_NO(112) | 2)
+#define PINMUX_GPIO112__FUNC_TP_UTXD1_AO (MTK_PIN_NO(112) | 3)
+#define PINMUX_GPIO112__FUNC_IDDIG (MTK_PIN_NO(112) | 4)
+#define PINMUX_GPIO112__FUNC_AGPS_SYNC (MTK_PIN_NO(112) | 5)
+#define PINMUX_GPIO112__FUNC_KPROW2 (MTK_PIN_NO(112) | 6)
+#define PINMUX_GPIO112__FUNC_UTXD1 (MTK_PIN_NO(112) | 7)
+
+#define PINMUX_GPIO113__FUNC_GPIO113 (MTK_PIN_NO(113) | 0)
+#define PINMUX_GPIO113__FUNC_CONN_TOP_CLK (MTK_PIN_NO(113) | 1)
+#define PINMUX_GPIO113__FUNC_SCL6 (MTK_PIN_NO(113) | 3)
+#define PINMUX_GPIO113__FUNC_AUXIF_CLK0 (MTK_PIN_NO(113) | 4)
+#define PINMUX_GPIO113__FUNC_TP_UCTS1_AO (MTK_PIN_NO(113) | 6)
+
+#define PINMUX_GPIO114__FUNC_GPIO114 (MTK_PIN_NO(114) | 0)
+#define PINMUX_GPIO114__FUNC_CONN_TOP_DATA (MTK_PIN_NO(114) | 1)
+#define PINMUX_GPIO114__FUNC_SDA6 (MTK_PIN_NO(114) | 3)
+#define PINMUX_GPIO114__FUNC_AUXIF_ST0 (MTK_PIN_NO(114) | 4)
+#define PINMUX_GPIO114__FUNC_TP_URTS1_AO (MTK_PIN_NO(114) | 6)
+
+#define PINMUX_GPIO115__FUNC_GPIO115 (MTK_PIN_NO(115) | 0)
+#define PINMUX_GPIO115__FUNC_CONN_BT_CLK (MTK_PIN_NO(115) | 1)
+#define PINMUX_GPIO115__FUNC_UTXD1 (MTK_PIN_NO(115) | 2)
+#define PINMUX_GPIO115__FUNC_PTA_TXD (MTK_PIN_NO(115) | 3)
+#define PINMUX_GPIO115__FUNC_AUXIF_CLK1 (MTK_PIN_NO(115) | 4)
+#define PINMUX_GPIO115__FUNC_DAP_MD32_SWD (MTK_PIN_NO(115) | 5)
+#define PINMUX_GPIO115__FUNC_TP_UTXD1_AO (MTK_PIN_NO(115) | 6)
+
+#define PINMUX_GPIO116__FUNC_GPIO116 (MTK_PIN_NO(116) | 0)
+#define PINMUX_GPIO116__FUNC_CONN_BT_DATA (MTK_PIN_NO(116) | 1)
+#define PINMUX_GPIO116__FUNC_IPU_JTAG_TRST (MTK_PIN_NO(116) | 2)
+#define PINMUX_GPIO116__FUNC_AUXIF_ST1 (MTK_PIN_NO(116) | 4)
+#define PINMUX_GPIO116__FUNC_DAP_MD32_SWCK (MTK_PIN_NO(116) | 5)
+#define PINMUX_GPIO116__FUNC_TP_URXD2_AO (MTK_PIN_NO(116) | 6)
+#define PINMUX_GPIO116__FUNC_DBG_MON_A0 (MTK_PIN_NO(116) | 7)
+
+#define PINMUX_GPIO117__FUNC_GPIO117 (MTK_PIN_NO(117) | 0)
+#define PINMUX_GPIO117__FUNC_CONN_WF_HB0 (MTK_PIN_NO(117) | 1)
+#define PINMUX_GPIO117__FUNC_IPU_JTAG_TDO (MTK_PIN_NO(117) | 2)
+#define PINMUX_GPIO117__FUNC_TP_UTXD2_AO (MTK_PIN_NO(117) | 6)
+#define PINMUX_GPIO117__FUNC_DBG_MON_A4 (MTK_PIN_NO(117) | 7)
+
+#define PINMUX_GPIO118__FUNC_GPIO118 (MTK_PIN_NO(118) | 0)
+#define PINMUX_GPIO118__FUNC_CONN_WF_HB1 (MTK_PIN_NO(118) | 1)
+#define PINMUX_GPIO118__FUNC_IPU_JTAG_TDI (MTK_PIN_NO(118) | 2)
+#define PINMUX_GPIO118__FUNC_SSPM_URXD_AO (MTK_PIN_NO(118) | 5)
+#define PINMUX_GPIO118__FUNC_TP_UCTS2_AO (MTK_PIN_NO(118) | 6)
+#define PINMUX_GPIO118__FUNC_DBG_MON_A5 (MTK_PIN_NO(118) | 7)
+
+#define PINMUX_GPIO119__FUNC_GPIO119 (MTK_PIN_NO(119) | 0)
+#define PINMUX_GPIO119__FUNC_CONN_WF_HB2 (MTK_PIN_NO(119) | 1)
+#define PINMUX_GPIO119__FUNC_IPU_JTAG_TCK (MTK_PIN_NO(119) | 2)
+#define PINMUX_GPIO119__FUNC_SSPM_UTXD_AO (MTK_PIN_NO(119) | 5)
+#define PINMUX_GPIO119__FUNC_TP_URTS2_AO (MTK_PIN_NO(119) | 6)
+
+#define PINMUX_GPIO120__FUNC_GPIO120 (MTK_PIN_NO(120) | 0)
+#define PINMUX_GPIO120__FUNC_CONN_WB_PTA (MTK_PIN_NO(120) | 1)
+#define PINMUX_GPIO120__FUNC_IPU_JTAG_TMS (MTK_PIN_NO(120) | 2)
+#define PINMUX_GPIO120__FUNC_CCU_URXD_AO (MTK_PIN_NO(120) | 5)
+
+#define PINMUX_GPIO121__FUNC_GPIO121 (MTK_PIN_NO(121) | 0)
+#define PINMUX_GPIO121__FUNC_CONN_HRST_B (MTK_PIN_NO(121) | 1)
+#define PINMUX_GPIO121__FUNC_URXD1 (MTK_PIN_NO(121) | 2)
+#define PINMUX_GPIO121__FUNC_PTA_RXD (MTK_PIN_NO(121) | 3)
+#define PINMUX_GPIO121__FUNC_CCU_UTXD_AO (MTK_PIN_NO(121) | 5)
+#define PINMUX_GPIO121__FUNC_TP_URXD1_AO (MTK_PIN_NO(121) | 6)
+
+#define PINMUX_GPIO122__FUNC_GPIO122 (MTK_PIN_NO(122) | 0)
+#define PINMUX_GPIO122__FUNC_MSDC0_CMD (MTK_PIN_NO(122) | 1)
+#define PINMUX_GPIO122__FUNC_SSPM_URXD2_AO (MTK_PIN_NO(122) | 2)
+#define PINMUX_GPIO122__FUNC_ANT_SEL1 (MTK_PIN_NO(122) | 3)
+#define PINMUX_GPIO122__FUNC_DBG_MON_A12 (MTK_PIN_NO(122) | 7)
+
+#define PINMUX_GPIO123__FUNC_GPIO123 (MTK_PIN_NO(123) | 0)
+#define PINMUX_GPIO123__FUNC_MSDC0_DAT0 (MTK_PIN_NO(123) | 1)
+#define PINMUX_GPIO123__FUNC_ANT_SEL0 (MTK_PIN_NO(123) | 3)
+#define PINMUX_GPIO123__FUNC_DBG_MON_A13 (MTK_PIN_NO(123) | 7)
+
+#define PINMUX_GPIO124__FUNC_GPIO124 (MTK_PIN_NO(124) | 0)
+#define PINMUX_GPIO124__FUNC_MSDC0_CLK (MTK_PIN_NO(124) | 1)
+#define PINMUX_GPIO124__FUNC_DBG_MON_A14 (MTK_PIN_NO(124) | 7)
+
+#define PINMUX_GPIO125__FUNC_GPIO125 (MTK_PIN_NO(125) | 0)
+#define PINMUX_GPIO125__FUNC_MSDC0_DAT2 (MTK_PIN_NO(125) | 1)
+#define PINMUX_GPIO125__FUNC_MRG_CLK (MTK_PIN_NO(125) | 3)
+#define PINMUX_GPIO125__FUNC_DBG_MON_A15 (MTK_PIN_NO(125) | 7)
+
+#define PINMUX_GPIO126__FUNC_GPIO126 (MTK_PIN_NO(126) | 0)
+#define PINMUX_GPIO126__FUNC_MSDC0_DAT4 (MTK_PIN_NO(126) | 1)
+#define PINMUX_GPIO126__FUNC_ANT_SEL5 (MTK_PIN_NO(126) | 3)
+#define PINMUX_GPIO126__FUNC_UFS_MPHY_SCL (MTK_PIN_NO(126) | 6)
+#define PINMUX_GPIO126__FUNC_DBG_MON_A16 (MTK_PIN_NO(126) | 7)
+
+#define PINMUX_GPIO127__FUNC_GPIO127 (MTK_PIN_NO(127) | 0)
+#define PINMUX_GPIO127__FUNC_MSDC0_DAT6 (MTK_PIN_NO(127) | 1)
+#define PINMUX_GPIO127__FUNC_ANT_SEL4 (MTK_PIN_NO(127) | 3)
+#define PINMUX_GPIO127__FUNC_UFS_MPHY_SDA (MTK_PIN_NO(127) | 6)
+#define PINMUX_GPIO127__FUNC_DBG_MON_A17 (MTK_PIN_NO(127) | 7)
+
+#define PINMUX_GPIO128__FUNC_GPIO128 (MTK_PIN_NO(128) | 0)
+#define PINMUX_GPIO128__FUNC_MSDC0_DAT1 (MTK_PIN_NO(128) | 1)
+#define PINMUX_GPIO128__FUNC_ANT_SEL2 (MTK_PIN_NO(128) | 3)
+#define PINMUX_GPIO128__FUNC_UFS_UNIPRO_SDA (MTK_PIN_NO(128) | 6)
+#define PINMUX_GPIO128__FUNC_DBG_MON_A18 (MTK_PIN_NO(128) | 7)
+
+#define PINMUX_GPIO129__FUNC_GPIO129 (MTK_PIN_NO(129) | 0)
+#define PINMUX_GPIO129__FUNC_MSDC0_DAT5 (MTK_PIN_NO(129) | 1)
+#define PINMUX_GPIO129__FUNC_ANT_SEL3 (MTK_PIN_NO(129) | 3)
+#define PINMUX_GPIO129__FUNC_UFS_UNIPRO_SCL (MTK_PIN_NO(129) | 6)
+#define PINMUX_GPIO129__FUNC_DBG_MON_A23 (MTK_PIN_NO(129) | 7)
+
+#define PINMUX_GPIO130__FUNC_GPIO130 (MTK_PIN_NO(130) | 0)
+#define PINMUX_GPIO130__FUNC_MSDC0_DAT7 (MTK_PIN_NO(130) | 1)
+#define PINMUX_GPIO130__FUNC_MRG_DO (MTK_PIN_NO(130) | 3)
+#define PINMUX_GPIO130__FUNC_DBG_MON_A24 (MTK_PIN_NO(130) | 7)
+
+#define PINMUX_GPIO131__FUNC_GPIO131 (MTK_PIN_NO(131) | 0)
+#define PINMUX_GPIO131__FUNC_MSDC0_DSL (MTK_PIN_NO(131) | 1)
+#define PINMUX_GPIO131__FUNC_MRG_SYNC (MTK_PIN_NO(131) | 3)
+#define PINMUX_GPIO131__FUNC_DBG_MON_A25 (MTK_PIN_NO(131) | 7)
+
+#define PINMUX_GPIO132__FUNC_GPIO132 (MTK_PIN_NO(132) | 0)
+#define PINMUX_GPIO132__FUNC_MSDC0_DAT3 (MTK_PIN_NO(132) | 1)
+#define PINMUX_GPIO132__FUNC_MRG_DI (MTK_PIN_NO(132) | 3)
+#define PINMUX_GPIO132__FUNC_DBG_MON_A26 (MTK_PIN_NO(132) | 7)
+
+#define PINMUX_GPIO133__FUNC_GPIO133 (MTK_PIN_NO(133) | 0)
+#define PINMUX_GPIO133__FUNC_MSDC0_RSTB (MTK_PIN_NO(133) | 1)
+#define PINMUX_GPIO133__FUNC_AGPS_SYNC (MTK_PIN_NO(133) | 3)
+#define PINMUX_GPIO133__FUNC_DBG_MON_A27 (MTK_PIN_NO(133) | 7)
+
+#define PINMUX_GPIO134__FUNC_GPIO134 (MTK_PIN_NO(134) | 0)
+#define PINMUX_GPIO134__FUNC_RTC32K_CK (MTK_PIN_NO(134) | 1)
+
+#define PINMUX_GPIO135__FUNC_GPIO135 (MTK_PIN_NO(135) | 0)
+#define PINMUX_GPIO135__FUNC_WATCHDOG (MTK_PIN_NO(135) | 1)
+
+#define PINMUX_GPIO136__FUNC_GPIO136 (MTK_PIN_NO(136) | 0)
+#define PINMUX_GPIO136__FUNC_AUD_CLK_MOSI (MTK_PIN_NO(136) | 1)
+#define PINMUX_GPIO136__FUNC_AUD_CLK_MISO (MTK_PIN_NO(136) | 2)
+#define PINMUX_GPIO136__FUNC_I2S1_MCK (MTK_PIN_NO(136) | 3)
+#define PINMUX_GPIO136__FUNC_UFS_UNIPRO_SCL (MTK_PIN_NO(136) | 6)
+
+#define PINMUX_GPIO137__FUNC_GPIO137 (MTK_PIN_NO(137) | 0)
+#define PINMUX_GPIO137__FUNC_AUD_SYNC_MOSI (MTK_PIN_NO(137) | 1)
+#define PINMUX_GPIO137__FUNC_AUD_SYNC_MISO (MTK_PIN_NO(137) | 2)
+#define PINMUX_GPIO137__FUNC_I2S1_BCK (MTK_PIN_NO(137) | 3)
+
+#define PINMUX_GPIO138__FUNC_GPIO138 (MTK_PIN_NO(138) | 0)
+#define PINMUX_GPIO138__FUNC_AUD_DAT_MOSI0 (MTK_PIN_NO(138) | 1)
+#define PINMUX_GPIO138__FUNC_AUD_DAT_MISO0 (MTK_PIN_NO(138) | 2)
+#define PINMUX_GPIO138__FUNC_I2S1_LRCK (MTK_PIN_NO(138) | 3)
+#define PINMUX_GPIO138__FUNC_DBG_MON_B24 (MTK_PIN_NO(138) | 7)
+
+#define PINMUX_GPIO139__FUNC_GPIO139 (MTK_PIN_NO(139) | 0)
+#define PINMUX_GPIO139__FUNC_AUD_DAT_MOSI1 (MTK_PIN_NO(139) | 1)
+#define PINMUX_GPIO139__FUNC_AUD_DAT_MISO1 (MTK_PIN_NO(139) | 2)
+#define PINMUX_GPIO139__FUNC_I2S1_DO (MTK_PIN_NO(139) | 3)
+#define PINMUX_GPIO139__FUNC_UFS_MPHY_SDA (MTK_PIN_NO(139) | 6)
+
+#define PINMUX_GPIO140__FUNC_GPIO140 (MTK_PIN_NO(140) | 0)
+#define PINMUX_GPIO140__FUNC_AUD_CLK_MISO (MTK_PIN_NO(140) | 1)
+#define PINMUX_GPIO140__FUNC_AUD_CLK_MOSI (MTK_PIN_NO(140) | 2)
+#define PINMUX_GPIO140__FUNC_I2S0_MCK (MTK_PIN_NO(140) | 3)
+#define PINMUX_GPIO140__FUNC_UFS_UNIPRO_SDA (MTK_PIN_NO(140) | 6)
+
+#define PINMUX_GPIO141__FUNC_GPIO141 (MTK_PIN_NO(141) | 0)
+#define PINMUX_GPIO141__FUNC_AUD_SYNC_MISO (MTK_PIN_NO(141) | 1)
+#define PINMUX_GPIO141__FUNC_AUD_SYNC_MOSI (MTK_PIN_NO(141) | 2)
+#define PINMUX_GPIO141__FUNC_I2S0_BCK (MTK_PIN_NO(141) | 3)
+
+#define PINMUX_GPIO142__FUNC_GPIO142 (MTK_PIN_NO(142) | 0)
+#define PINMUX_GPIO142__FUNC_AUD_DAT_MISO0 (MTK_PIN_NO(142) | 1)
+#define PINMUX_GPIO142__FUNC_AUD_DAT_MOSI0 (MTK_PIN_NO(142) | 2)
+#define PINMUX_GPIO142__FUNC_I2S0_LRCK (MTK_PIN_NO(142) | 3)
+#define PINMUX_GPIO142__FUNC_VOW_DAT_MISO (MTK_PIN_NO(142) | 4)
+#define PINMUX_GPIO142__FUNC_DBG_MON_B25 (MTK_PIN_NO(142) | 7)
+
+#define PINMUX_GPIO143__FUNC_GPIO143 (MTK_PIN_NO(143) | 0)
+#define PINMUX_GPIO143__FUNC_AUD_DAT_MISO1 (MTK_PIN_NO(143) | 1)
+#define PINMUX_GPIO143__FUNC_AUD_DAT_MOSI1 (MTK_PIN_NO(143) | 2)
+#define PINMUX_GPIO143__FUNC_I2S0_DI (MTK_PIN_NO(143) | 3)
+#define PINMUX_GPIO143__FUNC_VOW_CLK_MISO (MTK_PIN_NO(143) | 4)
+#define PINMUX_GPIO143__FUNC_UFS_MPHY_SCL (MTK_PIN_NO(143) | 6)
+#define PINMUX_GPIO143__FUNC_DBG_MON_B26 (MTK_PIN_NO(143) | 7)
+
+#define PINMUX_GPIO144__FUNC_GPIO144 (MTK_PIN_NO(144) | 0)
+#define PINMUX_GPIO144__FUNC_PWRAP_SPI0_MI (MTK_PIN_NO(144) | 1)
+#define PINMUX_GPIO144__FUNC_PWRAP_SPI0_MO (MTK_PIN_NO(144) | 2)
+
+#define PINMUX_GPIO145__FUNC_GPIO145 (MTK_PIN_NO(145) | 0)
+#define PINMUX_GPIO145__FUNC_PWRAP_SPI0_CSN (MTK_PIN_NO(145) | 1)
+
+#define PINMUX_GPIO146__FUNC_GPIO146 (MTK_PIN_NO(146) | 0)
+#define PINMUX_GPIO146__FUNC_PWRAP_SPI0_MO (MTK_PIN_NO(146) | 1)
+#define PINMUX_GPIO146__FUNC_PWRAP_SPI0_MI (MTK_PIN_NO(146) | 2)
+
+#define PINMUX_GPIO147__FUNC_GPIO147 (MTK_PIN_NO(147) | 0)
+#define PINMUX_GPIO147__FUNC_PWRAP_SPI0_CK (MTK_PIN_NO(147) | 1)
+
+#define PINMUX_GPIO148__FUNC_GPIO148 (MTK_PIN_NO(148) | 0)
+#define PINMUX_GPIO148__FUNC_SRCLKENA0 (MTK_PIN_NO(148) | 1)
+
+#define PINMUX_GPIO149__FUNC_GPIO149 (MTK_PIN_NO(149) | 0)
+#define PINMUX_GPIO149__FUNC_SRCLKENA1 (MTK_PIN_NO(149) | 1)
+
+#define PINMUX_GPIO150__FUNC_GPIO150 (MTK_PIN_NO(150) | 0)
+#define PINMUX_GPIO150__FUNC_PWM_A (MTK_PIN_NO(150) | 1)
+#define PINMUX_GPIO150__FUNC_CMFLASH (MTK_PIN_NO(150) | 2)
+#define PINMUX_GPIO150__FUNC_CLKM0 (MTK_PIN_NO(150) | 3)
+#define PINMUX_GPIO150__FUNC_DBG_MON_B30 (MTK_PIN_NO(150) | 7)
+
+#define PINMUX_GPIO151__FUNC_GPIO151 (MTK_PIN_NO(151) | 0)
+#define PINMUX_GPIO151__FUNC_PWM_B (MTK_PIN_NO(151) | 1)
+#define PINMUX_GPIO151__FUNC_CMVREF0 (MTK_PIN_NO(151) | 2)
+#define PINMUX_GPIO151__FUNC_CLKM1 (MTK_PIN_NO(151) | 3)
+#define PINMUX_GPIO151__FUNC_DBG_MON_B20 (MTK_PIN_NO(151) | 7)
+
+#define PINMUX_GPIO152__FUNC_GPIO152 (MTK_PIN_NO(152) | 0)
+#define PINMUX_GPIO152__FUNC_PWM_C (MTK_PIN_NO(152) | 1)
+#define PINMUX_GPIO152__FUNC_CMFLASH (MTK_PIN_NO(152) | 2)
+#define PINMUX_GPIO152__FUNC_CLKM2 (MTK_PIN_NO(152) | 3)
+#define PINMUX_GPIO152__FUNC_DBG_MON_B21 (MTK_PIN_NO(152) | 7)
+
+#define PINMUX_GPIO153__FUNC_GPIO153 (MTK_PIN_NO(153) | 0)
+#define PINMUX_GPIO153__FUNC_PWM_A (MTK_PIN_NO(153) | 1)
+#define PINMUX_GPIO153__FUNC_CMVREF0 (MTK_PIN_NO(153) | 2)
+#define PINMUX_GPIO153__FUNC_CLKM3 (MTK_PIN_NO(153) | 3)
+#define PINMUX_GPIO153__FUNC_DBG_MON_B22 (MTK_PIN_NO(153) | 7)
+
+#define PINMUX_GPIO154__FUNC_GPIO154 (MTK_PIN_NO(154) | 0)
+#define PINMUX_GPIO154__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(154) | 1)
+#define PINMUX_GPIO154__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(154) | 2)
+#define PINMUX_GPIO154__FUNC_DBG_MON_B18 (MTK_PIN_NO(154) | 7)
+
+#define PINMUX_GPIO155__FUNC_GPIO155 (MTK_PIN_NO(155) | 0)
+#define PINMUX_GPIO155__FUNC_ANT_SEL0 (MTK_PIN_NO(155) | 1)
+#define PINMUX_GPIO155__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(155) | 2)
+#define PINMUX_GPIO155__FUNC_CMVREF1 (MTK_PIN_NO(155) | 3)
+#define PINMUX_GPIO155__FUNC_SCP_JTAG_TDI (MTK_PIN_NO(155) | 7)
+
+#define PINMUX_GPIO156__FUNC_GPIO156 (MTK_PIN_NO(156) | 0)
+#define PINMUX_GPIO156__FUNC_ANT_SEL1 (MTK_PIN_NO(156) | 1)
+#define PINMUX_GPIO156__FUNC_SRCLKENAI0 (MTK_PIN_NO(156) | 2)
+#define PINMUX_GPIO156__FUNC_SCL6 (MTK_PIN_NO(156) | 3)
+#define PINMUX_GPIO156__FUNC_KPCOL2 (MTK_PIN_NO(156) | 4)
+#define PINMUX_GPIO156__FUNC_IDDIG (MTK_PIN_NO(156) | 5)
+#define PINMUX_GPIO156__FUNC_SCP_JTAG_TCK (MTK_PIN_NO(156) | 7)
+
+#define PINMUX_GPIO157__FUNC_GPIO157 (MTK_PIN_NO(157) | 0)
+#define PINMUX_GPIO157__FUNC_ANT_SEL2 (MTK_PIN_NO(157) | 1)
+#define PINMUX_GPIO157__FUNC_SRCLKENAI1 (MTK_PIN_NO(157) | 2)
+#define PINMUX_GPIO157__FUNC_SDA6 (MTK_PIN_NO(157) | 3)
+#define PINMUX_GPIO157__FUNC_KPROW2 (MTK_PIN_NO(157) | 4)
+#define PINMUX_GPIO157__FUNC_USB_DRVVBUS (MTK_PIN_NO(157) | 5)
+#define PINMUX_GPIO157__FUNC_SCP_JTAG_TRSTN (MTK_PIN_NO(157) | 7)
+
+#define PINMUX_GPIO158__FUNC_GPIO158 (MTK_PIN_NO(158) | 0)
+#define PINMUX_GPIO158__FUNC_ANT_SEL3 (MTK_PIN_NO(158) | 1)
+
+#define PINMUX_GPIO159__FUNC_GPIO159 (MTK_PIN_NO(159) | 0)
+#define PINMUX_GPIO159__FUNC_ANT_SEL4 (MTK_PIN_NO(159) | 1)
+
+#define PINMUX_GPIO160__FUNC_GPIO160 (MTK_PIN_NO(160) | 0)
+#define PINMUX_GPIO160__FUNC_ANT_SEL5 (MTK_PIN_NO(160) | 1)
+
+#define PINMUX_GPIO161__FUNC_GPIO161 (MTK_PIN_NO(161) | 0)
+#define PINMUX_GPIO161__FUNC_SPI1_A_MI (MTK_PIN_NO(161) | 1)
+#define PINMUX_GPIO161__FUNC_SCP_SPI1_MI (MTK_PIN_NO(161) | 2)
+#define PINMUX_GPIO161__FUNC_IDDIG (MTK_PIN_NO(161) | 3)
+#define PINMUX_GPIO161__FUNC_ANT_SEL6 (MTK_PIN_NO(161) | 4)
+#define PINMUX_GPIO161__FUNC_KPCOL2 (MTK_PIN_NO(161) | 5)
+#define PINMUX_GPIO161__FUNC_PTA_RXD (MTK_PIN_NO(161) | 6)
+#define PINMUX_GPIO161__FUNC_DBG_MON_B19 (MTK_PIN_NO(161) | 7)
+
+#define PINMUX_GPIO162__FUNC_GPIO162 (MTK_PIN_NO(162) | 0)
+#define PINMUX_GPIO162__FUNC_SPI1_A_CSB (MTK_PIN_NO(162) | 1)
+#define PINMUX_GPIO162__FUNC_SCP_SPI1_CS (MTK_PIN_NO(162) | 2)
+#define PINMUX_GPIO162__FUNC_USB_DRVVBUS (MTK_PIN_NO(162) | 3)
+#define PINMUX_GPIO162__FUNC_ANT_SEL5 (MTK_PIN_NO(162) | 4)
+#define PINMUX_GPIO162__FUNC_KPROW2 (MTK_PIN_NO(162) | 5)
+#define PINMUX_GPIO162__FUNC_PTA_TXD (MTK_PIN_NO(162) | 6)
+
+#define PINMUX_GPIO163__FUNC_GPIO163 (MTK_PIN_NO(163) | 0)
+#define PINMUX_GPIO163__FUNC_SPI1_A_MO (MTK_PIN_NO(163) | 1)
+#define PINMUX_GPIO163__FUNC_SCP_SPI1_MO (MTK_PIN_NO(163) | 2)
+#define PINMUX_GPIO163__FUNC_SDA1 (MTK_PIN_NO(163) | 3)
+#define PINMUX_GPIO163__FUNC_ANT_SEL4 (MTK_PIN_NO(163) | 4)
+#define PINMUX_GPIO163__FUNC_CMMCLK2 (MTK_PIN_NO(163) | 5)
+#define PINMUX_GPIO163__FUNC_DMIC_CLK (MTK_PIN_NO(163) | 6)
+
+#define PINMUX_GPIO164__FUNC_GPIO164 (MTK_PIN_NO(164) | 0)
+#define PINMUX_GPIO164__FUNC_SPI1_A_CLK (MTK_PIN_NO(164) | 1)
+#define PINMUX_GPIO164__FUNC_SCP_SPI1_CK (MTK_PIN_NO(164) | 2)
+#define PINMUX_GPIO164__FUNC_SCL1 (MTK_PIN_NO(164) | 3)
+#define PINMUX_GPIO164__FUNC_ANT_SEL3 (MTK_PIN_NO(164) | 4)
+#define PINMUX_GPIO164__FUNC_CMMCLK3 (MTK_PIN_NO(164) | 5)
+#define PINMUX_GPIO164__FUNC_DMIC_DAT (MTK_PIN_NO(164) | 6)
+
+#define PINMUX_GPIO165__FUNC_GPIO165 (MTK_PIN_NO(165) | 0)
+#define PINMUX_GPIO165__FUNC_PWM_B (MTK_PIN_NO(165) | 1)
+#define PINMUX_GPIO165__FUNC_CMMCLK2 (MTK_PIN_NO(165) | 2)
+#define PINMUX_GPIO165__FUNC_SCP_VREQ_VAO (MTK_PIN_NO(165) | 3)
+#define PINMUX_GPIO165__FUNC_TDM_MCK_2ND (MTK_PIN_NO(165) | 6)
+#define PINMUX_GPIO165__FUNC_SCP_JTAG_TDO (MTK_PIN_NO(165) | 7)
+
+#define PINMUX_GPIO166__FUNC_GPIO166 (MTK_PIN_NO(166) | 0)
+#define PINMUX_GPIO166__FUNC_ANT_SEL6 (MTK_PIN_NO(166) | 1)
+
+#define PINMUX_GPIO167__FUNC_GPIO167 (MTK_PIN_NO(167) | 0)
+#define PINMUX_GPIO167__FUNC_RFIC0_BSI_EN (MTK_PIN_NO(167) | 1)
+#define PINMUX_GPIO167__FUNC_SPM_BSI_EN (MTK_PIN_NO(167) | 2)
+
+#define PINMUX_GPIO168__FUNC_GPIO168 (MTK_PIN_NO(168) | 0)
+#define PINMUX_GPIO168__FUNC_RFIC0_BSI_CK (MTK_PIN_NO(168) | 1)
+#define PINMUX_GPIO168__FUNC_SPM_BSI_CK (MTK_PIN_NO(168) | 2)
+
+#define PINMUX_GPIO169__FUNC_GPIO169 (MTK_PIN_NO(169) | 0)
+#define PINMUX_GPIO169__FUNC_PWM_C (MTK_PIN_NO(169) | 1)
+#define PINMUX_GPIO169__FUNC_CMMCLK3 (MTK_PIN_NO(169) | 2)
+#define PINMUX_GPIO169__FUNC_CMVREF1 (MTK_PIN_NO(169) | 3)
+#define PINMUX_GPIO169__FUNC_ANT_SEL7 (MTK_PIN_NO(169) | 4)
+#define PINMUX_GPIO169__FUNC_AGPS_SYNC (MTK_PIN_NO(169) | 5)
+#define PINMUX_GPIO169__FUNC_TDM_BCK_2ND (MTK_PIN_NO(169) | 6)
+#define PINMUX_GPIO169__FUNC_SCP_JTAG_TMS (MTK_PIN_NO(169) | 7)
+
+#define PINMUX_GPIO170__FUNC_GPIO170 (MTK_PIN_NO(170) | 0)
+#define PINMUX_GPIO170__FUNC_I2S1_BCK (MTK_PIN_NO(170) | 1)
+#define PINMUX_GPIO170__FUNC_I2S3_BCK (MTK_PIN_NO(170) | 2)
+#define PINMUX_GPIO170__FUNC_SCL7 (MTK_PIN_NO(170) | 3)
+#define PINMUX_GPIO170__FUNC_I2S5_BCK (MTK_PIN_NO(170) | 4)
+#define PINMUX_GPIO170__FUNC_EXT_FRAME_SYNC (MTK_PIN_NO(170) | 5)
+#define PINMUX_GPIO170__FUNC_TDM_LRCK_2ND (MTK_PIN_NO(170) | 6)
+#define PINMUX_GPIO170__FUNC_ANT_SEL3 (MTK_PIN_NO(170) | 7)
+
+#define PINMUX_GPIO171__FUNC_GPIO171 (MTK_PIN_NO(171) | 0)
+#define PINMUX_GPIO171__FUNC_I2S1_LRCK (MTK_PIN_NO(171) | 1)
+#define PINMUX_GPIO171__FUNC_I2S3_LRCK (MTK_PIN_NO(171) | 2)
+#define PINMUX_GPIO171__FUNC_SDA7 (MTK_PIN_NO(171) | 3)
+#define PINMUX_GPIO171__FUNC_I2S5_LRCK (MTK_PIN_NO(171) | 4)
+#define PINMUX_GPIO171__FUNC_URXD1 (MTK_PIN_NO(171) | 5)
+#define PINMUX_GPIO171__FUNC_TDM_DATA0_2ND (MTK_PIN_NO(171) | 6)
+#define PINMUX_GPIO171__FUNC_ANT_SEL4 (MTK_PIN_NO(171) | 7)
+
+#define PINMUX_GPIO172__FUNC_GPIO172 (MTK_PIN_NO(172) | 0)
+#define PINMUX_GPIO172__FUNC_I2S1_DO (MTK_PIN_NO(172) | 1)
+#define PINMUX_GPIO172__FUNC_I2S3_DO (MTK_PIN_NO(172) | 2)
+#define PINMUX_GPIO172__FUNC_SCL8 (MTK_PIN_NO(172) | 3)
+#define PINMUX_GPIO172__FUNC_I2S5_DO (MTK_PIN_NO(172) | 4)
+#define PINMUX_GPIO172__FUNC_UTXD1 (MTK_PIN_NO(172) | 5)
+#define PINMUX_GPIO172__FUNC_TDM_DATA1_2ND (MTK_PIN_NO(172) | 6)
+#define PINMUX_GPIO172__FUNC_ANT_SEL5 (MTK_PIN_NO(172) | 7)
+
+#define PINMUX_GPIO173__FUNC_GPIO173 (MTK_PIN_NO(173) | 0)
+#define PINMUX_GPIO173__FUNC_I2S1_MCK (MTK_PIN_NO(173) | 1)
+#define PINMUX_GPIO173__FUNC_I2S3_MCK (MTK_PIN_NO(173) | 2)
+#define PINMUX_GPIO173__FUNC_SDA8 (MTK_PIN_NO(173) | 3)
+#define PINMUX_GPIO173__FUNC_I2S5_MCK (MTK_PIN_NO(173) | 4)
+#define PINMUX_GPIO173__FUNC_UCTS0 (MTK_PIN_NO(173) | 5)
+#define PINMUX_GPIO173__FUNC_TDM_DATA2_2ND (MTK_PIN_NO(173) | 6)
+#define PINMUX_GPIO173__FUNC_ANT_SEL6 (MTK_PIN_NO(173) | 7)
+
+#define PINMUX_GPIO174__FUNC_GPIO174 (MTK_PIN_NO(174) | 0)
+#define PINMUX_GPIO174__FUNC_I2S2_DI (MTK_PIN_NO(174) | 1)
+#define PINMUX_GPIO174__FUNC_I2S0_DI (MTK_PIN_NO(174) | 2)
+#define PINMUX_GPIO174__FUNC_DVFSRC_EXT_REQ (MTK_PIN_NO(174) | 3)
+#define PINMUX_GPIO174__FUNC_I2S2_DI2 (MTK_PIN_NO(174) | 4)
+#define PINMUX_GPIO174__FUNC_URTS0 (MTK_PIN_NO(174) | 5)
+#define PINMUX_GPIO174__FUNC_TDM_DATA3_2ND (MTK_PIN_NO(174) | 6)
+#define PINMUX_GPIO174__FUNC_ANT_SEL7 (MTK_PIN_NO(174) | 7)
+
+#define PINMUX_GPIO175__FUNC_GPIO175 (MTK_PIN_NO(175) | 0)
+#define PINMUX_GPIO175__FUNC_ANT_SEL7 (MTK_PIN_NO(175) | 1)
+
+#define PINMUX_GPIO176__FUNC_GPIO176 (MTK_PIN_NO(176) | 0)
+
+#define PINMUX_GPIO177__FUNC_GPIO177 (MTK_PIN_NO(177) | 0)
+
+#define PINMUX_GPIO178__FUNC_GPIO178 (MTK_PIN_NO(178) | 0)
+
+#define PINMUX_GPIO179__FUNC_GPIO179 (MTK_PIN_NO(179) | 0)
+
+#endif /* __MT8183-PINFUNC_H */
index 6b8ab55..bcd018c 100644 (file)
@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_TEGRA_132_SOC) += tegra132-norrin.dtb
 dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2371-0000.dtb
 dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2371-2180.dtb
 dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2571.dtb
+dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p3450-0000.dtb
 dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-smaug.dtb
 dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2894-0050-a08.dtb
 dtb-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186-p2771-0000.dtb
index 31457f3..14d7fea 100644 (file)
                status = "okay";
        };
 
+       padctl@3520000 {
+               status = "disabled";
+
+               avdd-pll-erefeut-supply = <&vdd_1v8_pll>;
+               avdd-usb-supply = <&vdd_3v3_sys>;
+               dvdd-pex-supply = <&vdd_pex>;
+               dvdd-pex-pll-supply = <&vdd_pex>;
+               hvdd-pex-supply = <&vdd_1v8>;
+               hvdd-pex-pll-supply = <&vdd_1v8>;
+               vclamp-usb-supply = <&vdd_1v8>;
+               vddio-hsic-supply = <&gnd>;
+
+               pads {
+                       usb2 {
+                               status = "okay";
+
+                               lanes {
+                                       usb2-0 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb2-1 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb2-2 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+                               };
+                       };
+
+                       usb3 {
+                               status = "okay";
+
+                               lanes {
+                                       usb3-0 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb3-1 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb3-2 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+                               };
+                       };
+               };
+
+               ports {
+                       usb2-0 {
+                               status = "okay";
+                               mode = "otg";
+
+                               vbus-supply = <&vdd_usb0>;
+                       };
+
+                       usb2-1 {
+                               status = "okay";
+                               mode = "host";
+
+                               vbus-supply = <&vdd_usb1>;
+                       };
+
+                       usb3-0 {
+                               nvidia,usb2-companion = <1>;
+                               status = "okay";
+                       };
+               };
+       };
+
+       usb@3530000 {
+               status = "disabled";
+
+               phys = <&{/padctl@3520000/pads/usb2/lanes/usb2-0}>,
+                      <&{/padctl@3520000/pads/usb2/lanes/usb2-1}>,
+                      <&{/padctl@3520000/pads/usb3/lanes/usb3-0}>;
+               phy-names = "usb2-0", "usb2-1", "usb3-0";
+       };
+
        pcie@10003000 {
                status = "okay";
 
 
                        vin-supply = <&vdd_5v0_sys>;
                };
+
+               vdd_usb0: regulator@102 {
+                       compatible = "regulator-fixed";
+                       reg = <102>;
+
+                       regulator-name = "VDD_USB0";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+
+                       gpio = <&gpio TEGRA_MAIN_GPIO(L, 4) GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+
+               vdd_usb1: regulator@103 {
+                       compatible = "regulator-fixed";
+                       reg = <103>;
+
+                       regulator-name = "VDD_USB1";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+
+                       gpio = <&gpio TEGRA_MAIN_GPIO(L, 5) GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
        };
 };
index 89a2da4..64686b0 100644 (file)
                                                regulator-name = "AVDD_DSI_CSI_1V2";
                                                regulator-min-microvolt = <1200000>;
                                                regulator-max-microvolt = <1200000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
 
                                        vdd_1v8: sd2 {
                                                regulator-name = "VDD_1V8";
                                                regulator-min-microvolt = <1800000>;
                                                regulator-max-microvolt = <1800000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
 
                                        vdd_3v3_sys: sd3 {
                                                regulator-name = "VDD_3V3_SYS";
                                                regulator-min-microvolt = <3300000>;
                                                regulator-max-microvolt = <3300000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
 
-                                       ldo0 {
+                                       vdd_1v8_pll: ldo0 {
                                                regulator-name = "VDD_1V8_AP_PLL";
                                                regulator-min-microvolt = <1800000>;
                                                regulator-max-microvolt = <1800000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
 
                                        ldo2 {
                                                regulator-name = "VDDIO_3V3_AOHV";
                                                regulator-min-microvolt = <3300000>;
                                                regulator-max-microvolt = <3300000>;
-                                               /* XXX */
                                                regulator-always-on;
                                                regulator-boot-on;
                                        };
                                                regulator-name = "VDD_HDMI_1V05";
                                                regulator-min-microvolt = <1050000>;
                                                regulator-max-microvolt = <1050000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
 
                                        vdd_pex: ldo8 {
                                                regulator-name = "VDD_PEX_1V05";
                                                regulator-min-microvolt = <1050000>;
                                                regulator-max-microvolt = <1050000>;
-                                               /* XXX */
-                                               regulator-always-on;
-                                               regulator-boot-on;
                                        };
                                };
                        };
                #address-cells = <1>;
                #size-cells = <0>;
 
-               vdd_5v0_sys: regulator@0 {
+               gnd: regulator@0 {
                        compatible = "regulator-fixed";
                        reg = <0>;
 
+                       regulator-name = "GND";
+                       regulator-min-microvolt = <0>;
+                       regulator-max-microvolt = <0>;
+                       regulator-always-on;
+                       regulator-boot-on;
+               };
+
+               vdd_5v0_sys: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+
                        regulator-name = "VDD_5V0_SYS";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        regulator-boot-on;
                };
 
-               vdd_1v8_ap: regulator@1 {
+               vdd_1v8_ap: regulator@2 {
                        compatible = "regulator-fixed";
-                       reg = <1>;
+                       reg = <2>;
 
                        regulator-name = "VDD_1V8_AP";
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <1800000>;
 
-                       /* XXX */
-                       regulator-always-on;
-                       regulator-boot-on;
-
                        gpio = <&pmic 1 GPIO_ACTIVE_HIGH>;
                        enable-active-high;
 
index 97aeb94..426ac0b 100644 (file)
@@ -60,6 +60,7 @@
                clock-names = "master_bus", "slave_bus", "rx", "tx", "ptp_ref";
                resets = <&bpmp TEGRA186_RESET_EQOS>;
                reset-names = "eqos";
+               iommus = <&smmu TEGRA186_SID_EQOS>;
                status = "disabled";
 
                snps,write-requests = <1>;
                nvidia,pad-autocal-pull-down-offset-1v8-timeout = <0x0a>;
                nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x0a>;
                nvidia,pad-autocal-pull-down-offset-3v3-timeout = <0x0a>;
-               nvidia,default-tap = <0x5>;
-               nvidia,default-trim = <0x9>;
+               nvidia,default-tap = <0x9>;
+               nvidia,default-trim = <0x5>;
                nvidia,dqs-trim = <63>;
                mmc-hs400-1_8v;
+               supports-cqe;
                status = "disabled";
        };
 
                         <&bpmp TEGRA186_RESET_HDA2CODEC_2X>;
                reset-names = "hda", "hda2hdmi", "hda2codec_2x";
                power-domains = <&bpmp TEGRA186_POWER_DOMAIN_DISP>;
+               iommus = <&smmu TEGRA186_SID_HDA>;
                status = "disabled";
        };
 
+       padctl: padctl@3520000 {
+               compatible = "nvidia,tegra186-xusb-padctl";
+               reg = <0x0 0x03520000 0x0 0x1000>,
+                     <0x0 0x03540000 0x0 0x1000>;
+               reg-names = "padctl", "ao";
+
+               resets = <&bpmp TEGRA186_RESET_XUSB_PADCTL>;
+               reset-names = "padctl";
+
+               status = "disabled";
+
+               pads {
+                       usb2 {
+                               clocks = <&bpmp TEGRA186_CLK_USB2_TRK>;
+                               clock-names = "trk";
+                               status = "disabled";
+
+                               lanes {
+                                       usb2-0 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+
+                                       usb2-1 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+
+                                       usb2-2 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+                               };
+                       };
+
+                       hsic {
+                               clocks = <&bpmp TEGRA186_CLK_HSIC_TRK>;
+                               clock-names = "trk";
+                               status = "disabled";
+
+                               lanes {
+                                       hsic-0 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+                               };
+                       };
+
+                       usb3 {
+                               status = "disabled";
+
+                               lanes {
+                                       usb3-0 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+
+                                       usb3-1 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+
+                                       usb3-2 {
+                                               status = "disabled";
+                                               #phy-cells = <0>;
+                                       };
+                               };
+                       };
+               };
+
+               ports {
+                       usb2-0 {
+                               status = "disabled";
+                       };
+
+                       usb2-1 {
+                               status = "disabled";
+                       };
+
+                       usb2-2 {
+                               status = "disabled";
+                       };
+
+                       hsic-0 {
+                               status = "disabled";
+                       };
+
+                       usb3-0 {
+                               status = "disabled";
+                       };
+
+                       usb3-1 {
+                               status = "disabled";
+                       };
+
+                       usb3-2 {
+                               status = "disabled";
+                       };
+               };
+       };
+
+       usb@3530000 {
+               compatible = "nvidia,tegra186-xusb";
+               reg = <0x0 0x03530000 0x0 0x8000>,
+                     <0x0 0x03538000 0x0 0x1000>;
+               reg-names = "hcd", "fpci";
+
+               interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+
+               clocks = <&bpmp TEGRA186_CLK_XUSB_HOST>,
+                        <&bpmp TEGRA186_CLK_XUSB_FALCON>,
+                        <&bpmp TEGRA186_CLK_XUSB_SS>,
+                        <&bpmp TEGRA186_CLK_XUSB_CORE_SS>,
+                        <&bpmp TEGRA186_CLK_CLK_M>,
+                        <&bpmp TEGRA186_CLK_XUSB_FS>,
+                        <&bpmp TEGRA186_CLK_PLLU>,
+                        <&bpmp TEGRA186_CLK_CLK_M>,
+                        <&bpmp TEGRA186_CLK_PLLE>;
+               clock-names = "xusb_host", "xusb_falcon_src", "xusb_ss",
+                             "xusb_ss_src", "xusb_hs_src", "xusb_fs_src",
+                             "pll_u_480m", "clk_m", "pll_e";
+
+               power-domains = <&bpmp TEGRA186_POWER_DOMAIN_XUSBC>,
+                               <&bpmp TEGRA186_POWER_DOMAIN_XUSBA>;
+               power-domain-names = "xusb_host", "xusb_ss";
+               nvidia,xusb-padctl = <&padctl>;
+
+               status = "disabled";
+
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
        fuse@3820000 {
                compatible = "nvidia,tegra186-efuse";
                reg = <0x0 0x03820000 0x0 0x10000>;
                         <&bpmp TEGRA186_RESET_PCIEXCLK>;
                reset-names = "afi", "pex", "pcie_x";
 
+               iommus = <&smmu TEGRA186_SID_AFI>;
+               iommu-map = <0x0 &smmu TEGRA186_SID_AFI 0x1000>;
+               iommu-map-mask = <0x0>;
+
                status = "disabled";
 
                pci@1,0 {
 
        bpmp: bpmp {
                compatible = "nvidia,tegra186-bpmp";
+               iommus = <&smmu TEGRA186_SID_BPMP>;
                mboxes = <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB
                                    TEGRA_HSP_DB_MASTER_BPMP>;
                shmem = <&cpu_bpmp_tx &cpu_bpmp_rx>;
index 246c1eb..0fd5bd2 100644 (file)
                                interrupt-parent = <&gpio>;
                                interrupts = <TEGRA194_MAIN_GPIO(H, 2)
                                              IRQ_TYPE_LEVEL_LOW>;
+                               vcc-supply = <&vdd_1v8ls>;
 
                                #thermal-sensor-cells = <1>;
                        };
index b62e969..73801b4 100644 (file)
@@ -57,8 +57,6 @@
                pwms = <&pwm4 0 45334>;
 
                cooling-levels = <0 64 128 255>;
-               cooling-min-state = <0>;
-               cooling-max-state = <3>;
                #cooling-cells = <2>;
        };
 
index 053458a..4dcd0d3 100644 (file)
                cpu@3 {
                        enable-method = "psci";
                };
+
+               idle-states {
+                       cpu-sleep {
+                               status = "okay";
+                       };
+               };
        };
 
        psci {
index 9fad0d2..5a57396 100644 (file)
                pinctrl-0 = <&dvfs_pwm_active_state>;
                pinctrl-1 = <&dvfs_pwm_inactive_state>;
        };
+
+       aconnect@702c0000 {
+               status = "okay";
+
+               dma@702e2000 {
+                       status = "okay";
+               };
+
+               agic@702f9000 {
+                       status = "okay";
+               };
+       };
 };
index 95e890d..a7dc319 100644 (file)
        padctl@7009f000 {
                status = "okay";
 
+               avdd-pll-utmip-supply = <&vdd_1v8>;
+               avdd-pll-uerefe-supply = <&avdd_1v05_pll>;
+               dvdd-pex-pll-supply = <&vdd_pex_1v05>;
+               hvdd-pex-pll-e-supply = <&vdd_1v8>;
+
                pads {
                        usb2 {
                                status = "okay";
index 3ddf173..88a4b93 100644 (file)
                cpu@3 {
                        enable-method = "psci";
                };
+
+               idle-states {
+                       cpu-sleep {
+                               status = "okay";
+                       };
+               };
        };
 
        psci {
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts b/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts
new file mode 100644 (file)
index 0000000..5d01819
--- /dev/null
@@ -0,0 +1,650 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/mfd/max77620.h>
+
+#include "tegra210.dtsi"
+
+/ {
+       model = "NVIDIA Jetson Nano Developer Kit";
+       compatible = "nvidia,p3450-0000", "nvidia,tegra210";
+
+       aliases {
+               ethernet = "/pcie@1003000/pci@2,0/ethernet@0,0";
+               rtc0 = "/i2c@7000d000/pmic@3c";
+               rtc1 = "/rtc@7000e000";
+               serial0 = &uarta;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x0 0x80000000 0x1 0x0>;
+       };
+
+       pcie@1003000 {
+               status = "okay";
+
+               avdd-pll-uerefe-supply = <&vdd_pex_1v05>;
+               hvddio-pex-supply = <&vdd_1v8>;
+               dvddio-pex-supply = <&vdd_pex_1v05>;
+               dvdd-pex-pll-supply = <&vdd_pex_1v05>;
+               hvdd-pex-pll-e-supply = <&vdd_1v8>;
+               vddio-pex-ctl-supply = <&vdd_1v8>;
+
+               pci@1,0 {
+                       phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-1}>,
+                              <&{/padctl@7009f000/pads/pcie/lanes/pcie-2}>,
+                              <&{/padctl@7009f000/pads/pcie/lanes/pcie-3}>,
+                              <&{/padctl@7009f000/pads/pcie/lanes/pcie-4}>;
+                       phy-names = "pcie-0", "pcie-1", "pcie-2", "pcie-3";
+                       nvidia,num-lanes = <4>;
+                       status = "okay";
+               };
+
+               pci@2,0 {
+                       phys = <&{/padctl@7009f000/pads/pcie/lanes/pcie-0}>;
+                       phy-names = "pcie-0";
+                       status = "okay";
+
+                       ethernet@0,0 {
+                               reg = <0x000000 0 0 0 0>;
+                               local-mac-address = [ 00 00 00 00 00 00 ];
+                       };
+               };
+       };
+
+       host1x@50000000 {
+               dpaux@54040000 {
+                       status = "okay";
+               };
+
+               sor@54580000 {
+                       status = "okay";
+
+                       avdd-io-supply = <&avdd_1v05>;
+                       vdd-pll-supply = <&vdd_1v8>;
+                       hdmi-supply = <&vdd_hdmi>;
+
+                       nvidia,ddc-i2c-bus = <&hdmi_ddc>;
+                       nvidia,hpd-gpio = <&gpio TEGRA_GPIO(CC, 1)
+                                          GPIO_ACTIVE_LOW>;
+                       nvidia,xbar-cfg = <0 1 2 3 4>;
+               };
+       };
+
+       gpu@57000000 {
+               vdd-supply = <&vdd_gpu>;
+               status = "okay";
+       };
+
+       /* debug port */
+       serial@70006000 {
+               status = "okay";
+       };
+
+       hdmi_ddc: i2c@7000c700 {
+               status = "okay";
+               clock-frequency = <100000>;
+       };
+
+       i2c@7000d000 {
+               status = "okay";
+               clock-frequency = <400000>;
+
+               pmic: pmic@3c {
+                       compatible = "maxim,max77620";
+                       reg = <0x3c>;
+                       interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
+
+                       #interrupt-cells = <2>;
+                       interrupt-controller;
+
+                       #gpio-cells = <2>;
+                       gpio-controller;
+
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&max77620_default>;
+
+                       max77620_default: pinmux {
+                               gpio0 {
+                                       pins = "gpio0";
+                                       function = "gpio";
+                               };
+
+                               gpio1 {
+                                       pins = "gpio1";
+                                       function = "fps-out";
+                                       drive-push-pull = <1>;
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_NONE>;
+                                       maxim,active-fps-power-up-slot = <0>;
+                                       maxim,active-fps-power-down-slot = <7>;
+                               };
+
+                               gpio2 {
+                                       pins = "gpio2";
+                                       function = "fps-out";
+                                       drive-open-drain = <1>;
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_0>;
+                                       maxim,active-fps-power-up-slot = <0>;
+                                       maxim,active-fps-power-down-slot = <7>;
+                               };
+
+                               gpio3 {
+                                       pins = "gpio3";
+                                       function = "fps-out";
+                                       drive-open-drain = <1>;
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_0>;
+                                       maxim,active-fps-power-up-slot = <4>;
+                                       maxim,active-fps-power-down-slot = <3>;
+                               };
+
+                               gpio4 {
+                                       pins = "gpio4";
+                                       function = "32k-out1";
+                               };
+
+                               gpio5_6_7 {
+                                       pins = "gpio5", "gpio6", "gpio7";
+                                       function = "gpio";
+                                       drive-push-pull = <1>;
+                               };
+                       };
+
+                       fps {
+                               fps0 {
+                                       maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN0>;
+                                       maxim,suspend-fps-time-period-us = <5120>;
+                               };
+
+                               fps1 {
+                                       maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN1>;
+                                       maxim,suspend-fps-time-period-us = <5120>;
+                               };
+
+                               fps2 {
+                                       maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN0>;
+                               };
+                       };
+
+                       regulators {
+                               in-ldo0-1-supply = <&vdd_pre>;
+                               in-ldo2-supply = <&vdd_3v3_sys>;
+                               in-ldo3-5-supply = <&vdd_1v8>;
+                               in-ldo4-6-supply = <&vdd_5v0_sys>;
+                               in-ldo7-8-supply = <&vdd_pre>;
+                               in-sd0-supply = <&vdd_5v0_sys>;
+                               in-sd1-supply = <&vdd_5v0_sys>;
+                               in-sd2-supply = <&vdd_5v0_sys>;
+                               in-sd3-supply = <&vdd_5v0_sys>;
+
+                               vdd_soc: sd0 {
+                                       regulator-name = "VDD_SOC";
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1170000>;
+                                       regulator-enable-ramp-delay = <146>;
+                                       regulator-disable-ramp-delay = <4080>;
+                                       regulator-ramp-delay = <27500>;
+                                       regulator-ramp-delay-scale = <300>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_1>;
+                                       maxim,active-fps-power-up-slot = <1>;
+                                       maxim,active-fps-power-down-slot = <6>;
+                               };
+
+                               vdd_ddr: sd1 {
+                                       regulator-name = "VDD_DDR_1V1_PMIC";
+                                       regulator-min-microvolt = <1150000>;
+                                       regulator-max-microvolt = <1150000>;
+                                       regulator-enable-ramp-delay = <176>;
+                                       regulator-disable-ramp-delay = <145800>;
+                                       regulator-ramp-delay = <27500>;
+                                       regulator-ramp-delay-scale = <300>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_0>;
+                                       maxim,active-fps-power-up-slot = <5>;
+                                       maxim,active-fps-power-down-slot = <2>;
+                               };
+
+                               vdd_pre: sd2 {
+                                       regulator-name = "VDD_PRE_REG_1V35";
+                                       regulator-min-microvolt = <1350000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-enable-ramp-delay = <176>;
+                                       regulator-disable-ramp-delay = <32000>;
+                                       regulator-ramp-delay = <27500>;
+                                       regulator-ramp-delay-scale = <350>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_1>;
+                                       maxim,active-fps-power-up-slot = <2>;
+                                       maxim,active-fps-power-down-slot = <5>;
+                               };
+
+                               vdd_1v8: sd3 {
+                                       regulator-name = "VDD_1V8";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-enable-ramp-delay = <242>;
+                                       regulator-disable-ramp-delay = <118000>;
+                                       regulator-ramp-delay = <27500>;
+                                       regulator-ramp-delay-scale = <360>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_0>;
+                                       maxim,active-fps-power-up-slot = <3>;
+                                       maxim,active-fps-power-down-slot = <4>;
+                               };
+
+                               vdd_sys_1v2: ldo0 {
+                                       regulator-name = "AVDD_SYS_1V2";
+                                       regulator-min-microvolt = <1200000>;
+                                       regulator-max-microvolt = <1200000>;
+                                       regulator-enable-ramp-delay = <26>;
+                                       regulator-disable-ramp-delay = <626>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_NONE>;
+                                       maxim,active-fps-power-up-slot = <0>;
+                                       maxim,active-fps-power-down-slot = <7>;
+                               };
+
+                               vdd_pex_1v05: ldo1 {
+                                       regulator-name = "VDD_PEX_1V05";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                                       regulator-enable-ramp-delay = <22>;
+                                       regulator-disable-ramp-delay = <650>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_NONE>;
+                                       maxim,active-fps-power-up-slot = <0>;
+                                       maxim,active-fps-power-down-slot = <7>;
+                               };
+
+                               vddio_sdmmc: ldo2 {
+                                       regulator-name = "VDDIO_SDMMC";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <3300000>;
+                                       regulator-enable-ramp-delay = <62>;
+                                       regulator-disable-ramp-delay = <650>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_NONE>;
+                                       maxim,active-fps-power-up-slot = <0>;
+                                       maxim,active-fps-power-down-slot = <7>;
+                               };
+
+                               ldo3 {
+                                       status = "disabled";
+                               };
+
+                               vdd_rtc: ldo4 {
+                                       regulator-name = "VDD_RTC";
+                                       regulator-min-microvolt = <850000>;
+                                       regulator-max-microvolt = <1100000>;
+                                       regulator-enable-ramp-delay = <22>;
+                                       regulator-disable-ramp-delay = <610>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+                                       regulator-disable-active-discharge;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_0>;
+                                       maxim,active-fps-power-up-slot = <1>;
+                                       maxim,active-fps-power-down-slot = <6>;
+                               };
+
+                               ldo5 {
+                                       status = "disabled";
+                               };
+
+                               ldo6 {
+                                       status = "disabled";
+                               };
+
+                               avdd_1v05_pll: ldo7 {
+                                       regulator-name = "AVDD_1V05_PLL";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                                       regulator-enable-ramp-delay = <24>;
+                                       regulator-disable-ramp-delay = <2768>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_1>;
+                                       maxim,active-fps-power-up-slot = <3>;
+                                       maxim,active-fps-power-down-slot = <4>;
+                               };
+
+                               avdd_1v05: ldo8 {
+                                       regulator-name = "AVDD_SATA_HDMI_DP_1V05";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                                       regulator-enable-ramp-delay = <22>;
+                                       regulator-disable-ramp-delay = <1160>;
+                                       regulator-ramp-delay = <100000>;
+                                       regulator-ramp-delay-scale = <200>;
+
+                                       maxim,active-fps-source = <MAX77620_FPS_SRC_1>;
+                                       maxim,active-fps-power-up-slot = <6>;
+                                       maxim,active-fps-power-down-slot = <1>;
+                               };
+                       };
+               };
+       };
+
+       pmc@7000e400 {
+               nvidia,invert-interrupt;
+       };
+
+       hda@70030000 {
+               nvidia,model = "jetson-nano-hda";
+
+               status = "okay";
+       };
+
+       usb@70090000 {
+               phys = <&{/padctl@7009f000/pads/usb2/lanes/usb2-0}>,
+                      <&{/padctl@7009f000/pads/usb2/lanes/usb2-1}>,
+                      <&{/padctl@7009f000/pads/usb2/lanes/usb2-2}>,
+                      <&{/padctl@7009f000/pads/pcie/lanes/pcie-6}>;
+               phy-names = "usb2-0", "usb2-1", "usb2-2", "usb3-0";
+
+               avdd-usb-supply = <&vdd_3v3_sys>;
+               dvddio-pex-supply = <&vdd_pex_1v05>;
+               hvddio-pex-supply = <&vdd_1v8>;
+               /* these really belong to the XUSB pad controller */
+               avdd-pll-utmip-supply = <&vdd_1v8>;
+               avdd-pll-uerefe-supply = <&vdd_pex_1v05>;
+               dvdd-usb-ss-pll-supply = <&vdd_pex_1v05>;
+               hvdd-usb-ss-pll-e-supply = <&vdd_1v8>;
+
+               status = "okay";
+       };
+
+       padctl@7009f000 {
+               status = "okay";
+
+               avdd-pll-utmip-supply = <&vdd_1v8>;
+               avdd-pll-uerefe-supply = <&vdd_pex_1v05>;
+               dvdd-pex-pll-supply = <&vdd_pex_1v05>;
+               hvdd-pex-pll-e-supply = <&vdd_1v8>;
+
+               pads {
+                       usb2 {
+                               status = "okay";
+
+                               lanes {
+                                       usb2-0 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb2-1 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+
+                                       usb2-2 {
+                                               nvidia,function = "xusb";
+                                               status = "okay";
+                                       };
+                               };
+                       };
+
+                       pcie {
+                               status = "okay";
+
+                               lanes {
+                                       pcie-0 {
+                                               nvidia,function = "pcie-x1";
+                                               status = "okay";
+                                       };
+
+                                       pcie-1 {
+                                               nvidia,function = "pcie-x4";
+                                               status = "okay";
+                                       };
+
+                                       pcie-2 {
+                                               nvidia,function = "pcie-x4";
+                                               status = "okay";
+                                       };
+
+                                       pcie-3 {
+                                               nvidia,function = "pcie-x4";
+                                               status = "okay";
+                                       };
+
+                                       pcie-4 {
+                                               nvidia,function = "pcie-x4";
+                                               status = "okay";
+                                       };
+
+                                       pcie-5 {
+                                               nvidia,function = "usb3-ss";
+                                               status = "okay";
+                                       };
+
+                                       pcie-6 {
+                                               nvidia,function = "usb3-ss";
+                                               status = "okay";
+                                       };
+                               };
+                       };
+               };
+
+               ports {
+                       usb2-0 {
+                               status = "okay";
+                               mode = "otg";
+                       };
+
+                       usb2-1 {
+                               status = "okay";
+                               mode = "host";
+                       };
+
+                       usb2-2 {
+                               status = "okay";
+                               mode = "host";
+                       };
+
+                       usb3-0 {
+                               status = "okay";
+                               nvidia,usb2-companion = <1>;
+                               vbus-supply = <&vdd_hub_3v3>;
+                       };
+               };
+       };
+
+       sdhci@700b0000 {
+               status = "okay";
+               bus-width = <4>;
+
+               cd-gpios = <&gpio TEGRA_GPIO(Z, 1) GPIO_ACTIVE_LOW>;
+
+               vqmmc-supply = <&vddio_sdmmc>;
+               vmmc-supply = <&vdd_3v3_sd>;
+       };
+
+       clocks {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               clk32k_in: clock@0 {
+                       compatible = "fixed-clock";
+                       reg = <0>;
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+
+       cpus {
+               cpu@0 {
+                       enable-method = "psci";
+               };
+
+               cpu@1 {
+                       enable-method = "psci";
+               };
+
+               cpu@2 {
+                       enable-method = "psci";
+               };
+
+               cpu@3 {
+                       enable-method = "psci";
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power {
+                       label = "Power";
+                       gpios = <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_LOW>;
+                       linux,input-type = <EV_KEY>;
+                       linux,code = <KEY_POWER>;
+                       debounce-interval = <30>;
+                       wakeup-event-action = <EV_ACT_ASSERTED>;
+                       wakeup-source;
+               };
+
+               force-recovery {
+                       label = "Force Recovery";
+                       gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>;
+                       linux,input-type = <EV_KEY>;
+                       linux,code = <BTN_1>;
+                       debounce-interval = <30>;
+               };
+       };
+
+       psci {
+               compatible = "arm,psci-1.0";
+               method = "smc";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               vdd_5v0_sys: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+
+                       regulator-name = "VDD_5V0_SYS";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+                       regulator-boot-on;
+               };
+
+               vdd_3v3_sys: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "VDD_3V3_SYS";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-enable-ramp-delay = <240>;
+                       regulator-disable-ramp-delay = <11340>;
+                       regulator-always-on;
+                       regulator-boot-on;
+
+                       gpio = <&pmic 3 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+
+               vdd_3v3_sd: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+
+                       regulator-name = "VDD_3V3_SD";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+
+                       gpio = <&gpio TEGRA_GPIO(Z, 3) GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_3v3_sys>;
+               };
+
+               vdd_hdmi: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+
+                       regulator-name = "VDD_HDMI_5V0";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+
+               vdd_hub_3v3: regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+
+                       regulator-name = "VDD_HUB_3V3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+
+                       gpio = <&gpio TEGRA_GPIO(A, 6) GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+
+               vdd_cpu: regulator@5 {
+                       compatible = "regulator-fixed";
+                       reg = <5>;
+
+                       regulator-name = "VDD_CPU";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+                       regulator-boot-on;
+
+                       gpio = <&pmic 5 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+
+               vdd_gpu: regulator@6 {
+                       compatible = "regulator-fixed";
+                       reg = <6>;
+
+                       regulator-name = "VDD_GPU";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-enable-ramp-delay = <250>;
+
+                       gpio = <&pmic 6 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+
+                       vin-supply = <&vdd_5v0_sys>;
+               };
+       };
+};
index a4b8f66..72c7a04 100644 (file)
        padctl@7009f000 {
                status = "okay";
 
+               avdd-pll-utmip-supply = <&pp1800>;
+               avdd-pll-uerefe-supply = <&pp1050_avdd>;
+               dvdd-pex-pll-supply = <&avddio_1v05>;
+               hvdd-pex-pll-e-supply = <&pp1800>;
+
                pads {
                        usb2 {
                                status = "okay";
                cpu@3 {
                        enable-method = "psci";
                };
+
+               idle-states {
+                       cpu-sleep {
+                               arm,psci-suspend-param = <0x00010007>;
+                               status = "okay";
+                       };
+               };
        };
 
        gpio-keys {
index 6574396..a550c0a 100644 (file)
        };
 
        timer@60005000 {
-               compatible = "nvidia,tegra210-timer", "nvidia,tegra20-timer";
+               compatible = "nvidia,tegra210-timer";
                reg = <0x0 0x60005000 0x0 0x400>;
-               interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+               interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
-                            <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+                            <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA210_CLK_TIMER>;
                clock-names = "timer";
        };
                                 <&dfll>;
                        clock-names = "cpu_g", "pll_x", "pll_p", "dfll";
                        clock-latency = <300000>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       next-level-cache = <&L2>;
                };
 
                cpu@1 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a57";
                        reg = <1>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       next-level-cache = <&L2>;
                };
 
                cpu@2 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a57";
                        reg = <2>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       next-level-cache = <&L2>;
                };
 
                cpu@3 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a57";
                        reg = <3>;
+                       cpu-idle-states = <&CPU_SLEEP>;
+                       next-level-cache = <&L2>;
+               };
+
+               idle-states {
+                       entry-method = "psci";
+
+                       CPU_SLEEP: cpu-sleep {
+                               compatible = "arm,idle-state";
+                               arm,psci-suspend-param = <0x40000007>;
+                               entry-latency-us = <100>;
+                               exit-latency-us = <30>;
+                               min-residency-us = <1000>;
+                               wakeup-latency-us = <130>;
+                               idle-state-name = "cpu-sleep";
+                               status = "disabled";
+                       };
+               };
+
+               L2: l2-cache {
+                       compatible = "cache";
                };
        };
 
index 6a57387..1c0d06f 100644 (file)
                        bias-disable;
                };
        };
+
+       hdmi_hpd_active: hdmi_hpd_active {
+               mux {
+                       pins = "gpio34";
+                       function = "hdmi_hot";
+               };
+
+               config {
+                       pins = "gpio34";
+                       bias-pull-down;
+                       drive-strength = <16>;
+               };
+       };
+
+       hdmi_hpd_suspend: hdmi_hpd_suspend {
+               mux {
+                       pins = "gpio34";
+                       function = "hdmi_hot";
+               };
+
+               config {
+                       pins = "gpio34";
+                       bias-pull-down;
+                       drive-strength = <2>;
+               };
+       };
+
+       hdmi_ddc_active: hdmi_ddc_active {
+               mux {
+                       pins = "gpio32", "gpio33";
+                       function = "hdmi_ddc";
+               };
+
+               config {
+                       pins = "gpio32", "gpio33";
+                       drive-strength = <2>;
+                       bias-pull-up;
+               };
+       };
+
+       hdmi_ddc_suspend: hdmi_ddc_suspend {
+               mux {
+                       pins = "gpio32", "gpio33";
+                       function = "hdmi_ddc";
+               };
+
+               config {
+                       pins = "gpio32", "gpio33";
+                       drive-strength = <2>;
+                       bias-pull-down;
+               };
+       };
 };
index a6ad3d7..31a3e33 100644 (file)
                };
        };
 
+       audio_mclk: clk_div1 {
+               pinconf {
+                       pins = "gpio15";
+                       function = "func1";
+                       power-source = <PM8994_GPIO_S4>; // 1.8V
+               };
+       };
+
        volume_up_gpio: pm8996_gpio2 {
                pinconf {
                        pins = "gpio2";
index 6d50449..943f699 100644 (file)
@@ -18,6 +18,8 @@
 #include "apq8096-db820c-pmic-pins.dtsi"
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/sound/qcom,q6afe.h>
+#include <dt-bindings/sound/qcom,q6asm.h>
 
 /*
  * GPIO name legend: proper name = the GPIO line is used as GPIO
@@ -63,6 +65,7 @@
        };
 
        clocks {
+               compatible = "simple-bus";
                divclk4: divclk4 {
                        compatible = "fixed-clock";
                        #clock-cells = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&divclk4_pin_a>;
                };
+
+               div1_mclk: divclk1 {
+                       compatible = "gpio-gate-clock";
+                       pinctrl-0 = <&audio_mclk>;
+                       pinctrl-names = "default";
+                       clocks = <&rpmcc RPM_SMD_DIV_CLK1>;
+                       #clock-cells = <0>;
+                       enable-gpios = <&pm8994_gpios 15 0>;
+               };
        };
 
        soc {
                                perst-gpio = <&msmgpio 114 GPIO_ACTIVE_LOW>;
                        };
                };
+
+               slim_msm: slim@91c0000 {
+                       ngd@1 {
+                               wcd9335: codec@1{
+                                       clock-names = "mclk", "slimbus";
+                                       clocks = <&div1_mclk>,
+                                                <&rpmcc RPM_SMD_BB_CLK1>;
+                               };
+                       };
+               };
+
+               mdss@900000 {
+                       status = "okay";
+
+                       mdp@901000 {
+                               status = "okay";
+                       };
+
+                       hdmi-phy@9a0600 {
+                               status = "okay";
+
+                               vddio-supply = <&pm8994_l12>;
+                               vcca-supply = <&pm8994_l28>;
+                               #phy-cells = <0>;
+                       };
+
+                       hdmi-tx@9a0000 {
+                               status = "okay";
+
+                               pinctrl-names = "default", "sleep";
+                               pinctrl-0 = <&hdmi_hpd_active &hdmi_ddc_active>;
+                               pinctrl-1 = <&hdmi_hpd_suspend &hdmi_ddc_suspend>;
+
+                               core-vdda-supply = <&pm8994_l12>;
+                               core-vcc-supply = <&pm8994_s4>;
+                       };
+               };
        };
 
 
                };
        };
 };
+
+&sound {
+       compatible = "qcom,apq8096-sndcard";
+       model = "DB820c";
+       audio-routing = "RX_BIAS", "MCLK";
+
+       mm1-dai-link {
+               link-name = "MultiMedia1";
+               cpu {
+                       sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA1>;
+               };
+       };
+
+       mm2-dai-link {
+               link-name = "MultiMedia2";
+               cpu {
+                       sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA2>;
+               };
+       };
+
+       mm3-dai-link {
+               link-name = "MultiMedia3";
+               cpu {
+                       sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
+               };
+       };
+
+       hdmi-dai-link {
+               link-name = "HDMI";
+               cpu {
+                       sound-dai = <&q6afedai HDMI_RX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+               };
+
+               codec {
+                       sound-dai = <&hdmi 0>;
+               };
+       };
+
+       slim-dai-link {
+               link-name = "SLIM Playback";
+               cpu {
+                       sound-dai = <&q6afedai SLIMBUS_6_RX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+       };
+
+               codec {
+                       sound-dai = <&wcd9335 6>;
+               };
+       };
+
+       slimcap-dai-link {
+               link-name = "SLIM Capture";
+               cpu {
+                       sound-dai = <&q6afedai SLIMBUS_0_TX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+               };
+
+               codec {
+                       sound-dai = <&wcd9335 1>;
+               };
+       };
+};
index 0803ca8..423dda9 100644 (file)
        };
 
        thermal-zones {
-               cpu-thermal0 {
+               cpu0_1-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens 4>;
 
                        trips {
-                               cpu_alert0: trip0 {
+                               cpu0_1_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
-                               cpu_crit0: trip1 {
+                               cpu0_1_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
 
                        cooling-maps {
                                map0 {
-                                       trip = <&cpu_alert0>;
+                                       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>,
                        };
                };
 
-               cpu-thermal1 {
+               cpu2_3-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens 3>;
 
                        trips {
-                               cpu_alert1: trip0 {
+                               cpu2_3_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
-                               cpu_crit1: trip1 {
+                               cpu2_3_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
 
                        cooling-maps {
                                map0 {
-                                       trip = <&cpu_alert1>;
+                                       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>,
                        thermal-sensors = <&tsens 2>;
 
                        trips {
-                               gpu_alert: trip0 {
+                               gpu_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
-                               gpu_crit: trip1 {
+                               gpu_crit: gpu_crit {
                                        temperature = <95000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        thermal-sensors = <&tsens 1>;
 
                        trips {
-                               cam_alert: trip0 {
+                               cam_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
-                                       type = "passive";
+                                       type = "hot";
                                };
-                               cam_crit: trip1 {
-                                       temperature = <95000>;
+                       };
+               };
+
+               modem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens 0>;
+
+                       trips {
+                               modem_alert0: trip-point@0 {
+                                       temperature = <85000>;
                                        hysteresis = <2000>;
-                                       type = "critical";
+                                       type = "hot";
                                };
                        };
-
                };
 
        };
                                #clock-cells = <1>;
                                #phy-cells = <0>;
 
-                               clocks = <&gcc GCC_MDSS_AHB_CLK>;
-                               clock-names = "iface";
+                               clocks = <&gcc GCC_MDSS_AHB_CLK>,
+                                        <&xo_board>;
+                               clock-names = "iface", "ref";
                        };
                };
 
index 131878d..fba2229 100644 (file)
 
 &msmgpio {
 
+       wcd9xxx_intr {
+               wcd_intr_default: wcd_intr_default{
+                       mux {
+                               pins = "gpio54";
+                               function = "gpio";
+                       };
+
+                       config {
+                               pins = "gpio54";
+                               drive-strength = <2>; /* 2 mA */
+                               bias-pull-down; /* pull down */
+                               input-enable;
+                       };
+               };
+       };
+
+       cdc_reset_ctrl {
+               cdc_reset_sleep: cdc_reset_sleep {
+                       mux {
+                               pins = "gpio64";
+                               function = "gpio";
+                       };
+                       config {
+                               pins = "gpio64";
+                               drive-strength = <16>;
+                               bias-disable;
+                               output-low;
+                       };
+               };
+               cdc_reset_active:cdc_reset_active {
+                       mux {
+                               pins = "gpio64";
+                               function = "gpio";
+                       };
+                       config {
+                               pins = "gpio64";
+                               drive-strength = <16>;
+                               bias-pull-down;
+                               output-high;
+                       };
+               };
+       };
+
        blsp1_spi0_default: blsp1_spi0_default {
                pinmux {
                        function = "blsp_spi1";
index c761269..c4e7fde 100644 (file)
@@ -14,6 +14,7 @@
 #include <dt-bindings/clock/qcom,gcc-msm8996.h>
 #include <dt-bindings/clock/qcom,mmcc-msm8996.h>
 #include <dt-bindings/clock/qcom,rpmcc.h>
+#include <dt-bindings/soc/qcom,apr.h>
 
 / {
        interrupt-parent = <&intc>;
                        qcom,client-id = <1>;
                        qcom,vmid = <15>;
                };
+
+               zap_shader_region: gpu@8f200000 {
+                       compatible = "shared-dma-pool";
+                       reg = <0x0 0x90b00000 0x0 0xa00000>;
+                       no-map;
+               };
        };
 
        cpus {
        };
 
        thermal-zones {
-               cpu-thermal0 {
+               cpu0-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens0 3>;
 
                        trips {
-                               cpu_alert0: trip0 {
+                               cpu0_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit0: trip1 {
+                               cpu0_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal1 {
+               cpu1-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens0 5>;
 
                        trips {
-                               cpu_alert1: trip0 {
+                               cpu1_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit1: trip1 {
+                               cpu1_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal2 {
+               cpu2-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens0 8>;
 
                        trips {
-                               cpu_alert2: trip0 {
+                               cpu2_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit2: trip1 {
+                               cpu2_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal3 {
+               cpu3-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens0 10>;
 
                        trips {
-                               cpu_alert3: trip0 {
+                               cpu3_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit3: trip1 {
+                               cpu3_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                                };
                        };
                };
+
+               gpu-thermal-top {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 6>;
+
+                       trips {
+                               gpu1_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               gpu-thermal-bottom {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 7>;
+
+                       trips {
+                               gpu2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               m4m-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 1>;
+
+                       trips {
+                               m4m_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               l3-or-venus-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 2>;
+
+                       trips {
+                               l3_or_venus_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               cluster0-l2-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 7>;
+
+                       trips {
+                               cluster0_l2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               cluster1-l2-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 12>;
+
+                       trips {
+                               cluster1_l2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               camera-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 1>;
+
+                       trips {
+                               camera_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               q6-dsp-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 2>;
+
+                       trips {
+                               q6_dsp_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               mem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 3>;
+
+                       trips {
+                               mem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               modemtx-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 4>;
+
+                       trips {
+                               modemtx_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
        };
 
        timer {
                                reg = <0x24f 0x1>;
                                bits = <1 4>;
                        };
+
+                       gpu_speed_bin: gpu_speed_bin@133 {
+                               reg = <0x133 0x1>;
+                               bits = <5 3>;
+                       };
                };
 
                phy@34000 {
                        };
                };
 
+               adreno_smmu: arm,smmu@b40000 {
+                       compatible = "qcom,msm8996-smmu-v2", "qcom,smmu-v2";
+                       reg = <0xb40000 0x10000>;
+
+                       #global-interrupts = <1>;
+                       interrupts = <GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 329 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 330 IRQ_TYPE_LEVEL_HIGH>;
+                       #iommu-cells = <1>;
+
+                       clocks = <&mmcc GPU_AHB_CLK>,
+                                <&gcc GCC_MMSS_BIMC_GFX_CLK>;
+                       clock-names = "iface", "bus";
+
+                       power-domains = <&mmcc GPU_GDSC>;
+
+                       status = "disabled";
+               };
+
+               mdp_smmu: arm,smmu@d00000 {
+                       compatible = "qcom,msm8996-smmu-v2", "qcom,smmu-v2";
+                       reg = <0xd00000 0x10000>;
+
+                       #global-interrupts = <1>;
+                       interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH>;
+                       #iommu-cells = <1>;
+                       clocks = <&mmcc SMMU_MDP_AHB_CLK>,
+                                <&mmcc SMMU_MDP_AXI_CLK>;
+                       clock-names = "iface", "bus";
+
+                       power-domains = <&mmcc MDSS_GDSC>;
+
+                       status = "disabled";
+               };
+
+               lpass_q6_smmu: arm,smmu-lpass_q6@1600000 {
+                       compatible = "qcom,msm8996-smmu-v2", "qcom,smmu-v2";
+                       reg = <0x1600000 0x20000>;
+                       #iommu-cells = <1>;
+                       power-domains = <&gcc HLOS1_VOTE_LPASS_CORE_GDSC>;
+
+                       #global-interrupts = <1>;
+                       interrupts = <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 395 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 396 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 397 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
+                               <GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>;
+
+                       clocks = <&gcc GCC_HLOS1_VOTE_LPASS_CORE_SMMU_CLK>,
+                                <&gcc GCC_HLOS1_VOTE_LPASS_ADSP_SMMU_CLK>;
+                       clock-names = "iface", "bus";
+                       status = "disabled";
+               };
+
                agnoc@0 {
                        power-domains = <&gcc AGGRE0_NOC_GDSC>;
                        compatible = "simple-pm-bus";
                                                "bus_slave";
                        };
                };
+
+               slimbam:dma@9184000
+               {
+                       compatible = "qcom,bam-v1.7.0";
+                       qcom,controlled-remotely;
+                       reg = <0x9184000 0x32000>;
+                       num-channels  = <31>;
+                       interrupts = <0 164 IRQ_TYPE_LEVEL_HIGH>;
+                       #dma-cells = <1>;
+                       qcom,ee = <1>;
+                       qcom,num-ees = <2>;
+               };
+
+               slim_msm: slim@91c0000 {
+                       compatible = "qcom,slim-ngd-v1.5.0";
+                       reg = <0x91c0000 0x2C000>;
+                       reg-names = "ctrl";
+                       interrupts = <0 163 IRQ_TYPE_LEVEL_HIGH>;
+                       dmas =  <&slimbam 3>, <&slimbam 4>,
+                               <&slimbam 5>, <&slimbam 6>;
+                       dma-names = "rx", "tx", "tx2", "rx2";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       ngd@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               tasha_ifd: tas-ifd {
+                                       compatible = "slim217,1a0";
+                                       reg  = <0 0>;
+                               };
+
+                               wcd9335: codec@1{
+                                       pinctrl-0 = <&cdc_reset_active &wcd_intr_default>;
+                                       pinctrl-names = "default";
+
+                                       compatible = "slim217,1a0";
+                                       reg  = <1 0>;
+
+                                       interrupt-parent = <&msmgpio>;
+                                       interrupts = <54 IRQ_TYPE_LEVEL_HIGH>,
+                                                    <53 IRQ_TYPE_LEVEL_HIGH>;
+                                       interrupt-names  = "intr1", "intr2";
+                                       interrupt-controller;
+                                       #interrupt-cells = <1>;
+                                       reset-gpios = <&msmgpio 64 0>;
+
+                                       slim-ifc-dev  = <&tasha_ifd>;
+
+                                       vdd-buck-supply = <&pm8994_s4>;
+                                       vdd-buck-sido-supply = <&pm8994_s4>;
+                                       vdd-tx-supply = <&pm8994_s4>;
+                                       vdd-rx-supply = <&pm8994_s4>;
+                                       vdd-io-supply = <&pm8994_s4>;
+
+                                       #sound-dai-cells = <1>;
+                               };
+                       };
+               };
+
+               gpu@b00000 {
+                       compatible = "qcom,adreno-530.2", "qcom,adreno";
+                       #stream-id-cells = <16>;
+
+                       reg = <0xb00000 0x3f000>;
+                       reg-names = "kgsl_3d0_reg_memory";
+
+                       interrupts = <0 300 IRQ_TYPE_LEVEL_HIGH>;
+
+                       clocks = <&mmcc GPU_GX_GFX3D_CLK>,
+                               <&mmcc GPU_AHB_CLK>,
+                               <&mmcc GPU_GX_RBBMTIMER_CLK>,
+                               <&gcc GCC_BIMC_GFX_CLK>,
+                               <&gcc GCC_MMSS_BIMC_GFX_CLK>;
+
+                       clock-names = "core",
+                               "iface",
+                               "rbbmtimer",
+                               "mem",
+                               "mem_iface";
+
+                       power-domains = <&mmcc GPU_GDSC>;
+                       iommus = <&adreno_smmu 0>;
+
+                       nvmem-cells = <&gpu_speed_bin>;
+                       nvmem-cell-names = "speed_bin";
+
+                       qcom,gpu-quirk-two-pass-use-wfi;
+                       qcom,gpu-quirk-fault-detect-mask;
+
+                       operating-points-v2 = <&gpu_opp_table>;
+
+                       gpu_opp_table: opp-table {
+                               compatible  ="operating-points-v2";
+
+                               /*
+                                * 624Mhz and 560Mhz are only available on speed
+                                * bin (1 << 0). All the rest are available on
+                                * all bins of the hardware
+                                */
+                               opp-624000000 {
+                                       opp-hz = /bits/ 64 <624000000>;
+                                       opp-supported-hw = <0x01>;
+                               };
+                               opp-560000000 {
+                                       opp-hz = /bits/ 64 <560000000>;
+                                       opp-supported-hw = <0x01>;
+                               };
+                               opp-510000000 {
+                                       opp-hz = /bits/ 64 <510000000>;
+                                       opp-supported-hw = <0xFF>;
+                               };
+                               opp-401800000 {
+                                       opp-hz = /bits/ 64 <401800000>;
+                                       opp-supported-hw = <0xFF>;
+                               };
+                               opp-315000000 {
+                                       opp-hz = /bits/ 64 <315000000>;
+                                       opp-supported-hw = <0xFF>;
+                               };
+                               opp-214000000 {
+                                       opp-hz = /bits/ 64 <214000000>;
+                                       opp-supported-hw = <0xFF>;
+                               };
+                               opp-133000000 {
+                                       opp-hz = /bits/ 64 <133000000>;
+                                       opp-supported-hw = <0xFF>;
+                               };
+                       };
+
+                       zap-shader {
+                               memory-region = <&zap_shader_region>;
+                       };
+               };
+
+               mdss: mdss@900000 {
+                       compatible = "qcom,mdss";
+
+                       reg = <0x900000 0x1000>,
+                             <0x9b0000 0x1040>,
+                             <0x9b8000 0x1040>;
+                       reg-names = "mdss_phys",
+                                   "vbif_phys",
+                                   "vbif_nrt_phys";
+
+                       power-domains = <&mmcc MDSS_GDSC>;
+                       interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+
+                       clocks = <&mmcc MDSS_AHB_CLK>;
+                       clock-names = "iface_clk";
+
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       mdp: mdp@901000 {
+                               compatible = "qcom,mdp5";
+                               reg = <0x901000 0x90000>;
+                               reg-names = "mdp_phys";
+
+                               interrupt-parent = <&mdss>;
+                               interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+
+                               clocks = <&mmcc MDSS_AHB_CLK>,
+                                        <&mmcc MDSS_AXI_CLK>,
+                                        <&mmcc MDSS_MDP_CLK>,
+                                        <&mmcc SMMU_MDP_AXI_CLK>,
+                                        <&mmcc MDSS_VSYNC_CLK>;
+                               clock-names = "iface_clk",
+                                             "bus_clk",
+                                             "core_clk",
+                                             "iommu_clk",
+                                             "vsync_clk";
+
+                               iommus = <&mdp_smmu 0>;
+
+                               ports {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       port@0 {
+                                               reg = <0>;
+                                               mdp5_intf3_out: endpoint {
+                                                       remote-endpoint = <&hdmi_in>;
+                                               };
+                                       };
+                               };
+                       };
+
+                       hdmi: hdmi-tx@9a0000 {
+                               compatible = "qcom,hdmi-tx-8996";
+                               reg =   <0x009a0000 0x50c>,
+                                       <0x00070000 0x6158>,
+                                       <0x009e0000 0xfff>;
+                               reg-names = "core_physical",
+                                           "qfprom_physical",
+                                           "hdcp_physical";
+
+                               interrupt-parent = <&mdss>;
+                               interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+
+                               clocks = <&mmcc MDSS_MDP_CLK>,
+                                        <&mmcc MDSS_AHB_CLK>,
+                                        <&mmcc MDSS_HDMI_CLK>,
+                                        <&mmcc MDSS_HDMI_AHB_CLK>,
+                                        <&mmcc MDSS_EXTPCLK_CLK>;
+                               clock-names =
+                                       "mdp_core_clk",
+                                       "iface_clk",
+                                       "core_clk",
+                                       "alt_iface_clk",
+                                       "extp_clk";
+
+                               phys = <&hdmi_phy>;
+                               phy-names = "hdmi_phy";
+                               #sound-dai-cells = <1>;
+
+                               ports {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       port@0 {
+                                               reg = <0>;
+                                               hdmi_in: endpoint {
+                                                       remote-endpoint = <&mdp5_intf3_out>;
+                                               };
+                                       };
+                               };
+                       };
+
+                       hdmi_phy: hdmi-phy@9a0600 {
+                               #phy-cells = <0>;
+                               compatible = "qcom,hdmi-phy-8996";
+                               reg = <0x9a0600 0x1c4>,
+                                     <0x9a0a00 0x124>,
+                                     <0x9a0c00 0x124>,
+                                     <0x9a0e00 0x124>,
+                                     <0x9a1000 0x124>,
+                                     <0x9a1200 0x0c8>;
+                               reg-names = "hdmi_pll",
+                                           "hdmi_tx_l0",
+                                           "hdmi_tx_l1",
+                                           "hdmi_tx_l2",
+                                           "hdmi_tx_l3",
+                                           "hdmi_phy";
+
+                               clocks = <&mmcc MDSS_AHB_CLK>,
+                                        <&gcc GCC_HDMI_CLKREF_CLK>;
+                               clock-names = "iface_clk",
+                                             "ref_clk";
+                       };
+               };
+       };
+
+       sound: sound {
        };
 
        adsp-pil {
                        mboxes = <&apcs_glb 8>;
                        qcom,smd-edge = <1>;
                        qcom,remote-pid = <2>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       apr {
+                               power-domains = <&gcc HLOS1_VOTE_LPASS_ADSP_GDSC>;
+                               compatible = "qcom,apr-v2";
+                               qcom,smd-channels = "apr_audio_svc";
+                               reg = <APR_DOMAIN_ADSP>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               q6core {
+                                       reg = <APR_SVC_ADSP_CORE>;
+                                       compatible = "qcom,q6core";
+                               };
+
+                               q6afe: q6afe {
+                                       compatible = "qcom,q6afe";
+                                       reg = <APR_SVC_AFE>;
+                                       q6afedai: dais {
+                                               compatible = "qcom,q6afe-dais";
+                                               #address-cells = <1>;
+                                               #size-cells = <0>;
+                                               #sound-dai-cells = <1>;
+                                               hdmi@1 {
+                                                       reg = <1>;
+                                               };
+                                       };
+                               };
+
+                               q6asm: q6asm {
+                                       compatible = "qcom,q6asm";
+                                       reg = <APR_SVC_ASM>;
+                                       q6asmdai: dais {
+                                               compatible = "qcom,q6asm-dais";
+                                               #sound-dai-cells = <1>;
+                                               iommus = <&lpass_q6_smmu 1>;
+                                       };
+                               };
+
+                               q6adm: q6adm {
+                                       compatible = "qcom,q6adm";
+                                       reg = <APR_SVC_ADM>;
+                                       q6routing: routing {
+                                               compatible = "qcom,q6adm-routing";
+                                               #sound-dai-cells = <0>;
+                                       };
+                               };
+                       };
+
                };
        };
 
index f090106..f09f3e0 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
-       thermal-zones {
-               battery-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
-
-                       thermal-sensors = <&tsens0 0>;
-
-                       trips {
-                               battery_crit: trip0 {
-                                       temperature = <60000>;
-                                       hysteresis = <2000>;
-                                       type = "critical";
-                               };
-                       };
-               };
-
-               skin-thermal {
-                       polling-delay-passive = <250>;
-                       polling-delay = <1000>;
-
-                       thermal-sensors = <&tsens1 5>;
-
-                       trips {
-                               skin_alert: trip0 {
-                                       temperature = <44000>;
-                                       hysteresis = <2000>;
-                                       type = "passive";
-                               };
-
-                               skip_crit: trip1 {
-                                       temperature = <70000>;
-                                       hysteresis = <2000>;
-                                       type = "critical";
-                               };
-                       };
-               };
-       };
-
        vph_pwr: vph-pwr-regulator {
                compatible = "regulator-fixed";
                regulator-name = "vph_pwr";
                vreg_s4a_1p8: s4 {
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <1800000>;
+                       regulator-allow-set-load;
                };
                vreg_s5a_2p04: s5 {
                        regulator-min-microvolt = <1904000>;
                vreg_l20a_2p95: l20 {
                        regulator-min-microvolt = <2960000>;
                        regulator-max-microvolt = <2960000>;
+                       regulator-allow-set-load;
                };
                vreg_l21a_2p95: l21 {
                        regulator-min-microvolt = <2960000>;
                vreg_l26a_1p2: l26 {
                        regulator-min-microvolt = <1200000>;
                        regulator-max-microvolt = <1200000>;
+                       regulator-allow-set-load;
                };
                vreg_l28_3p0: l28 {
                        regulator-min-microvolt = <3008000>;
        pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;
 };
 
+&ufshc {
+       vcc-supply = <&vreg_l20a_2p95>;
+       vccq-supply = <&vreg_l26a_1p2>;
+       vccq2-supply = <&vreg_s4a_1p8>;
+       vcc-max-microamp = <750000>;
+       vccq-max-microamp = <560000>;
+       vccq2-max-microamp = <750000>;
+};
+
+&ufsphy {
+       vdda-phy-supply = <&vreg_l1a_0p875>;
+       vdda-pll-supply = <&vreg_l2a_1p2>;
+       vddp-ref-clk-supply = <&vreg_l26a_1p2>;
+       vdda-phy-max-microamp = <51400>;
+       vdda-pll-max-microamp = <14600>;
+       vddp-ref-clk-max-microamp = <100>;
+       vddp-ref-clk-always-on;
+};
+
 &usb3 {
        status = "okay";
 };
index 3fd0769..574be78 100644 (file)
@@ -78,7 +78,6 @@
                        compatible = "arm,armv8";
                        reg = <0x0 0x0>;
                        enable-method = "psci";
-                       efficiency = <1024>;
                        next-level-cache = <&L2_0>;
                        L2_0: l2-cache {
                                compatible = "arm,arch-cache";
@@ -97,7 +96,6 @@
                        compatible = "arm,armv8";
                        reg = <0x0 0x1>;
                        enable-method = "psci";
-                       efficiency = <1024>;
                        next-level-cache = <&L2_0>;
                        L1_I_1: l1-icache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x2>;
                        enable-method = "psci";
-                       efficiency = <1024>;
                        next-level-cache = <&L2_0>;
                        L1_I_2: l1-icache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x3>;
                        enable-method = "psci";
-                       efficiency = <1024>;
                        next-level-cache = <&L2_0>;
                        L1_I_3: l1-icache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x100>;
                        enable-method = "psci";
-                       efficiency = <1536>;
                        next-level-cache = <&L2_1>;
                        L2_1: l2-cache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x101>;
                        enable-method = "psci";
-                       efficiency = <1536>;
                        next-level-cache = <&L2_1>;
                        L1_I_101: l1-icache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x102>;
                        enable-method = "psci";
-                       efficiency = <1536>;
                        next-level-cache = <&L2_1>;
                        L1_I_102: l1-icache {
                                compatible = "arm,arch-cache";
                        compatible = "arm,armv8";
                        reg = <0x0 0x103>;
                        enable-method = "psci";
-                       efficiency = <1536>;
                        next-level-cache = <&L2_1>;
                        L1_I_103: l1-icache {
                                compatible = "arm,arch-cache";
        };
 
        thermal-zones {
-               cpu-thermal0 {
+               cpu0-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 6>;
+                       thermal-sensors = <&tsens0 1>;
 
                        trips {
-                               cpu_alert0: trip0 {
+                               cpu0_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit0: trip1 {
+                               cpu0_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal1 {
+               cpu1-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 7>;
+                       thermal-sensors = <&tsens0 2>;
 
                        trips {
-                               cpu_alert1: trip0 {
+                               cpu1_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit1: trip1 {
+                               cpu1_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal2 {
+               cpu2-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 8>;
+                       thermal-sensors = <&tsens0 3>;
 
                        trips {
-                               cpu_alert2: trip0 {
+                               cpu2_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit2: trip1 {
+                               cpu2_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal3 {
+               cpu3-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 9>;
+                       thermal-sensors = <&tsens0 4>;
 
                        trips {
-                               cpu_alert3: trip0 {
+                               cpu3_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit3: trip1 {
+                               cpu3_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal4 {
+               cpu4-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 10>;
+                       thermal-sensors = <&tsens0 7>;
 
                        trips {
-                               cpu_alert4: trip0 {
+                               cpu4_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit4: trip1 {
+                               cpu4_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal5 {
+               cpu5-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens0 11>;
+                       thermal-sensors = <&tsens0 8>;
 
                        trips {
-                               cpu_alert5: trip0 {
+                               cpu5_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit5: trip1 {
+                               cpu5_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal6 {
+               cpu6-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens1 0>;
+                       thermal-sensors = <&tsens0 9>;
 
                        trips {
-                               cpu_alert6: trip0 {
+                               cpu6_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit6: trip1 {
+                               cpu6_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               cpu-thermal7 {
+               cpu7-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
-                       thermal-sensors = <&tsens1 1>;
+                       thermal-sensors = <&tsens0 10>;
 
                        trips {
-                               cpu_alert7: trip0 {
+                               cpu7_alert0: trip-point@0 {
                                        temperature = <75000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
-                               cpu_crit7: trip1 {
+                               cpu7_crit: cpu_crit {
                                        temperature = <110000>;
                                        hysteresis = <2000>;
                                        type = "critical";
                        };
                };
 
-               gpu-thermal {
+               gpu-thermal-bottom {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 12>;
+
+                       trips {
+                               gpu1_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               gpu-thermal-top {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 13>;
+
+                       trips {
+                               gpu2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               clust0-mhm-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 5>;
+
+                       trips {
+                               cluster0_mhm_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               clust1-mhm-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 6>;
+
+                       trips {
+                               cluster1_mhm_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               cluster1-l2-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 11>;
+
+                       trips {
+                               cluster1_l2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               modem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 1>;
+
+                       trips {
+                               modem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               mem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 2>;
+
+                       trips {
+                               mem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               wlan-thermal {
                        polling-delay-passive = <250>;
                        polling-delay = <1000>;
 
                        thermal-sensors = <&tsens1 3>;
+
+                       trips {
+                               wlan_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               q6-dsp-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 4>;
+
+                       trips {
+                               q6_dsp_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               camera-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 5>;
+
+                       trips {
+                               camera_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               multimedia-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 6>;
+
+                       trips {
+                               multimedia_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
                };
        };
 
                        cell-index = <0>;
                };
 
-               tsens0: thermal@10aa000 {
+               tsens0: thermal@10ab000 {
                        compatible = "qcom,msm8998-tsens", "qcom,tsens-v2";
-                       reg = <0x10aa000 0x2000>;
+                       reg = <0x10ab000 0x1000>, /* TM */
+                             <0x10aa000 0x1000>; /* SROT */
 
-                       #qcom,sensors = <12>;
+                       #qcom,sensors = <14>;
                        #thermal-sensor-cells = <1>;
                };
 
-               tsens1: thermal@10ad000 {
+               tsens1: thermal@10ae000 {
                        compatible = "qcom,msm8998-tsens", "qcom,tsens-v2";
-                       reg = <0x10ad000 0x2000>;
+                       reg = <0x10ae000 0x1000>, /* TM */
+                             <0x10ad000 0x1000>; /* SROT */
 
                        #qcom,sensors = <8>;
                        #thermal-sensor-cells = <1>;
 
                blsp2_i2c5: i2c@c1ba000 {
                        compatible = "qcom,i2c-qup-v2.2.1";
-                       reg = <0x0c175000 0x600>;
+                       reg = <0x0c1ba000 0x600>;
                        interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
 
                        clocks = <&gcc GCC_BLSP2_QUP6_I2C_APPS_CLK>,
                        redistributor-stride = <0x0 0x20000>;
                        interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
                };
+
+               ufshc: ufshc@1da4000 {
+                       compatible = "qcom,msm8998-ufshc", "qcom,ufshc", "jedec,ufs-2.0";
+                       reg = <0x01da4000 0x2500>;
+                       interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>;
+                       phys = <&ufsphy_lanes>;
+                       phy-names = "ufsphy";
+                       lanes-per-direction = <2>;
+                       power-domains = <&gcc UFS_GDSC>;
+                       #reset-cells = <1>;
+
+                       clock-names =
+                               "core_clk",
+                               "bus_aggr_clk",
+                               "iface_clk",
+                               "core_clk_unipro",
+                               "ref_clk",
+                               "tx_lane0_sync_clk",
+                               "rx_lane0_sync_clk",
+                               "rx_lane1_sync_clk";
+                       clocks =
+                               <&gcc GCC_UFS_AXI_CLK>,
+                               <&gcc GCC_AGGRE1_UFS_AXI_CLK>,
+                               <&gcc GCC_UFS_AHB_CLK>,
+                               <&gcc GCC_UFS_UNIPRO_CORE_CLK>,
+                               <&rpmcc RPM_SMD_LN_BB_CLK1>,
+                               <&gcc GCC_UFS_TX_SYMBOL_0_CLK>,
+                               <&gcc GCC_UFS_RX_SYMBOL_0_CLK>,
+                               <&gcc GCC_UFS_RX_SYMBOL_1_CLK>;
+                       freq-table-hz =
+                               <50000000 200000000>,
+                               <0 0>,
+                               <0 0>,
+                               <37500000 150000000>,
+                               <0 0>,
+                               <0 0>,
+                               <0 0>,
+                               <0 0>;
+
+                       resets = <&gcc GCC_UFS_BCR>;
+                       reset-names = "rst";
+               };
+
+               ufsphy: phy@1da7000 {
+                       compatible = "qcom,msm8998-qmp-ufs-phy";
+                       reg = <0x01da7000 0x18c>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       clock-names =
+                               "ref",
+                               "ref_aux";
+                       clocks =
+                               <&gcc GCC_UFS_CLKREF_CLK>,
+                               <&gcc GCC_UFS_PHY_AUX_CLK>;
+
+                       reset-names = "ufsphy";
+                       resets = <&ufshc 0>;
+
+                       ufsphy_lanes: lanes@1da7400 {
+                               reg = <0x01da7400 0x128>,
+                                     <0x01da7600 0x1fc>,
+                                     <0x01da7c00 0x1dc>,
+                                     <0x01da7800 0x128>,
+                                     <0x01da7a00 0x1fc>;
+                               #phy-cells = <0>;
+                       };
+               };
        };
 };
 
index c0ddf12..3f97607 100644 (file)
@@ -15,6 +15,7 @@
                        compatible = "qcom,pm8005-gpio", "qcom,spmi-gpio";
                        reg = <0xc000>;
                        gpio-controller;
+                       gpio-ranges = <&pm8005_gpio 0 0 4>;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
index 43cb5ea..d3ca35a 100644 (file)
@@ -58,6 +58,8 @@
                        compatible = "qcom,spmi-temp-alarm";
                        reg = <0x2400>;
                        interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
+                       io-channels = <&pm8998_adc ADC5_DIE_TEMP>;
+                       io-channel-names = "thermal";
                        #thermal-sensor-cells = <0>;
                };
 
@@ -93,6 +95,7 @@
                        compatible = "qcom,pm8998-gpio", "qcom,spmi-gpio";
                        reg = <0xc000>;
                        gpio-controller;
+                       gpio-ranges = <&pm8998_gpio 0 0 26>;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
index 3aee10e..21e0521 100644 (file)
@@ -14,6 +14,7 @@
                        compatible = "qcom,pmi8994-gpio", "qcom,spmi-gpio";
                        reg = <0xc000>;
                        gpio-controller;
+                       gpio-ranges = <&pmi8994_gpios 0 0 10>;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
index 051f57e..23f9146 100644 (file)
@@ -13,6 +13,7 @@
                        compatible = "qcom,pmi8998-gpio", "qcom,spmi-gpio";
                        reg = <0xc000>;
                        gpio-controller;
+                       gpio-ranges = <&pmi8998_gpio 0 0 14>;
                        #gpio-cells = <2>;
                        interrupt-controller;
                        #interrupt-cells = <2>;
index 1bb836d..e8e186b 100644 (file)
                        interrupts = <0x0 0x61 0x1 IRQ_TYPE_NONE>;
                };
        };
+
+       pms405_1: pms405@1 {
+               compatible = "qcom,spmi-pmic";
+               reg = <0x1 SPMI_USID>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               pms405_spmi_regulators: regulators {
+                       compatible = "qcom,pms405-regulators";
+               };
+       };
 };
index 2c14903..937eb45 100644 (file)
@@ -7,5 +7,6 @@
 
 / {
        model = "Qualcomm Technologies, Inc. QCS404 EVB 1000";
-       compatible = "qcom,qcs404-evb";
+       compatible = "qcom,qcs404-evb-1000", "qcom,qcs404-evb",
+                    "qcom,qcs404";
 };
index 11269ad..479ad3a 100644 (file)
@@ -3,9 +3,92 @@
 
 /dts-v1/;
 
+#include <dt-bindings/gpio/gpio.h>
 #include "qcs404-evb.dtsi"
 
 / {
        model = "Qualcomm Technologies, Inc. QCS404 EVB 4000";
-       compatible = "qcom,qcs404-evb";
+       compatible = "qcom,qcs404-evb-4000", "qcom,qcs404-evb",
+                    "qcom,qcs404";
+};
+
+&ethernet {
+       status = "ok";
+
+       snps,reset-gpio = <&tlmm 60 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 10000>;
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&ethernet_defaults>;
+
+       phy-handle = <&phy1>;
+       phy-mode = "rgmii";
+       mdio {
+               #address-cells = <0x1>;
+               #size-cells = <0x0>;
+               compatible = "snps,dwmac-mdio";
+               phy1: phy@4 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       device_type = "ethernet-phy";
+                       reg = <0x4>;
+               };
+       };
+};
+
+&tlmm {
+       ethernet_defaults: ethernet-defaults {
+               int {
+                       pins = "gpio61";
+                       function = "rgmii_int";
+                       bias-disable;
+                       drive-strength = <2>;
+               };
+               mdc {
+                       pins = "gpio76";
+                       function = "rgmii_mdc";
+                       bias-pull-up;
+               };
+               mdio {
+                       pins = "gpio75";
+                       function = "rgmii_mdio";
+                       bias-pull-up;
+               };
+               tx {
+                       pins = "gpio67", "gpio66", "gpio65", "gpio64";
+                       function = "rgmii_tx";
+                       bias-pull-up;
+                       drive-strength = <16>;
+               };
+               rx {
+                       pins = "gpio73", "gpio72", "gpio71", "gpio70";
+                       function = "rgmii_rx";
+                       bias-disable;
+                       drive-strength = <2>;
+               };
+               tx-ctl {
+                       pins = "gpio68";
+                       function = "rgmii_ctl";
+                       bias-pull-up;
+                       drive-strength = <16>;
+               };
+               rx-ctl {
+                       pins = "gpio74";
+                       function = "rgmii_ctl";
+                       bias-disable;
+                       drive-strength = <2>;
+               };
+               tx-ck {
+                       pins = "gpio63";
+                       function = "rgmii_ck";
+                       bias-pull-up;
+                       drive-strength = <16>;
+               };
+               rx-ck {
+                       pins = "gpio69";
+                       function = "rgmii_ck";
+                       bias-disable;
+                       drive-strength = <2>;
+               };
+       };
 };
index 50b3589..2c31271 100644 (file)
@@ -7,6 +7,7 @@
 / {
        aliases {
                serial0 = &blsp1_uart2;
+               serial1 = &blsp1_uart3;
        };
 
        chosen {
                regulator-always-on;
                regulator-boot-on;
        };
+
+       vdd_ch0_3p3:
+       vdd_esmps3_3p3: vdd-esmps3-3p3-regulator {
+               compatible = "regulator-fixed";
+               regulator-name = "eSMPS3_3P3";
+
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+};
+
+&blsp1_uart3 {
+       status = "okay";
+
+       bluetooth {
+               compatible = "qcom,wcn3990-bt";
+               vddio-supply = <&vreg_l6_1p8>;
+               vddxo-supply = <&vreg_l5_1p8>;
+               vddrf-supply = <&vreg_l1_1p3>;
+               vddch0-supply = <&vdd_ch0_3p3>;
+
+               local-bd-address = [ 02 00 00 00 5a ad ];
+
+               max-speed = <3200000>;
+       };
+};
+
+&blsp1_dma {
+       qcom,controlled-remotely;
+};
+
+&blsp2_dma {
+       qcom,controlled-remotely;
+};
+
+&pms405_spmi_regulators {
+       vdd_s3-supply = <&pms405_s3>;
+
+       pms405_s3: s3 {
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-name = "vdd_apc";
+               regulator-min-microvolt = <1048000>;
+               regulator-max-microvolt = <1352000>;
+       };
 };
 
 &remoteproc_adsp {
        pms405-regulators {
                compatible = "qcom,rpm-pms405-regulators";
 
-               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-l1-l2-supply = <&vreg_s5_1p35>;
-               vdd-l3-l8-supply = <&vreg_s5_1p35>;
-               vdd-l4-supply = <&vreg_s5_1p35>;
-               vdd-l5-l6-supply = <&vreg_s4_1p8>;
-               vdd-l7-supply = <&vph_pwr>;
-               vdd-l9-supply = <&vreg_s5_1p35>;
-               vdd-l10-l11-l12-l13-supply = <&vph_pwr>;
+               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_l1_l2-supply = <&vreg_s5_1p35>;
+               vdd_l3_l8-supply = <&vreg_s5_1p35>;
+               vdd_l4-supply = <&vreg_s5_1p35>;
+               vdd_l5_l6-supply = <&vreg_s4_1p8>;
+               vdd_l7-supply = <&vph_pwr>;
+               vdd_l9-supply = <&vreg_s5_1p35>;
+               vdd_l10_l11_l12_l13-supply = <&vph_pwr>;
 
                vreg_s4_1p8: s4 {
                        regulator-min-microvolt = <1728000>;
                };
 
                vreg_s5_1p35: s5 {
-                       regulator-min-microvolt = <>;
-                       regulator-max-microvolt = <>;
+                       regulator-min-microvolt = <1352000>;
+                       regulator-max-microvolt = <1352000>;
                };
 
                vreg_l1_1p3: l1 {
                };
 
                vreg_l3_1p05: l3 {
-                       regulator-min-microvolt = <976000>;
+                       regulator-min-microvolt = <1050000>;
                        regulator-max-microvolt = <1160000>;
                };
 
                bias-disable;
        };
 };
+
+&blsp1_uart3_default {
+       cts {
+               pins = "gpio84";
+               bias-disable;
+       };
+
+       rts-tx {
+               pins = "gpio85", "gpio82";
+               drive-strength = <2>;
+               bias-disable;
+       };
+
+       rx {
+               pins = "gpio83";
+               bias-pull-up;
+       };
+};
index e8fd266..ffedf96 100644 (file)
                        clocks = <&gcc GCC_BLSP1_AHB_CLK>;
                        clock-names = "bam_clk";
                        #dma-cells = <1>;
-                       qcom,controlled-remotely = <1>;
                        qcom,ee = <0>;
                        status = "okay";
                };
                        status = "okay";
                };
 
+               ethernet: ethernet@7a80000 {
+                       compatible = "qcom,qcs404-ethqos";
+                       reg = <0x07a80000 0x10000>,
+                               <0x07a96000 0x100>;
+                       reg-names = "stmmaceth", "rgmii";
+                       clock-names = "stmmaceth", "pclk", "ptp_ref", "rgmii";
+                       clocks = <&gcc GCC_ETH_AXI_CLK>,
+                               <&gcc GCC_ETH_SLAVE_AHB_CLK>,
+                               <&gcc GCC_ETH_PTP_CLK>,
+                               <&gcc GCC_ETH_RGMII_CLK>;
+                       interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
+                                       <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "macirq", "eth_lpi";
+
+                       snps,tso;
+                       rx-fifo-depth = <4096>;
+                       tx-fifo-depth = <4096>;
+
+                       status = "disabled";
+               };
+
                wifi: wifi@a000000 {
                        compatible = "qcom,wcn3990-wifi";
                        reg = <0xa000000 0x800000>;
                        clocks = <&gcc GCC_BLSP2_AHB_CLK>;
                        clock-names = "bam_clk";
                        #dma-cells = <1>;
-                       qcom,controlled-remotely = <1>;
                        qcom,ee = <0>;
                        status = "disabled";
                };
index af8c6a2..02b8357 100644 (file)
        };
 };
 
+&adsp_pas {
+       status = "okay";
+};
+
 &apps_rsc {
        pm8998-rpmh-regulators {
                compatible = "qcom,pm8998-rpmh-regulators";
        };
 };
 
+&cdsp_pas {
+       status = "okay";
+};
+
 &gcc {
        protected-clocks = <GCC_QSPI_CORE_CLK>,
                           <GCC_QSPI_CORE_CLK_SRC>,
index 5308f16..fcb9330 100644 (file)
 #include <dt-bindings/clock/qcom,lpass-sdm845.h>
 #include <dt-bindings/clock/qcom,rpmh.h>
 #include <dt-bindings/clock/qcom,videocc-sdm845.h>
+#include <dt-bindings/interconnect/qcom,sdm845.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/phy/phy-qcom-qusb2.h>
+#include <dt-bindings/power/qcom-rpmpd.h>
 #include <dt-bindings/reset/qcom,sdm845-aoss.h>
 #include <dt-bindings/reset/qcom,sdm845-pdc.h>
 #include <dt-bindings/soc/qcom,rpmh-rsc.h>
                #size-cells = <2>;
                ranges;
 
-               memory@85fc0000 {
+               hyp_mem: memory@85700000 {
+                       reg = <0 0x85700000 0 0x600000>;
+                       no-map;
+               };
+
+               xbl_mem: memory@85e00000 {
+                       reg = <0 0x85e00000 0 0x100000>;
+                       no-map;
+               };
+
+               aop_mem: memory@85fc0000 {
                        reg = <0 0x85fc0000 0 0x20000>;
                        no-map;
                };
 
-               memory@85fe0000 {
+               aop_cmd_db_mem: memory@85fe0000 {
                        compatible = "qcom,cmd-db";
-                       reg = <0x0 0x85fe0000 0x0 0x20000>;
+                       reg = <0x0 0x85fe0000 0 0x20000>;
                        no-map;
                };
 
                smem_mem: memory@86000000 {
-                       reg = <0x0 0x86000000 0x0 0x200000>;
+                       reg = <0x0 0x86000000 0 0x200000>;
                        no-map;
                };
 
-               memory@86200000 {
+               tz_mem: memory@86200000 {
                        reg = <0 0x86200000 0 0x2d00000>;
                        no-map;
                };
 
-               wlan_msa_mem: memory@96700000 {
-                       reg = <0 0x96700000 0 0x100000>;
+               rmtfs_mem: memory@88f00000 {
+                       compatible = "qcom,rmtfs-mem";
+                       reg = <0 0x88f00000 0 0x200000>;
+                       no-map;
+
+                       qcom,client-id = <1>;
+                       qcom,vmid = <15>;
+               };
+
+               qseecom_mem: memory@8ab00000 {
+                       reg = <0 0x8ab00000 0 0x1400000>;
+                       no-map;
+               };
+
+               camera_mem: memory@8bf00000 {
+                       reg = <0 0x8bf00000 0 0x500000>;
+                       no-map;
+               };
+
+               ipa_fw_mem: memory@8c400000 {
+                       reg = <0 0x8c400000 0 0x10000>;
+                       no-map;
+               };
+
+               ipa_gsi_mem: memory@8c410000 {
+                       reg = <0 0x8c410000 0 0x5000>;
+                       no-map;
+               };
+
+               gpu_mem: memory@8c415000 {
+                       reg = <0 0x8c415000 0 0x2000>;
+                       no-map;
+               };
+
+               adsp_mem: memory@8c500000 {
+                       reg = <0 0x8c500000 0 0x1a00000>;
+                       no-map;
+               };
+
+               wlan_msa_mem: memory@8df00000 {
+                       reg = <0 0x8df00000 0 0x100000>;
                        no-map;
                };
 
                        no-map;
                };
 
+               venus_mem: memory@95800000 {
+                       reg = <0 0x95800000 0 0x500000>;
+                       no-map;
+               };
+
+               cdsp_mem: memory@95d00000 {
+                       reg = <0 0x95d00000 0 0x800000>;
+                       no-map;
+               };
+
                mba_region: memory@96500000 {
                        reg = <0 0x96500000 0 0x200000>;
                        no-map;
                };
+
+               slpi_mem: memory@96700000 {
+                       reg = <0 0x96700000 0 0x1400000>;
+                       no-map;
+               };
+
+               spss_mem: memory@97b00000 {
+                       reg = <0 0x97b00000 0 0x100000>;
+                       no-map;
+               };
        };
 
        cpus {
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x0>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <607>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_0>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x100>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <607>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_100>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x200>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <607>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_200>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x300>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <607>;
                        qcom,freq-domain = <&cpufreq_hw 0>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_300>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x400>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_400>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x500>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_500>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x600>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_600>;
                        compatible = "qcom,kryo385";
                        reg = <0x0 0x700>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        qcom,freq-domain = <&cpufreq_hw 1>;
                        #cooling-cells = <2>;
                        next-level-cache = <&L2_700>;
                                next-level-cache = <&L3_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>;
+                               };
+                       };
+               };
        };
 
        pmu {
                };
        };
 
+       adsp_pas: remoteproc-adsp {
+               compatible = "qcom,sdm845-adsp-pas";
+
+               interrupts-extended = <&intc GIC_SPI 162 IRQ_TYPE_EDGE_RISING>,
+                                     <&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+                                     <&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+                                     <&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+                                     <&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+               interrupt-names = "wdog", "fatal", "ready",
+                                 "handover", "stop-ack";
+
+               clocks = <&rpmhcc RPMH_CXO_CLK>;
+               clock-names = "xo";
+
+               memory-region = <&adsp_mem>;
+
+               qcom,smem-states = <&adsp_smp2p_out 0>;
+               qcom,smem-state-names = "stop";
+
+               status = "disabled";
+
+               glink-edge {
+                       interrupts = <GIC_SPI 156 IRQ_TYPE_EDGE_RISING>;
+                       label = "lpass";
+                       qcom,remote-pid = <2>;
+                       mboxes = <&apss_shared 8>;
+               };
+       };
+
+       cdsp_pas: remoteproc-cdsp {
+               compatible = "qcom,sdm845-cdsp-pas";
+
+               interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>,
+                                     <&cdsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+                                     <&cdsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+                                     <&cdsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+                                     <&cdsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+               interrupt-names = "wdog", "fatal", "ready",
+                                 "handover", "stop-ack";
+
+               clocks = <&rpmhcc RPMH_CXO_CLK>;
+               clock-names = "xo";
+
+               memory-region = <&cdsp_mem>;
+
+               qcom,smem-states = <&cdsp_smp2p_out 0>;
+               qcom,smem-state-names = "stop";
+
+               status = "disabled";
+
+               glink-edge {
+                       interrupts = <GIC_SPI 574 IRQ_TYPE_EDGE_RISING>;
+                       label = "turing";
+                       qcom,remote-pid = <5>;
+                       mboxes = <&apss_shared 4>;
+               };
+       };
+
        tcsr_mutex: hwlock {
                compatible = "qcom,tcsr-mutex";
                syscon = <&tcsr_mutex_regs 0 0x1000>;
                        phy-names = "ufsphy";
                        lanes-per-direction = <2>;
                        power-domains = <&gcc UFS_PHY_GDSC>;
+                       #reset-cells = <1>;
 
                        iommus = <&apps_smmu 0x100 0xf>;
 
                        clocks = <&gcc GCC_UFS_MEM_CLKREF_CLK>,
                                 <&gcc GCC_UFS_PHY_PHY_AUX_CLK>;
 
+                       resets = <&ufs_mem_hc 0>;
+                       reset-names = "ufsphy";
                        status = "disabled";
 
                        ufs_mem_phy_lanes: lanes@1d87400 {
                                #clock-cells = <1>;
                                #phy-cells = <0>;
 
-                               clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>;
-                               clock-names = "iface";
+                               clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>,
+                                        <&rpmhcc RPMH_CXO_CLK>;
+                               clock-names = "iface", "ref";
 
                                status = "disabled";
                        };
                                #clock-cells = <1>;
                                #phy-cells = <0>;
 
-                               clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>;
-                               clock-names = "iface";
+                               clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>,
+                                        <&rpmhcc RPMH_CXO_CLK>;
+                               clock-names = "iface", "ref";
 
                                status = "disabled";
                        };
                                        compatible = "operating-points-v2";
 
                                        rpmhpd_opp_ret: opp1 {
-                                               opp-level = <16>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_RETENTION>;
                                        };
 
                                        rpmhpd_opp_min_svs: opp2 {
-                                               opp-level = <48>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_MIN_SVS>;
                                        };
 
                                        rpmhpd_opp_low_svs: opp3 {
-                                               opp-level = <64>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_LOW_SVS>;
                                        };
 
                                        rpmhpd_opp_svs: opp4 {
-                                               opp-level = <128>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_SVS>;
                                        };
 
                                        rpmhpd_opp_svs_l1: opp5 {
-                                               opp-level = <192>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_SVS_L1>;
                                        };
 
                                        rpmhpd_opp_nom: opp6 {
-                                               opp-level = <256>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_NOM>;
                                        };
 
                                        rpmhpd_opp_nom_l1: opp7 {
-                                               opp-level = <320>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_NOM_L1>;
                                        };
 
                                        rpmhpd_opp_nom_l2: opp8 {
-                                               opp-level = <336>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_NOM_L2>;
                                        };
 
                                        rpmhpd_opp_turbo: opp9 {
-                                               opp-level = <384>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_TURBO>;
                                        };
 
                                        rpmhpd_opp_turbo_l1: opp10 {
-                                               opp-level = <416>;
+                                               opp-level = <RPMH_REGULATOR_LEVEL_TURBO_L1>;
                                        };
                                };
                        };
                                };
                        };
                };
+
+               aoss0-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 0>;
+
+                       trips {
+                               aoss0_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               cluster0-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 5>;
+
+                       trips {
+                               cluster0_alert0: trip-point@0 {
+                                       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-point@0 {
+                                       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 11>;
+
+                       trips {
+                               gpu1_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               gpu-thermal-bottom {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens0 12>;
+
+                       trips {
+                               gpu2_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               aoss1-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 0>;
+
+                       trips {
+                               aoss1_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               q6-modem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 1>;
+
+                       trips {
+                               q6_modem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               mem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 2>;
+
+                       trips {
+                               mem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               wlan-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 3>;
+
+                       trips {
+                               wlan_alert0: trip-point@0 {
+                                       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-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               camera-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 5>;
+
+                       trips {
+                               camera_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               video-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 6>;
+
+                       trips {
+                               video_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
+
+               modem-thermal {
+                       polling-delay-passive = <250>;
+                       polling-delay = <1000>;
+
+                       thermal-sensors = <&tsens1 7>;
+
+                       trips {
+                               modem_alert0: trip-point@0 {
+                                       temperature = <90000>;
+                                       hysteresis = <2000>;
+                                       type = "hot";
+                               };
+                       };
+               };
        };
 };
index c108d73..90c897a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-mele-v9.dtb
 dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-probox2-ava.dtb
 dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-zidoo-x9s.dtb
index 14db667..aaefc3a 100644 (file)
        };
 };
 
+&can0 {
+       pinctrl-0 = <&can0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-0 = <&can1_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
 &pciec0 {
        status = "okay";
 };
                        function = "avb";
                };
        };
+
+       can0_pins: can0 {
+               groups = "can0_data";
+               function = "can0";
+       };
+
+       can1_pins: can1 {
+               groups = "can1_data";
+               function = "can1";
+       };
 };
index ef3cff2..de282c4 100644 (file)
                                     "renesas,rcar-gen3-can";
                        reg = <0 0xe6c30000 0 0x1000>;
                        interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 916>, <&can_clk>;
-                       clock-names = "clkp1", "can_clk";
+                       clocks = <&cpg CPG_MOD 916>,
+                                <&cpg CPG_CORE R8A774A1_CLK_CANFD>,
+                                <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
                        power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
                        resets = <&cpg 916>;
                        status = "disabled";
                                     "renesas,rcar-gen3-can";
                        reg = <0 0xe6c38000 0 0x1000>;
                        interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 915>, <&can_clk>;
-                       clock-names = "clkp1", "can_clk";
+                       clocks = <&cpg CPG_MOD 915>,
+                                <&cpg CPG_CORE R8A774A1_CLK_CANFD>,
+                                <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
                        power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
                        resets = <&cpg 915>;
                        status = "disabled";
index 96ee0d2..013a48c 100644 (file)
                stdout-path = "serial0:115200n8";
        };
 
+       leds {
+               compatible = "gpio-leds";
+
+               led0 {
+                       gpios = <&gpio5 19 GPIO_ACTIVE_HIGH>;
+                       label = "LED0";
+               };
+
+               led1 {
+                       gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+                       label = "LED1";
+               };
+
+               led2 {
+                       gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>;
+                       label = "LED2";
+               };
+
+               led3 {
+                       gpios = <&gpio6 4 GPIO_ACTIVE_HIGH>;
+                       label = "LED3";
+               };
+       };
+
        memory@48000000 {
                device_type = "memory";
                /* first 128MB is reserved for secure area. */
        };
 };
 
+&ehci0 {
+       dr_mode = "host";
+       status = "okay";
+};
+
 &extal_clk {
        clock-frequency = <48000000>;
 };
 
+&i2c1 {
+       pinctrl-0 = <&i2c1_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+       clock-frequency = <400000>;
+
+       rtc@32 {
+               compatible = "epson,rx8571";
+               reg = <0x32>;
+       };
+};
+
+&ohci0 {
+       dr_mode = "host";
+       status = "okay";
+};
+
 &pcie_bus_clk {
        clock-frequency = <100000000>;
 };
 };
 
 &pfc {
+       i2c1_pins: i2c1 {
+               groups = "i2c1_b";
+               function = "i2c1";
+       };
+
        scif2_pins: scif2 {
                groups = "scif2_data_a";
                function = "scif2";
        };
 };
 
+&rwdt {
+       timeout-sec = <60>;
+       status = "okay";
+};
+
 &scif2 {
        pinctrl-0 = <&scif2_pins>;
        pinctrl-names = "default";
        sd-uhs-sdr104;
        status = "okay";
 };
+
+&usb2_phy0 {
+       renesas,no-otg-pins;
+       status = "okay";
+};
index 1ea684a..3f86db1 100644 (file)
@@ -76,7 +76,7 @@
                        power-domains = <&sysc R8A774C0_PD_CA53_CPU0>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
-                       clocks =<&cpg CPG_CORE R8A774C0_CLK_Z2>;
+                       clocks = <&cpg CPG_CORE R8A774C0_CLK_Z2>;
                        operating-points-v2 = <&cluster1_opp>;
                };
 
@@ -87,7 +87,7 @@
                        power-domains = <&sysc R8A774C0_PD_CA53_CPU1>;
                        next-level-cache = <&L2_CA53>;
                        enable-method = "psci";
-                       clocks =<&cpg CPG_CORE R8A774C0_CLK_Z2>;
+                       clocks = <&cpg CPG_CORE R8A774C0_CLK_Z2>;
                        operating-points-v2 = <&cluster1_opp>;
                };
 
                                     "renesas,rcar-gen3-can";
                        reg = <0 0xe6c30000 0 0x1000>;
                        interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 916>, <&can_clk>;
-                       clock-names = "clkp1", "can_clk";
+                       clocks = <&cpg CPG_MOD 916>,
+                                <&cpg CPG_CORE R8A774C0_CLK_CANFD>,
+                                <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
                        power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
                        resets = <&cpg 916>;
                        status = "disabled";
                                     "renesas,rcar-gen3-can";
                        reg = <0 0xe6c38000 0 0x1000>;
                        interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&cpg CPG_MOD 915>, <&can_clk>;
-                       clock-names = "clkp1", "can_clk";
+                       clocks = <&cpg CPG_MOD 915>,
+                                <&cpg CPG_CORE R8A774C0_CLK_CANFD>,
+                                <&can_clk>;
+                       clock-names = "clkp1", "clkp2", "can_clk";
                        power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
                        resets = <&cpg 915>;
                        status = "disabled";
                };
 
+               canfd: can@e66c0000 {
+                       compatible = "renesas,r8a774c0-canfd",
+                                    "renesas,rcar-gen3-canfd";
+                       reg = <0 0xe66c0000 0 0x8000>;
+                       interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 914>,
+                                <&cpg CPG_CORE R8A774C0_CLK_CANFD>,
+                                <&can_clk>;
+                       clock-names = "fck", "canfd", "can_clk";
+                       assigned-clocks = <&cpg CPG_CORE R8A774C0_CLK_CANFD>;
+                       assigned-clock-rates = <40000000>;
+                       power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>;
+                       resets = <&cpg 914>;
+                       status = "disabled";
+
+                       channel0 {
+                               status = "disabled";
+                       };
+
+                       channel1 {
+                               status = "disabled";
+                       };
+               };
+
                pwm0: pwm@e6e30000 {
                        compatible = "renesas,pwm-r8a774c0", "renesas,pwm-rcar";
                        reg = <0 0xe6e30000 0 0x8>;
                };
 
                csi40: csi2@feaa0000 {
-                       compatible = "renesas,r8a774c0-csi2",
-                                    "renesas,rcar-gen3-csi2";
+                       compatible = "renesas,r8a774c0-csi2";
                        reg = <0 0xfeaa0000 0 0x10000>;
                        interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&cpg CPG_MOD 716>;
index abeac30..097538c 100644 (file)
                        reg = <0 0xe6060000 0 0x50c>;
                };
 
+               cmt0: timer@e60f0000 {
+                       compatible = "renesas,r8a7795-cmt0",
+                                    "renesas,rcar-gen3-cmt0";
+                       reg = <0 0xe60f0000 0 0x1004>;
+                       interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 303>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 303>;
+                       status = "disabled";
+               };
+
+               cmt1: timer@e6130000 {
+                       compatible = "renesas,r8a7795-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6130000 0 0x1004>;
+                       interrupts = <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>;
+                       clocks = <&cpg CPG_MOD 302>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 302>;
+                       status = "disabled";
+               };
+
+               cmt2: timer@e6140000 {
+                       compatible = "renesas,r8a7795-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6140000 0 0x1004>;
+                       interrupts = <GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 301>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 301>;
+                       status = "disabled";
+               };
+
+               cmt3: timer@e6148000 {
+                       compatible = "renesas,r8a7795-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6148000 0 0x1004>;
+                       interrupts = <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 477 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 300>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+                       resets = <&cpg 300>;
+                       status = "disabled";
+               };
+
                cpg: clock-controller@e6150000 {
                        compatible = "renesas,r8a7795-cpg-mssr";
                        reg = <0 0xe6150000 0 0x1000>;
                                <0 0xec5a0000 0 0x100>,  /* ADG */
                                <0 0xec540000 0 0x1000>, /* SSIU */
                                <0 0xec541000 0 0x280>,  /* SSI */
-                               <0 0xec740000 0 0x200>;  /* Audio DMAC peri peri*/
+                               <0 0xec760000 0 0x200>;  /* Audio DMAC peri peri*/
                        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
 
                        clocks = <&cpg CPG_MOD 1005>,
index b4f9567..2aefa53 100644 (file)
@@ -68,6 +68,7 @@
        ports {
                /* rsnd_port0 is on salvator-common */
                rsnd_port1: port@1 {
+                       reg = <1>;
                        rsnd_endpoint1: endpoint {
                                remote-endpoint = <&dw_hdmi0_snd_in>;
 
index 31f1205..d58ede1 100644 (file)
@@ -68,6 +68,7 @@
        ports {
                /* rsnd_port0 is on salvator-common */
                rsnd_port1: port@1 {
+                       reg = <1>;
                        rsnd_endpoint1: endpoint {
                                remote-endpoint = <&dw_hdmi0_snd_in>;
 
index cdf7848..d5e2f4a 100644 (file)
                                <0 0xec5a0000 0 0x100>,  /* ADG */
                                <0 0xec540000 0 0x1000>, /* SSIU */
                                <0 0xec541000 0 0x280>,  /* SSI */
-                               <0 0xec740000 0 0x200>;  /* Audio DMAC peri peri*/
+                               <0 0xec760000 0 0x200>;  /* Audio DMAC peri peri*/
                        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
 
                        clocks = <&cpg CPG_MOD 1005>,
                                        dma-names = "rx", "tx";
                                };
                        };
-
-                       ports {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               port@0 {
-                                       reg = <0>;
-                               };
-                               port@1 {
-                                       reg = <1>;
-                               };
-                       };
                };
 
                audma0: dma-controller@ec700000 {
index 9763d10..2554b17 100644 (file)
                        reg = <0 0xe6060000 0 0x50c>;
                };
 
+               cmt0: timer@e60f0000 {
+                       compatible = "renesas,r8a77965-cmt0",
+                                    "renesas,rcar-gen3-cmt0";
+                       reg = <0 0xe60f0000 0 0x1004>;
+                       interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 303>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77965_PD_ALWAYS_ON>;
+                       resets = <&cpg 303>;
+                       status = "disabled";
+               };
+
+               cmt1: timer@e6130000 {
+                       compatible = "renesas,r8a77965-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6130000 0 0x1004>;
+                       interrupts = <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>;
+                       clocks = <&cpg CPG_MOD 302>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77965_PD_ALWAYS_ON>;
+                       resets = <&cpg 302>;
+                       status = "disabled";
+               };
+
+               cmt2: timer@e6140000 {
+                       compatible = "renesas,r8a77965-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6140000 0 0x1004>;
+                       interrupts = <GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 301>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77965_PD_ALWAYS_ON>;
+                       resets = <&cpg 301>;
+                       status = "disabled";
+               };
+
+               cmt3: timer@e6148000 {
+                       compatible = "renesas,r8a77965-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6148000 0 0x1004>;
+                       interrupts = <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 477 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 300>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77965_PD_ALWAYS_ON>;
+                       resets = <&cpg 300>;
+                       status = "disabled";
+               };
+
                cpg: clock-controller@e6150000 {
                        compatible = "renesas,r8a77965-cpg-mssr";
                        reg = <0 0xe6150000 0 0x1000>;
                                <0 0xec5a0000 0 0x100>,  /* ADG */
                                <0 0xec540000 0 0x1000>, /* SSIU */
                                <0 0xec541000 0 0x280>,  /* SSI */
-                               <0 0xec740000 0 0x200>;  /* Audio DMAC peri peri*/
+                               <0 0xec760000 0 0x200>;  /* Audio DMAC peri peri*/
                        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
 
                        clocks = <&cpg CPG_MOD 1005>,
                                };
                        };
 
+                       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>, <&audma0 0x15>, <&audma1 0x16>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x49>, <&audma1 0x4a>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x63>, <&audma1 0x64>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x6f>, <&audma1 0x70>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x71>, <&audma1 0x72>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x73>, <&audma1 0x74>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x75>, <&audma1 0x76>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x79>, <&audma1 0x7a>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x7b>, <&audma1 0x7c>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       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>, <&audma0 0x7d>, <&audma1 0x7e>;
-                                       dma-names = "rx", "tx", "rxu", "txu";
+                                       dmas = <&audma0 0x13>, <&audma1 0x14>;
+                                       dma-names = "rx", "tx";
                                };
                        };
                };
                du: display@feb00000 {
                        compatible = "renesas,du-r8a77965";
                        reg = <0 0xfeb00000 0 0x80000>;
-                       reg-names = "du";
                        interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
                                     <GIC_SPI 270 IRQ_TYPE_LEVEL_HIGH>;
index 4081622..a901a34 100644 (file)
                        clocks = <&cpg CPG_MOD 811>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 811>;
+                       renesas,id = <0>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 810>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        status = "disabled";
+                       renesas,id = <1>;
                        resets = <&cpg 810>;
 
                        ports {
                        clocks = <&cpg CPG_MOD 809>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 809>;
+                       renesas,id = <2>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 808>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 808>;
+                       renesas,id = <3>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 807>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 807>;
+                       renesas,id = <4>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 806>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 806>;
+                       renesas,id = <5>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 805>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 805>;
+                       renesas,id = <6>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 804>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 804>;
+                       renesas,id = <7>;
                        status = "disabled";
 
                        ports {
                        clocks = <&cpg CPG_MOD 628>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 628>;
+                       renesas,id = <8>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 627>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 627>;
+                       renesas,id = <9>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 625>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 625>;
+                       renesas,id = <10>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 618>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 618>;
+                       renesas,id = <11>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 612>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 612>;
+                       renesas,id = <12>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 608>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 608>;
+                       renesas,id = <13>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 605>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 605>;
+                       renesas,id = <14>;
                        status = "disabled";
                };
 
                        clocks = <&cpg CPG_MOD 604>;
                        power-domains = <&sysc R8A77980_PD_ALWAYS_ON>;
                        resets = <&cpg 604>;
+                       renesas,id = <15>;
                        status = "disabled";
                };
 
index 144c082..c727725 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Device Tree Source for the ebisu board
  *
@@ -19,7 +19,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial0:115200n8";
        };
 
 &i2c0 {
        status = "okay";
 
+       io_expander: gpio@20 {
+               compatible = "onnn,pca9654";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gpio2>;
+               interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
+       };
+
        hdmi-encoder@39 {
                compatible = "adi,adv7511w";
                reg = <0x39>;
                };
 
                port@a {
-                       reg = <0xa>;
+                       reg = <10>;
 
                        adv7482_txa: endpoint {
                                clock-lanes = <0>;
        };
 };
 
+&i2c_dvfs {
+       status = "okay";
+
+       clock-frequency = <400000>;
+
+       pmic: pmic@30 {
+               pinctrl-0 = <&irq0_pins>;
+               pinctrl-names = "default";
+
+               compatible = "rohm,bd9571mwv";
+               reg = <0x30>;
+               interrupt-parent = <&intc_ex>;
+               interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               rohm,ddr-backup-power = <0x1>;
+               rohm,rstbmode-level;
+       };
+};
+
 &lvds0 {
        status = "okay";
 
 };
 
 &lvds1 {
+       /*
+        * Even though the LVDS1 output is not connected, the encoder must be
+        * enabled to supply a pixel clock to the DU for the DPAD output when
+        * LVDS0 is in use.
+        */
+       status = "okay";
+
        clocks = <&cpg CPG_MOD 727>,
                 <&x13_clk>,
                 <&extal_clk>;
                function = "du";
        };
 
+       irq0_pins: irq0 {
+               groups = "intc_ex_irq0";
+               function = "intc_ex";
+       };
+
        pwm3_pins: pwm3 {
                groups = "pwm3_b";
                function = "pwm3";
        status = "okay";
 };
 
+&vin5 {
+       status = "okay";
+};
+
 &xhci0 {
        pinctrl-0 = <&usb30_pins>;
        pinctrl-names = "default";
index d2ad665..56cb566 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Device Tree Source for the R-Car E3 (R8A77990) SoC
  *
                        status = "disabled";
                };
 
+               cmt0: timer@e60f0000 {
+                       compatible = "renesas,r8a77990-cmt0",
+                                    "renesas,rcar-gen3-cmt0";
+                       reg = <0 0xe60f0000 0 0x1004>;
+                       interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 303>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 303>;
+                       status = "disabled";
+               };
+
+               cmt1: timer@e6130000 {
+                       compatible = "renesas,r8a77990-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6130000 0 0x1004>;
+                       interrupts = <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>;
+                       clocks = <&cpg CPG_MOD 302>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 302>;
+                       status = "disabled";
+               };
+
+               cmt2: timer@e6140000 {
+                       compatible = "renesas,r8a77990-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6140000 0 0x1004>;
+                       interrupts = <GIC_SPI 398 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 399 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 400 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 402 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 403 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 404 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 301>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 301>;
+                       status = "disabled";
+               };
+
+               cmt3: timer@e6148000 {
+                       compatible = "renesas,r8a77990-cmt1",
+                                    "renesas,rcar-gen3-cmt1";
+                       reg = <0 0xe6148000 0 0x1004>;
+                       interrupts = <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 477 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 300>;
+                       clock-names = "fck";
+                       power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+                       resets = <&cpg 300>;
+                       status = "disabled";
+               };
+
                cpg: clock-controller@e6150000 {
                        compatible = "renesas,r8a77990-cpg-mssr";
                        reg = <0 0xe6150000 0 0x1000>;
                };
 
                csi40: csi2@feaa0000 {
-                       compatible = "renesas,r8a77990-csi2", "renesas,rcar-gen3-csi2";
+                       compatible = "renesas,r8a77990-csi2";
                        reg = <0 0xfeaa0000 0 0x10000>;
                        interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&cpg CPG_MOD 716>;
index db2bed1..a7dc11e 100644 (file)
@@ -20,7 +20,7 @@
        };
 
        chosen {
-               bootargs = "ignore_loglevel";
+               bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
                stdout-path = "serial0:115200n8";
        };
 
        pinctrl-names = "default";
        renesas,no-ether-link;
        phy-handle = <&phy0>;
-       phy-mode = "rgmii-txid";
        status = "okay";
 
        phy0: ethernet-phy@0 {
        };
 };
 
+&can0 {
+       pinctrl-0 = <&can0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-0 = <&can1_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
 &du {
        pinctrl-0 = <&du_pins>;
        pinctrl-names = "default";
 };
 
 &lvds1 {
+       /*
+        * Even though the LVDS1 output is not connected, the encoder must be
+        * enabled to supply a pixel clock to the DU for the DPAD output when
+        * LVDS0 is in use.
+        */
+       status = "okay";
+
        clocks = <&cpg CPG_MOD 727>,
                 <&x12_clk>,
                 <&extal_clk>;
                };
        };
 
+       can0_pins: can0 {
+               groups = "can0_data_a";
+               function = "can0";
+       };
+
+       can1_pins: can1 {
+               groups = "can1_data_a";
+               function = "can1";
+       };
+
        du_pins: du {
                groups = "du_rgb888", "du_sync", "du_disp", "du_clk_out_0";
                function = "du";
index a225c24..2dba132 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
        aliases {
                };
        };
 
+       keys {
+               compatible = "gpio-keys";
+
+               pinctrl-0 = <&keys_pins>;
+               pinctrl-names = "default";
+
+               key-1 {
+                       gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_1>;
+                       label = "SW4-1";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-2 {
+                       gpios = <&gpio5 20 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_2>;
+                       label = "SW4-2";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-3 {
+                       gpios = <&gpio5 22 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_3>;
+                       label = "SW4-3";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-4 {
+                       gpios = <&gpio5 23 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_4>;
+                       label = "SW4-4";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-a {
+                       gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_A>;
+                       label = "TSW0";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-b {
+                       gpios = <&gpio6 12 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_B>;
+                       label = "TSW1";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+               key-c {
+                       gpios = <&gpio6 13 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_C>;
+                       label = "TSW2";
+                       wakeup-source;
+                       debounce-interval = <20>;
+               };
+       };
+
        reg_1p8v: regulator0 {
                compatible = "regulator-fixed";
                regulator-name = "fixed-1.8V";
                function = "intc_ex";
        };
 
+       keys_pins: keys {
+               pins = "GP_5_17", "GP_5_20", "GP_5_22";
+               bias-pull-up;
+       };
+
        pwm1_pins: pwm1 {
                groups = "pwm1_a";
                function = "pwm1";
        };
 };
 
+&rwdt {
+       timeout-sec = <60>;
+       status = "okay";
+};
+
 &scif1 {
        pinctrl-0 = <&scif1_pins>;
        pinctrl-names = "default";
        status = "okay";
 };
 
-&rwdt {
-       timeout-sec = <60>;
-       status = "okay";
-};
-
 &xhci0 {
        pinctrl-0 = <&usb30_pins>;
        pinctrl-names = "default";
index 1b28fa7..5f2687a 100644 (file)
@@ -18,6 +18,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-neo4.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock-pi-4.dtb
index 263d7f3..6eb7407 100644 (file)
 
                soc_slppin_slp: soc_slppin_slp {
                        rockchip,pins =
-                               <0 RK_PA4 RK_FUNC_1 &pcfg_pull_none>;
+                               <0 RK_PA4 1 &pcfg_pull_none>;
                };
 
                soc_slppin_rst: soc_slppin_rst {
                        rockchip,pins =
-                               <0 RK_PA4 RK_FUNC_2 &pcfg_pull_none>;
+                               <0 RK_PA4 2 &pcfg_pull_none>;
                };
        };
 
index 8302d86..49c4b96 100644 (file)
        sdio-pwrseq {
                wifi_enable_h: wifi-enable-h {
                rockchip,pins =
-                       <1 18 RK_FUNC_GPIO &pcfg_pull_none>;
+                       <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 0e34354..5d499c9 100644 (file)
                regulator-always-on;
                regulator-boot-on;
        };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       label = "firefly:blue:power";
+                       linux,default-trigger = "heartbeat";
+                       gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+                       mode = <0x23>;
+               };
+
+               user {
+                       label = "firefly:yellow:user";
+                       linux,default-trigger = "mmc1";
+                       gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       mode = <0x05>;
+               };
+       };
 };
 
 &cpu0 {
        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;
+       max-frequency = <150000000>;
+       mmc-ddr-1_8v;
+       mmc-hs200-1_8v;
        non-removable;
        pinctrl-names = "default";
        pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
+       vmmc-supply = <&vcc_io>;
+       vqmmc-supply = <&vcc18_emmc>;
        status = "okay";
 };
 
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+};
+
+&hdmiphy {
+       status = "okay";
+};
+
 &i2c1 {
        status = "okay";
 
 &usb_host0_ohci {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+};
+
+&vop_mmu {
+       status = "okay";
+};
index 79b4d1d..7cfd5ca 100644 (file)
                regulator-max-microvolt = <5000000>;
        };
 
+       ir-receiver {
+               compatible = "gpio-ir-receiver";
+               gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
+               pinctrl-0 = <&ir_int>;
+               pinctrl-names = "default";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       gpios = <&rk805 1 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "mmc0";
+               };
+
+               standby {
+                       gpios = <&rk805 0 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
        sound {
                compatible = "audio-graph-card";
                label = "rockchip,rk3328";
                interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
                #clock-cells = <1>;
                clock-output-names = "xin32k", "rk805-clkout2";
+               gpio-controller;
+               #gpio-cells = <2>;
                pinctrl-names = "default";
                pinctrl-0 = <&pmic_int_l>;
                rockchip,system-power-controller;
                        };
 
                        vcc_18: LDO_REG1 {
-                               regulator-name = "vdd_18";
+                               regulator-name = "vcc_18";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-always-on;
                        };
 
                        vcc18_emmc: LDO_REG2 {
-                               regulator-name = "vcc_18emmc";
+                               regulator-name = "vcc18_emmc";
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-always-on;
 };
 
 &pinctrl {
+       ir {
+               ir_int: ir-int {
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
index dabef1a..9944686 100644 (file)
                interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&cru PCLK_HDMI>,
-                        <&cru SCLK_HDMI_SFC>;
+                        <&cru SCLK_HDMI_SFC>,
+                        <&cru SCLK_RTC32K>;
                clock-names = "iahb",
-                             "isfr";
+                             "isfr",
+                             "cec";
                phys = <&hdmiphy>;
                phy-names = "hdmi";
                pinctrl-names = "default";
                pinctrl-0 = <&hdmi_cec &hdmii2c_xfer &hdmi_hpd>;
                rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
                status = "disabled";
 
                ports {
index e96eb62..1c52f47 100644 (file)
 
        backlight {
                bl_en: bl-en {
-                       rockchip,pins = <0 20 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        emmc {
                emmc_bus8: emmc-bus8 {
-                       rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 19 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 20 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 21 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 22 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 23 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 24 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 25 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC3 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC4 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC5 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC6 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC7 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD0 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD1 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc-clk {
-                       rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none_drv_8ma>;
                };
 
                emmc-cmd {
-                       rockchip,pins = <1 26 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PD2 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc_reset: emmc-reset {
-                       rockchip,pins = <2 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        pmic {
                pmic_int: pmic-int {
-                       rockchip,pins = <0 1 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        sdio {
                wifi_reg_on: wifi-reg-on {
-                       rockchip,pins = <3 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                bt_rst: bt-rst {
-                       rockchip,pins = <3 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 8fa550c..1d0778f 100644 (file)
 &pinctrl {
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <3 30 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_sleep: pmic-sleep {
-                       rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                };
 
                pmic_int: pmic-int {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index fca8e87..8251f3c 100644 (file)
                haikou_pin_hog: haikou-pin-hog {
                        rockchip,pins =
                                /* LID_BTN */
-                               <RK_GPIO3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
+                               <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
                                /* BATLOW# */
-                               <RK_GPIO0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>,
+                               <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>,
                                /* SLP_BTN# */
-                               <RK_GPIO3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
+                               <3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
                                /* BIOS_DISABLE# */
-                               <RK_GPIO3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
+                               <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        leds {
                led_sd_haikou: led-sd-gpio {
                        rockchip,pins =
-                               <RK_GPIO0 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <0 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdmmc {
                sdmmc_cd_gpio: sdmmc-cd-gpio {
                        rockchip,pins =
-                               <RK_GPIO2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb_otg {
                otg_vbus_drv: otg-vbus-drv {
                        rockchip,pins =
-                               <RK_GPIO0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 1b35d61..e17311e 100644 (file)
@@ -56,8 +56,6 @@
                        fan: fan@18 {
                                compatible = "ti,amc6821";
                                reg = <0x18>;
-                               cooling-min-state = <0>;
-                               cooling-max-state = <9>;
                                #cooling-cells = <2>;
                        };
 
        leds {
                led_pins_module: led-module-gpio {
                        rockchip,pins =
-                               <RK_GPIO2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>,
-                               <RK_GPIO3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>,
+                               <3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
        pmic {
                pmic_int_l: pmic-int-l {
-                       rockchip,pins = <RK_GPIO0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                pmic_sleep: pmic-sleep {
-                       rockchip,pins = <RK_GPIO0 RK_PA0 RK_FUNC_2 &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                };
        };
 };
index f5aa3ca..6cc3102 100644 (file)
 
        emmc {
                emmc_bus8: emmc-bus8 {
-                       rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 19 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 20 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 21 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 22 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 23 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 24 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 25 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC3 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC4 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC5 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC6 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC7 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD0 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD1 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc-clk {
-                       rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none_drv_8ma>;
                };
 
                emmc-cmd {
-                       rockchip,pins = <1 26 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PD2 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc_reset: emmc-reset {
-                       rockchip,pins = <2 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        leds {
                stby_pwren: stby-pwren {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                led_ctl: led-ctl {
-                       rockchip,pins = <3 29 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdmmc {
                sdmmc_clk: sdmmc-clk {
-                       rockchip,pins = <2 9 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <2 RK_PB1 1 &pcfg_pull_none_drv_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
-                       rockchip,pins = <2 10 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <2 RK_PB2 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_cd: sdmmc-cd {
-                       rockchip,pins = <2 11 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <2 RK_PB3 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_bus1: sdmmc-bus1 {
-                       rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up_drv_8ma>;
                };
 
                sdmmc_bus4: sdmmc-bus4 {
-                       rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <2 6 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <2 7 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
-                                       <2 8 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up_drv_8ma>,
+                                       <2 RK_PA6 1 &pcfg_pull_up_drv_8ma>,
+                                       <2 RK_PA7 1 &pcfg_pull_up_drv_8ma>,
+                                       <2 RK_PB0 1 &pcfg_pull_up_drv_8ma>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 41edcfd..231db03 100644 (file)
 &pinctrl {
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_sleep: pmic-sleep {
-                       rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                };
 
                pmic_int: pmic-int {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index d34064c..006a1fb 100644 (file)
 
        emmc {
                emmc_bus8: emmc-bus8 {
-                       rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 19 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 20 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 21 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 22 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 23 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 24 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
-                                       <1 25 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC3 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC4 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC5 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC6 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PC7 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD0 2 &pcfg_pull_up_drv_8ma>,
+                                       <1 RK_PD1 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc-clk {
-                       rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none_drv_8ma>;
+                       rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none_drv_8ma>;
                };
 
                emmc-cmd {
-                       rockchip,pins = <1 26 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
+                       rockchip,pins = <1 RK_PD2 2 &pcfg_pull_up_drv_8ma>;
                };
 
                emmc_reset: emmc-reset {
-                       rockchip,pins = <2 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        ir {
                ir_int: ir-int {
-                       rockchip,pins = <3 30 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        keys {
                pwr_key: pwr-key {
-                       rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        leds {
                stby_pwren: stby-pwren {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                led_ctl: led-ctl {
-                       rockchip,pins = <3 29 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sdio {
                wifi_reg_on: wifi-reg-on {
-                       rockchip,pins = <3 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                bt_rst: bt-rst {
-                       rockchip,pins = <3 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb {
                host_vbus_drv: host-vbus-drv {
-                       rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 06e7c31..fd86188 100644 (file)
 
                emmc {
                        emmc_clk: emmc-clk {
-                               rockchip,pins = <2 4 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA4 2 &pcfg_pull_none>;
                        };
 
                        emmc_cmd: emmc-cmd {
-                               rockchip,pins = <1 26 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD2 2 &pcfg_pull_up>;
                        };
 
                        emmc_pwr: emmc-pwr {
-                               rockchip,pins = <1 27 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD3 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus1: emmc-bus1 {
-                               rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus4: emmc-bus4 {
-                               rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 19 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 20 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 21 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up>,
+                                               <1 RK_PC3 2 &pcfg_pull_up>,
+                                               <1 RK_PC4 2 &pcfg_pull_up>,
+                                               <1 RK_PC5 2 &pcfg_pull_up>;
                        };
 
                        emmc_bus8: emmc-bus8 {
-                               rockchip,pins = <1 18 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 19 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 20 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 21 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 22 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 23 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 24 RK_FUNC_2 &pcfg_pull_up>,
-                                               <1 25 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC2 2 &pcfg_pull_up>,
+                                               <1 RK_PC3 2 &pcfg_pull_up>,
+                                               <1 RK_PC4 2 &pcfg_pull_up>,
+                                               <1 RK_PC5 2 &pcfg_pull_up>,
+                                               <1 RK_PC6 2 &pcfg_pull_up>,
+                                               <1 RK_PC7 2 &pcfg_pull_up>,
+                                               <1 RK_PD0 2 &pcfg_pull_up>,
+                                               <1 RK_PD1 2 &pcfg_pull_up>;
                        };
                };
 
                gmac {
                        rgmii_pins: rgmii-pins {
-                               rockchip,pins = <3 22 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 24 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 8 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 9 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 10 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 14 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 28 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 13 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 15 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 18 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 25 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC6 1 &pcfg_pull_none>,
+                                               <3 RK_PD0 1 &pcfg_pull_none>,
+                                               <3 RK_PC3 1 &pcfg_pull_none>,
+                                               <3 RK_PB0 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB1 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB2 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB6 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PD4 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB5 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB7 1 &pcfg_pull_none>,
+                                               <3 RK_PC0 1 &pcfg_pull_none>,
+                                               <3 RK_PC1 1 &pcfg_pull_none>,
+                                               <3 RK_PC2 1 &pcfg_pull_none>,
+                                               <3 RK_PD1 1 &pcfg_pull_none>,
+                                               <3 RK_PC4 1 &pcfg_pull_none>;
                        };
 
                        rmii_pins: rmii-pins {
-                               rockchip,pins = <3 22 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 24 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 8 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 9 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 13 RK_FUNC_1 &pcfg_pull_none_12ma>,
-                                               <3 15 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 20 RK_FUNC_1 &pcfg_pull_none>,
-                                               <3 21 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC6 1 &pcfg_pull_none>,
+                                               <3 RK_PD0 1 &pcfg_pull_none>,
+                                               <3 RK_PC3 1 &pcfg_pull_none>,
+                                               <3 RK_PB0 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB1 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB5 1 &pcfg_pull_none_12ma>,
+                                               <3 RK_PB7 1 &pcfg_pull_none>,
+                                               <3 RK_PC0 1 &pcfg_pull_none>,
+                                               <3 RK_PC4 1 &pcfg_pull_none>,
+                                               <3 RK_PC5 1 &pcfg_pull_none>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
-                               rockchip,pins = <0 6 RK_FUNC_1 &pcfg_pull_none>,
-                                               <0 7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA6 1 &pcfg_pull_none>,
+                                               <0 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
-                               rockchip,pins = <2 21 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 22 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC5 1 &pcfg_pull_none>,
+                                               <2 RK_PC6 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
-                               rockchip,pins = <0 9 RK_FUNC_2 &pcfg_pull_none>,
-                                               <3 31 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB1 2 &pcfg_pull_none>,
+                                               <3 RK_PD7 2 &pcfg_pull_none>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
-                               rockchip,pins = <1 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <1 17 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PC0 1 &pcfg_pull_none>,
+                                               <1 RK_PC1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
-                               rockchip,pins = <3 24 RK_FUNC_2 &pcfg_pull_none>,
-                                               <3 25 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD0 2 &pcfg_pull_none>,
+                                               <3 RK_PD1 2 &pcfg_pull_none>;
                        };
                };
 
                i2c5 {
                        i2c5_xfer: i2c5-xfer {
-                               rockchip,pins = <3 26 RK_FUNC_2 &pcfg_pull_none>,
-                                               <3 27 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD2 2 &pcfg_pull_none>,
+                                               <3 RK_PD3 2 &pcfg_pull_none>;
                        };
                };
 
                i2s {
                        i2s_8ch_bus: i2s-8ch-bus {
-                               rockchip,pins = <2 12 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 13 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 14 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 15 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 16 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 17 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 18 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 19 RK_FUNC_1 &pcfg_pull_none>,
-                                               <2 20 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB4 1 &pcfg_pull_none>,
+                                               <2 RK_PB5 1 &pcfg_pull_none>,
+                                               <2 RK_PB6 1 &pcfg_pull_none>,
+                                               <2 RK_PB7 1 &pcfg_pull_none>,
+                                               <2 RK_PC0 1 &pcfg_pull_none>,
+                                               <2 RK_PC1 1 &pcfg_pull_none>,
+                                               <2 RK_PC2 1 &pcfg_pull_none>,
+                                               <2 RK_PC3 1 &pcfg_pull_none>,
+                                               <2 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
-                               rockchip,pins = <3 8 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PB0 2 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
-                               rockchip,pins = <0 8 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PB0 2 &pcfg_pull_none>;
                        };
                };
 
                pwm3 {
                        pwm3_pin: pwm3-pin {
-                               rockchip,pins = <3 29 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD5 3 &pcfg_pull_none>;
                        };
                };
 
                sdio0 {
                        sdio0_bus1: sdio0-bus1 {
-                               rockchip,pins = <2 28 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PD4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bus4: sdio0-bus4 {
-                               rockchip,pins = <2 28 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 29 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 30 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 31 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PD4 1 &pcfg_pull_up>,
+                                               <2 RK_PD5 1 &pcfg_pull_up>,
+                                               <2 RK_PD6 1 &pcfg_pull_up>,
+                                               <2 RK_PD7 1 &pcfg_pull_up>;
                        };
 
                        sdio0_cmd: sdio0-cmd {
-                               rockchip,pins = <3 0 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA0 1 &pcfg_pull_up>;
                        };
 
                        sdio0_clk: sdio0-clk {
-                               rockchip,pins = <3 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PA1 1 &pcfg_pull_none>;
                        };
 
                        sdio0_cd: sdio0-cd {
-                               rockchip,pins = <3 2 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA2 1 &pcfg_pull_up>;
                        };
 
                        sdio0_wp: sdio0-wp {
-                               rockchip,pins = <3 3 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_pwr: sdio0-pwr {
-                               rockchip,pins = <3 4 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bkpwr: sdio0-bkpwr {
-                               rockchip,pins = <3 5 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA5 1 &pcfg_pull_up>;
                        };
 
                        sdio0_int: sdio0-int {
-                               rockchip,pins = <3 6 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PA6 1 &pcfg_pull_up>;
                        };
                };
 
                sdmmc {
                        sdmmc_clk: sdmmc-clk {
-                               rockchip,pins = <2 9 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PB1 1 &pcfg_pull_none>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
-                               rockchip,pins = <2 10 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB2 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
-                               rockchip,pins = <2 11 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PB3 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus1: sdmmc-bus1 {
-                               rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
-                               rockchip,pins = <2 5 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 6 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 7 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 8 RK_FUNC_1 &pcfg_pull_up>;
+                               rockchip,pins = <2 RK_PA5 1 &pcfg_pull_up>,
+                                               <2 RK_PA6 1 &pcfg_pull_up>,
+                                               <2 RK_PA7 1 &pcfg_pull_up>,
+                                               <2 RK_PB0 1 &pcfg_pull_up>;
                        };
                };
 
                spdif {
                        spdif_tx: spdif-tx {
-                               rockchip,pins = <2 RK_PC7 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PC7 1 &pcfg_pull_none>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
-                               rockchip,pins = <1 29 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD5 2 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
-                               rockchip,pins = <1 24 RK_FUNC_3 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD0 3 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
-                               rockchip,pins = <1 25 RK_FUNC_3 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PD1 3 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
-                               rockchip,pins = <1 23 RK_FUNC_3 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC7 3 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
-                               rockchip,pins = <1 22 RK_FUNC_3 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC6 3 &pcfg_pull_up>;
                        };
                };
 
                spi1 {
                        spi1_clk: spi1-clk {
-                               rockchip,pins = <1 14 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PB6 2 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
-                               rockchip,pins = <1 15 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PB7 2 &pcfg_pull_up>;
                        };
                        spi1_cs1: spi1-cs1 {
-                               rockchip,pins = <3 28 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <3 RK_PD4 2 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
-                               rockchip,pins = <1 16 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC0 2 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
-                               rockchip,pins = <1 17 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <1 RK_PC1 2 &pcfg_pull_up>;
                        };
                };
 
                spi2 {
                        spi2_clk: spi2-clk {
-                               rockchip,pins = <0 12 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB4 2 &pcfg_pull_up>;
                        };
                        spi2_cs0: spi2-cs0 {
-                               rockchip,pins = <0 13 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB5 2 &pcfg_pull_up>;
                        };
                        spi2_rx: spi2-rx {
-                               rockchip,pins = <0 10 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB2 2 &pcfg_pull_up>;
                        };
                        spi2_tx: spi2-tx {
-                               rockchip,pins = <0 11 RK_FUNC_2 &pcfg_pull_up>;
+                               rockchip,pins = <0 RK_PB3 2 &pcfg_pull_up>;
                        };
                };
 
                tsadc {
                        otp_gpio: otp-gpio {
-                               rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
 
                        otp_out: otp-out {
-                               rockchip,pins = <0 3 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA3 1 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
-                               rockchip,pins = <2 24 RK_FUNC_1 &pcfg_pull_up>,
-                                               <2 25 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD0 1 &pcfg_pull_up>,
+                                               <2 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
-                               rockchip,pins = <2 26 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD2 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
-                               rockchip,pins = <2 27 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PD3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
-                               rockchip,pins = <0 20 RK_FUNC_3 &pcfg_pull_up>,
-                                               <0 21 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC4 3 &pcfg_pull_up>,
+                                               <0 RK_PC5 3 &pcfg_pull_none>;
                        };
 
                        uart1_cts: uart1-cts {
-                               rockchip,pins = <0 22 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC6 3 &pcfg_pull_none>;
                        };
 
                        uart1_rts: uart1-rts {
-                               rockchip,pins = <0 23 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PC7 3 &pcfg_pull_none>;
                        };
                };
 
                uart2 {
                        uart2_xfer: uart2-xfer {
-                               rockchip,pins = <2 6 RK_FUNC_2 &pcfg_pull_up>,
-                                               <2 5 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <2 RK_PA6 2 &pcfg_pull_up>,
+                                               <2 RK_PA5 2 &pcfg_pull_none>;
                        };
                        /* no rts / cts for uart2 */
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
-                               rockchip,pins = <3 29 RK_FUNC_2 &pcfg_pull_up>,
-                                               <3 30 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PD5 2 &pcfg_pull_up>,
+                                               <3 RK_PD6 3 &pcfg_pull_none>;
                        };
 
                        uart3_cts: uart3-cts {
-                               rockchip,pins = <3 16 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC0 2 &pcfg_pull_none>;
                        };
 
                        uart3_rts: uart3-rts {
-                               rockchip,pins = <3 17 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <3 RK_PC1 2 &pcfg_pull_none>;
                        };
                };
 
                uart4 {
                        uart4_xfer: uart4-xfer {
-                               rockchip,pins = <0 27 RK_FUNC_3 &pcfg_pull_up>,
-                                               <0 26 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD3 3 &pcfg_pull_up>,
+                                               <0 RK_PD2 3 &pcfg_pull_none>;
                        };
 
                        uart4_cts: uart4-cts {
-                               rockchip,pins = <0 24 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD0 3 &pcfg_pull_none>;
                        };
 
                        uart4_rts: uart4-rts {
-                               rockchip,pins = <0 25 RK_FUNC_3 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PD1 3 &pcfg_pull_none>;
                        };
                };
        };
index 959ddc3..77008dc 100644 (file)
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
-                               <1 21 RK_FUNC_GPIO &pcfg_pull_up>;
+                               <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                pmic_dvs2: pmic-dvs2 {
                        rockchip,pins =
-                               <1 18 RK_FUNC_GPIO &pcfg_pull_down>;
+                               <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        usb2 {
                vcc5v0_host_en: vcc5v0-host-en {
                        rockchip,pins =
-                               <4 25 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 027d428..6b059bd 100644 (file)
        gmac {
                rgmii_sleep_pins: rgmii-sleep-pins {
                        rockchip,pins =
-                               <3 15 RK_FUNC_GPIO &pcfg_output_low>;
+                               <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
                };
        };
 
        pcie {
                pcie_drv: pcie-drv {
                        rockchip,pins =
-                               <1 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
        };
 
        usb2 {
                host_vbus_drv: host-vbus-drv {
                        rockchip,pins =
-                               <4 27 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        leds {
                user_led1: user_led1 {
                        rockchip,pins =
-                               <4 25 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                user_led2: user_led2 {
                        rockchip,pins =
-                               <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                user_led3: user_led3 {
                        rockchip,pins =
-                               <4 30 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                user_led4: user_led4 {
                        rockchip,pins =
-                               <1 0 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                wlan_led: wlan_led {
                        rockchip,pins =
-                               <1 1 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                bt_led: bt_led {
                        rockchip,pins =
-                               <1 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index d1cf404..a9f4d6d 100644 (file)
@@ -73,7 +73,7 @@
 &pinctrl {
        tpm {
                h1_int_od_l: h1-int-od-l {
-                       rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 931640e..7cd6d47 100644 (file)
@@ -365,27 +365,27 @@ ap_i2c_tp: &i2c5 {
 &pinctrl {
        discrete-regulators {
                pp1500_en: pp1500-en {
-                       rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                pp1800_audio_en: pp1800-audio-en {
-                       rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO
                                         &pcfg_pull_down>;
                };
 
                pp3000_en: pp3000-en {
-                       rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                pp3300_disp_en: pp3300-disp-en {
-                       rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
+                       rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                wlan_module_pd_l: wlan-module-pd-l {
-                       rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO
                                         &pcfg_pull_down>;
                };
        };
@@ -393,10 +393,10 @@ ap_i2c_tp: &i2c5 {
 
 &wifi {
        wifi_perst_l: wifi-perst-l {
-               rockchip,pins = <2 27 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 
        wlan_host_wake_l: wlan-host-wake-l {
-               rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 };
index 15e254a..3e2272b 100644 (file)
@@ -290,24 +290,24 @@ ap_i2c_dig: &i2c2 {
        digitizer {
                /* Has external pullup */
                cpu1_dig_irq_l: cpu1-dig-irq-l {
-                       rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                /* Has external pullup */
                cpu1_dig_pdct_l: cpu1-dig-pdct-l {
-                       rockchip,pins = <2 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        discrete-regulators {
                cpu3_pen_pwr_en: cpu3-pen-pwr-en {
-                       rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pen {
                cpu1_pen_eject: cpu1-pen-eject {
-                       rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 62ea7d6..50dfab5 100644 (file)
@@ -455,58 +455,58 @@ camera: &i2c7 {
 
 /* PINCTRL OVERRIDES */
 &ec_ap_int_l {
-       rockchip,pins = <1 18 RK_FUNC_GPIO &pcfg_pull_up>;
+       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
 };
 
 &ap_fw_wp {
-       rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_none>;
+       rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
 };
 
 &bl_en {
-       rockchip,pins = <4 21 RK_FUNC_GPIO &pcfg_pull_none>;
+       rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
 };
 
 &bt_host_wake_l {
-       rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_none>;
+       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
 };
 
 &ec_ap_int_l {
-       rockchip,pins = <1 18 RK_FUNC_GPIO &pcfg_pull_up>;
+       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
 };
 
 &headset_int_l {
-       rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_up>;
+       rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
 };
 
 &i2s0_8ch_bus {
        rockchip,pins =
-               <3 24 RK_FUNC_1 &pcfg_pull_none_6ma>,
-               <3 25 RK_FUNC_1 &pcfg_pull_none_6ma>,
-               <3 26 RK_FUNC_1 &pcfg_pull_none_6ma>,
-               <3 27 RK_FUNC_1 &pcfg_pull_none_6ma>,
-               <3 31 RK_FUNC_1 &pcfg_pull_none_6ma>,
-               <4 0 RK_FUNC_1 &pcfg_pull_none_6ma>;
+               <3 RK_PD0 1 &pcfg_pull_none_6ma>,
+               <3 RK_PD1 1 &pcfg_pull_none_6ma>,
+               <3 RK_PD2 1 &pcfg_pull_none_6ma>,
+               <3 RK_PD3 1 &pcfg_pull_none_6ma>,
+               <3 RK_PD7 1 &pcfg_pull_none_6ma>,
+               <4 RK_PA0 1 &pcfg_pull_none_6ma>;
 };
 
 /* there is no external pull up, so need to set this pin pull up */
 &sdmmc_cd_gpio {
-       rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_pull_up>;
+       rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>;
 };
 
 &sd_pwr_1800_sel {
-       rockchip,pins = <2 28 RK_FUNC_GPIO &pcfg_pull_up>;
+       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
 };
 
 &sdmode_en {
-       rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_down>;
+       rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_down>;
 };
 
 &touch_reset_l {
-       rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_down>;
+       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>;
 };
 
 &touch_int_l {
-       rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_down>;
+       rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
 };
 
 &pinctrl {
@@ -523,84 +523,84 @@ camera: &i2c7 {
 
        camera {
                pp1250_cam_en: pp1250-dvdd {
-                       rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                pp2800_cam_en: pp2800-avdd {
-                       rockchip,pins = <2 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                ucam_rst: ucam_rst {
-                       rockchip,pins = <2 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                wcam_rst: wcam_rst {
-                       rockchip,pins = <2 5 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        digitizer {
                pen_int_odl: pen-int-odl {
-                       rockchip,pins = <1 0 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                pen_reset_l: pen-reset-l {
-                       rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        discrete-regulators {
                display_rst_l: display-rst-l {
-                       rockchip,pins = <4 25 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                ppvarp_lcd_en: ppvarp-lcd-en {
-                       rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                ppvarn_lcd_en: ppvarn-lcd-en {
-                       rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        dmic {
                dmic_en: dmic-en {
-                       rockchip,pins = <4 3 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pen {
                pen_eject_odl: pen-eject-odl {
-                       rockchip,pins = <1 1 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        tpm {
                h1_int_od_l: h1-int-od-l {
-                       rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
 
 &wifi {
        bt_en_1v8_l: bt-en-1v8-l {
-               rockchip,pins = <0 8 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 
        wlan_pd_1v8_l: wlan-pd-1v8-l {
-               rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 
        /* Default pull-up, but just to be clear */
        wlan_rf_kill_1v8_l: wlan-rf-kill-1v8-l {
-               rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;
+               rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
        };
 
        wifi_perst_l: wifi-perst-l {
-               rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_none>;
+               rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 
        wlan_host_wake_l: wlan-host-wake-l {
-               rockchip,pins = <1 3 RK_FUNC_GPIO &pcfg_pull_up>;
+               rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
        };
 };
index da03fa9..dd56249 100644 (file)
@@ -676,29 +676,29 @@ ap_i2c_audio: &i2c8 {
 
        backlight-enable {
                bl_en: bl-en {
-                       rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        cros-ec {
                ec_ap_int_l: ec-ap-int-l {
-                       rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        discrete-regulators {
                sd_io_pwr_en: sd-io-pwr-en {
-                       rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
+                       rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                sd_pwr_1800_sel: sd-pwr-1800-sel {
-                       rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
+                       rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
 
                sd_slot_pwr_en: sd-slot-pwr-en {
-                       rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
+                       rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO
                                         &pcfg_pull_none>;
                };
        };
@@ -706,17 +706,17 @@ ap_i2c_audio: &i2c8 {
        codec {
                /* Has external pullup */
                headset_int_l: headset-int-l {
-                       rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                mic_int: mic-int {
-                       rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        max98357a {
                sdmode_en: sdmode-en {
-                       rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
@@ -727,7 +727,7 @@ ap_i2c_audio: &i2c8 {
                         * to hack this as gpio, so the EP could be able to
                         * de-assert it along and make ClockPM(CPM) work.
                         */
-                       rockchip,pins = <2 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
@@ -738,20 +738,20 @@ ap_i2c_audio: &i2c8 {
                 */
                sdmmc_bus4: sdmmc-bus4 {
                        rockchip,pins =
-                               <4 8 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 9 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 10 RK_FUNC_1 &pcfg_pull_none_8ma>,
-                               <4 11 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB0 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB1 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB2 1 &pcfg_pull_none_8ma>,
+                               <4 RK_PB3 1 &pcfg_pull_none_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
                        rockchip,pins =
-                               <4 12 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB4 1 &pcfg_pull_none_8ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
                        rockchip,pins =
-                               <4 13 RK_FUNC_1 &pcfg_pull_none_8ma>;
+                               <4 RK_PB5 1 &pcfg_pull_none_8ma>;
                };
 
                /*
@@ -765,12 +765,12 @@ ap_i2c_audio: &i2c8 {
                 */
                sdmmc_cd: sdmmc-cd {
                        rockchip,pins =
-                               <0 7 RK_FUNC_1 &pcfg_pull_none>;
+                               <0 RK_PA7 1 &pcfg_pull_none>;
                };
 
                /* This is where we actually hook up CD; has external pull */
                sdmmc_cd_gpio: sdmmc-cd-gpio {
-                       rockchip,pins = <4 24 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
@@ -780,47 +780,47 @@ ap_i2c_audio: &i2c8 {
                         * Pull down SPI1 CLK/CS/RX/TX during suspend, to
                         * prevent leakage.
                         */
-                       rockchip,pins = <1 9 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 10 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 7 RK_FUNC_GPIO &pcfg_pull_down>,
-                                       <1 8 RK_FUNC_GPIO &pcfg_pull_down>;
+                       rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_down>,
+                                       <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
        touchscreen {
                touch_int_l: touch-int-l {
-                       rockchip,pins = <3 13 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                touch_reset_l: touch-reset-l {
-                       rockchip,pins = <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        trackpad {
                ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
-                       rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
+                       rockchip,pins = <3 RK_PB4 RK_FUNC_GPIO &pcfg_output_high>;
                };
 
                trackpad_int_l: trackpad-int-l {
-                       rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        wifi: wifi {
                wlan_module_reset_l: wlan-module-reset-l {
-                       rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_pull_none>;
+                       rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
 
                bt_host_wake_l: bt-host-wake-l {
                        /* Kevin has an external pull up, but Gru does not */
-                       rockchip,pins = <0 3 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        write-protect {
                ap_fw_wp: ap-fw-wp {
-                       rockchip,pins = <1 18 RK_FUNC_GPIO &pcfg_pull_up>;
+                       rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 };
index 84433cf..2a12798 100644 (file)
                pinctrl-names = "default";
                pinctrl-0 = <&ir_rx>;
        };
+
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               /*
+                * With 20KHz PWM and an EVERCOOL EC4007H12SA fan, these levels
+                * work out to 0, ~1200, ~3000, and 5000RPM respectively.
+                */
+               cooling-levels = <0 12 18 255>;
+               #cooling-cells = <2>;
+               fan-supply = <&vcc12v0_sys>;
+               pwms = <&pwm1 0 50000 0>;
+       };
+};
+
+&cpu_thermal {
+       trips {
+               cpu_warm: cpu_warm {
+                       temperature = <55000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+
+               cpu_hot: cpu_hot {
+                       temperature = <65000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+       };
+
+       cooling-maps {
+               map2 {
+                       trip = <&cpu_warm>;
+                       cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+               };
+
+               map3 {
+                       trip = <&cpu_hot>;
+                       cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+               };
+       };
+};
+
+&gpu_thermal {
+       trips {
+               gpu_warm: gpu_warm {
+                       temperature = <55000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+
+               gpu_hot: gpu_hot {
+                       temperature = <65000>;
+                       hysteresis = <2000>;
+                       type = "active";
+               };
+       };
+       cooling-maps {
+               map1 {
+                       trip = <&gpu_warm>;
+                       cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+               };
+
+               map2 {
+                       trip = <&gpu_hot>;
+                       cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+               };
+       };
 };
 
 &pinctrl {
        ir {
                ir_rx: ir-rx {
                        /* external pullup to VCC3V3_SYS, despite being 1.8V :/ */
-                       rockchip,pins = <0 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+                       rockchip,pins = <0 RK_PA6 1 &pcfg_pull_none>;
                };
        };
 };
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-neo4.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-neo4.dts
new file mode 100644 (file)
index 0000000..195410b
--- /dev/null
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2019 Amarula Solutions B.V.
+ * Author: Jagan Teki <jagan@amarulasolutions.com>
+ */
+
+/dts-v1/;
+
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+       model = "FriendlyARM NanoPi NEO4";
+       compatible = "friendlyarm,nanopi-neo4", "rockchip,rk3399";
+
+       vdd_5v: vdd-5v {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd_5v";
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       vcc5v0_core: vcc5v0-core {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_core";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vdd_5v>;
+       };
+
+       vcc5v0_usb1: vcc5v0-usb1 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc5v0_usb1";
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc5v0_sys>;
+       };
+};
+
+&vcc3v3_sys {
+       vin-supply = <&vcc5v0_core>;
+};
+
+&u2phy0_host {
+       phy-supply = <&vcc5v0_usb1>;
+};
+
+&vbus_typec {
+       regulator-always-on;
+       vin-supply = <&vdd_5v>;
+};
index d325e11..dd16c80 100644 (file)
        assigned-clocks = <&cru SCLK_RMII_SRC>;
        clock_in_out = "input";
        pinctrl-names = "default";
-       pinctrl-0 = <&rgmii_pins>;
+       pinctrl-0 = <&rgmii_pins>, <&phy_intb>, <&phy_rstb>;
+       phy-handle = <&rtl8211e>;
        phy-mode = "rgmii";
        phy-supply = <&vcc3v3_s3>;
        snps,reset-active-low;
-       snps,reset-delays-us = <0 10000 50000>;
+       snps,reset-delays-us = <0 10000 30000>;
        snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
        tx_delay = <0x28>;
        rx_delay = <0x11>;
        status = "okay";
+
+       mdio {
+               compatible = "snps,dwmac-mdio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               rtl8211e: phy@1 {
+                       reg = <1>;
+                       interrupt-parent = <&gpio3>;
+                       interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
+               };
+       };
 };
 
 &gpu {
                };
        };
 
+       phy {
+               phy_intb: phy-intb {
+                       rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+
+               phy_rstb: phy-rstb {
+                       rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
                cpu_b_sleep: cpu-b-sleep {
                        rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts
new file mode 100644 (file)
index 0000000..0541dfc
--- /dev/null
@@ -0,0 +1,790 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ */
+
+/dts-v1/;
+
+#include "dt-bindings/pwm/pwm.h"
+#include "dt-bindings/input/input.h"
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+       model = "Orange Pi RK3399 Board";
+       compatible = "rockchip,rk3399-orangepi", "rockchip,rk3399";
+
+       chosen {
+               stdout-path = "serial2:1500000n8";
+       };
+
+       clkin_gmac: external-gmac-clock {
+               compatible = "fixed-clock";
+               clock-frequency = <125000000>;
+               clock-output-names = "clkin_gmac";
+               #clock-cells = <0>;
+       };
+
+       adc-keys {
+               compatible = "adc-keys";
+               io-channels = <&saradc 1>;
+               io-channel-names = "buttons";
+               keyup-threshold-microvolt = <1800000>;
+               poll-interval = <100>;
+
+               button-up {
+                       label = "Volume Up";
+                       linux,code = <KEY_VOLUMEUP>;
+                       press-threshold-microvolt = <100000>;
+               };
+
+               button-down {
+                       label = "Volume Down";
+                       linux,code = <KEY_VOLUMEDOWN>;
+                       press-threshold-microvolt = <300000>;
+               };
+
+               back {
+                       label = "Back";
+                       linux,code = <KEY_BACK>;
+                       press-threshold-microvolt = <985000>;
+               };
+
+               menu {
+                       label = "Menu";
+                       linux,code = <KEY_MENU>;
+                       press-threshold-microvolt = <1314000>;
+               };
+       };
+
+       dc_12v: dc-12v {
+               compatible = "regulator-fixed";
+               regulator-name = "dc_12v";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+       };
+
+       keys: gpio-keys {
+               compatible = "gpio-keys";
+               autorepeat;
+
+               power {
+                       debounce-interval = <100>;
+                       gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
+                       label = "GPIO Power";
+                       linux,code = <KEY_POWER>;
+                       linux,input-type = <1>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pwr_btn>;
+                       wakeup-source;
+               };
+       };
+
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;
+               clock-names = "ext_clock";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_reg_on_h>;
+               reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+       };
+
+       /* switched by pmic_sleep */
+       vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc1v8_s3";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_1v8>;
+       };
+
+       vcc3v0_sd: vcc3v0-sd {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sdmmc0_pwr_h>;
+               regulator-boot-on;
+               regulator-max-microvolt = <3000000>;
+               regulator-min-microvolt = <3000000>;
+               regulator-name = "vcc3v0_sd";
+               vin-supply = <&vcc3v3_sys>;
+       };
+
+       vcc3v3_sys: vcc3v3-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc3v3_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc5v0_host: vcc5v0-host-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_host_en>;
+               regulator-name = "vcc5v0_host";
+               regulator-always-on;
+               vin-supply = <&vcc_sys>;
+       };
+
+       vbus_typec: vbus-typec-regulator {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&vcc5v0_typec_en>;
+               regulator-name = "vbus_typec";
+               vin-supply = <&vcc_sys>;
+       };
+
+       vcc_sys: vcc-sys {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_sys";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               vin-supply = <&dc_12v>;
+       };
+
+       vdd_log: vdd-log {
+               compatible = "pwm-regulator";
+               pwms = <&pwm2 0 25000 1>;
+               regulator-name = "vdd_log";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-min-microvolt = <800000>;
+               regulator-max-microvolt = <1400000>;
+               vin-supply = <&vcc_sys>;
+       };
+};
+
+&cpu_l0 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l1 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l2 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_l3 {
+       cpu-supply = <&vdd_cpu_l>;
+};
+
+&cpu_b0 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&cpu_b1 {
+       cpu-supply = <&vdd_cpu_b>;
+};
+
+&emmc_phy {
+       status = "okay";
+};
+
+&gmac {
+       assigned-clocks = <&cru SCLK_RMII_SRC>;
+       assigned-clock-parents = <&clkin_gmac>;
+       clock_in_out = "input";
+       phy-supply = <&vcc3v3_s3>;
+       phy-mode = "rgmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii_pins>;
+       snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
+       snps,reset-active-low;
+       snps,reset-delays-us = <0 10000 50000>;
+       tx_delay = <0x28>;
+       rx_delay = <0x11>;
+       status = "okay";
+};
+
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&hdmi_sound {
+       status = "okay";
+};
+
+&i2c0 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <168>;
+       i2c-scl-falling-time-ns = <4>;
+       status = "okay";
+
+       rk808: pmic@1b {
+               compatible = "rockchip,rk808";
+               reg = <0x1b>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
+               #clock-cells = <1>;
+               clock-output-names = "rtc_clko_soc", "rtc_clko_wifi";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pmic_int_l>;
+               rockchip,system-power-controller;
+               wakeup-source;
+
+               vcc1-supply = <&vcc3v3_sys>;
+               vcc2-supply = <&vcc3v3_sys>;
+               vcc3-supply = <&vcc3v3_sys>;
+               vcc4-supply = <&vcc3v3_sys>;
+               vcc6-supply = <&vcc3v3_sys>;
+               vcc7-supply = <&vcc3v3_sys>;
+               vcc8-supply = <&vcc3v3_sys>;
+               vcc9-supply = <&vcc3v3_sys>;
+               vcc10-supply = <&vcc3v3_sys>;
+               vcc11-supply = <&vcc3v3_sys>;
+               vcc12-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc_3v0>;
+
+               regulators {
+                       vdd_center: DCDC_REG1 {
+                               regulator-name = "vdd_center";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vdd_cpu_l: DCDC_REG2 {
+                               regulator-name = "vdd_cpu_l";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-ramp-delay = <6001>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_ddr: DCDC_REG3 {
+                               regulator-name = "vcc_ddr";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                               };
+                       };
+
+                       vcc_1v8: DCDC_REG4 {
+                               regulator-name = "vcc_1v8";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc1v8_dvp: LDO_REG1 {
+                               regulator-name = "vcc1v8_dvp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v0_tp: LDO_REG2 {
+                               regulator-name = "vcc3v0_tp";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc1v8_pmupll: LDO_REG3 {
+                               regulator-name = "vcc1v8_pmupll";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1800000>;
+                               };
+                       };
+
+                       vcc_sdio: LDO_REG4 {
+                               regulator-name = "vcc_sdio";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcca3v0_codec: LDO_REG5 {
+                               regulator-name = "vcca3v0_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_1v5: LDO_REG6 {
+                               regulator-name = "vcc_1v5";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <1500000>;
+                               };
+                       };
+
+                       vcca1v8_codec: LDO_REG7 {
+                               regulator-name = "vcca1v8_codec";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc_3v0: LDO_REG8 {
+                               regulator-name = "vcc_3v0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-state-mem {
+                                       regulator-on-in-suspend;
+                                       regulator-suspend-microvolt = <3000000>;
+                               };
+                       };
+
+                       vcc3v3_s3: SWITCH_REG1 {
+                               regulator-name = "vcc3v3_s3";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+
+                       vcc3v3_s0: SWITCH_REG2 {
+                               regulator-name = "vcc3v3_s0";
+                               regulator-always-on;
+                               regulator-boot-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+                       };
+               };
+       };
+
+       vdd_cpu_b: regulator@40 {
+               compatible = "silergy,syr827";
+               reg = <0x40>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_cpu_b";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc3v3_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+
+       vdd_gpu: regulator@41 {
+               compatible = "silergy,syr828";
+               reg = <0x41>;
+               fcs,suspend-voltage-selector = <1>;
+               regulator-name = "vdd_gpu";
+               regulator-min-microvolt = <712500>;
+               regulator-max-microvolt = <1500000>;
+               regulator-ramp-delay = <1000>;
+               regulator-always-on;
+               regulator-boot-on;
+               vin-supply = <&vcc3v3_sys>;
+
+               regulator-state-mem {
+                       regulator-off-in-suspend;
+               };
+       };
+};
+
+&i2c1 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c3 {
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+};
+
+&i2c4 {
+       clock-frequency = <400000>;
+       i2c-scl-rising-time-ns = <450>;
+       i2c-scl-falling-time-ns = <15>;
+       status = "okay";
+
+       ak09911@c {
+               compatible = "asahi-kasei,ak09911";
+               reg = <0x0c>;
+               vdd-supply = <&vcc3v3_s3>;
+               vid-supply = <&vcc3v3_s3>;
+       };
+
+       mpu6500@68 {
+               compatible = "invensense,mpu6500";
+               reg = <0x68>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PC6 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&gsensor_int_l>;
+               vddio-supply = <&vcc3v3_s3>;
+       };
+
+       lsm6ds3@6a {
+               compatible = "st,lsm6ds3";
+               reg = <0x6a>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PD0 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&gyr_int_l>;
+               vdd-supply = <&vcc3v3_s3>;
+               vddio-supply = <&vcc3v3_s3>;
+       };
+
+       cm32181@10 {
+               compatible = "capella,cm32181";
+               reg = <0x10>;
+               interrupt-parent = <&gpio4>;
+               interrupts = <RK_PD0 IRQ_TYPE_EDGE_RISING>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&light_int_l>;
+               vdd-supply = <&vcc3v3_s3>;
+       };
+
+       fusb302@22 {
+               compatible = "fcs,fusb302";
+               reg = <0x22>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&chg_cc_int_l>;
+               vbus-supply = <&vbus_typec>;
+       };
+};
+
+&io_domains {
+       status = "okay";
+       bt656-supply = <&vcc_3v0>;
+       audio-supply = <&vcca1v8_codec>;
+       sdmmc-supply = <&vcc_sdio>;
+       gpio1830-supply = <&vcc_3v0>;
+};
+
+&pmu_io_domains {
+       status = "okay";
+       pmu1830-supply = <&vcc_3v0>;
+};
+
+&pinctrl {
+       buttons {
+               pwr_btn: pwr-btn {
+                       rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       pmic {
+               pmic_int_l: pmic-int-l {
+                       rockchip,pins =
+                               <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+
+       sd {
+               sdmmc0_pwr_h: sdmmc0-pwr-h {
+                       rockchip,pins =
+                               <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       usb2 {
+               vcc5v0_host_en: vcc5v0-host-en {
+                       rockchip,pins =
+                               <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               vcc5v0_typec_en: vcc5v0-typec-en {
+                       rockchip,pins =
+                               <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       sdio-pwrseq {
+               wifi_reg_on_h: wifi-reg-on-h {
+                       rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       wifi {
+               wifi_host_wake_l: wifi-host-wake-l {
+                       rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       bluetooth {
+               bt_reg_on_h: bt-enable-h {
+                       rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_host_wake_l: bt-host-wake-l {
+                       rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+
+               bt_wake_l: bt-wake-l {
+                       rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       mpu6500 {
+               gsensor_int_l: gsensor-int-l {
+                       rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       lsm6ds3 {
+               gyr_int_l: gyr-int-l {
+                       rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       cm32181 {
+               light_int_l: light-int-l {
+                       rockchip,pins = <4 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
+       fusb302 {
+               chg_cc_int_l: chg-cc-int-l {
+                       rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
+       };
+};
+
+&pwm0 {
+       status = "okay";
+};
+
+&pwm2 {
+       status = "okay";
+};
+
+&saradc {
+       vref-supply = <&vcca1v8_s3>;
+       status = "okay";
+};
+
+&sdhci {
+       bus-width = <8>;
+       mmc-hs400-1_8v;
+       mmc-hs400-enhanced-strobe;
+       non-removable;
+       status = "okay";
+};
+
+&sdio0 {
+       bus-width = <4>;
+       cap-sd-highspeed;
+       cap-sdio-irq;
+       clock-frequency = <50000000>;
+       disable-wp;
+       keep-power-in-suspend;
+       max-frequency = <50000000>;
+       mmc-pwrseq = <&sdio_pwrseq>;
+       non-removable;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
+       sd-uhs-sdr104;
+       status = "okay";
+
+       brcmf: wifi@1 {
+               compatible = "brcm,bcm4329-fmac";
+               interrupt-parent = <&gpio0>;
+               interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>;
+               interrupt-names = "host-wake";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wifi_host_wake_l>;
+       };
+};
+
+&sdmmc {
+       bus-width = <4>;
+       cap-mmc-highspeed;
+       cap-sd-highspeed;
+       cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
+       clock-frequency = <150000000>;
+       disable-wp;
+       max-frequency = <150000000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
+       vmmc-supply = <&vcc3v0_sd>;
+       vqmmc-supply = <&vcc_sdio>;
+       status = "okay";
+};
+
+&tcphy0 {
+       status = "okay";
+};
+
+&tcphy1 {
+       status = "okay";
+};
+
+&tsadc {
+       rockchip,hw-tshut-mode = <1>;
+       rockchip,hw-tshut-polarity = <1>;
+       status = "okay";
+};
+
+&u2phy0 {
+       status = "okay";
+
+       u2phy0_otg: otg-port {
+               phy-supply = <&vbus_typec>;
+               status = "okay";
+       };
+
+       u2phy0_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&u2phy1 {
+       status = "okay";
+
+       u2phy1_otg: otg-port {
+               status = "okay";
+       };
+
+       u2phy1_host: host-port {
+               phy-supply = <&vcc5v0_host>;
+               status = "okay";
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm43438-bt";
+               clocks = <&rk808 1>;
+               clock-names = "lpo";
+               device-wakeup-gpios = <&gpio2 RK_PD2 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_reg_on_h>;
+               vbat-supply = <&vcc3v3_sys>;
+               vddio-supply = <&vcc_1v8>;
+       };
+};
+
+&uart2 {
+       status = "okay";
+};
+
+&usb_host0_ehci {
+       status = "okay";
+};
+
+&usb_host0_ohci {
+       status = "okay";
+};
+
+&usb_host1_ehci {
+       status = "okay";
+};
+
+&usb_host1_ohci {
+       status = "okay";
+};
+
+&usbdrd3_0 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_0 {
+       status = "okay";
+       dr_mode = "otg";
+};
+
+&usbdrd3_1 {
+       status = "okay";
+};
+
+&usbdrd_dwc3_1 {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&vopb {
+       status = "okay";
+};
+
+&vopb_mmu {
+       status = "okay";
+};
+
+&vopl {
+       status = "okay";
+};
+
+&vopl_mmu {
+       status = "okay";
+};
index 1e6a710..d80d6b7 100644 (file)
                haikou_pin_hog: haikou-pin-hog {
                        rockchip,pins =
                          /* LID_BTN */
-                         <RK_GPIO0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
+                         <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
                          /* BATLOW# */
-                         <RK_GPIO0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
+                         <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
                          /* SLP_BTN# */
-                         <RK_GPIO0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
+                         <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
                          /* BIOS_DISABLE# */
-                         <RK_GPIO0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
+                         <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        leds {
                led_sd_haikou: led-sd-gpio {
                        rockchip,pins =
-                         <RK_GPIO1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+                         <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        usb2 {
                otg_vbus_drv: otg-vbus-drv {
                        rockchip,pins =
-                         <RK_GPIO0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
+                         <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 0130b9f..62ea288 100644 (file)
 
 &emmc_phy {
        status = "okay";
+       drive-impedance-ohm = <33>;
 };
 
 &gmac {
        fan: fan@18 {
                compatible = "ti,amc6821";
                reg = <0x18>;
-               cooling-min-state = <0>;
-               cooling-max-state = <9>;
                #cooling-cells = <2>;
        };
 
  */
 &i2s0_2ch_bus {
        rockchip,pins =
-               <RK_GPIO3 RK_PD0 RK_FUNC_1 &pcfg_pull_none>,
-               <RK_GPIO3 RK_PD2 RK_FUNC_1 &pcfg_pull_none>,
-               <RK_GPIO3 RK_PD3 RK_FUNC_1 &pcfg_pull_none>,
-               <RK_GPIO3 RK_PD7 RK_FUNC_1 &pcfg_pull_none>;
+               <3 RK_PD0 1 &pcfg_pull_none>,
+               <3 RK_PD2 1 &pcfg_pull_none>,
+               <3 RK_PD3 1 &pcfg_pull_none>,
+               <3 RK_PD7 1 &pcfg_pull_none>;
 };
 
 &io_domains {
        i2c8 {
                i2c8_xfer_a: i2c8-xfer {
                        rockchip,pins =
-                         <RK_GPIO1 RK_PC4 RK_FUNC_1 &pcfg_pull_up>,
-                         <RK_GPIO1 RK_PC5 RK_FUNC_1 &pcfg_pull_up>;
+                         <1 RK_PC4 1 &pcfg_pull_up>,
+                         <1 RK_PC5 1 &pcfg_pull_up>;
                };
        };
 
        leds {
                led_pin_module: led-module-gpio {
                        rockchip,pins =
-                         <RK_GPIO2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+                         <2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
-                         <RK_GPIO1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
+                         <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
                };
        };
 
        usb2 {
                vcc5v0_host_en: vcc5v0-host-en {
                        rockchip,pins =
-                         <RK_GPIO4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
+                         <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 };
index 844eac9..e030627 100644 (file)
        status = "okay";
 };
 
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
 &hdmi {
        ddc-i2c-bus = <&i2c3>;
        pinctrl-names = "default";
index 2927db4..c7d48d4 100644 (file)
                reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
        };
 
+       vcc12v_dcin: vcc12v-dcin {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc12v_dcin";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        vcc1v8_s0: vcc1v8-s0 {
                compatible = "regulator-fixed";
                regulator-name = "vcc1v8_s0";
                regulator-always-on;
        };
 
-       vcc_sys: vcc-sys {
+       vcc5v0_sys: vcc5v0-sys {
                compatible = "regulator-fixed";
-               regulator-name = "vcc_sys";
+               regulator-name = "vcc5v0_sys";
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                regulator-always-on;
+               vin-supply = <&vcc12v_dcin>;
        };
 
        vcc3v3_sys: vcc3v3-sys {
@@ -40,7 +50,7 @@
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                regulator-always-on;
-               vin-supply = <&vcc_sys>;
+               vin-supply = <&vcc5v0_sys>;
        };
 
        vcc3v3_pcie: vcc3v3-pcie-regulator {
@@ -64,7 +74,7 @@
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                regulator-always-on;
-               vin-supply = <&vcc_sys>;
+               vin-supply = <&vcc5v0_sys>;
        };
 };
 
        status = "okay";
 };
 
+&gpu {
+       mali-supply = <&vdd_gpu>;
+       status = "okay";
+};
+
 &hdmi {
        ddc-i2c-bus = <&i2c3>;
        pinctrl-names = "default";
                regulator-ramp-delay = <1000>;
                regulator-always-on;
                regulator-boot-on;
-               vin-supply = <&vcc_sys>;
+               vin-supply = <&vcc5v0_sys>;
                status = "okay";
 
                regulator-state-mem {
                regulator-ramp-delay = <1000>;
                regulator-always-on;
                regulator-boot-on;
-               vin-supply = <&vcc_sys>;
+               vin-supply = <&vcc5v0_sys>;
                regulator-state-mem {
                        regulator-off-in-suspend;
                };
                #clock-cells = <1>;
                clock-output-names = "xin32k", "rk808-clkout2";
 
-               vcc1-supply = <&vcc_sys>;
-               vcc2-supply = <&vcc_sys>;
-               vcc3-supply = <&vcc_sys>;
-               vcc4-supply = <&vcc_sys>;
-               vcc6-supply = <&vcc_sys>;
-               vcc7-supply = <&vcc_sys>;
+               vcc1-supply = <&vcc5v0_sys>;
+               vcc2-supply = <&vcc5v0_sys>;
+               vcc3-supply = <&vcc5v0_sys>;
+               vcc4-supply = <&vcc5v0_sys>;
+               vcc6-supply = <&vcc5v0_sys>;
+               vcc7-supply = <&vcc5v0_sys>;
                vcc8-supply = <&vcc3v3_sys>;
-               vcc9-supply = <&vcc_sys>;
-               vcc10-supply = <&vcc_sys>;
-               vcc11-supply = <&vcc_sys>;
+               vcc9-supply = <&vcc5v0_sys>;
+               vcc10-supply = <&vcc5v0_sys>;
+               vcc11-supply = <&vcc5v0_sys>;
                vcc12-supply = <&vcc3v3_sys>;
                vddio-supply = <&vcc_1v8>;
 
        sdmmc {
                sdmmc_bus1: sdmmc-bus1 {
                        rockchip,pins =
-                               <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               <4 RK_PB0 1 &pcfg_pull_up_8ma>;
                };
 
                sdmmc_bus4: sdmmc-bus4 {
                        rockchip,pins =
-                               <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                               <4 9 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                               <4 10 RK_FUNC_1 &pcfg_pull_up_8ma>,
-                               <4 11 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               <4 RK_PB0 1 &pcfg_pull_up_8ma>,
+                               <4 RK_PB1 1 &pcfg_pull_up_8ma>,
+                               <4 RK_PB2 1 &pcfg_pull_up_8ma>,
+                               <4 RK_PB3 1 &pcfg_pull_up_8ma>;
                };
 
                sdmmc_clk: sdmmc-clk {
                        rockchip,pins =
-                               <4 12 RK_FUNC_1 &pcfg_pull_none_18ma>;
+                               <4 RK_PB4 1 &pcfg_pull_none_18ma>;
                };
 
                sdmmc_cmd: sdmmc-cmd {
                        rockchip,pins =
-                               <4 13 RK_FUNC_1 &pcfg_pull_up_8ma>;
+                               <4 RK_PB5 1 &pcfg_pull_up_8ma>;
                };
        };
 
        sdio0 {
                sdio0_bus4: sdio0-bus4 {
                        rockchip,pins =
-                               <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>,
-                               <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>,
-                               <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>,
-                               <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>;
+                               <2 RK_PC4 1 &pcfg_pull_up_20ma>,
+                               <2 RK_PC5 1 &pcfg_pull_up_20ma>,
+                               <2 RK_PC6 1 &pcfg_pull_up_20ma>,
+                               <2 RK_PC7 1 &pcfg_pull_up_20ma>;
                };
 
                sdio0_cmd: sdio0-cmd {
                        rockchip,pins =
-                               <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>;
+                               <2 RK_PD0 1 &pcfg_pull_up_20ma>;
                };
 
                sdio0_clk: sdio0-clk {
                        rockchip,pins =
-                               <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>;
+                               <2 RK_PD1 1 &pcfg_pull_none_20ma>;
                };
        };
 
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
-                               <1 21 RK_FUNC_GPIO &pcfg_pull_up>;
+                               <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
                };
 
                vsel1_gpio: vsel1-gpio {
                        rockchip,pins =
-                               <1 17 RK_FUNC_GPIO &pcfg_pull_down>;
+                               <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
                };
 
                vsel2_gpio: vsel2-gpio {
                        rockchip,pins =
-                               <1 14 RK_FUNC_GPIO &pcfg_pull_down>;
+                               <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
                };
        };
 
index 1f2394e..20ec7d1 100644 (file)
        status = "okay";
 };
 
+&hdmi_sound {
+       status = "okay";
+};
+
 &gpu {
        mali-supply = <&vdd_gpu>;
        status = "okay";
        status = "okay";
 
        bt656-supply = <&vcc1v8_dvp>;
-       audio-supply = <&vcca1v8_codec>;
+       audio-supply = <&vcc_3v0>;
        sdmmc-supply = <&vcc_sdio>;
        gpio1830-supply = <&vcc_3v0>;
 };
index 946d358..04623e5 100644 (file)
        fan {
                motor_pwr: motor-pwr {
                        rockchip,pins =
-                               <RK_GPIO1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
        sd {
                sdmmc0_pwr_h: sdmmc0-pwr-h {
                        rockchip,pins =
-                               <RK_GPIO0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+                               <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };
 
index db9d948..196ac9b 100644 (file)
@@ -71,6 +71,7 @@
                        compatible = "arm,cortex-a53";
                        reg = <0x0 0x0>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <100>;
@@ -82,6 +83,7 @@
                        compatible = "arm,cortex-a53";
                        reg = <0x0 0x1>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <100>;
@@ -93,6 +95,7 @@
                        compatible = "arm,cortex-a53";
                        reg = <0x0 0x2>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <100>;
                        compatible = "arm,cortex-a53";
                        reg = <0x0 0x3>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <485>;
                        clocks = <&cru ARMCLKL>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <100>;
                        compatible = "arm,cortex-a72";
                        reg = <0x0 0x100>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        clocks = <&cru ARMCLKB>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <436>;
                        compatible = "arm,cortex-a72";
                        reg = <0x0 0x101>;
                        enable-method = "psci";
+                       capacity-dmips-mhz = <1024>;
                        clocks = <&cru ARMCLKB>;
                        #cooling-cells = <2>; /* min followed by max */
                        dynamic-power-coefficient = <436>;
                phys = <&emmc_phy>;
                phy-names = "phy_arasan";
                power-domains = <&power RK3399_PD_EMMC>;
+               disable-cqe-dcmd;
                status = "disabled";
        };
 
                        clock-names = "refclk";
                        #phy-cells = <1>;
                        resets = <&cru SRST_PCIEPHY>;
+                       drive-impedance-ohm = <50>;
                        reset-names = "phy";
                        status = "disabled";
                };
 
                clock {
                        clk_32k: clk-32k {
-                               rockchip,pins = <0 0 RK_FUNC_2 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA0 2 &pcfg_pull_none>;
                        };
                };
 
                edp {
                        edp_hpd: edp-hpd {
                                rockchip,pins =
-                                       <4 23 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC7 2 &pcfg_pull_none>;
                        };
                };
 
                        rgmii_pins: rgmii-pins {
                                rockchip,pins =
                                        /* mac_txclk */
-                                       <3 17 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PC1 1 &pcfg_pull_none_13ma>,
                                        /* mac_rxclk */
-                                       <3 14 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB6 1 &pcfg_pull_none>,
                                        /* mac_mdio */
-                                       <3 13 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB5 1 &pcfg_pull_none>,
                                        /* mac_txen */
-                                       <3 12 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PB4 1 &pcfg_pull_none_13ma>,
                                        /* mac_clk */
-                                       <3 11 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB3 1 &pcfg_pull_none>,
                                        /* mac_rxdv */
-                                       <3 9 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB1 1 &pcfg_pull_none>,
                                        /* mac_mdc */
-                                       <3 8 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB0 1 &pcfg_pull_none>,
                                        /* mac_rxd1 */
-                                       <3 7 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA7 1 &pcfg_pull_none>,
                                        /* mac_rxd0 */
-                                       <3 6 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA6 1 &pcfg_pull_none>,
                                        /* mac_txd1 */
-                                       <3 5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA5 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd0 */
-                                       <3 4 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA4 1 &pcfg_pull_none_13ma>,
                                        /* mac_rxd3 */
-                                       <3 3 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA3 1 &pcfg_pull_none>,
                                        /* mac_rxd2 */
-                                       <3 2 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA2 1 &pcfg_pull_none>,
                                        /* mac_txd3 */
-                                       <3 1 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA1 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd2 */
-                                       <3 0 RK_FUNC_1 &pcfg_pull_none_13ma>;
+                                       <3 RK_PA0 1 &pcfg_pull_none_13ma>;
                        };
 
                        rmii_pins: rmii-pins {
                                rockchip,pins =
                                        /* mac_mdio */
-                                       <3 13 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB5 1 &pcfg_pull_none>,
                                        /* mac_txen */
-                                       <3 12 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PB4 1 &pcfg_pull_none_13ma>,
                                        /* mac_clk */
-                                       <3 11 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB3 1 &pcfg_pull_none>,
                                        /* mac_rxer */
-                                       <3 10 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB2 1 &pcfg_pull_none>,
                                        /* mac_rxdv */
-                                       <3 9 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB1 1 &pcfg_pull_none>,
                                        /* mac_mdc */
-                                       <3 8 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PB0 1 &pcfg_pull_none>,
                                        /* mac_rxd1 */
-                                       <3 7 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA7 1 &pcfg_pull_none>,
                                        /* mac_rxd0 */
-                                       <3 6 RK_FUNC_1 &pcfg_pull_none>,
+                                       <3 RK_PA6 1 &pcfg_pull_none>,
                                        /* mac_txd1 */
-                                       <3 5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+                                       <3 RK_PA5 1 &pcfg_pull_none_13ma>,
                                        /* mac_txd0 */
-                                       <3 4 RK_FUNC_1 &pcfg_pull_none_13ma>;
+                                       <3 RK_PA4 1 &pcfg_pull_none_13ma>;
                        };
                };
 
                i2c0 {
                        i2c0_xfer: i2c0-xfer {
                                rockchip,pins =
-                                       <1 15 RK_FUNC_2 &pcfg_pull_none>,
-                                       <1 16 RK_FUNC_2 &pcfg_pull_none>;
+                                       <1 RK_PB7 2 &pcfg_pull_none>,
+                                       <1 RK_PC0 2 &pcfg_pull_none>;
                        };
                };
 
                i2c1 {
                        i2c1_xfer: i2c1-xfer {
                                rockchip,pins =
-                                       <4 2 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 1 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PA2 1 &pcfg_pull_none>,
+                                       <4 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                i2c2 {
                        i2c2_xfer: i2c2-xfer {
                                rockchip,pins =
-                                       <2 1 RK_FUNC_2 &pcfg_pull_none_12ma>,
-                                       <2 0 RK_FUNC_2 &pcfg_pull_none_12ma>;
+                                       <2 RK_PA1 2 &pcfg_pull_none_12ma>,
+                                       <2 RK_PA0 2 &pcfg_pull_none_12ma>;
                        };
                };
 
                i2c3 {
                        i2c3_xfer: i2c3-xfer {
                                rockchip,pins =
-                                       <4 17 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 16 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC1 1 &pcfg_pull_none>,
+                                       <4 RK_PC0 1 &pcfg_pull_none>;
                        };
                };
 
                i2c4 {
                        i2c4_xfer: i2c4-xfer {
                                rockchip,pins =
-                                       <1 12 RK_FUNC_1 &pcfg_pull_none>,
-                                       <1 11 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PB4 1 &pcfg_pull_none>,
+                                       <1 RK_PB3 1 &pcfg_pull_none>;
                        };
                };
 
                i2c5 {
                        i2c5_xfer: i2c5-xfer {
                                rockchip,pins =
-                                       <3 11 RK_FUNC_2 &pcfg_pull_none>,
-                                       <3 10 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB3 2 &pcfg_pull_none>,
+                                       <3 RK_PB2 2 &pcfg_pull_none>;
                        };
                };
 
                i2c6 {
                        i2c6_xfer: i2c6-xfer {
                                rockchip,pins =
-                                       <2 10 RK_FUNC_2 &pcfg_pull_none>,
-                                       <2 9 RK_FUNC_2 &pcfg_pull_none>;
+                                       <2 RK_PB2 2 &pcfg_pull_none>,
+                                       <2 RK_PB1 2 &pcfg_pull_none>;
                        };
                };
 
                i2c7 {
                        i2c7_xfer: i2c7-xfer {
                                rockchip,pins =
-                                       <2 8 RK_FUNC_2 &pcfg_pull_none>,
-                                       <2 7 RK_FUNC_2 &pcfg_pull_none>;
+                                       <2 RK_PB0 2 &pcfg_pull_none>,
+                                       <2 RK_PA7 2 &pcfg_pull_none>;
                        };
                };
 
                i2c8 {
                        i2c8_xfer: i2c8-xfer {
                                rockchip,pins =
-                                       <1 21 RK_FUNC_1 &pcfg_pull_none>,
-                                       <1 20 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PC5 1 &pcfg_pull_none>,
+                                       <1 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                i2s0 {
                        i2s0_2ch_bus: i2s0-2ch-bus {
                                rockchip,pins =
-                                       <3 24 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 25 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 26 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 27 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 31 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <3 RK_PD0 1 &pcfg_pull_none>,
+                                       <3 RK_PD1 1 &pcfg_pull_none>,
+                                       <3 RK_PD2 1 &pcfg_pull_none>,
+                                       <3 RK_PD3 1 &pcfg_pull_none>,
+                                       <3 RK_PD7 1 &pcfg_pull_none>,
+                                       <4 RK_PA0 1 &pcfg_pull_none>;
                        };
 
                        i2s0_8ch_bus: i2s0-8ch-bus {
                                rockchip,pins =
-                                       <3 24 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 25 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 26 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 27 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 28 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 29 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 30 RK_FUNC_1 &pcfg_pull_none>,
-                                       <3 31 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <3 RK_PD0 1 &pcfg_pull_none>,
+                                       <3 RK_PD1 1 &pcfg_pull_none>,
+                                       <3 RK_PD2 1 &pcfg_pull_none>,
+                                       <3 RK_PD3 1 &pcfg_pull_none>,
+                                       <3 RK_PD4 1 &pcfg_pull_none>,
+                                       <3 RK_PD5 1 &pcfg_pull_none>,
+                                       <3 RK_PD6 1 &pcfg_pull_none>,
+                                       <3 RK_PD7 1 &pcfg_pull_none>,
+                                       <4 RK_PA0 1 &pcfg_pull_none>;
                        };
                };
 
                i2s1 {
                        i2s1_2ch_bus: i2s1-2ch-bus {
                                rockchip,pins =
-                                       <4 3 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 4 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 5 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 6 RK_FUNC_1 &pcfg_pull_none>,
-                                       <4 7 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PA3 1 &pcfg_pull_none>,
+                                       <4 RK_PA4 1 &pcfg_pull_none>,
+                                       <4 RK_PA5 1 &pcfg_pull_none>,
+                                       <4 RK_PA6 1 &pcfg_pull_none>,
+                                       <4 RK_PA7 1 &pcfg_pull_none>;
                        };
                };
 
                sdio0 {
                        sdio0_bus1: sdio0-bus1 {
                                rockchip,pins =
-                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PC4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bus4: sdio0-bus4 {
                                rockchip,pins =
-                                       <2 RK_PC4 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC5 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC6 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 RK_PC7 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PC4 1 &pcfg_pull_up>,
+                                       <2 RK_PC5 1 &pcfg_pull_up>,
+                                       <2 RK_PC6 1 &pcfg_pull_up>,
+                                       <2 RK_PC7 1 &pcfg_pull_up>;
                        };
 
                        sdio0_cmd: sdio0-cmd {
                                rockchip,pins =
-                                       <2 RK_PD0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD0 1 &pcfg_pull_up>;
                        };
 
                        sdio0_clk: sdio0-clk {
                                rockchip,pins =
-                                       <2 RK_PD1 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PD1 1 &pcfg_pull_none>;
                        };
 
                        sdio0_cd: sdio0-cd {
                                rockchip,pins =
-                                       <2 RK_PD2 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD2 1 &pcfg_pull_up>;
                        };
 
                        sdio0_pwr: sdio0-pwr {
                                rockchip,pins =
-                                       <2 RK_PD3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_bkpwr: sdio0-bkpwr {
                                rockchip,pins =
-                                       <2 RK_PD4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PD4 1 &pcfg_pull_up>;
                        };
 
                        sdio0_wp: sdio0-wp {
                                rockchip,pins =
-                                       <0 RK_PA3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA3 1 &pcfg_pull_up>;
                        };
 
                        sdio0_int: sdio0-int {
                                rockchip,pins =
-                                       <0 RK_PA4 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA4 1 &pcfg_pull_up>;
                        };
                };
 
                sdmmc {
                        sdmmc_bus1: sdmmc-bus1 {
                                rockchip,pins =
-                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB0 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_bus4: sdmmc-bus4 {
                                rockchip,pins =
-                                       <4 RK_PB0 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB1 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB2 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 RK_PB3 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB0 1 &pcfg_pull_up>,
+                                       <4 RK_PB1 1 &pcfg_pull_up>,
+                                       <4 RK_PB2 1 &pcfg_pull_up>,
+                                       <4 RK_PB3 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_clk: sdmmc-clk {
                                rockchip,pins =
-                                       <4 RK_PB4 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PB4 1 &pcfg_pull_none>;
                        };
 
                        sdmmc_cmd: sdmmc-cmd {
                                rockchip,pins =
-                                       <4 RK_PB5 RK_FUNC_1 &pcfg_pull_up>;
+                                       <4 RK_PB5 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_cd: sdmmc-cd {
                                rockchip,pins =
-                                       <0 RK_PA7 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PA7 1 &pcfg_pull_up>;
                        };
 
                        sdmmc_wp: sdmmc-wp {
                                rockchip,pins =
-                                       <0 RK_PB0 RK_FUNC_1 &pcfg_pull_up>;
+                                       <0 RK_PB0 1 &pcfg_pull_up>;
                        };
                };
 
                sleep {
                        ap_pwroff: ap-pwroff {
-                               rockchip,pins = <1 5 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA5 1 &pcfg_pull_none>;
                        };
 
                        ddrio_pwroff: ddrio-pwroff {
-                               rockchip,pins = <0 1 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>;
                        };
                };
 
                spdif {
                        spdif_bus: spdif-bus {
                                rockchip,pins =
-                                       <4 21 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC5 1 &pcfg_pull_none>;
                        };
 
                        spdif_bus_1: spdif-bus-1 {
                                rockchip,pins =
-                                       <3 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                                       <3 RK_PC0 3 &pcfg_pull_none>;
                        };
                };
 
                spi0 {
                        spi0_clk: spi0-clk {
                                rockchip,pins =
-                                       <3 6 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA6 2 &pcfg_pull_up>;
                        };
                        spi0_cs0: spi0-cs0 {
                                rockchip,pins =
-                                       <3 7 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA7 2 &pcfg_pull_up>;
                        };
                        spi0_cs1: spi0-cs1 {
                                rockchip,pins =
-                                       <3 8 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PB0 2 &pcfg_pull_up>;
                        };
                        spi0_tx: spi0-tx {
                                rockchip,pins =
-                                       <3 5 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA5 2 &pcfg_pull_up>;
                        };
                        spi0_rx: spi0-rx {
                                rockchip,pins =
-                                       <3 4 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA4 2 &pcfg_pull_up>;
                        };
                };
 
                spi1 {
                        spi1_clk: spi1-clk {
                                rockchip,pins =
-                                       <1 9 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB1 2 &pcfg_pull_up>;
                        };
                        spi1_cs0: spi1-cs0 {
                                rockchip,pins =
-                                       <1 10 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB2 2 &pcfg_pull_up>;
                        };
                        spi1_rx: spi1-rx {
                                rockchip,pins =
-                                       <1 7 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PA7 2 &pcfg_pull_up>;
                        };
                        spi1_tx: spi1-tx {
                                rockchip,pins =
-                                       <1 8 RK_FUNC_2 &pcfg_pull_up>;
+                                       <1 RK_PB0 2 &pcfg_pull_up>;
                        };
                };
 
                spi2 {
                        spi2_clk: spi2-clk {
                                rockchip,pins =
-                                       <2 11 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB3 1 &pcfg_pull_up>;
                        };
                        spi2_cs0: spi2-cs0 {
                                rockchip,pins =
-                                       <2 12 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB4 1 &pcfg_pull_up>;
                        };
                        spi2_rx: spi2-rx {
                                rockchip,pins =
-                                       <2 9 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB1 1 &pcfg_pull_up>;
                        };
                        spi2_tx: spi2-tx {
                                rockchip,pins =
-                                       <2 10 RK_FUNC_1 &pcfg_pull_up>;
+                                       <2 RK_PB2 1 &pcfg_pull_up>;
                        };
                };
 
                spi3 {
                        spi3_clk: spi3-clk {
                                rockchip,pins =
-                                       <1 17 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC1 1 &pcfg_pull_up>;
                        };
                        spi3_cs0: spi3-cs0 {
                                rockchip,pins =
-                                       <1 18 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC2 1 &pcfg_pull_up>;
                        };
                        spi3_rx: spi3-rx {
                                rockchip,pins =
-                                       <1 15 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PB7 1 &pcfg_pull_up>;
                        };
                        spi3_tx: spi3-tx {
                                rockchip,pins =
-                                       <1 16 RK_FUNC_1 &pcfg_pull_up>;
+                                       <1 RK_PC0 1 &pcfg_pull_up>;
                        };
                };
 
                spi4 {
                        spi4_clk: spi4-clk {
                                rockchip,pins =
-                                       <3 2 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA2 2 &pcfg_pull_up>;
                        };
                        spi4_cs0: spi4-cs0 {
                                rockchip,pins =
-                                       <3 3 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA3 2 &pcfg_pull_up>;
                        };
                        spi4_rx: spi4-rx {
                                rockchip,pins =
-                                       <3 0 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA0 2 &pcfg_pull_up>;
                        };
                        spi4_tx: spi4-tx {
                                rockchip,pins =
-                                       <3 1 RK_FUNC_2 &pcfg_pull_up>;
+                                       <3 RK_PA1 2 &pcfg_pull_up>;
                        };
                };
 
                spi5 {
                        spi5_clk: spi5-clk {
                                rockchip,pins =
-                                       <2 22 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC6 2 &pcfg_pull_up>;
                        };
                        spi5_cs0: spi5-cs0 {
                                rockchip,pins =
-                                       <2 23 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC7 2 &pcfg_pull_up>;
                        };
                        spi5_rx: spi5-rx {
                                rockchip,pins =
-                                       <2 20 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC4 2 &pcfg_pull_up>;
                        };
                        spi5_tx: spi5-tx {
                                rockchip,pins =
-                                       <2 21 RK_FUNC_2 &pcfg_pull_up>;
+                                       <2 RK_PC5 2 &pcfg_pull_up>;
                        };
                };
 
                testclk {
                        test_clkout0: test-clkout0 {
                                rockchip,pins =
-                                       <0 0 RK_FUNC_1 &pcfg_pull_none>;
+                                       <0 RK_PA0 1 &pcfg_pull_none>;
                        };
 
                        test_clkout1: test-clkout1 {
                                rockchip,pins =
-                                       <2 25 RK_FUNC_2 &pcfg_pull_none>;
+                                       <2 RK_PD1 2 &pcfg_pull_none>;
                        };
 
                        test_clkout2: test-clkout2 {
                                rockchip,pins =
-                                       <0 8 RK_FUNC_3 &pcfg_pull_none>;
+                                       <0 RK_PB0 3 &pcfg_pull_none>;
                        };
                };
 
                tsadc {
                        otp_gpio: otp-gpio {
-                               rockchip,pins = <1 6 RK_FUNC_GPIO &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
                        };
 
                        otp_out: otp-out {
-                               rockchip,pins = <1 6 RK_FUNC_1 &pcfg_pull_none>;
+                               rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none>;
                        };
                };
 
                uart0 {
                        uart0_xfer: uart0-xfer {
                                rockchip,pins =
-                                       <2 16 RK_FUNC_1 &pcfg_pull_up>,
-                                       <2 17 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC0 1 &pcfg_pull_up>,
+                                       <2 RK_PC1 1 &pcfg_pull_none>;
                        };
 
                        uart0_cts: uart0-cts {
                                rockchip,pins =
-                                       <2 18 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC2 1 &pcfg_pull_none>;
                        };
 
                        uart0_rts: uart0-rts {
                                rockchip,pins =
-                                       <2 19 RK_FUNC_1 &pcfg_pull_none>;
+                                       <2 RK_PC3 1 &pcfg_pull_none>;
                        };
                };
 
                uart1 {
                        uart1_xfer: uart1-xfer {
                                rockchip,pins =
-                                       <3 12 RK_FUNC_2 &pcfg_pull_up>,
-                                       <3 13 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB4 2 &pcfg_pull_up>,
+                                       <3 RK_PB5 2 &pcfg_pull_none>;
                        };
                };
 
                uart2a {
                        uart2a_xfer: uart2a-xfer {
                                rockchip,pins =
-                                       <4 8 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 9 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PB0 2 &pcfg_pull_up>,
+                                       <4 RK_PB1 2 &pcfg_pull_none>;
                        };
                };
 
                uart2b {
                        uart2b_xfer: uart2b-xfer {
                                rockchip,pins =
-                                       <4 16 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 17 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC0 2 &pcfg_pull_up>,
+                                       <4 RK_PC1 2 &pcfg_pull_none>;
                        };
                };
 
                uart2c {
                        uart2c_xfer: uart2c-xfer {
                                rockchip,pins =
-                                       <4 19 RK_FUNC_1 &pcfg_pull_up>,
-                                       <4 20 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC3 1 &pcfg_pull_up>,
+                                       <4 RK_PC4 1 &pcfg_pull_none>;
                        };
                };
 
                uart3 {
                        uart3_xfer: uart3-xfer {
                                rockchip,pins =
-                                       <3 14 RK_FUNC_2 &pcfg_pull_up>,
-                                       <3 15 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PB6 2 &pcfg_pull_up>,
+                                       <3 RK_PB7 2 &pcfg_pull_none>;
                        };
 
                        uart3_cts: uart3-cts {
                                rockchip,pins =
-                                       <3 18 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PC0 2 &pcfg_pull_none>;
                        };
 
                        uart3_rts: uart3-rts {
                                rockchip,pins =
-                                       <3 19 RK_FUNC_2 &pcfg_pull_none>;
+                                       <3 RK_PC1 2 &pcfg_pull_none>;
                        };
                };
 
                uart4 {
                        uart4_xfer: uart4-xfer {
                                rockchip,pins =
-                                       <1 7 RK_FUNC_1 &pcfg_pull_up>,
-                                       <1 8 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PA7 1 &pcfg_pull_up>,
+                                       <1 RK_PB0 1 &pcfg_pull_none>;
                        };
                };
 
                uarthdcp {
                        uarthdcp_xfer: uarthdcp-xfer {
                                rockchip,pins =
-                                       <4 21 RK_FUNC_2 &pcfg_pull_up>,
-                                       <4 22 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC5 2 &pcfg_pull_up>,
+                                       <4 RK_PC6 2 &pcfg_pull_none>;
                        };
                };
 
                pwm0 {
                        pwm0_pin: pwm0-pin {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC2 1 &pcfg_pull_none>;
                        };
 
                        pwm0_pin_pull_down: pwm0-pin-pull-down {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_1 &pcfg_pull_down>;
+                                       <4 RK_PC2 1 &pcfg_pull_down>;
                        };
 
                        vop0_pwm_pin: vop0-pwm-pin {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_2 &pcfg_pull_none>;
+                                       <4 RK_PC2 2 &pcfg_pull_none>;
                        };
 
                        vop1_pwm_pin: vop1-pwm-pin {
                                rockchip,pins =
-                                       <4 RK_PC2 RK_FUNC_3 &pcfg_pull_none>;
+                                       <4 RK_PC2 3 &pcfg_pull_none>;
                        };
                };
 
                pwm1 {
                        pwm1_pin: pwm1-pin {
                                rockchip,pins =
-                                       <4 RK_PC6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC6 1 &pcfg_pull_none>;
                        };
 
                        pwm1_pin_pull_down: pwm1-pin-pull-down {
                                rockchip,pins =
-                                       <4 RK_PC6 RK_FUNC_1 &pcfg_pull_down>;
+                                       <4 RK_PC6 1 &pcfg_pull_down>;
                        };
                };
 
                pwm2 {
                        pwm2_pin: pwm2-pin {
                                rockchip,pins =
-                                       <1 RK_PC3 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PC3 1 &pcfg_pull_none>;
                        };
 
                        pwm2_pin_pull_down: pwm2-pin-pull-down {
                                rockchip,pins =
-                                       <1 RK_PC3 RK_FUNC_1 &pcfg_pull_down>;
+                                       <1 RK_PC3 1 &pcfg_pull_down>;
                        };
                };
 
                pwm3a {
                        pwm3a_pin: pwm3a-pin {
                                rockchip,pins =
-                                       <0 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <0 RK_PA6 1 &pcfg_pull_none>;
                        };
                };
 
                pwm3b {
                        pwm3b_pin: pwm3b-pin {
                                rockchip,pins =
-                                       <1 RK_PB6 RK_FUNC_1 &pcfg_pull_none>;
+                                       <1 RK_PB6 1 &pcfg_pull_none>;
                        };
                };
 
                hdmi {
                        hdmi_i2c_xfer: hdmi-i2c-xfer {
                                rockchip,pins =
-                                       <4 RK_PC1 RK_FUNC_3 &pcfg_pull_none>,
-                                       <4 RK_PC0 RK_FUNC_3 &pcfg_pull_none>;
+                                       <4 RK_PC1 3 &pcfg_pull_none>,
+                                       <4 RK_PC0 3 &pcfg_pull_none>;
                        };
 
                        hdmi_cec: hdmi-cec {
                                rockchip,pins =
-                                       <4 RK_PC7 RK_FUNC_1 &pcfg_pull_none>;
+                                       <4 RK_PC7 1 &pcfg_pull_none>;
                        };
                };
 
index eb6be56..4bb862c 100644 (file)
@@ -75,7 +75,9 @@
                                             "sprd,sc9836-uart";
                                reg = <0x0 0x100>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&ext_26m>;
+                               clock-names = "enable", "uart", "source";
+                               clocks = <&apapb_gate CLK_UART0_EB>,
+                                      <&ap_clk CLK_UART0>, <&ext_26m>;
                                status = "disabled";
                        };
 
@@ -84,7 +86,9 @@
                                             "sprd,sc9836-uart";
                                reg = <0x100000 0x100>;
                                interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&ext_26m>;
+                               clock-names = "enable", "uart", "source";
+                               clocks = <&apapb_gate CLK_UART1_EB>,
+                                      <&ap_clk CLK_UART1>, <&ext_26m>;
                                status = "disabled";
                        };
 
@@ -93,7 +97,9 @@
                                             "sprd,sc9836-uart";
                                reg = <0x200000 0x100>;
                                interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&ext_26m>;
+                               clock-names = "enable", "uart", "source";
+                               clocks = <&apapb_gate CLK_UART2_EB>,
+                                      <&ap_clk CLK_UART2>, <&ext_26m>;
                                status = "disabled";
                        };
 
                                             "sprd,sc9836-uart";
                                reg = <0x300000 0x100>;
                                interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
-                               clocks = <&ext_26m>;
+                               clock-names = "enable", "uart", "source";
+                               clocks = <&apapb_gate CLK_UART3_EB>,
+                                      <&ap_clk CLK_UART3>, <&ext_26m>;
                                status = "disabled";
                        };
                };
index 11cc671..2421ec7 100644 (file)
@@ -89,6 +89,7 @@
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
 };
 
index cef8167..2a3b665 100644 (file)
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
 };
 
index af4d868..1780ed2 100644 (file)
@@ -21,6 +21,7 @@
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
        /* Cleanup from RevA */
        /delete-node/ phy@21;
index d4ad19a..8f45614 100644 (file)
@@ -55,6 +55,7 @@
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
 };
 
index 94cf509..93ce7eb 100644 (file)
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
 };
 
index 460adc3..8bb0001 100644 (file)
                ti,rx-internal-delay = <0x8>;
                ti,tx-internal-delay = <0xa>;
                ti,fifo-depth = <0x1>;
+               ti,dp83867-rxctrl-strap-quirk;
        };
 };
 
index 14a1cdf..1268961 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_ARCH_ZX) += zx296718-evb.dtb
 dtb-$(CONFIG_ARCH_ZX) += zx296718-pcbox.dtb
index 74f0a19..4d58351 100644 (file)
@@ -29,6 +29,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_ALL=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_PROFILING=y
+CONFIG_ARCH_AGILEX=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_ARCH_ALPINE=y
 CONFIG_ARCH_BCM2835=y
@@ -46,15 +47,6 @@ CONFIG_ARCH_MVEBU=y
 CONFIG_ARCH_MXC=y
 CONFIG_ARCH_QCOM=y
 CONFIG_ARCH_RENESAS=y
-CONFIG_ARCH_R8A774A1=y
-CONFIG_ARCH_R8A774C0=y
-CONFIG_ARCH_R8A7795=y
-CONFIG_ARCH_R8A7796=y
-CONFIG_ARCH_R8A77965=y
-CONFIG_ARCH_R8A77970=y
-CONFIG_ARCH_R8A77980=y
-CONFIG_ARCH_R8A77990=y
-CONFIG_ARCH_R8A77995=y
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_ARCH_SEATTLE=y
 CONFIG_ARCH_STRATIX10=y
@@ -68,25 +60,6 @@ CONFIG_ARCH_VEXPRESS=y
 CONFIG_ARCH_XGENE=y
 CONFIG_ARCH_ZX=y
 CONFIG_ARCH_ZYNQMP=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_IOV=y
-CONFIG_HOTPLUG_PCI=y
-CONFIG_HOTPLUG_PCI_ACPI=y
-CONFIG_PCI_AARDVARK=y
-CONFIG_PCI_TEGRA=y
-CONFIG_PCIE_RCAR=y
-CONFIG_PCI_HOST_GENERIC=y
-CONFIG_PCI_XGENE=y
-CONFIG_PCI_HOST_THUNDER_PEM=y
-CONFIG_PCI_HOST_THUNDER_ECAM=y
-CONFIG_PCIE_ROCKCHIP_HOST=m
-CONFIG_PCI_LAYERSCAPE=y
-CONFIG_PCI_HISI=y
-CONFIG_PCIE_QCOM=y
-CONFIG_PCIE_ARMADA_8K=y
-CONFIG_PCIE_KIRIN=y
-CONFIG_PCIE_HISI_STB=y
 CONFIG_ARM64_VA_BITS_48=y
 CONFIG_SCHED_MC=y
 CONFIG_NUMA=y
@@ -112,6 +85,7 @@ CONFIG_ARM_SCPI_CPUFREQ=y
 CONFIG_ARM_TEGRA186_CPUFREQ=y
 CONFIG_ARM_SCPI_PROTOCOL=y
 CONFIG_RASPBERRYPI_FIRMWARE=y
+CONFIG_INTEL_STRATIX10_SERVICE=y
 CONFIG_TI_SCI_PROTOCOL=y
 CONFIG_EFI_CAPSULE_LOADER=y
 CONFIG_IMX_SCU=y
@@ -196,11 +170,30 @@ CONFIG_MAC80211_LEDS=y
 CONFIG_RFKILL=m
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
+CONFIG_PCI=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_IOV=y
+CONFIG_HOTPLUG_PCI=y
+CONFIG_HOTPLUG_PCI_ACPI=y
+CONFIG_PCI_AARDVARK=y
+CONFIG_PCI_TEGRA=y
+CONFIG_PCIE_RCAR=y
+CONFIG_PCI_HOST_GENERIC=y
+CONFIG_PCI_XGENE=y
+CONFIG_PCIE_ALTERA=y
+CONFIG_PCIE_ALTERA_MSI=y
+CONFIG_PCI_HOST_THUNDER_PEM=y
+CONFIG_PCI_HOST_THUNDER_ECAM=y
+CONFIG_PCIE_ROCKCHIP_HOST=m
+CONFIG_PCI_LAYERSCAPE=y
+CONFIG_PCI_HISI=y
+CONFIG_PCIE_QCOM=y
+CONFIG_PCIE_ARMADA_8K=y
+CONFIG_PCIE_KIRIN=y
+CONFIG_PCIE_HISI_STB=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_DMA_CMA=y
-CONFIG_CMA_SIZE_MBYTES=32
 CONFIG_HISILICON_LPC=y
 CONFIG_SIMPLE_PM_BUS=y
 CONFIG_MTD=y
@@ -222,10 +215,10 @@ CONFIG_BLK_DEV_SD=y
 CONFIG_SCSI_SAS_ATA=y
 CONFIG_SCSI_HISI_SAS=y
 CONFIG_SCSI_HISI_SAS_PCI=y
-CONFIG_SCSI_UFSHCD=m
-CONFIG_SCSI_UFSHCD_PLATFORM=m
+CONFIG_SCSI_UFSHCD=y
+CONFIG_SCSI_UFSHCD_PLATFORM=y
 CONFIG_SCSI_UFS_QCOM=m
-CONFIG_SCSI_UFS_HISI=m
+CONFIG_SCSI_UFS_HISI=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
@@ -364,6 +357,7 @@ CONFIG_SPI=y
 CONFIG_SPI_ARMADA_3700=y
 CONFIG_SPI_BCM2835=m
 CONFIG_SPI_BCM2835AUX=m
+CONFIG_SPI_NXP_FLEXSPI=y
 CONFIG_SPI_MESON_SPICC=m
 CONFIG_SPI_MESON_SPIFC=m
 CONFIG_SPI_ORION=y
@@ -372,7 +366,7 @@ CONFIG_SPI_ROCKCHIP=y
 CONFIG_SPI_QUP=y
 CONFIG_SPI_S3C64XX=y
 CONFIG_SPI_SPIDEV=m
-CONFIG_SPI_NXP_FLEXSPI=y
+CONFIG_SPI_SUN6I=y
 CONFIG_SPMI=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_PINCTRL_MAX77620=y
@@ -387,7 +381,6 @@ CONFIG_PINCTRL_QCS404=y
 CONFIG_PINCTRL_QDF2XXX=y
 CONFIG_PINCTRL_QCOM_SPMI_PMIC=y
 CONFIG_PINCTRL_SDM845=y
-CONFIG_PINCTRL_MTK_MOORE=y
 CONFIG_GPIO_DWAPB=y
 CONFIG_GPIO_MB86S7X=y
 CONFIG_GPIO_PL061=y
@@ -408,6 +401,7 @@ CONFIG_BATTERY_SBS=m
 CONFIG_BATTERY_BQ27XXX=y
 CONFIG_SENSORS_ARM_SCPI=y
 CONFIG_SENSORS_LM90=m
+CONFIG_SENSORS_PWM_FAN=m
 CONFIG_SENSORS_RASPBERRYPI_HWMON=m
 CONFIG_SENSORS_INA2XX=m
 CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
@@ -473,14 +467,14 @@ CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
 CONFIG_MEDIA_CONTROLLER=y
 CONFIG_VIDEO_V4L2_SUBDEV_API=y
 # CONFIG_DVB_NET is not set
-CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
+CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_VIDEO_SUN6I_CSI=m
 CONFIG_V4L_MEM2MEM_DRIVERS=y
 CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m
 CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
 CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
-CONFIG_VIDEO_SUN6I_CSI=m
 CONFIG_VIDEO_RENESAS_FCP=m
 CONFIG_VIDEO_RENESAS_VSP1=m
 CONFIG_DRM=m
@@ -499,7 +493,6 @@ CONFIG_ROCKCHIP_DW_HDMI=y
 CONFIG_ROCKCHIP_DW_MIPI_DSI=y
 CONFIG_ROCKCHIP_INNO_HDMI=y
 CONFIG_DRM_RCAR_DU=m
-CONFIG_DRM_RCAR_LVDS=m
 CONFIG_DRM_SUN4I=m
 CONFIG_DRM_SUN8I_DW_HDMI=m
 CONFIG_DRM_SUN8I_MIXER=m
@@ -514,7 +507,6 @@ CONFIG_DRM_MESON=m
 CONFIG_DRM_PL111=m
 CONFIG_FB=y
 CONFIG_FB_MODE_HELPERS=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_BACKLIGHT_GENERIC=m
 CONFIG_BACKLIGHT_PWM=m
 CONFIG_BACKLIGHT_LP855X=m
@@ -523,22 +515,24 @@ CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_SOUND=y
 CONFIG_SND=y
+CONFIG_SND_HDA_TEGRA=m
+CONFIG_SND_HDA_CODEC_HDMI=m
 CONFIG_SND_SOC=y
 CONFIG_SND_BCM2835_SOC_I2S=m
+CONFIG_SND_MESON_AXG_SOUND_CARD=m
 CONFIG_SND_SOC_ROCKCHIP=m
 CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
 CONFIG_SND_SOC_ROCKCHIP_RT5645=m
 CONFIG_SND_SOC_RK3399_GRU_SOUND=m
-CONFIG_SND_MESON_AXG_SOUND_CARD=m
 CONFIG_SND_SOC_SAMSUNG=y
 CONFIG_SND_SOC_RCAR=m
 CONFIG_SND_SOC_AK4613=m
-CONFIG_SND_SOC_PCM3168A_I2C=m
-CONFIG_SND_SIMPLE_CARD=m
-CONFIG_SND_AUDIO_GRAPH_CARD=m
 CONFIG_SND_SOC_ES7134=m
 CONFIG_SND_SOC_ES7241=m
+CONFIG_SND_SOC_PCM3168A_I2C=m
 CONFIG_SND_SOC_TAS571X=m
+CONFIG_SND_SIMPLE_CARD=m
+CONFIG_SND_AUDIO_GRAPH_CARD=m
 CONFIG_I2C_HID=m
 CONFIG_USB=y
 CONFIG_USB_OTG=y
@@ -606,6 +600,7 @@ CONFIG_EDAC_GHES=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_MAX77686=y
 CONFIG_RTC_DRV_RK808=m
+CONFIG_RTC_DRV_RX8581=m
 CONFIG_RTC_DRV_S5M=y
 CONFIG_RTC_DRV_DS3232=y
 CONFIG_RTC_DRV_EFI=y
@@ -620,6 +615,7 @@ CONFIG_RTC_DRV_XGENE=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_BCM2835=m
 CONFIG_K3_DMA=y
+CONFIG_MV_XOR=y
 CONFIG_MV_XOR_V2=y
 CONFIG_PL330_DMA=y
 CONFIG_TEGRA20_APB_DMA=y
@@ -677,7 +673,6 @@ CONFIG_RPMSG_QCOM_GLINK_RPM=y
 CONFIG_RPMSG_QCOM_GLINK_SMEM=m
 CONFIG_RPMSG_QCOM_SMD=y
 CONFIG_RASPBERRYPI_POWER=y
-CONFIG_IMX_GPCV2_PM_DOMAINS=y
 CONFIG_QCOM_COMMAND_DB=y
 CONFIG_QCOM_GENI_SE=y
 CONFIG_QCOM_GLINK_SSR=m
@@ -686,6 +681,15 @@ CONFIG_QCOM_SMEM=y
 CONFIG_QCOM_SMD_RPM=y
 CONFIG_QCOM_SMP2P=y
 CONFIG_QCOM_SMSM=y
+CONFIG_ARCH_R8A774A1=y
+CONFIG_ARCH_R8A774C0=y
+CONFIG_ARCH_R8A7795=y
+CONFIG_ARCH_R8A7796=y
+CONFIG_ARCH_R8A77965=y
+CONFIG_ARCH_R8A77970=y
+CONFIG_ARCH_R8A77980=y
+CONFIG_ARCH_R8A77990=y
+CONFIG_ARCH_R8A77995=y
 CONFIG_ROCKCHIP_PM_DOMAINS=y
 CONFIG_ARCH_TEGRA_132_SOC=y
 CONFIG_ARCH_TEGRA_210_SOC=y
@@ -741,6 +745,12 @@ CONFIG_QCOM_QFPROM=y
 CONFIG_ROCKCHIP_EFUSE=y
 CONFIG_UNIPHIER_EFUSE=y
 CONFIG_MESON_EFUSE=m
+CONFIG_FPGA=y
+CONFIG_FPGA_MGR_STRATIX10_SOC=m
+CONFIG_FPGA_BRIDGE=m
+CONFIG_ALTERA_FREEZE_BRIDGE=m
+CONFIG_FPGA_REGION=m
+CONFIG_OF_FPGA_REGION=m
 CONFIG_TEE=y
 CONFIG_OPTEE=y
 CONFIG_EXT2_FS=y
@@ -771,6 +781,8 @@ CONFIG_NLS_ISO8859_1=y
 CONFIG_SECURITY=y
 CONFIG_CRYPTO_ECHAINIV=y
 CONFIG_CRYPTO_ANSI_CPRNG=y
+CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=32
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
index eb0df23..1de6e05 100644 (file)
@@ -17,10 +17,8 @@ generic-y += mmiowb.h
 generic-y += msi.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += set_memory.h
-generic-y += sizes.h
 generic-y += switch_to.h
 generic-y += trace_clock.h
 generic-y += unaligned.h
index 039fbd8..92b6b7c 100644 (file)
@@ -718,12 +718,11 @@ USER(\label, ic   ivau, \tmp2)                    // invalidate I line PoU
  * the output section, any use of such directives is undefined.
  *
  * The yield itself consists of the following:
- * - Check whether the preempt count is exactly 1, in which case disabling
- *   preemption once will make the task preemptible. If this is not the case,
- *   yielding is pointless.
- * - Check whether TIF_NEED_RESCHED is set, and if so, disable and re-enable
- *   kernel mode NEON (which will trigger a reschedule), and branch to the
- *   yield fixup code.
+ * - Check whether the preempt count is exactly 1 and a reschedule is also
+ *   needed. If so, calling of preempt_enable() in kernel_neon_end() will
+ *   trigger a reschedule. If it is not the case, yielding is pointless.
+ * - Disable and re-enable kernel mode NEON, and branch to the yield fixup
+ *   code.
  *
  * This macro sequence may clobber all CPU state that is not guaranteed by the
  * AAPCS to be preserved across an ordinary function call.
index 355e552..c7f67da 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __ASM_BOOT_H
 #define __ASM_BOOT_H
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /*
  * arm64 requires the DTB to be 8 byte aligned and
index f210bcf..bc895c8 100644 (file)
@@ -401,7 +401,7 @@ unsigned long cpu_get_elf_hwcap2(void);
 #define cpu_have_named_feature(name) cpu_have_feature(cpu_feature(name))
 
 /* System capability check for constant caps */
-static inline bool __cpus_have_const_cap(int num)
+static __always_inline bool __cpus_have_const_cap(int num)
 {
        if (num >= ARM64_NCAPS)
                return false;
@@ -415,7 +415,7 @@ static inline bool cpus_have_cap(unsigned int num)
        return test_bit(num, cpu_hwcaps);
 }
 
-static inline bool cpus_have_const_cap(int num)
+static __always_inline bool cpus_have_const_cap(int num)
 {
        if (static_branch_likely(&arm64_const_caps_ready))
                return __cpus_have_const_cap(num);
index dd1ad39..df62bbd 100644 (file)
 
 #ifndef __ASSEMBLY__
 
+#include <linux/bitmap.h>
 #include <linux/build_bug.h>
+#include <linux/bug.h>
 #include <linux/cache.h>
 #include <linux/init.h>
 #include <linux/stddef.h>
+#include <linux/types.h>
 
 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
 /* Masks for extracting the FPSR and FPCR from the FPSCR */
@@ -56,7 +59,8 @@ extern void fpsimd_restore_current_state(void);
 extern void fpsimd_update_current_state(struct user_fpsimd_state const *state);
 
 extern void fpsimd_bind_task_to_cpu(void);
-extern void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *state);
+extern void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *state,
+                                    void *sve_state, unsigned int sve_vl);
 
 extern void fpsimd_flush_task_state(struct task_struct *target);
 extern void fpsimd_flush_cpu_state(void);
@@ -87,6 +91,29 @@ extern void sve_kernel_enable(const struct arm64_cpu_capabilities *__unused);
 extern u64 read_zcr_features(void);
 
 extern int __ro_after_init sve_max_vl;
+extern int __ro_after_init sve_max_virtualisable_vl;
+extern __ro_after_init DECLARE_BITMAP(sve_vq_map, SVE_VQ_MAX);
+
+/*
+ * Helpers to translate bit indices in sve_vq_map to VQ values (and
+ * vice versa).  This allows find_next_bit() to be used to find the
+ * _maximum_ VQ not exceeding a certain value.
+ */
+static inline unsigned int __vq_to_bit(unsigned int vq)
+{
+       return SVE_VQ_MAX - vq;
+}
+
+static inline unsigned int __bit_to_vq(unsigned int bit)
+{
+       return SVE_VQ_MAX - bit;
+}
+
+/* Ensure vq >= SVE_VQ_MIN && vq <= SVE_VQ_MAX before calling this function */
+static inline bool sve_vq_available(unsigned int vq)
+{
+       return test_bit(__vq_to_bit(vq), sve_vq_map);
+}
 
 #ifdef CONFIG_ARM64_SVE
 
index f5b79e9..ff73f54 100644 (file)
@@ -108,7 +108,8 @@ extern u32 __kvm_get_mdcr_el2(void);
 .endm
 
 .macro get_host_ctxt reg, tmp
-       hyp_adr_this_cpu \reg, kvm_host_cpu_state, \tmp
+       hyp_adr_this_cpu \reg, kvm_host_data, \tmp
+       add     \reg, \reg, #HOST_DATA_CONTEXT
 .endm
 
 .macro get_vcpu_ptr vcpu, ctxt
index d384279..613427f 100644 (file)
@@ -98,6 +98,22 @@ static inline void vcpu_set_wfe_traps(struct kvm_vcpu *vcpu)
        vcpu->arch.hcr_el2 |= HCR_TWE;
 }
 
+static inline void vcpu_ptrauth_enable(struct kvm_vcpu *vcpu)
+{
+       vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK);
+}
+
+static inline void vcpu_ptrauth_disable(struct kvm_vcpu *vcpu)
+{
+       vcpu->arch.hcr_el2 &= ~(HCR_API | HCR_APK);
+}
+
+static inline void vcpu_ptrauth_setup_lazy(struct kvm_vcpu *vcpu)
+{
+       if (vcpu_has_ptrauth(vcpu))
+               vcpu_ptrauth_disable(vcpu);
+}
+
 static inline unsigned long vcpu_get_vsesr(struct kvm_vcpu *vcpu)
 {
        return vcpu->arch.vsesr_el2;
index a01fe08..2a8d3f8 100644 (file)
 #ifndef __ARM64_KVM_HOST_H__
 #define __ARM64_KVM_HOST_H__
 
+#include <linux/bitmap.h>
 #include <linux/types.h>
+#include <linux/jump_label.h>
 #include <linux/kvm_types.h>
+#include <linux/percpu.h>
 #include <asm/arch_gicv3.h>
+#include <asm/barrier.h>
 #include <asm/cpufeature.h>
 #include <asm/daifflags.h>
 #include <asm/fpsimd.h>
@@ -45,7 +49,7 @@
 
 #define KVM_MAX_VCPUS VGIC_V3_MAX_CPUS
 
-#define KVM_VCPU_MAX_FEATURES 4
+#define KVM_VCPU_MAX_FEATURES 7
 
 #define KVM_REQ_SLEEP \
        KVM_ARCH_REQ_FLAGS(0, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
 
 DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
 
+extern unsigned int kvm_sve_max_vl;
+int kvm_arm_init_sve(void);
+
 int __attribute_const__ kvm_target_cpu(void);
 int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
+void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
 int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext);
 void __extended_idmap_trampoline(phys_addr_t boot_pgd, phys_addr_t idmap_start);
 
@@ -117,6 +125,7 @@ enum vcpu_sysreg {
        SCTLR_EL1,      /* System Control Register */
        ACTLR_EL1,      /* Auxiliary Control Register */
        CPACR_EL1,      /* Coprocessor Access Control */
+       ZCR_EL1,        /* SVE Control */
        TTBR0_EL1,      /* Translation Table Base Register 0 */
        TTBR1_EL1,      /* Translation Table Base Register 1 */
        TCR_EL1,        /* Translation Control Register */
@@ -152,6 +161,18 @@ enum vcpu_sysreg {
        PMSWINC_EL0,    /* Software Increment Register */
        PMUSERENR_EL0,  /* User Enable Register */
 
+       /* Pointer Authentication Registers in a strict increasing order. */
+       APIAKEYLO_EL1,
+       APIAKEYHI_EL1,
+       APIBKEYLO_EL1,
+       APIBKEYHI_EL1,
+       APDAKEYLO_EL1,
+       APDAKEYHI_EL1,
+       APDBKEYLO_EL1,
+       APDBKEYHI_EL1,
+       APGAKEYLO_EL1,
+       APGAKEYHI_EL1,
+
        /* 32bit specific registers. Keep them at the end of the range */
        DACR32_EL2,     /* Domain Access Control Register */
        IFSR32_EL2,     /* Instruction Fault Status Register */
@@ -212,7 +233,17 @@ struct kvm_cpu_context {
        struct kvm_vcpu *__hyp_running_vcpu;
 };
 
-typedef struct kvm_cpu_context kvm_cpu_context_t;
+struct kvm_pmu_events {
+       u32 events_host;
+       u32 events_guest;
+};
+
+struct kvm_host_data {
+       struct kvm_cpu_context host_ctxt;
+       struct kvm_pmu_events pmu_events;
+};
+
+typedef struct kvm_host_data kvm_host_data_t;
 
 struct vcpu_reset_state {
        unsigned long   pc;
@@ -223,6 +254,8 @@ struct vcpu_reset_state {
 
 struct kvm_vcpu_arch {
        struct kvm_cpu_context ctxt;
+       void *sve_state;
+       unsigned int sve_max_vl;
 
        /* HYP configuration */
        u64 hcr_el2;
@@ -255,7 +288,7 @@ struct kvm_vcpu_arch {
        struct kvm_guest_debug_arch external_debug_state;
 
        /* Pointer to host CPU context */
-       kvm_cpu_context_t *host_cpu_context;
+       struct kvm_cpu_context *host_cpu_context;
 
        struct thread_info *host_thread_info;   /* hyp VA */
        struct user_fpsimd_state *host_fpsimd_state;    /* hyp VA */
@@ -318,12 +351,40 @@ struct kvm_vcpu_arch {
        bool sysregs_loaded_on_cpu;
 };
 
+/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */
+#define vcpu_sve_pffr(vcpu) ((void *)((char *)((vcpu)->arch.sve_state) + \
+                                     sve_ffr_offset((vcpu)->arch.sve_max_vl)))
+
+#define vcpu_sve_state_size(vcpu) ({                                   \
+       size_t __size_ret;                                              \
+       unsigned int __vcpu_vq;                                         \
+                                                                       \
+       if (WARN_ON(!sve_vl_valid((vcpu)->arch.sve_max_vl))) {          \
+               __size_ret = 0;                                         \
+       } else {                                                        \
+               __vcpu_vq = sve_vq_from_vl((vcpu)->arch.sve_max_vl);    \
+               __size_ret = SVE_SIG_REGS_SIZE(__vcpu_vq);              \
+       }                                                               \
+                                                                       \
+       __size_ret;                                                     \
+})
+
 /* vcpu_arch flags field values: */
 #define KVM_ARM64_DEBUG_DIRTY          (1 << 0)
 #define KVM_ARM64_FP_ENABLED           (1 << 1) /* guest FP regs loaded */
 #define KVM_ARM64_FP_HOST              (1 << 2) /* host FP regs loaded */
 #define KVM_ARM64_HOST_SVE_IN_USE      (1 << 3) /* backup for host TIF_SVE */
 #define KVM_ARM64_HOST_SVE_ENABLED     (1 << 4) /* SVE enabled for EL0 */
+#define KVM_ARM64_GUEST_HAS_SVE                (1 << 5) /* SVE exposed to guest */
+#define KVM_ARM64_VCPU_SVE_FINALIZED   (1 << 6) /* SVE config completed */
+#define KVM_ARM64_GUEST_HAS_PTRAUTH    (1 << 7) /* PTRAUTH exposed to guest */
+
+#define vcpu_has_sve(vcpu) (system_supports_sve() && \
+                           ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE))
+
+#define vcpu_has_ptrauth(vcpu) ((system_supports_address_auth() || \
+                                 system_supports_generic_auth()) && \
+                                ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_PTRAUTH))
 
 #define vcpu_gp_regs(v)                (&(v)->arch.ctxt.gp_regs)
 
@@ -432,9 +493,9 @@ void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome);
 
 struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
 
-DECLARE_PER_CPU(kvm_cpu_context_t, kvm_host_cpu_state);
+DECLARE_PER_CPU(kvm_host_data_t, kvm_host_data);
 
-static inline void kvm_init_host_cpu_context(kvm_cpu_context_t *cpu_ctxt,
+static inline void kvm_init_host_cpu_context(struct kvm_cpu_context *cpu_ctxt,
                                             int cpu)
 {
        /* The host's MPIDR is immutable, so let's set it up at boot time */
@@ -452,8 +513,8 @@ static inline void __cpu_init_hyp_mode(phys_addr_t pgd_ptr,
         * kernel's mapping to the linear mapping, and store it in tpidr_el2
         * so that we can use adr_l to access per-cpu variables in EL2.
         */
-       u64 tpidr_el2 = ((u64)this_cpu_ptr(&kvm_host_cpu_state) -
-                        (u64)kvm_ksym_ref(kvm_host_cpu_state));
+       u64 tpidr_el2 = ((u64)this_cpu_ptr(&kvm_host_data) -
+                        (u64)kvm_ksym_ref(kvm_host_data));
 
        /*
         * Call initialization code, and switch to the full blown HYP code.
@@ -491,9 +552,10 @@ static inline bool kvm_arch_requires_vhe(void)
        return false;
 }
 
+void kvm_arm_vcpu_ptrauth_trap(struct kvm_vcpu *vcpu);
+
 static inline void kvm_arch_hardware_unsetup(void) {}
 static inline void kvm_arch_sync_events(struct kvm *kvm) {}
-static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}
 static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
 static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
 
@@ -516,11 +578,28 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu);
 void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu);
 void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu);
 
+static inline bool kvm_pmu_counter_deferred(struct perf_event_attr *attr)
+{
+       return (!has_vhe() && attr->exclude_host);
+}
+
 #ifdef CONFIG_KVM /* Avoid conflicts with core headers if CONFIG_KVM=n */
 static inline int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu)
 {
        return kvm_arch_vcpu_run_map_fp(vcpu);
 }
+
+void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr);
+void kvm_clr_pmu_events(u32 clr);
+
+void __pmu_switch_to_host(struct kvm_cpu_context *host_ctxt);
+bool __pmu_switch_to_guest(struct kvm_cpu_context *host_ctxt);
+
+void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu);
+void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu);
+#else
+static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {}
+static inline void kvm_clr_pmu_events(u32 clr) {}
 #endif
 
 static inline void kvm_arm_vhe_guest_enter(void)
@@ -594,4 +673,10 @@ void kvm_arch_free_vm(struct kvm *kvm);
 
 int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type);
 
+int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature);
+bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu);
+
+#define kvm_arm_vcpu_sve_finalized(vcpu) \
+       ((vcpu)->arch.flags & KVM_ARM64_VCPU_SVE_FINALIZED)
+
 #endif /* __ARM64_KVM_HOST_H__ */
index c306083..09fe8bd 100644 (file)
@@ -149,7 +149,6 @@ void __debug_switch_to_host(struct kvm_vcpu *vcpu);
 
 void __fpsimd_save_state(struct user_fpsimd_state *fp_regs);
 void __fpsimd_restore_state(struct user_fpsimd_state *fp_regs);
-bool __fpsimd_enabled(void);
 
 void activate_traps_vhe_load(struct kvm_vcpu *vcpu);
 void deactivate_traps_vhe_put(void);
diff --git a/arch/arm64/include/asm/kvm_ptrauth.h b/arch/arm64/include/asm/kvm_ptrauth.h
new file mode 100644 (file)
index 0000000..6301813
--- /dev/null
@@ -0,0 +1,111 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* arch/arm64/include/asm/kvm_ptrauth.h: Guest/host ptrauth save/restore
+ * Copyright 2019 Arm Limited
+ * Authors: Mark Rutland <mark.rutland@arm.com>
+ *         Amit Daniel Kachhap <amit.kachhap@arm.com>
+ */
+
+#ifndef __ASM_KVM_PTRAUTH_H
+#define __ASM_KVM_PTRAUTH_H
+
+#ifdef __ASSEMBLY__
+
+#include <asm/sysreg.h>
+
+#ifdef CONFIG_ARM64_PTR_AUTH
+
+#define PTRAUTH_REG_OFFSET(x)  (x - CPU_APIAKEYLO_EL1)
+
+/*
+ * CPU_AP*_EL1 values exceed immediate offset range (512) for stp
+ * instruction so below macros takes CPU_APIAKEYLO_EL1 as base and
+ * calculates the offset of the keys from this base to avoid an extra add
+ * instruction. These macros assumes the keys offsets follow the order of
+ * the sysreg enum in kvm_host.h.
+ */
+.macro ptrauth_save_state base, reg1, reg2
+       mrs_s   \reg1, SYS_APIAKEYLO_EL1
+       mrs_s   \reg2, SYS_APIAKEYHI_EL1
+       stp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APIAKEYLO_EL1)]
+       mrs_s   \reg1, SYS_APIBKEYLO_EL1
+       mrs_s   \reg2, SYS_APIBKEYHI_EL1
+       stp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APIBKEYLO_EL1)]
+       mrs_s   \reg1, SYS_APDAKEYLO_EL1
+       mrs_s   \reg2, SYS_APDAKEYHI_EL1
+       stp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APDAKEYLO_EL1)]
+       mrs_s   \reg1, SYS_APDBKEYLO_EL1
+       mrs_s   \reg2, SYS_APDBKEYHI_EL1
+       stp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APDBKEYLO_EL1)]
+       mrs_s   \reg1, SYS_APGAKEYLO_EL1
+       mrs_s   \reg2, SYS_APGAKEYHI_EL1
+       stp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APGAKEYLO_EL1)]
+.endm
+
+.macro ptrauth_restore_state base, reg1, reg2
+       ldp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APIAKEYLO_EL1)]
+       msr_s   SYS_APIAKEYLO_EL1, \reg1
+       msr_s   SYS_APIAKEYHI_EL1, \reg2
+       ldp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APIBKEYLO_EL1)]
+       msr_s   SYS_APIBKEYLO_EL1, \reg1
+       msr_s   SYS_APIBKEYHI_EL1, \reg2
+       ldp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APDAKEYLO_EL1)]
+       msr_s   SYS_APDAKEYLO_EL1, \reg1
+       msr_s   SYS_APDAKEYHI_EL1, \reg2
+       ldp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APDBKEYLO_EL1)]
+       msr_s   SYS_APDBKEYLO_EL1, \reg1
+       msr_s   SYS_APDBKEYHI_EL1, \reg2
+       ldp     \reg1, \reg2, [\base, #PTRAUTH_REG_OFFSET(CPU_APGAKEYLO_EL1)]
+       msr_s   SYS_APGAKEYLO_EL1, \reg1
+       msr_s   SYS_APGAKEYHI_EL1, \reg2
+.endm
+
+/*
+ * Both ptrauth_switch_to_guest and ptrauth_switch_to_host macros will
+ * check for the presence of one of the cpufeature flag
+ * ARM64_HAS_ADDRESS_AUTH_ARCH or ARM64_HAS_ADDRESS_AUTH_IMP_DEF and
+ * then proceed ahead with the save/restore of Pointer Authentication
+ * key registers.
+ */
+.macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3
+alternative_if ARM64_HAS_ADDRESS_AUTH_ARCH
+       b       1000f
+alternative_else_nop_endif
+alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
+       b       1001f
+alternative_else_nop_endif
+1000:
+       ldr     \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
+       and     \reg1, \reg1, #(HCR_API | HCR_APK)
+       cbz     \reg1, 1001f
+       add     \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
+       ptrauth_restore_state   \reg1, \reg2, \reg3
+1001:
+.endm
+
+.macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3
+alternative_if ARM64_HAS_ADDRESS_AUTH_ARCH
+       b       2000f
+alternative_else_nop_endif
+alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
+       b       2001f
+alternative_else_nop_endif
+2000:
+       ldr     \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
+       and     \reg1, \reg1, #(HCR_API | HCR_APK)
+       cbz     \reg1, 2001f
+       add     \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
+       ptrauth_save_state      \reg1, \reg2, \reg3
+       add     \reg1, \h_ctxt, #CPU_APIAKEYLO_EL1
+       ptrauth_restore_state   \reg1, \reg2, \reg3
+       isb
+2001:
+.endm
+
+#else /* !CONFIG_ARM64_PTR_AUTH */
+.macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3
+.endm
+.macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3
+.endm
+#endif /* CONFIG_ARM64_PTR_AUTH */
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_KVM_PTRAUTH_H */
index 2cb8248..8ffcf5a 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/types.h>
 #include <asm/bug.h>
 #include <asm/page-def.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /*
  * Size of the PCI I/O space. This must remain a power of two so that
index 3f7b917..902d75b 100644 (file)
 #define SYS_ICH_LR14_EL2               __SYS__LR8_EL2(6)
 #define SYS_ICH_LR15_EL2               __SYS__LR8_EL2(7)
 
+/* VHE encodings for architectural EL0/1 system registers */
+#define SYS_ZCR_EL12                   sys_reg(3, 5, 1, 2, 0)
+
 /* Common SCTLR_ELx flags. */
 #define SCTLR_ELx_DSSBS        (_BITUL(44))
 #define SCTLR_ELx_ENIA (_BITUL(31))
index f2a83ff..70e6882 100644 (file)
@@ -44,7 +44,7 @@
 #define __ARM_NR_compat_set_tls                (__ARM_NR_COMPAT_BASE + 5)
 #define __ARM_NR_COMPAT_END            (__ARM_NR_COMPAT_BASE + 0x800)
 
-#define __NR_compat_syscalls           428
+#define __NR_compat_syscalls           434
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
index 23f1a44..c39e906 100644 (file)
@@ -874,6 +874,18 @@ __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
 __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
 #define __NR_io_uring_register 427
 __SYSCALL(__NR_io_uring_register, sys_io_uring_register)
+#define __NR_open_tree 428
+__SYSCALL(__NR_open_tree, sys_open_tree)
+#define __NR_move_mount 429
+__SYSCALL(__NR_move_mount, sys_move_mount)
+#define __NR_fsopen 430
+__SYSCALL(__NR_fsopen, sys_fsopen)
+#define __NR_fsconfig 431
+__SYSCALL(__NR_fsconfig, sys_fsconfig)
+#define __NR_fsmount 432
+__SYSCALL(__NR_fsmount, sys_fsmount)
+#define __NR_fspick 433
+__SYSCALL(__NR_fspick, sys_fspick)
 
 /*
  * Please add new compat syscalls above this comment and update
index 97c3478..7b7ac0f 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/psci.h>
 #include <linux/types.h>
 #include <asm/ptrace.h>
+#include <asm/sve_context.h>
 
 #define __KVM_HAVE_GUEST_DEBUG
 #define __KVM_HAVE_IRQ_LINE
@@ -102,6 +103,9 @@ struct kvm_regs {
 #define KVM_ARM_VCPU_EL1_32BIT         1 /* CPU running a 32bit VM */
 #define KVM_ARM_VCPU_PSCI_0_2          2 /* CPU uses PSCI v0.2 */
 #define KVM_ARM_VCPU_PMU_V3            3 /* Support guest PMUv3 */
+#define KVM_ARM_VCPU_SVE               4 /* enable SVE for this CPU */
+#define KVM_ARM_VCPU_PTRAUTH_ADDRESS   5 /* VCPU uses address authentication */
+#define KVM_ARM_VCPU_PTRAUTH_GENERIC   6 /* VCPU uses generic authentication */
 
 struct kvm_vcpu_init {
        __u32 target;
@@ -226,6 +230,45 @@ struct kvm_vcpu_events {
                                         KVM_REG_ARM_FW | ((r) & 0xffff))
 #define KVM_REG_ARM_PSCI_VERSION       KVM_REG_ARM_FW_REG(0)
 
+/* SVE registers */
+#define KVM_REG_ARM64_SVE              (0x15 << KVM_REG_ARM_COPROC_SHIFT)
+
+/* Z- and P-regs occupy blocks at the following offsets within this range: */
+#define KVM_REG_ARM64_SVE_ZREG_BASE    0
+#define KVM_REG_ARM64_SVE_PREG_BASE    0x400
+#define KVM_REG_ARM64_SVE_FFR_BASE     0x600
+
+#define KVM_ARM64_SVE_NUM_ZREGS                __SVE_NUM_ZREGS
+#define KVM_ARM64_SVE_NUM_PREGS                __SVE_NUM_PREGS
+
+#define KVM_ARM64_SVE_MAX_SLICES       32
+
+#define KVM_REG_ARM64_SVE_ZREG(n, i)                                   \
+       (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | \
+        KVM_REG_SIZE_U2048 |                                           \
+        (((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) |                 \
+        ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
+
+#define KVM_REG_ARM64_SVE_PREG(n, i)                                   \
+       (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | \
+        KVM_REG_SIZE_U256 |                                            \
+        (((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) |                 \
+        ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
+
+#define KVM_REG_ARM64_SVE_FFR(i)                                       \
+       (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | \
+        KVM_REG_SIZE_U256 |                                            \
+        ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
+
+#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN
+#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
+
+/* Vector lengths pseudo-register: */
+#define KVM_REG_ARM64_SVE_VLS          (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | \
+                                        KVM_REG_SIZE_U512 | 0xffff)
+#define KVM_ARM64_SVE_VLS_WORDS        \
+       ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
+
 /* Device Control API: ARM VGIC */
 #define KVM_DEV_ARM_VGIC_GRP_ADDR      0
 #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
index e10e2a5..947e398 100644 (file)
@@ -125,9 +125,16 @@ int main(void)
   DEFINE(VCPU_CONTEXT,         offsetof(struct kvm_vcpu, arch.ctxt));
   DEFINE(VCPU_FAULT_DISR,      offsetof(struct kvm_vcpu, arch.fault.disr_el1));
   DEFINE(VCPU_WORKAROUND_FLAGS,        offsetof(struct kvm_vcpu, arch.workaround_flags));
+  DEFINE(VCPU_HCR_EL2,         offsetof(struct kvm_vcpu, arch.hcr_el2));
   DEFINE(CPU_GP_REGS,          offsetof(struct kvm_cpu_context, gp_regs));
+  DEFINE(CPU_APIAKEYLO_EL1,    offsetof(struct kvm_cpu_context, sys_regs[APIAKEYLO_EL1]));
+  DEFINE(CPU_APIBKEYLO_EL1,    offsetof(struct kvm_cpu_context, sys_regs[APIBKEYLO_EL1]));
+  DEFINE(CPU_APDAKEYLO_EL1,    offsetof(struct kvm_cpu_context, sys_regs[APDAKEYLO_EL1]));
+  DEFINE(CPU_APDBKEYLO_EL1,    offsetof(struct kvm_cpu_context, sys_regs[APDBKEYLO_EL1]));
+  DEFINE(CPU_APGAKEYLO_EL1,    offsetof(struct kvm_cpu_context, sys_regs[APGAKEYLO_EL1]));
   DEFINE(CPU_USER_PT_REGS,     offsetof(struct kvm_regs, regs));
   DEFINE(HOST_CONTEXT_VCPU,    offsetof(struct kvm_cpu_context, __hyp_running_vcpu));
+  DEFINE(HOST_DATA_CONTEXT,    offsetof(struct kvm_host_data, host_ctxt));
 #endif
 #ifdef CONFIG_CPU_PM
   DEFINE(CPU_CTX_SP,           offsetof(struct cpu_suspend_ctx, sp));
index 2b807f1..ca27e08 100644 (file)
@@ -1913,7 +1913,7 @@ static void verify_sve_features(void)
        unsigned int len = zcr & ZCR_ELx_LEN_MASK;
 
        if (len < safe_len || sve_verify_vq_map()) {
-               pr_crit("CPU%d: SVE: required vector length(s) missing\n",
+               pr_crit("CPU%d: SVE: vector length support mismatch\n",
                        smp_processor_id());
                cpu_die_early();
        }
index 735cf1f..a38bf74 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/bitmap.h>
+#include <linux/bitops.h>
 #include <linux/bottom_half.h>
 #include <linux/bug.h>
 #include <linux/cache.h>
@@ -48,6 +49,7 @@
 #include <asm/sigcontext.h>
 #include <asm/sysreg.h>
 #include <asm/traps.h>
+#include <asm/virt.h>
 
 #define FPEXC_IOF      (1 << 0)
 #define FPEXC_DZF      (1 << 1)
  */
 struct fpsimd_last_state_struct {
        struct user_fpsimd_state *st;
+       void *sve_state;
+       unsigned int sve_vl;
 };
 
 static DEFINE_PER_CPU(struct fpsimd_last_state_struct, fpsimd_last_state);
@@ -130,14 +134,23 @@ static int sve_default_vl = -1;
 
 /* Maximum supported vector length across all CPUs (initially poisoned) */
 int __ro_after_init sve_max_vl = SVE_VL_MIN;
-/* Set of available vector lengths, as vq_to_bit(vq): */
-static __ro_after_init DECLARE_BITMAP(sve_vq_map, SVE_VQ_MAX);
+int __ro_after_init sve_max_virtualisable_vl = SVE_VL_MIN;
+
+/*
+ * Set of available vector lengths,
+ * where length vq encoded as bit __vq_to_bit(vq):
+ */
+__ro_after_init DECLARE_BITMAP(sve_vq_map, SVE_VQ_MAX);
+/* Set of vector lengths present on at least one cpu: */
+static __ro_after_init DECLARE_BITMAP(sve_vq_partial_map, SVE_VQ_MAX);
+
 static void __percpu *efi_sve_state;
 
 #else /* ! CONFIG_ARM64_SVE */
 
 /* Dummy declaration for code that will be optimised out: */
 extern __ro_after_init DECLARE_BITMAP(sve_vq_map, SVE_VQ_MAX);
+extern __ro_after_init DECLARE_BITMAP(sve_vq_partial_map, SVE_VQ_MAX);
 extern void __percpu *efi_sve_state;
 
 #endif /* ! CONFIG_ARM64_SVE */
@@ -235,14 +248,15 @@ static void task_fpsimd_load(void)
  */
 void fpsimd_save(void)
 {
-       struct user_fpsimd_state *st = __this_cpu_read(fpsimd_last_state.st);
+       struct fpsimd_last_state_struct const *last =
+               this_cpu_ptr(&fpsimd_last_state);
        /* set by fpsimd_bind_task_to_cpu() or fpsimd_bind_state_to_cpu() */
 
        WARN_ON(!in_softirq() && !irqs_disabled());
 
        if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) {
                if (system_supports_sve() && test_thread_flag(TIF_SVE)) {
-                       if (WARN_ON(sve_get_vl() != current->thread.sve_vl)) {
+                       if (WARN_ON(sve_get_vl() != last->sve_vl)) {
                                /*
                                 * Can't save the user regs, so current would
                                 * re-enter user with corrupt state.
@@ -252,32 +266,15 @@ void fpsimd_save(void)
                                return;
                        }
 
-                       sve_save_state(sve_pffr(&current->thread), &st->fpsr);
+                       sve_save_state((char *)last->sve_state +
+                                               sve_ffr_offset(last->sve_vl),
+                                      &last->st->fpsr);
                } else
-                       fpsimd_save_state(st);
+                       fpsimd_save_state(last->st);
        }
 }
 
 /*
- * Helpers to translate bit indices in sve_vq_map to VQ values (and
- * vice versa).  This allows find_next_bit() to be used to find the
- * _maximum_ VQ not exceeding a certain value.
- */
-
-static unsigned int vq_to_bit(unsigned int vq)
-{
-       return SVE_VQ_MAX - vq;
-}
-
-static unsigned int bit_to_vq(unsigned int bit)
-{
-       if (WARN_ON(bit >= SVE_VQ_MAX))
-               bit = SVE_VQ_MAX - 1;
-
-       return SVE_VQ_MAX - bit;
-}
-
-/*
  * All vector length selection from userspace comes through here.
  * We're on a slow path, so some sanity-checks are included.
  * If things go wrong there's a bug somewhere, but try to fall back to a
@@ -298,8 +295,8 @@ static unsigned int find_supported_vector_length(unsigned int vl)
                vl = max_vl;
 
        bit = find_next_bit(sve_vq_map, SVE_VQ_MAX,
-                           vq_to_bit(sve_vq_from_vl(vl)));
-       return sve_vl_from_vq(bit_to_vq(bit));
+                           __vq_to_bit(sve_vq_from_vl(vl)));
+       return sve_vl_from_vq(__bit_to_vq(bit));
 }
 
 #ifdef CONFIG_SYSCTL
@@ -550,7 +547,6 @@ int sve_set_vector_length(struct task_struct *task,
                local_bh_disable();
 
                fpsimd_save();
-               set_thread_flag(TIF_FOREIGN_FPSTATE);
        }
 
        fpsimd_flush_task_state(task);
@@ -624,12 +620,6 @@ int sve_get_current_vl(void)
        return sve_prctl_status(0);
 }
 
-/*
- * Bitmap for temporary storage of the per-CPU set of supported vector lengths
- * during secondary boot.
- */
-static DECLARE_BITMAP(sve_secondary_vq_map, SVE_VQ_MAX);
-
 static void sve_probe_vqs(DECLARE_BITMAP(map, SVE_VQ_MAX))
 {
        unsigned int vq, vl;
@@ -644,40 +634,82 @@ static void sve_probe_vqs(DECLARE_BITMAP(map, SVE_VQ_MAX))
                write_sysreg_s(zcr | (vq - 1), SYS_ZCR_EL1); /* self-syncing */
                vl = sve_get_vl();
                vq = sve_vq_from_vl(vl); /* skip intervening lengths */
-               set_bit(vq_to_bit(vq), map);
+               set_bit(__vq_to_bit(vq), map);
        }
 }
 
+/*
+ * Initialise the set of known supported VQs for the boot CPU.
+ * This is called during kernel boot, before secondary CPUs are brought up.
+ */
 void __init sve_init_vq_map(void)
 {
        sve_probe_vqs(sve_vq_map);
+       bitmap_copy(sve_vq_partial_map, sve_vq_map, SVE_VQ_MAX);
 }
 
 /*
  * If we haven't committed to the set of supported VQs yet, filter out
  * those not supported by the current CPU.
+ * This function is called during the bring-up of early secondary CPUs only.
  */
 void sve_update_vq_map(void)
 {
-       sve_probe_vqs(sve_secondary_vq_map);
-       bitmap_and(sve_vq_map, sve_vq_map, sve_secondary_vq_map, SVE_VQ_MAX);
+       DECLARE_BITMAP(tmp_map, SVE_VQ_MAX);
+
+       sve_probe_vqs(tmp_map);
+       bitmap_and(sve_vq_map, sve_vq_map, tmp_map, SVE_VQ_MAX);
+       bitmap_or(sve_vq_partial_map, sve_vq_partial_map, tmp_map, SVE_VQ_MAX);
 }
 
-/* Check whether the current CPU supports all VQs in the committed set */
+/*
+ * Check whether the current CPU supports all VQs in the committed set.
+ * This function is called during the bring-up of late secondary CPUs only.
+ */
 int sve_verify_vq_map(void)
 {
-       int ret = 0;
+       DECLARE_BITMAP(tmp_map, SVE_VQ_MAX);
+       unsigned long b;
 
-       sve_probe_vqs(sve_secondary_vq_map);
-       bitmap_andnot(sve_secondary_vq_map, sve_vq_map, sve_secondary_vq_map,
-                     SVE_VQ_MAX);
-       if (!bitmap_empty(sve_secondary_vq_map, SVE_VQ_MAX)) {
+       sve_probe_vqs(tmp_map);
+
+       bitmap_complement(tmp_map, tmp_map, SVE_VQ_MAX);
+       if (bitmap_intersects(tmp_map, sve_vq_map, SVE_VQ_MAX)) {
                pr_warn("SVE: cpu%d: Required vector length(s) missing\n",
                        smp_processor_id());
-               ret = -EINVAL;
+               return -EINVAL;
        }
 
-       return ret;
+       if (!IS_ENABLED(CONFIG_KVM) || !is_hyp_mode_available())
+               return 0;
+
+       /*
+        * For KVM, it is necessary to ensure that this CPU doesn't
+        * support any vector length that guests may have probed as
+        * unsupported.
+        */
+
+       /* Recover the set of supported VQs: */
+       bitmap_complement(tmp_map, tmp_map, SVE_VQ_MAX);
+       /* Find VQs supported that are not globally supported: */
+       bitmap_andnot(tmp_map, tmp_map, sve_vq_map, SVE_VQ_MAX);
+
+       /* Find the lowest such VQ, if any: */
+       b = find_last_bit(tmp_map, SVE_VQ_MAX);
+       if (b >= SVE_VQ_MAX)
+               return 0; /* no mismatches */
+
+       /*
+        * Mismatches above sve_max_virtualisable_vl are fine, since
+        * no guest is allowed to configure ZCR_EL2.LEN to exceed this:
+        */
+       if (sve_vl_from_vq(__bit_to_vq(b)) <= sve_max_virtualisable_vl) {
+               pr_warn("SVE: cpu%d: Unsupported vector length(s) present\n",
+                       smp_processor_id());
+               return -EINVAL;
+       }
+
+       return 0;
 }
 
 static void __init sve_efi_setup(void)
@@ -744,6 +776,8 @@ u64 read_zcr_features(void)
 void __init sve_setup(void)
 {
        u64 zcr;
+       DECLARE_BITMAP(tmp_map, SVE_VQ_MAX);
+       unsigned long b;
 
        if (!system_supports_sve())
                return;
@@ -753,8 +787,8 @@ void __init sve_setup(void)
         * so sve_vq_map must have at least SVE_VQ_MIN set.
         * If something went wrong, at least try to patch it up:
         */
-       if (WARN_ON(!test_bit(vq_to_bit(SVE_VQ_MIN), sve_vq_map)))
-               set_bit(vq_to_bit(SVE_VQ_MIN), sve_vq_map);
+       if (WARN_ON(!test_bit(__vq_to_bit(SVE_VQ_MIN), sve_vq_map)))
+               set_bit(__vq_to_bit(SVE_VQ_MIN), sve_vq_map);
 
        zcr = read_sanitised_ftr_reg(SYS_ZCR_EL1);
        sve_max_vl = sve_vl_from_vq((zcr & ZCR_ELx_LEN_MASK) + 1);
@@ -772,11 +806,31 @@ void __init sve_setup(void)
         */
        sve_default_vl = find_supported_vector_length(64);
 
+       bitmap_andnot(tmp_map, sve_vq_partial_map, sve_vq_map,
+                     SVE_VQ_MAX);
+
+       b = find_last_bit(tmp_map, SVE_VQ_MAX);
+       if (b >= SVE_VQ_MAX)
+               /* No non-virtualisable VLs found */
+               sve_max_virtualisable_vl = SVE_VQ_MAX;
+       else if (WARN_ON(b == SVE_VQ_MAX - 1))
+               /* No virtualisable VLs?  This is architecturally forbidden. */
+               sve_max_virtualisable_vl = SVE_VQ_MIN;
+       else /* b + 1 < SVE_VQ_MAX */
+               sve_max_virtualisable_vl = sve_vl_from_vq(__bit_to_vq(b + 1));
+
+       if (sve_max_virtualisable_vl > sve_max_vl)
+               sve_max_virtualisable_vl = sve_max_vl;
+
        pr_info("SVE: maximum available vector length %u bytes per vector\n",
                sve_max_vl);
        pr_info("SVE: default vector length %u bytes per vector\n",
                sve_default_vl);
 
+       /* KVM decides whether to support mismatched systems. Just warn here: */
+       if (sve_max_virtualisable_vl < sve_max_vl)
+               pr_warn("SVE: unvirtualisable vector lengths present\n");
+
        sve_efi_setup();
 }
 
@@ -816,12 +870,11 @@ asmlinkage void do_sve_acc(unsigned int esr, struct pt_regs *regs)
        local_bh_disable();
 
        fpsimd_save();
-       fpsimd_to_sve(current);
 
        /* Force ret_to_user to reload the registers: */
        fpsimd_flush_task_state(current);
-       set_thread_flag(TIF_FOREIGN_FPSTATE);
 
+       fpsimd_to_sve(current);
        if (test_and_set_thread_flag(TIF_SVE))
                WARN_ON(1); /* SVE access shouldn't have trapped */
 
@@ -894,9 +947,9 @@ void fpsimd_flush_thread(void)
 
        local_bh_disable();
 
+       fpsimd_flush_task_state(current);
        memset(&current->thread.uw.fpsimd_state, 0,
               sizeof(current->thread.uw.fpsimd_state));
-       fpsimd_flush_task_state(current);
 
        if (system_supports_sve()) {
                clear_thread_flag(TIF_SVE);
@@ -933,8 +986,6 @@ void fpsimd_flush_thread(void)
                        current->thread.sve_vl_onexec = 0;
        }
 
-       set_thread_flag(TIF_FOREIGN_FPSTATE);
-
        local_bh_enable();
 }
 
@@ -974,6 +1025,8 @@ void fpsimd_bind_task_to_cpu(void)
                this_cpu_ptr(&fpsimd_last_state);
 
        last->st = &current->thread.uw.fpsimd_state;
+       last->sve_state = current->thread.sve_state;
+       last->sve_vl = current->thread.sve_vl;
        current->thread.fpsimd_cpu = smp_processor_id();
 
        if (system_supports_sve()) {
@@ -987,7 +1040,8 @@ void fpsimd_bind_task_to_cpu(void)
        }
 }
 
-void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *st)
+void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *st, void *sve_state,
+                             unsigned int sve_vl)
 {
        struct fpsimd_last_state_struct *last =
                this_cpu_ptr(&fpsimd_last_state);
@@ -995,6 +1049,8 @@ void fpsimd_bind_state_to_cpu(struct user_fpsimd_state *st)
        WARN_ON(!in_softirq() && !irqs_disabled());
 
        last->st = st;
+       last->sve_state = sve_state;
+       last->sve_vl = sve_vl;
 }
 
 /*
@@ -1043,12 +1099,29 @@ void fpsimd_update_current_state(struct user_fpsimd_state const *state)
 
 /*
  * Invalidate live CPU copies of task t's FPSIMD state
+ *
+ * This function may be called with preemption enabled.  The barrier()
+ * ensures that the assignment to fpsimd_cpu is visible to any
+ * preemption/softirq that could race with set_tsk_thread_flag(), so
+ * that TIF_FOREIGN_FPSTATE cannot be spuriously re-cleared.
+ *
+ * The final barrier ensures that TIF_FOREIGN_FPSTATE is seen set by any
+ * subsequent code.
  */
 void fpsimd_flush_task_state(struct task_struct *t)
 {
        t->thread.fpsimd_cpu = NR_CPUS;
+
+       barrier();
+       set_tsk_thread_flag(t, TIF_FOREIGN_FPSTATE);
+
+       barrier();
 }
 
+/*
+ * Invalidate any task's FPSIMD state that is present on this cpu.
+ * This function must be called with softirqs disabled.
+ */
 void fpsimd_flush_cpu_state(void)
 {
        __this_cpu_write(fpsimd_last_state.st, NULL);
index 6164d38..348d12e 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <linux/acpi.h>
 #include <linux/clocksource.h>
+#include <linux/kvm_host.h>
 #include <linux/of.h>
 #include <linux/perf/arm_pmu.h>
 #include <linux/platform_device.h>
@@ -528,12 +529,21 @@ static inline int armv8pmu_enable_counter(int idx)
 
 static inline void armv8pmu_enable_event_counter(struct perf_event *event)
 {
+       struct perf_event_attr *attr = &event->attr;
        int idx = event->hw.idx;
+       u32 counter_bits = BIT(ARMV8_IDX_TO_COUNTER(idx));
 
-       armv8pmu_enable_counter(idx);
        if (armv8pmu_event_is_chained(event))
-               armv8pmu_enable_counter(idx - 1);
-       isb();
+               counter_bits |= BIT(ARMV8_IDX_TO_COUNTER(idx - 1));
+
+       kvm_set_pmu_events(counter_bits, attr);
+
+       /* We rely on the hypervisor switch code to enable guest counters */
+       if (!kvm_pmu_counter_deferred(attr)) {
+               armv8pmu_enable_counter(idx);
+               if (armv8pmu_event_is_chained(event))
+                       armv8pmu_enable_counter(idx - 1);
+       }
 }
 
 static inline int armv8pmu_disable_counter(int idx)
@@ -546,11 +556,21 @@ static inline int armv8pmu_disable_counter(int idx)
 static inline void armv8pmu_disable_event_counter(struct perf_event *event)
 {
        struct hw_perf_event *hwc = &event->hw;
+       struct perf_event_attr *attr = &event->attr;
        int idx = hwc->idx;
+       u32 counter_bits = BIT(ARMV8_IDX_TO_COUNTER(idx));
 
        if (armv8pmu_event_is_chained(event))
-               armv8pmu_disable_counter(idx - 1);
-       armv8pmu_disable_counter(idx);
+               counter_bits |= BIT(ARMV8_IDX_TO_COUNTER(idx - 1));
+
+       kvm_clr_pmu_events(counter_bits);
+
+       /* We rely on the hypervisor switch code to disable guest counters */
+       if (!kvm_pmu_counter_deferred(attr)) {
+               if (armv8pmu_event_is_chained(event))
+                       armv8pmu_disable_counter(idx - 1);
+               armv8pmu_disable_counter(idx);
+       }
 }
 
 static inline int armv8pmu_enable_intens(int idx)
@@ -827,14 +847,23 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
         * with other architectures (x86 and Power).
         */
        if (is_kernel_in_hyp_mode()) {
-               if (!attr->exclude_kernel)
+               if (!attr->exclude_kernel && !attr->exclude_host)
                        config_base |= ARMV8_PMU_INCLUDE_EL2;
-       } else {
-               if (attr->exclude_kernel)
+               if (attr->exclude_guest)
                        config_base |= ARMV8_PMU_EXCLUDE_EL1;
-               if (!attr->exclude_hv)
+               if (attr->exclude_host)
+                       config_base |= ARMV8_PMU_EXCLUDE_EL0;
+       } else {
+               if (!attr->exclude_hv && !attr->exclude_host)
                        config_base |= ARMV8_PMU_INCLUDE_EL2;
        }
+
+       /*
+        * Filter out !VHE kernels and guest kernels
+        */
+       if (attr->exclude_kernel)
+               config_base |= ARMV8_PMU_EXCLUDE_EL1;
+
        if (attr->exclude_user)
                config_base |= ARMV8_PMU_EXCLUDE_EL0;
 
@@ -864,6 +893,9 @@ static void armv8pmu_reset(void *info)
                armv8pmu_disable_intens(idx);
        }
 
+       /* Clear the counters we flip at guest entry/exit */
+       kvm_clr_pmu_events(U32_MAX);
+
        /*
         * Initialize & Reset PMNC. Request overflow interrupt for
         * 64 bit cycle counter but cheat in armv8pmu_write_counter().
index 867a7ce..a9b0485 100644 (file)
@@ -296,11 +296,6 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
         */
 
        fpsimd_flush_task_state(current);
-       barrier();
-       /* From now, fpsimd_thread_switch() won't clear TIF_FOREIGN_FPSTATE */
-
-       set_thread_flag(TIF_FOREIGN_FPSTATE);
-       barrier();
        /* From now, fpsimd_thread_switch() won't touch thread.sve_state */
 
        sve_alloc(current);
index 744b9db..fa230ff 100644 (file)
@@ -12,8 +12,8 @@ obj-vdso := gettimeofday.o note.o sigreturn.o
 targets := $(obj-vdso) vdso.so vdso.so.dbg
 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 
-ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 \
-               $(call ld-option, --hash-style=sysv) -n -T
+ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
+               --build-id -n -T
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
index 690e033..3ac1a64 100644 (file)
@@ -17,7 +17,7 @@ kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/psci.o $(KVM)/arm/perf.o
 kvm-$(CONFIG_KVM_ARM_HOST) += inject_fault.o regmap.o va_layout.o
 kvm-$(CONFIG_KVM_ARM_HOST) += hyp.o hyp-init.o handle_exit.o
 kvm-$(CONFIG_KVM_ARM_HOST) += guest.o debug.o reset.o sys_regs.o sys_regs_generic_v8.o
-kvm-$(CONFIG_KVM_ARM_HOST) += vgic-sys-reg-v3.o fpsimd.o
+kvm-$(CONFIG_KVM_ARM_HOST) += vgic-sys-reg-v3.o fpsimd.o pmu.o
 kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/aarch32.o
 
 kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic/vgic.o
index aac7808..6e3c9c8 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/sched.h>
 #include <linux/thread_info.h>
 #include <linux/kvm_host.h>
+#include <asm/fpsimd.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_host.h>
 #include <asm/kvm_mmu.h>
@@ -85,9 +86,12 @@ void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu)
        WARN_ON_ONCE(!irqs_disabled());
 
        if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) {
-               fpsimd_bind_state_to_cpu(&vcpu->arch.ctxt.gp_regs.fp_regs);
+               fpsimd_bind_state_to_cpu(&vcpu->arch.ctxt.gp_regs.fp_regs,
+                                        vcpu->arch.sve_state,
+                                        vcpu->arch.sve_max_vl);
+
                clear_thread_flag(TIF_FOREIGN_FPSTATE);
-               clear_thread_flag(TIF_SVE);
+               update_thread_flag(TIF_SVE, vcpu_has_sve(vcpu));
        }
 }
 
@@ -100,14 +104,21 @@ void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu)
 void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
 {
        unsigned long flags;
+       bool host_has_sve = system_supports_sve();
+       bool guest_has_sve = vcpu_has_sve(vcpu);
 
        local_irq_save(flags);
 
        if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) {
+               u64 *guest_zcr = &vcpu->arch.ctxt.sys_regs[ZCR_EL1];
+
                /* Clean guest FP state to memory and invalidate cpu view */
                fpsimd_save();
                fpsimd_flush_cpu_state();
-       } else if (system_supports_sve()) {
+
+               if (guest_has_sve)
+                       *guest_zcr = read_sysreg_s(SYS_ZCR_EL12);
+       } else if (host_has_sve) {
                /*
                 * The FPSIMD/SVE state in the CPU has not been touched, and we
                 * have SVE (and VHE): CPACR_EL1 (alias CPTR_EL2) has been
index dd436a5..3ae2f82 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <linux/bits.h>
 #include <linux/errno.h>
 #include <linux/err.h>
+#include <linux/nospec.h>
 #include <linux/kvm_host.h>
 #include <linux/module.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <kvm/arm_psci.h>
 #include <asm/cputype.h>
 #include <linux/uaccess.h>
+#include <asm/fpsimd.h>
 #include <asm/kvm.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_coproc.h>
+#include <asm/kvm_host.h>
+#include <asm/sigcontext.h>
 
 #include "trace.h"
 
@@ -52,12 +59,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
        return 0;
 }
 
+static bool core_reg_offset_is_vreg(u64 off)
+{
+       return off >= KVM_REG_ARM_CORE_REG(fp_regs.vregs) &&
+               off < KVM_REG_ARM_CORE_REG(fp_regs.fpsr);
+}
+
 static u64 core_reg_offset_from_id(u64 id)
 {
        return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
 }
 
-static int validate_core_offset(const struct kvm_one_reg *reg)
+static int validate_core_offset(const struct kvm_vcpu *vcpu,
+                               const struct kvm_one_reg *reg)
 {
        u64 off = core_reg_offset_from_id(reg->id);
        int size;
@@ -89,11 +103,19 @@ static int validate_core_offset(const struct kvm_one_reg *reg)
                return -EINVAL;
        }
 
-       if (KVM_REG_SIZE(reg->id) == size &&
-           IS_ALIGNED(off, size / sizeof(__u32)))
-               return 0;
+       if (KVM_REG_SIZE(reg->id) != size ||
+           !IS_ALIGNED(off, size / sizeof(__u32)))
+               return -EINVAL;
 
-       return -EINVAL;
+       /*
+        * The KVM_REG_ARM64_SVE regs must be used instead of
+        * KVM_REG_ARM_CORE for accessing the FPSIMD V-registers on
+        * SVE-enabled vcpus:
+        */
+       if (vcpu_has_sve(vcpu) && core_reg_offset_is_vreg(off))
+               return -EINVAL;
+
+       return 0;
 }
 
 static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
@@ -115,7 +137,7 @@ static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
            (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
                return -ENOENT;
 
-       if (validate_core_offset(reg))
+       if (validate_core_offset(vcpu, reg))
                return -EINVAL;
 
        if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
@@ -140,7 +162,7 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
            (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
                return -ENOENT;
 
-       if (validate_core_offset(reg))
+       if (validate_core_offset(vcpu, reg))
                return -EINVAL;
 
        if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
@@ -183,6 +205,239 @@ out:
        return err;
 }
 
+#define vq_word(vq) (((vq) - SVE_VQ_MIN) / 64)
+#define vq_mask(vq) ((u64)1 << ((vq) - SVE_VQ_MIN) % 64)
+
+static bool vq_present(
+       const u64 (*const vqs)[KVM_ARM64_SVE_VLS_WORDS],
+       unsigned int vq)
+{
+       return (*vqs)[vq_word(vq)] & vq_mask(vq);
+}
+
+static int get_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
+{
+       unsigned int max_vq, vq;
+       u64 vqs[KVM_ARM64_SVE_VLS_WORDS];
+
+       if (!vcpu_has_sve(vcpu))
+               return -ENOENT;
+
+       if (WARN_ON(!sve_vl_valid(vcpu->arch.sve_max_vl)))
+               return -EINVAL;
+
+       memset(vqs, 0, sizeof(vqs));
+
+       max_vq = sve_vq_from_vl(vcpu->arch.sve_max_vl);
+       for (vq = SVE_VQ_MIN; vq <= max_vq; ++vq)
+               if (sve_vq_available(vq))
+                       vqs[vq_word(vq)] |= vq_mask(vq);
+
+       if (copy_to_user((void __user *)reg->addr, vqs, sizeof(vqs)))
+               return -EFAULT;
+
+       return 0;
+}
+
+static int set_sve_vls(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
+{
+       unsigned int max_vq, vq;
+       u64 vqs[KVM_ARM64_SVE_VLS_WORDS];
+
+       if (!vcpu_has_sve(vcpu))
+               return -ENOENT;
+
+       if (kvm_arm_vcpu_sve_finalized(vcpu))
+               return -EPERM; /* too late! */
+
+       if (WARN_ON(vcpu->arch.sve_state))
+               return -EINVAL;
+
+       if (copy_from_user(vqs, (const void __user *)reg->addr, sizeof(vqs)))
+               return -EFAULT;
+
+       max_vq = 0;
+       for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; ++vq)
+               if (vq_present(&vqs, vq))
+                       max_vq = vq;
+
+       if (max_vq > sve_vq_from_vl(kvm_sve_max_vl))
+               return -EINVAL;
+
+       /*
+        * Vector lengths supported by the host can't currently be
+        * hidden from the guest individually: instead we can only set a
+        * maxmium via ZCR_EL2.LEN.  So, make sure the available vector
+        * lengths match the set requested exactly up to the requested
+        * maximum:
+        */
+       for (vq = SVE_VQ_MIN; vq <= max_vq; ++vq)
+               if (vq_present(&vqs, vq) != sve_vq_available(vq))
+                       return -EINVAL;
+
+       /* Can't run with no vector lengths at all: */
+       if (max_vq < SVE_VQ_MIN)
+               return -EINVAL;
+
+       /* vcpu->arch.sve_state will be alloc'd by kvm_vcpu_finalize_sve() */
+       vcpu->arch.sve_max_vl = sve_vl_from_vq(max_vq);
+
+       return 0;
+}
+
+#define SVE_REG_SLICE_SHIFT    0
+#define SVE_REG_SLICE_BITS     5
+#define SVE_REG_ID_SHIFT       (SVE_REG_SLICE_SHIFT + SVE_REG_SLICE_BITS)
+#define SVE_REG_ID_BITS                5
+
+#define SVE_REG_SLICE_MASK                                     \
+       GENMASK(SVE_REG_SLICE_SHIFT + SVE_REG_SLICE_BITS - 1,   \
+               SVE_REG_SLICE_SHIFT)
+#define SVE_REG_ID_MASK                                                        \
+       GENMASK(SVE_REG_ID_SHIFT + SVE_REG_ID_BITS - 1, SVE_REG_ID_SHIFT)
+
+#define SVE_NUM_SLICES (1 << SVE_REG_SLICE_BITS)
+
+#define KVM_SVE_ZREG_SIZE KVM_REG_SIZE(KVM_REG_ARM64_SVE_ZREG(0, 0))
+#define KVM_SVE_PREG_SIZE KVM_REG_SIZE(KVM_REG_ARM64_SVE_PREG(0, 0))
+
+/*
+ * Number of register slices required to cover each whole SVE register.
+ * NOTE: Only the first slice every exists, for now.
+ * If you are tempted to modify this, you must also rework sve_reg_to_region()
+ * to match:
+ */
+#define vcpu_sve_slices(vcpu) 1
+
+/* Bounds of a single SVE register slice within vcpu->arch.sve_state */
+struct sve_state_reg_region {
+       unsigned int koffset;   /* offset into sve_state in kernel memory */
+       unsigned int klen;      /* length in kernel memory */
+       unsigned int upad;      /* extra trailing padding in user memory */
+};
+
+/*
+ * Validate SVE register ID and get sanitised bounds for user/kernel SVE
+ * register copy
+ */
+static int sve_reg_to_region(struct sve_state_reg_region *region,
+                            struct kvm_vcpu *vcpu,
+                            const struct kvm_one_reg *reg)
+{
+       /* reg ID ranges for Z- registers */
+       const u64 zreg_id_min = KVM_REG_ARM64_SVE_ZREG(0, 0);
+       const u64 zreg_id_max = KVM_REG_ARM64_SVE_ZREG(SVE_NUM_ZREGS - 1,
+                                                      SVE_NUM_SLICES - 1);
+
+       /* reg ID ranges for P- registers and FFR (which are contiguous) */
+       const u64 preg_id_min = KVM_REG_ARM64_SVE_PREG(0, 0);
+       const u64 preg_id_max = KVM_REG_ARM64_SVE_FFR(SVE_NUM_SLICES - 1);
+
+       unsigned int vq;
+       unsigned int reg_num;
+
+       unsigned int reqoffset, reqlen; /* User-requested offset and length */
+       unsigned int maxlen; /* Maxmimum permitted length */
+
+       size_t sve_state_size;
+
+       const u64 last_preg_id = KVM_REG_ARM64_SVE_PREG(SVE_NUM_PREGS - 1,
+                                                       SVE_NUM_SLICES - 1);
+
+       /* Verify that the P-regs and FFR really do have contiguous IDs: */
+       BUILD_BUG_ON(KVM_REG_ARM64_SVE_FFR(0) != last_preg_id + 1);
+
+       /* Verify that we match the UAPI header: */
+       BUILD_BUG_ON(SVE_NUM_SLICES != KVM_ARM64_SVE_MAX_SLICES);
+
+       reg_num = (reg->id & SVE_REG_ID_MASK) >> SVE_REG_ID_SHIFT;
+
+       if (reg->id >= zreg_id_min && reg->id <= zreg_id_max) {
+               if (!vcpu_has_sve(vcpu) || (reg->id & SVE_REG_SLICE_MASK) > 0)
+                       return -ENOENT;
+
+               vq = sve_vq_from_vl(vcpu->arch.sve_max_vl);
+
+               reqoffset = SVE_SIG_ZREG_OFFSET(vq, reg_num) -
+                               SVE_SIG_REGS_OFFSET;
+               reqlen = KVM_SVE_ZREG_SIZE;
+               maxlen = SVE_SIG_ZREG_SIZE(vq);
+       } else if (reg->id >= preg_id_min && reg->id <= preg_id_max) {
+               if (!vcpu_has_sve(vcpu) || (reg->id & SVE_REG_SLICE_MASK) > 0)
+                       return -ENOENT;
+
+               vq = sve_vq_from_vl(vcpu->arch.sve_max_vl);
+
+               reqoffset = SVE_SIG_PREG_OFFSET(vq, reg_num) -
+                               SVE_SIG_REGS_OFFSET;
+               reqlen = KVM_SVE_PREG_SIZE;
+               maxlen = SVE_SIG_PREG_SIZE(vq);
+       } else {
+               return -EINVAL;
+       }
+
+       sve_state_size = vcpu_sve_state_size(vcpu);
+       if (WARN_ON(!sve_state_size))
+               return -EINVAL;
+
+       region->koffset = array_index_nospec(reqoffset, sve_state_size);
+       region->klen = min(maxlen, reqlen);
+       region->upad = reqlen - region->klen;
+
+       return 0;
+}
+
+static int get_sve_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
+{
+       int ret;
+       struct sve_state_reg_region region;
+       char __user *uptr = (char __user *)reg->addr;
+
+       /* Handle the KVM_REG_ARM64_SVE_VLS pseudo-reg as a special case: */
+       if (reg->id == KVM_REG_ARM64_SVE_VLS)
+               return get_sve_vls(vcpu, reg);
+
+       /* Try to interpret reg ID as an architectural SVE register... */
+       ret = sve_reg_to_region(&region, vcpu, reg);
+       if (ret)
+               return ret;
+
+       if (!kvm_arm_vcpu_sve_finalized(vcpu))
+               return -EPERM;
+
+       if (copy_to_user(uptr, vcpu->arch.sve_state + region.koffset,
+                        region.klen) ||
+           clear_user(uptr + region.klen, region.upad))
+               return -EFAULT;
+
+       return 0;
+}
+
+static int set_sve_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
+{
+       int ret;
+       struct sve_state_reg_region region;
+       const char __user *uptr = (const char __user *)reg->addr;
+
+       /* Handle the KVM_REG_ARM64_SVE_VLS pseudo-reg as a special case: */
+       if (reg->id == KVM_REG_ARM64_SVE_VLS)
+               return set_sve_vls(vcpu, reg);
+
+       /* Try to interpret reg ID as an architectural SVE register... */
+       ret = sve_reg_to_region(&region, vcpu, reg);
+       if (ret)
+               return ret;
+
+       if (!kvm_arm_vcpu_sve_finalized(vcpu))
+               return -EPERM;
+
+       if (copy_from_user(vcpu->arch.sve_state + region.koffset, uptr,
+                          region.klen))
+               return -EFAULT;
+
+       return 0;
+}
+
 int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 {
        return -EINVAL;
@@ -193,9 +448,37 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
        return -EINVAL;
 }
 
-static unsigned long num_core_regs(void)
+static int copy_core_reg_indices(const struct kvm_vcpu *vcpu,
+                                u64 __user *uindices)
+{
+       unsigned int i;
+       int n = 0;
+       const u64 core_reg = KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE;
+
+       for (i = 0; i < sizeof(struct kvm_regs) / sizeof(__u32); i++) {
+               /*
+                * The KVM_REG_ARM64_SVE regs must be used instead of
+                * KVM_REG_ARM_CORE for accessing the FPSIMD V-registers on
+                * SVE-enabled vcpus:
+                */
+               if (vcpu_has_sve(vcpu) && core_reg_offset_is_vreg(i))
+                       continue;
+
+               if (uindices) {
+                       if (put_user(core_reg | i, uindices))
+                               return -EFAULT;
+                       uindices++;
+               }
+
+               n++;
+       }
+
+       return n;
+}
+
+static unsigned long num_core_regs(const struct kvm_vcpu *vcpu)
 {
-       return sizeof(struct kvm_regs) / sizeof(__u32);
+       return copy_core_reg_indices(vcpu, NULL);
 }
 
 /**
@@ -251,6 +534,67 @@ static int get_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
        return copy_to_user(uaddr, &val, KVM_REG_SIZE(reg->id)) ? -EFAULT : 0;
 }
 
+static unsigned long num_sve_regs(const struct kvm_vcpu *vcpu)
+{
+       const unsigned int slices = vcpu_sve_slices(vcpu);
+
+       if (!vcpu_has_sve(vcpu))
+               return 0;
+
+       /* Policed by KVM_GET_REG_LIST: */
+       WARN_ON(!kvm_arm_vcpu_sve_finalized(vcpu));
+
+       return slices * (SVE_NUM_PREGS + SVE_NUM_ZREGS + 1 /* FFR */)
+               + 1; /* KVM_REG_ARM64_SVE_VLS */
+}
+
+static int copy_sve_reg_indices(const struct kvm_vcpu *vcpu,
+                               u64 __user *uindices)
+{
+       const unsigned int slices = vcpu_sve_slices(vcpu);
+       u64 reg;
+       unsigned int i, n;
+       int num_regs = 0;
+
+       if (!vcpu_has_sve(vcpu))
+               return 0;
+
+       /* Policed by KVM_GET_REG_LIST: */
+       WARN_ON(!kvm_arm_vcpu_sve_finalized(vcpu));
+
+       /*
+        * Enumerate this first, so that userspace can save/restore in
+        * the order reported by KVM_GET_REG_LIST:
+        */
+       reg = KVM_REG_ARM64_SVE_VLS;
+       if (put_user(reg, uindices++))
+               return -EFAULT;
+       ++num_regs;
+
+       for (i = 0; i < slices; i++) {
+               for (n = 0; n < SVE_NUM_ZREGS; n++) {
+                       reg = KVM_REG_ARM64_SVE_ZREG(n, i);
+                       if (put_user(reg, uindices++))
+                               return -EFAULT;
+                       num_regs++;
+               }
+
+               for (n = 0; n < SVE_NUM_PREGS; n++) {
+                       reg = KVM_REG_ARM64_SVE_PREG(n, i);
+                       if (put_user(reg, uindices++))
+                               return -EFAULT;
+                       num_regs++;
+               }
+
+               reg = KVM_REG_ARM64_SVE_FFR(i);
+               if (put_user(reg, uindices++))
+                       return -EFAULT;
+               num_regs++;
+       }
+
+       return num_regs;
+}
+
 /**
  * kvm_arm_num_regs - how many registers do we present via KVM_GET_ONE_REG
  *
@@ -258,8 +602,15 @@ static int get_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
  */
 unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu)
 {
-       return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu)
-               + kvm_arm_get_fw_num_regs(vcpu) + NUM_TIMER_REGS;
+       unsigned long res = 0;
+
+       res += num_core_regs(vcpu);
+       res += num_sve_regs(vcpu);
+       res += kvm_arm_num_sys_reg_descs(vcpu);
+       res += kvm_arm_get_fw_num_regs(vcpu);
+       res += NUM_TIMER_REGS;
+
+       return res;
 }
 
 /**
@@ -269,23 +620,25 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu)
  */
 int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
 {
-       unsigned int i;
-       const u64 core_reg = KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE;
        int ret;
 
-       for (i = 0; i < sizeof(struct kvm_regs) / sizeof(__u32); i++) {
-               if (put_user(core_reg | i, uindices))
-                       return -EFAULT;
-               uindices++;
-       }
+       ret = copy_core_reg_indices(vcpu, uindices);
+       if (ret < 0)
+               return ret;
+       uindices += ret;
+
+       ret = copy_sve_reg_indices(vcpu, uindices);
+       if (ret < 0)
+               return ret;
+       uindices += ret;
 
        ret = kvm_arm_copy_fw_reg_indices(vcpu, uindices);
-       if (ret)
+       if (ret < 0)
                return ret;
        uindices += kvm_arm_get_fw_num_regs(vcpu);
 
        ret = copy_timer_indices(vcpu, uindices);
-       if (ret)
+       if (ret < 0)
                return ret;
        uindices += NUM_TIMER_REGS;
 
@@ -298,12 +651,11 @@ int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
        if ((reg->id & ~KVM_REG_SIZE_MASK) >> 32 != KVM_REG_ARM64 >> 32)
                return -EINVAL;
 
-       /* Register group 16 means we want a core register. */
-       if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
-               return get_core_reg(vcpu, reg);
-
-       if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW)
-               return kvm_arm_get_fw_reg(vcpu, reg);
+       switch (reg->id & KVM_REG_ARM_COPROC_MASK) {
+       case KVM_REG_ARM_CORE:  return get_core_reg(vcpu, reg);
+       case KVM_REG_ARM_FW:    return kvm_arm_get_fw_reg(vcpu, reg);
+       case KVM_REG_ARM64_SVE: return get_sve_reg(vcpu, reg);
+       }
 
        if (is_timer_reg(reg->id))
                return get_timer_reg(vcpu, reg);
@@ -317,12 +669,11 @@ int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
        if ((reg->id & ~KVM_REG_SIZE_MASK) >> 32 != KVM_REG_ARM64 >> 32)
                return -EINVAL;
 
-       /* Register group 16 means we set a core register. */
-       if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
-               return set_core_reg(vcpu, reg);
-
-       if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_FW)
-               return kvm_arm_set_fw_reg(vcpu, reg);
+       switch (reg->id & KVM_REG_ARM_COPROC_MASK) {
+       case KVM_REG_ARM_CORE:  return set_core_reg(vcpu, reg);
+       case KVM_REG_ARM_FW:    return kvm_arm_set_fw_reg(vcpu, reg);
+       case KVM_REG_ARM64_SVE: return set_sve_reg(vcpu, reg);
+       }
 
        if (is_timer_reg(reg->id))
                return set_timer_reg(vcpu, reg);
index 0b79834..516aead 100644 (file)
@@ -173,20 +173,40 @@ static int handle_sve(struct kvm_vcpu *vcpu, struct kvm_run *run)
        return 1;
 }
 
+#define __ptrauth_save_key(regs, key)                                          \
+({                                                                             \
+       regs[key ## KEYLO_EL1] = read_sysreg_s(SYS_ ## key ## KEYLO_EL1);       \
+       regs[key ## KEYHI_EL1] = read_sysreg_s(SYS_ ## key ## KEYHI_EL1);       \
+})
+
+/*
+ * Handle the guest trying to use a ptrauth instruction, or trying to access a
+ * ptrauth register.
+ */
+void kvm_arm_vcpu_ptrauth_trap(struct kvm_vcpu *vcpu)
+{
+       struct kvm_cpu_context *ctxt;
+
+       if (vcpu_has_ptrauth(vcpu)) {
+               vcpu_ptrauth_enable(vcpu);
+               ctxt = vcpu->arch.host_cpu_context;
+               __ptrauth_save_key(ctxt->sys_regs, APIA);
+               __ptrauth_save_key(ctxt->sys_regs, APIB);
+               __ptrauth_save_key(ctxt->sys_regs, APDA);
+               __ptrauth_save_key(ctxt->sys_regs, APDB);
+               __ptrauth_save_key(ctxt->sys_regs, APGA);
+       } else {
+               kvm_inject_undefined(vcpu);
+       }
+}
+
 /*
  * Guest usage of a ptrauth instruction (which the guest EL1 did not turn into
  * a NOP).
  */
 static int kvm_handle_ptrauth(struct kvm_vcpu *vcpu, struct kvm_run *run)
 {
-       /*
-        * We don't currently support ptrauth in a guest, and we mask the ID
-        * registers to prevent well-behaved guests from trying to make use of
-        * it.
-        *
-        * Inject an UNDEF, as if the feature really isn't present.
-        */
-       kvm_inject_undefined(vcpu);
+       kvm_arm_vcpu_ptrauth_trap(vcpu);
        return 1;
 }
 
index 675fdc1..93ba3d7 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/kvm_arm.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_mmu.h>
+#include <asm/kvm_ptrauth.h>
 
 #define CPU_GP_REG_OFFSET(x)   (CPU_GP_REGS + x)
 #define CPU_XREG_OFFSET(x)     CPU_GP_REG_OFFSET(CPU_USER_PT_REGS + 8*x)
@@ -64,6 +65,13 @@ ENTRY(__guest_enter)
 
        add     x18, x0, #VCPU_CONTEXT
 
+       // Macro ptrauth_switch_to_guest format:
+       //      ptrauth_switch_to_guest(guest cxt, tmp1, tmp2, tmp3)
+       // The below macro to restore guest keys is not implemented in C code
+       // as it may cause Pointer Authentication key signing mismatch errors
+       // when this feature is enabled for kernel code.
+       ptrauth_switch_to_guest x18, x0, x1, x2
+
        // Restore guest regs x0-x17
        ldp     x0, x1,   [x18, #CPU_XREG_OFFSET(0)]
        ldp     x2, x3,   [x18, #CPU_XREG_OFFSET(2)]
@@ -118,6 +126,13 @@ ENTRY(__guest_exit)
 
        get_host_ctxt   x2, x3
 
+       // Macro ptrauth_switch_to_guest format:
+       //      ptrauth_switch_to_host(guest cxt, host cxt, tmp1, tmp2, tmp3)
+       // The below macro to save/restore keys is not implemented in C code
+       // as it may cause Pointer Authentication key signing mismatch errors
+       // when this feature is enabled for kernel code.
+       ptrauth_switch_to_host x1, x2, x3, x4, x5
+
        // Now restore the host regs
        restore_callee_saved_regs x2
 
index 3563fe6..22b4c33 100644 (file)
@@ -100,7 +100,10 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu)
        val = read_sysreg(cpacr_el1);
        val |= CPACR_EL1_TTA;
        val &= ~CPACR_EL1_ZEN;
-       if (!update_fp_enabled(vcpu)) {
+       if (update_fp_enabled(vcpu)) {
+               if (vcpu_has_sve(vcpu))
+                       val |= CPACR_EL1_ZEN;
+       } else {
                val &= ~CPACR_EL1_FPEN;
                __activate_traps_fpsimd32(vcpu);
        }
@@ -317,16 +320,48 @@ static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu)
        return true;
 }
 
-static bool __hyp_text __hyp_switch_fpsimd(struct kvm_vcpu *vcpu)
+/* Check for an FPSIMD/SVE trap and handle as appropriate */
+static bool __hyp_text __hyp_handle_fpsimd(struct kvm_vcpu *vcpu)
 {
-       struct user_fpsimd_state *host_fpsimd = vcpu->arch.host_fpsimd_state;
+       bool vhe, sve_guest, sve_host;
+       u8 hsr_ec;
 
-       if (has_vhe())
-               write_sysreg(read_sysreg(cpacr_el1) | CPACR_EL1_FPEN,
-                            cpacr_el1);
-       else
+       if (!system_supports_fpsimd())
+               return false;
+
+       if (system_supports_sve()) {
+               sve_guest = vcpu_has_sve(vcpu);
+               sve_host = vcpu->arch.flags & KVM_ARM64_HOST_SVE_IN_USE;
+               vhe = true;
+       } else {
+               sve_guest = false;
+               sve_host = false;
+               vhe = has_vhe();
+       }
+
+       hsr_ec = kvm_vcpu_trap_get_class(vcpu);
+       if (hsr_ec != ESR_ELx_EC_FP_ASIMD &&
+           hsr_ec != ESR_ELx_EC_SVE)
+               return false;
+
+       /* Don't handle SVE traps for non-SVE vcpus here: */
+       if (!sve_guest)
+               if (hsr_ec != ESR_ELx_EC_FP_ASIMD)
+                       return false;
+
+       /* Valid trap.  Switch the context: */
+
+       if (vhe) {
+               u64 reg = read_sysreg(cpacr_el1) | CPACR_EL1_FPEN;
+
+               if (sve_guest)
+                       reg |= CPACR_EL1_ZEN;
+
+               write_sysreg(reg, cpacr_el1);
+       } else {
                write_sysreg(read_sysreg(cptr_el2) & ~(u64)CPTR_EL2_TFP,
                             cptr_el2);
+       }
 
        isb();
 
@@ -335,21 +370,28 @@ static bool __hyp_text __hyp_switch_fpsimd(struct kvm_vcpu *vcpu)
                 * In the SVE case, VHE is assumed: it is enforced by
                 * Kconfig and kvm_arch_init().
                 */
-               if (system_supports_sve() &&
-                   (vcpu->arch.flags & KVM_ARM64_HOST_SVE_IN_USE)) {
+               if (sve_host) {
                        struct thread_struct *thread = container_of(
-                               host_fpsimd,
+                               vcpu->arch.host_fpsimd_state,
                                struct thread_struct, uw.fpsimd_state);
 
-                       sve_save_state(sve_pffr(thread), &host_fpsimd->fpsr);
+                       sve_save_state(sve_pffr(thread),
+                                      &vcpu->arch.host_fpsimd_state->fpsr);
                } else {
-                       __fpsimd_save_state(host_fpsimd);
+                       __fpsimd_save_state(vcpu->arch.host_fpsimd_state);
                }
 
                vcpu->arch.flags &= ~KVM_ARM64_FP_HOST;
        }
 
-       __fpsimd_restore_state(&vcpu->arch.ctxt.gp_regs.fp_regs);
+       if (sve_guest) {
+               sve_load_state(vcpu_sve_pffr(vcpu),
+                              &vcpu->arch.ctxt.gp_regs.fp_regs.fpsr,
+                              sve_vq_from_vl(vcpu->arch.sve_max_vl) - 1);
+               write_sysreg_s(vcpu->arch.ctxt.sys_regs[ZCR_EL1], SYS_ZCR_EL12);
+       } else {
+               __fpsimd_restore_state(&vcpu->arch.ctxt.gp_regs.fp_regs);
+       }
 
        /* Skip restoring fpexc32 for AArch64 guests */
        if (!(read_sysreg(hcr_el2) & HCR_RW))
@@ -385,10 +427,10 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
         * and restore the guest context lazily.
         * If FP/SIMD is not implemented, handle the trap and inject an
         * undefined instruction exception to the guest.
+        * Similarly for trapped SVE accesses.
         */
-       if (system_supports_fpsimd() &&
-           kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_FP_ASIMD)
-               return __hyp_switch_fpsimd(vcpu);
+       if (__hyp_handle_fpsimd(vcpu))
+               return true;
 
        if (!__populate_fault_info(vcpu))
                return true;
@@ -524,6 +566,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
 {
        struct kvm_cpu_context *host_ctxt;
        struct kvm_cpu_context *guest_ctxt;
+       bool pmu_switch_needed;
        u64 exit_code;
 
        /*
@@ -543,6 +586,8 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
        host_ctxt->__hyp_running_vcpu = vcpu;
        guest_ctxt = &vcpu->arch.ctxt;
 
+       pmu_switch_needed = __pmu_switch_to_guest(host_ctxt);
+
        __sysreg_save_state_nvhe(host_ctxt);
 
        __activate_vm(kern_hyp_va(vcpu->kvm));
@@ -589,6 +634,9 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
         */
        __debug_switch_to_host(vcpu);
 
+       if (pmu_switch_needed)
+               __pmu_switch_to_host(host_ctxt);
+
        /* Returning to host will clear PSR.I, remask PMR if needed */
        if (system_uses_irq_prio_masking())
                gic_write_pmr(GIC_PRIO_IRQOFF);
diff --git a/arch/arm64/kvm/pmu.c b/arch/arm64/kvm/pmu.c
new file mode 100644 (file)
index 0000000..3da94a5
--- /dev/null
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Arm Limited
+ * Author: Andrew Murray <Andrew.Murray@arm.com>
+ */
+#include <linux/kvm_host.h>
+#include <linux/perf_event.h>
+#include <asm/kvm_hyp.h>
+
+/*
+ * Given the perf event attributes and system type, determine
+ * if we are going to need to switch counters at guest entry/exit.
+ */
+static bool kvm_pmu_switch_needed(struct perf_event_attr *attr)
+{
+       /**
+        * With VHE the guest kernel runs at EL1 and the host at EL2,
+        * where user (EL0) is excluded then we have no reason to switch
+        * counters.
+        */
+       if (has_vhe() && attr->exclude_user)
+               return false;
+
+       /* Only switch if attributes are different */
+       return (attr->exclude_host != attr->exclude_guest);
+}
+
+/*
+ * Add events to track that we may want to switch at guest entry/exit
+ * time.
+ */
+void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr)
+{
+       struct kvm_host_data *ctx = this_cpu_ptr(&kvm_host_data);
+
+       if (!kvm_pmu_switch_needed(attr))
+               return;
+
+       if (!attr->exclude_host)
+               ctx->pmu_events.events_host |= set;
+       if (!attr->exclude_guest)
+               ctx->pmu_events.events_guest |= set;
+}
+
+/*
+ * Stop tracking events
+ */
+void kvm_clr_pmu_events(u32 clr)
+{
+       struct kvm_host_data *ctx = this_cpu_ptr(&kvm_host_data);
+
+       ctx->pmu_events.events_host &= ~clr;
+       ctx->pmu_events.events_guest &= ~clr;
+}
+
+/**
+ * Disable host events, enable guest events
+ */
+bool __hyp_text __pmu_switch_to_guest(struct kvm_cpu_context *host_ctxt)
+{
+       struct kvm_host_data *host;
+       struct kvm_pmu_events *pmu;
+
+       host = container_of(host_ctxt, struct kvm_host_data, host_ctxt);
+       pmu = &host->pmu_events;
+
+       if (pmu->events_host)
+               write_sysreg(pmu->events_host, pmcntenclr_el0);
+
+       if (pmu->events_guest)
+               write_sysreg(pmu->events_guest, pmcntenset_el0);
+
+       return (pmu->events_host || pmu->events_guest);
+}
+
+/**
+ * Disable guest events, enable host events
+ */
+void __hyp_text __pmu_switch_to_host(struct kvm_cpu_context *host_ctxt)
+{
+       struct kvm_host_data *host;
+       struct kvm_pmu_events *pmu;
+
+       host = container_of(host_ctxt, struct kvm_host_data, host_ctxt);
+       pmu = &host->pmu_events;
+
+       if (pmu->events_guest)
+               write_sysreg(pmu->events_guest, pmcntenclr_el0);
+
+       if (pmu->events_host)
+               write_sysreg(pmu->events_host, pmcntenset_el0);
+}
+
+#define PMEVTYPER_READ_CASE(idx)                               \
+       case idx:                                               \
+               return read_sysreg(pmevtyper##idx##_el0)
+
+#define PMEVTYPER_WRITE_CASE(idx)                              \
+       case idx:                                               \
+               write_sysreg(val, pmevtyper##idx##_el0);        \
+               break
+
+#define PMEVTYPER_CASES(readwrite)                             \
+       PMEVTYPER_##readwrite##_CASE(0);                        \
+       PMEVTYPER_##readwrite##_CASE(1);                        \
+       PMEVTYPER_##readwrite##_CASE(2);                        \
+       PMEVTYPER_##readwrite##_CASE(3);                        \
+       PMEVTYPER_##readwrite##_CASE(4);                        \
+       PMEVTYPER_##readwrite##_CASE(5);                        \
+       PMEVTYPER_##readwrite##_CASE(6);                        \
+       PMEVTYPER_##readwrite##_CASE(7);                        \
+       PMEVTYPER_##readwrite##_CASE(8);                        \
+       PMEVTYPER_##readwrite##_CASE(9);                        \
+       PMEVTYPER_##readwrite##_CASE(10);                       \
+       PMEVTYPER_##readwrite##_CASE(11);                       \
+       PMEVTYPER_##readwrite##_CASE(12);                       \
+       PMEVTYPER_##readwrite##_CASE(13);                       \
+       PMEVTYPER_##readwrite##_CASE(14);                       \
+       PMEVTYPER_##readwrite##_CASE(15);                       \
+       PMEVTYPER_##readwrite##_CASE(16);                       \
+       PMEVTYPER_##readwrite##_CASE(17);                       \
+       PMEVTYPER_##readwrite##_CASE(18);                       \
+       PMEVTYPER_##readwrite##_CASE(19);                       \
+       PMEVTYPER_##readwrite##_CASE(20);                       \
+       PMEVTYPER_##readwrite##_CASE(21);                       \
+       PMEVTYPER_##readwrite##_CASE(22);                       \
+       PMEVTYPER_##readwrite##_CASE(23);                       \
+       PMEVTYPER_##readwrite##_CASE(24);                       \
+       PMEVTYPER_##readwrite##_CASE(25);                       \
+       PMEVTYPER_##readwrite##_CASE(26);                       \
+       PMEVTYPER_##readwrite##_CASE(27);                       \
+       PMEVTYPER_##readwrite##_CASE(28);                       \
+       PMEVTYPER_##readwrite##_CASE(29);                       \
+       PMEVTYPER_##readwrite##_CASE(30)
+
+/*
+ * Read a value direct from PMEVTYPER<idx> where idx is 0-30
+ * or PMCCFILTR_EL0 where idx is ARMV8_PMU_CYCLE_IDX (31).
+ */
+static u64 kvm_vcpu_pmu_read_evtype_direct(int idx)
+{
+       switch (idx) {
+       PMEVTYPER_CASES(READ);
+       case ARMV8_PMU_CYCLE_IDX:
+               return read_sysreg(pmccfiltr_el0);
+       default:
+               WARN_ON(1);
+       }
+
+       return 0;
+}
+
+/*
+ * Write a value direct to PMEVTYPER<idx> where idx is 0-30
+ * or PMCCFILTR_EL0 where idx is ARMV8_PMU_CYCLE_IDX (31).
+ */
+static void kvm_vcpu_pmu_write_evtype_direct(int idx, u32 val)
+{
+       switch (idx) {
+       PMEVTYPER_CASES(WRITE);
+       case ARMV8_PMU_CYCLE_IDX:
+               write_sysreg(val, pmccfiltr_el0);
+               break;
+       default:
+               WARN_ON(1);
+       }
+}
+
+/*
+ * Modify ARMv8 PMU events to include EL0 counting
+ */
+static void kvm_vcpu_pmu_enable_el0(unsigned long events)
+{
+       u64 typer;
+       u32 counter;
+
+       for_each_set_bit(counter, &events, 32) {
+               typer = kvm_vcpu_pmu_read_evtype_direct(counter);
+               typer &= ~ARMV8_PMU_EXCLUDE_EL0;
+               kvm_vcpu_pmu_write_evtype_direct(counter, typer);
+       }
+}
+
+/*
+ * Modify ARMv8 PMU events to exclude EL0 counting
+ */
+static void kvm_vcpu_pmu_disable_el0(unsigned long events)
+{
+       u64 typer;
+       u32 counter;
+
+       for_each_set_bit(counter, &events, 32) {
+               typer = kvm_vcpu_pmu_read_evtype_direct(counter);
+               typer |= ARMV8_PMU_EXCLUDE_EL0;
+               kvm_vcpu_pmu_write_evtype_direct(counter, typer);
+       }
+}
+
+/*
+ * On VHE ensure that only guest events have EL0 counting enabled
+ */
+void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu)
+{
+       struct kvm_cpu_context *host_ctxt;
+       struct kvm_host_data *host;
+       u32 events_guest, events_host;
+
+       if (!has_vhe())
+               return;
+
+       host_ctxt = vcpu->arch.host_cpu_context;
+       host = container_of(host_ctxt, struct kvm_host_data, host_ctxt);
+       events_guest = host->pmu_events.events_guest;
+       events_host = host->pmu_events.events_host;
+
+       kvm_vcpu_pmu_enable_el0(events_guest);
+       kvm_vcpu_pmu_disable_el0(events_host);
+}
+
+/*
+ * On VHE ensure that only host events have EL0 counting enabled
+ */
+void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu)
+{
+       struct kvm_cpu_context *host_ctxt;
+       struct kvm_host_data *host;
+       u32 events_guest, events_host;
+
+       if (!has_vhe())
+               return;
+
+       host_ctxt = vcpu->arch.host_cpu_context;
+       host = container_of(host_ctxt, struct kvm_host_data, host_ctxt);
+       events_guest = host->pmu_events.events_guest;
+       events_host = host->pmu_events.events_host;
+
+       kvm_vcpu_pmu_enable_el0(events_host);
+       kvm_vcpu_pmu_disable_el0(events_guest);
+}
index e2a0500..1140b44 100644 (file)
  */
 
 #include <linux/errno.h>
+#include <linux/kernel.h>
 #include <linux/kvm_host.h>
 #include <linux/kvm.h>
 #include <linux/hw_breakpoint.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/types.h>
 
 #include <kvm/arm_arch_timer.h>
 
 #include <asm/cpufeature.h>
 #include <asm/cputype.h>
+#include <asm/fpsimd.h>
 #include <asm/ptrace.h>
 #include <asm/kvm_arm.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_coproc.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_mmu.h>
+#include <asm/virt.h>
 
 /* Maximum phys_shift supported for any VM on this host */
 static u32 kvm_ipa_limit;
@@ -92,6 +98,14 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_ARM_VM_IPA_SIZE:
                r = kvm_ipa_limit;
                break;
+       case KVM_CAP_ARM_SVE:
+               r = system_supports_sve();
+               break;
+       case KVM_CAP_ARM_PTRAUTH_ADDRESS:
+       case KVM_CAP_ARM_PTRAUTH_GENERIC:
+               r = has_vhe() && system_supports_address_auth() &&
+                                system_supports_generic_auth();
+               break;
        default:
                r = 0;
        }
@@ -99,13 +113,148 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        return r;
 }
 
+unsigned int kvm_sve_max_vl;
+
+int kvm_arm_init_sve(void)
+{
+       if (system_supports_sve()) {
+               kvm_sve_max_vl = sve_max_virtualisable_vl;
+
+               /*
+                * The get_sve_reg()/set_sve_reg() ioctl interface will need
+                * to be extended with multiple register slice support in
+                * order to support vector lengths greater than
+                * SVE_VL_ARCH_MAX:
+                */
+               if (WARN_ON(kvm_sve_max_vl > SVE_VL_ARCH_MAX))
+                       kvm_sve_max_vl = SVE_VL_ARCH_MAX;
+
+               /*
+                * Don't even try to make use of vector lengths that
+                * aren't available on all CPUs, for now:
+                */
+               if (kvm_sve_max_vl < sve_max_vl)
+                       pr_warn("KVM: SVE vector length for guests limited to %u bytes\n",
+                               kvm_sve_max_vl);
+       }
+
+       return 0;
+}
+
+static int kvm_vcpu_enable_sve(struct kvm_vcpu *vcpu)
+{
+       if (!system_supports_sve())
+               return -EINVAL;
+
+       /* Verify that KVM startup enforced this when SVE was detected: */
+       if (WARN_ON(!has_vhe()))
+               return -EINVAL;
+
+       vcpu->arch.sve_max_vl = kvm_sve_max_vl;
+
+       /*
+        * Userspace can still customize the vector lengths by writing
+        * KVM_REG_ARM64_SVE_VLS.  Allocation is deferred until
+        * kvm_arm_vcpu_finalize(), which freezes the configuration.
+        */
+       vcpu->arch.flags |= KVM_ARM64_GUEST_HAS_SVE;
+
+       return 0;
+}
+
+/*
+ * Finalize vcpu's maximum SVE vector length, allocating
+ * vcpu->arch.sve_state as necessary.
+ */
+static int kvm_vcpu_finalize_sve(struct kvm_vcpu *vcpu)
+{
+       void *buf;
+       unsigned int vl;
+
+       vl = vcpu->arch.sve_max_vl;
+
+       /*
+        * Resposibility for these properties is shared between
+        * kvm_arm_init_arch_resources(), kvm_vcpu_enable_sve() and
+        * set_sve_vls().  Double-check here just to be sure:
+        */
+       if (WARN_ON(!sve_vl_valid(vl) || vl > sve_max_virtualisable_vl ||
+                   vl > SVE_VL_ARCH_MAX))
+               return -EIO;
+
+       buf = kzalloc(SVE_SIG_REGS_SIZE(sve_vq_from_vl(vl)), GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       vcpu->arch.sve_state = buf;
+       vcpu->arch.flags |= KVM_ARM64_VCPU_SVE_FINALIZED;
+       return 0;
+}
+
+int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature)
+{
+       switch (feature) {
+       case KVM_ARM_VCPU_SVE:
+               if (!vcpu_has_sve(vcpu))
+                       return -EINVAL;
+
+               if (kvm_arm_vcpu_sve_finalized(vcpu))
+                       return -EPERM;
+
+               return kvm_vcpu_finalize_sve(vcpu);
+       }
+
+       return -EINVAL;
+}
+
+bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu)
+{
+       if (vcpu_has_sve(vcpu) && !kvm_arm_vcpu_sve_finalized(vcpu))
+               return false;
+
+       return true;
+}
+
+void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
+{
+       kfree(vcpu->arch.sve_state);
+}
+
+static void kvm_vcpu_reset_sve(struct kvm_vcpu *vcpu)
+{
+       if (vcpu_has_sve(vcpu))
+               memset(vcpu->arch.sve_state, 0, vcpu_sve_state_size(vcpu));
+}
+
+static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu)
+{
+       /* Support ptrauth only if the system supports these capabilities. */
+       if (!has_vhe())
+               return -EINVAL;
+
+       if (!system_supports_address_auth() ||
+           !system_supports_generic_auth())
+               return -EINVAL;
+       /*
+        * For now make sure that both address/generic pointer authentication
+        * features are requested by the userspace together.
+        */
+       if (!test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) ||
+           !test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features))
+               return -EINVAL;
+
+       vcpu->arch.flags |= KVM_ARM64_GUEST_HAS_PTRAUTH;
+       return 0;
+}
+
 /**
  * kvm_reset_vcpu - sets core registers and sys_regs to reset value
  * @vcpu: The VCPU pointer
  *
  * This function finds the right table above and sets the registers on
  * the virtual CPU struct to their architecturally defined reset
- * values.
+ * values, except for registers whose reset is deferred until
+ * kvm_arm_vcpu_finalize().
  *
  * Note: This function can be called from two paths: The KVM_ARM_VCPU_INIT
  * ioctl or as part of handling a request issued by another VCPU in the PSCI
@@ -131,6 +280,22 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
        if (loaded)
                kvm_arch_vcpu_put(vcpu);
 
+       if (!kvm_arm_vcpu_sve_finalized(vcpu)) {
+               if (test_bit(KVM_ARM_VCPU_SVE, vcpu->arch.features)) {
+                       ret = kvm_vcpu_enable_sve(vcpu);
+                       if (ret)
+                               goto out;
+               }
+       } else {
+               kvm_vcpu_reset_sve(vcpu);
+       }
+
+       if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) ||
+           test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) {
+               if (kvm_vcpu_enable_ptrauth(vcpu))
+                       goto out;
+       }
+
        switch (vcpu->arch.target) {
        default:
                if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) {
index 539feec..857b226 100644 (file)
@@ -695,6 +695,7 @@ static bool access_pmcr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
                val |= p->regval & ARMV8_PMU_PMCR_MASK;
                __vcpu_sys_reg(vcpu, PMCR_EL0) = val;
                kvm_pmu_handle_pmcr(vcpu, val);
+               kvm_vcpu_pmu_restore_guest(vcpu);
        } else {
                /* PMCR.P & PMCR.C are RAZ */
                val = __vcpu_sys_reg(vcpu, PMCR_EL0)
@@ -850,6 +851,7 @@ static bool access_pmu_evtyper(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
        if (p->is_write) {
                kvm_pmu_set_counter_event_type(vcpu, p->regval, idx);
                __vcpu_sys_reg(vcpu, reg) = p->regval & ARMV8_PMU_EVTYPE_MASK;
+               kvm_vcpu_pmu_restore_guest(vcpu);
        } else {
                p->regval = __vcpu_sys_reg(vcpu, reg) & ARMV8_PMU_EVTYPE_MASK;
        }
@@ -875,6 +877,7 @@ static bool access_pmcnten(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
                        /* accessing PMCNTENSET_EL0 */
                        __vcpu_sys_reg(vcpu, PMCNTENSET_EL0) |= val;
                        kvm_pmu_enable_counter(vcpu, val);
+                       kvm_vcpu_pmu_restore_guest(vcpu);
                } else {
                        /* accessing PMCNTENCLR_EL0 */
                        __vcpu_sys_reg(vcpu, PMCNTENSET_EL0) &= ~val;
@@ -1007,6 +1010,37 @@ static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
        { SYS_DESC(SYS_PMEVTYPERn_EL0(n)),                                      \
          access_pmu_evtyper, reset_unknown, (PMEVTYPER0_EL0 + n), }
 
+static bool trap_ptrauth(struct kvm_vcpu *vcpu,
+                        struct sys_reg_params *p,
+                        const struct sys_reg_desc *rd)
+{
+       kvm_arm_vcpu_ptrauth_trap(vcpu);
+
+       /*
+        * Return false for both cases as we never skip the trapped
+        * instruction:
+        *
+        * - Either we re-execute the same key register access instruction
+        *   after enabling ptrauth.
+        * - Or an UNDEF is injected as ptrauth is not supported/enabled.
+        */
+       return false;
+}
+
+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;
+}
+
+#define __PTRAUTH_KEY(k)                                               \
+       { SYS_DESC(SYS_## k), trap_ptrauth, reset_unknown, k,           \
+       .visibility = ptrauth_visibility}
+
+#define PTRAUTH_KEY(k)                                                 \
+       __PTRAUTH_KEY(k ## KEYLO_EL1),                                  \
+       __PTRAUTH_KEY(k ## KEYHI_EL1)
+
 static bool access_arch_timer(struct kvm_vcpu *vcpu,
                              struct sys_reg_params *p,
                              const struct sys_reg_desc *r)
@@ -1044,25 +1078,20 @@ static bool access_arch_timer(struct kvm_vcpu *vcpu,
 }
 
 /* Read a sanitised cpufeature ID register by sys_reg_desc */
-static u64 read_id_reg(struct sys_reg_desc const *r, bool raz)
+static u64 read_id_reg(const struct kvm_vcpu *vcpu,
+               struct sys_reg_desc const *r, bool raz)
 {
        u32 id = sys_reg((u32)r->Op0, (u32)r->Op1,
                         (u32)r->CRn, (u32)r->CRm, (u32)r->Op2);
        u64 val = raz ? 0 : read_sanitised_ftr_reg(id);
 
-       if (id == SYS_ID_AA64PFR0_EL1) {
-               if (val & (0xfUL << ID_AA64PFR0_SVE_SHIFT))
-                       kvm_debug("SVE unsupported for guests, suppressing\n");
-
+       if (id == SYS_ID_AA64PFR0_EL1 && !vcpu_has_sve(vcpu)) {
                val &= ~(0xfUL << ID_AA64PFR0_SVE_SHIFT);
-       } else if (id == SYS_ID_AA64ISAR1_EL1) {
-               const u64 ptrauth_mask = (0xfUL << ID_AA64ISAR1_APA_SHIFT) |
-                                        (0xfUL << ID_AA64ISAR1_API_SHIFT) |
-                                        (0xfUL << ID_AA64ISAR1_GPA_SHIFT) |
-                                        (0xfUL << ID_AA64ISAR1_GPI_SHIFT);
-               if (val & ptrauth_mask)
-                       kvm_debug("ptrauth unsupported for guests, suppressing\n");
-               val &= ~ptrauth_mask;
+       } else if (id == SYS_ID_AA64ISAR1_EL1 && !vcpu_has_ptrauth(vcpu)) {
+               val &= ~((0xfUL << ID_AA64ISAR1_APA_SHIFT) |
+                        (0xfUL << ID_AA64ISAR1_API_SHIFT) |
+                        (0xfUL << ID_AA64ISAR1_GPA_SHIFT) |
+                        (0xfUL << ID_AA64ISAR1_GPI_SHIFT));
        }
 
        return val;
@@ -1078,7 +1107,7 @@ static bool __access_id_reg(struct kvm_vcpu *vcpu,
        if (p->is_write)
                return write_to_read_only(vcpu, p, r);
 
-       p->regval = read_id_reg(r, raz);
+       p->regval = read_id_reg(vcpu, r, raz);
        return true;
 }
 
@@ -1100,6 +1129,81 @@ static int reg_from_user(u64 *val, const void __user *uaddr, u64 id);
 static int reg_to_user(void __user *uaddr, const u64 *val, u64 id);
 static u64 sys_reg_to_index(const struct sys_reg_desc *reg);
 
+/* Visibility overrides for SVE-specific control registers */
+static unsigned int sve_visibility(const struct kvm_vcpu *vcpu,
+                                  const struct sys_reg_desc *rd)
+{
+       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;
+}
+
 /*
  * cpufeature ID register user accessors
  *
@@ -1107,16 +1211,18 @@ static u64 sys_reg_to_index(const struct sys_reg_desc *reg);
  * are stored, and for set_id_reg() we don't allow the effective value
  * to be changed.
  */
-static int __get_id_reg(const struct sys_reg_desc *rd, void __user *uaddr,
+static int __get_id_reg(const struct kvm_vcpu *vcpu,
+                       const struct sys_reg_desc *rd, void __user *uaddr,
                        bool raz)
 {
        const u64 id = sys_reg_to_index(rd);
-       const u64 val = read_id_reg(rd, raz);
+       const u64 val = read_id_reg(vcpu, rd, raz);
 
        return reg_to_user(uaddr, &val, id);
 }
 
-static int __set_id_reg(const struct sys_reg_desc *rd, void __user *uaddr,
+static int __set_id_reg(const struct kvm_vcpu *vcpu,
+                       const struct sys_reg_desc *rd, void __user *uaddr,
                        bool raz)
 {
        const u64 id = sys_reg_to_index(rd);
@@ -1128,7 +1234,7 @@ static int __set_id_reg(const struct sys_reg_desc *rd, void __user *uaddr,
                return err;
 
        /* This is what we mean by invariant: you can't change it. */
-       if (val != read_id_reg(rd, raz))
+       if (val != read_id_reg(vcpu, rd, raz))
                return -EINVAL;
 
        return 0;
@@ -1137,25 +1243,25 @@ static int __set_id_reg(const struct sys_reg_desc *rd, void __user *uaddr,
 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(rd, uaddr, false);
+       return __get_id_reg(vcpu, rd, uaddr, false);
 }
 
 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(rd, uaddr, false);
+       return __set_id_reg(vcpu, rd, uaddr, false);
 }
 
 static int get_raz_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(rd, uaddr, true);
+       return __get_id_reg(vcpu, rd, uaddr, true);
 }
 
 static int set_raz_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(rd, uaddr, true);
+       return __set_id_reg(vcpu, rd, uaddr, true);
 }
 
 static bool access_ctr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
@@ -1343,7 +1449,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
        ID_SANITISED(ID_AA64PFR1_EL1),
        ID_UNALLOCATED(4,2),
        ID_UNALLOCATED(4,3),
-       ID_UNALLOCATED(4,4),
+       { 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_UNALLOCATED(4,5),
        ID_UNALLOCATED(4,6),
        ID_UNALLOCATED(4,7),
@@ -1380,10 +1486,17 @@ static const struct sys_reg_desc sys_reg_descs[] = {
 
        { SYS_DESC(SYS_SCTLR_EL1), access_vm_reg, reset_val, SCTLR_EL1, 0x00C50078 },
        { SYS_DESC(SYS_CPACR_EL1), NULL, reset_val, CPACR_EL1, 0 },
+       { SYS_DESC(SYS_ZCR_EL1), NULL, reset_val, ZCR_EL1, 0, .visibility = sve_visibility },
        { SYS_DESC(SYS_TTBR0_EL1), access_vm_reg, reset_unknown, TTBR0_EL1 },
        { SYS_DESC(SYS_TTBR1_EL1), access_vm_reg, reset_unknown, TTBR1_EL1 },
        { SYS_DESC(SYS_TCR_EL1), access_vm_reg, reset_val, TCR_EL1, 0 },
 
+       PTRAUTH_KEY(APIA),
+       PTRAUTH_KEY(APIB),
+       PTRAUTH_KEY(APDA),
+       PTRAUTH_KEY(APDB),
+       PTRAUTH_KEY(APGA),
+
        { SYS_DESC(SYS_AFSR0_EL1), access_vm_reg, reset_unknown, AFSR0_EL1 },
        { SYS_DESC(SYS_AFSR1_EL1), access_vm_reg, reset_unknown, AFSR1_EL1 },
        { SYS_DESC(SYS_ESR_EL1), access_vm_reg, reset_unknown, ESR_EL1 },
@@ -1924,6 +2037,12 @@ 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)) {
+               kvm_inject_undefined(vcpu);
+               return;
+       }
+
        /*
         * Not having an accessor means that we have configured a trap
         * that we don't know how to handle. This certainly qualifies
@@ -2435,6 +2554,10 @@ int kvm_arm_sys_reg_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg
        if (!r)
                return get_invariant_sys_reg(reg->id, uaddr);
 
+       /* Check for regs disabled by runtime config */
+       if (sysreg_hidden_from_user(vcpu, r))
+               return -ENOENT;
+
        if (r->get_user)
                return (r->get_user)(vcpu, r, reg, uaddr);
 
@@ -2456,6 +2579,10 @@ int kvm_arm_sys_reg_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg
        if (!r)
                return set_invariant_sys_reg(reg->id, uaddr);
 
+       /* Check for regs disabled by runtime config */
+       if (sysreg_hidden_from_user(vcpu, r))
+               return -ENOENT;
+
        if (r->set_user)
                return (r->set_user)(vcpu, r, reg, uaddr);
 
@@ -2512,7 +2639,8 @@ static bool copy_reg_to_user(const struct sys_reg_desc *reg, u64 __user **uind)
        return true;
 }
 
-static int walk_one_sys_reg(const struct sys_reg_desc *rd,
+static int walk_one_sys_reg(const struct kvm_vcpu *vcpu,
+                           const struct sys_reg_desc *rd,
                            u64 __user **uind,
                            unsigned int *total)
 {
@@ -2523,6 +2651,9 @@ static int walk_one_sys_reg(const struct sys_reg_desc *rd,
        if (!(rd->reg || rd->get_user))
                return 0;
 
+       if (sysreg_hidden_from_user(vcpu, rd))
+               return 0;
+
        if (!copy_reg_to_user(rd, uind))
                return -EFAULT;
 
@@ -2551,9 +2682,9 @@ static int walk_sys_regs(struct kvm_vcpu *vcpu, u64 __user *uind)
                int cmp = cmp_sys_reg(i1, i2);
                /* target-specific overrides generic entry. */
                if (cmp <= 0)
-                       err = walk_one_sys_reg(i1, &uind, &total);
+                       err = walk_one_sys_reg(vcpu, i1, &uind, &total);
                else
-                       err = walk_one_sys_reg(i2, &uind, &total);
+                       err = walk_one_sys_reg(vcpu, i2, &uind, &total);
 
                if (err)
                        return err;
index 3b1bc7f..2be9950 100644 (file)
@@ -64,8 +64,15 @@ struct sys_reg_desc {
                        const struct kvm_one_reg *reg, void __user *uaddr);
        int (*set_user)(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
                        const struct kvm_one_reg *reg, void __user *uaddr);
+
+       /* Return mask of REG_* runtime visibility overrides */
+       unsigned int (*visibility)(const struct kvm_vcpu *vcpu,
+                                  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 */
+
 static inline void print_sys_reg_instr(const struct sys_reg_params *p)
 {
        /* Look, we even formatted it for you to paste into the table! */
@@ -102,6 +109,24 @@ 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)
+{
+       if (likely(!r->visibility))
+               return false;
+
+       return r->visibility(vcpu, r) & REG_HIDDEN_GUEST;
+}
+
+static inline bool sysreg_hidden_from_user(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;
+}
+
 static inline int cmp_sys_reg(const struct sys_reg_desc *i1,
                              const struct sys_reg_desc *i2)
 {
index 78c0a72..674860e 100644 (file)
@@ -249,6 +249,11 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
        if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
                return ret;
 
+       if (!is_vmalloc_addr(cpu_addr)) {
+               unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));
+               return __swiotlb_mmap_pfn(vma, pfn, size);
+       }
+
        if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) {
                /*
                 * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped,
@@ -272,6 +277,11 @@ static int __iommu_get_sgtable(struct device *dev, struct sg_table *sgt,
        unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
        struct vm_struct *area = find_vm_area(cpu_addr);
 
+       if (!is_vmalloc_addr(cpu_addr)) {
+               struct page *page = virt_to_page(cpu_addr);
+               return __swiotlb_get_sgtable_page(sgt, page, size);
+       }
+
        if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) {
                /*
                 * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped,
index 0cb0e09..dda234b 100644 (file)
@@ -171,9 +171,10 @@ static void show_pte(unsigned long addr)
                return;
        }
 
-       pr_alert("%s pgtable: %luk pages, %u-bit VAs, pgdp = %p\n",
+       pr_alert("%s pgtable: %luk pages, %u-bit VAs, pgdp=%016lx\n",
                 mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K,
-                mm == &init_mm ? VA_BITS : (int) vabits_user, mm->pgd);
+                mm == &init_mm ? VA_BITS : (int)vabits_user,
+                (unsigned long)virt_to_phys(mm->pgd));
        pgdp = pgd_offset(mm, addr);
        pgd = READ_ONCE(*pgdp);
        pr_alert("[%016lx] pgd=%016llx", addr, pgd_val(pgd));
index 007c05a..d2adffb 100644 (file)
@@ -48,7 +48,7 @@
 #include <asm/numa.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/tlb.h>
 #include <asm/alternative.h>
 
index ef32d48..a1bfc44 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/kernel-pgtable.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
 #include <asm/ptdump.h>
@@ -955,13 +955,18 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
 
 int __init arch_ioremap_pud_supported(void)
 {
-       /* only 4k granule supports level 1 block mappings */
-       return IS_ENABLED(CONFIG_ARM64_4K_PAGES);
+       /*
+        * Only 4k granule supports level 1 block mappings.
+        * SW table walks can't handle removal of intermediate entries.
+        */
+       return IS_ENABLED(CONFIG_ARM64_4K_PAGES) &&
+              !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
 }
 
 int __init arch_ioremap_pmd_supported(void)
 {
-       return 1;
+       /* See arch_ioremap_pud_supported() */
+       return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS);
 }
 
 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
index da97633..5c540ef 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ARM64 networking code
 #
index 8ff8aa9..a4fc65f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 xen-arm-y      += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o)
 obj-y          := xen-arm.o hypercall.o
 obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
index 6b168d3..2162eb3 100644 (file)
@@ -30,7 +30,6 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += pgalloc.h
 generic-y += preempt.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
 generic-y += tlbflush.h
index ffd3c65..e182004 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for arch/c6x/lib/
 #
index 136a975..19d05e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux c6x-specific parts of the memory manager.
 #
index 5f7d934..b320f1c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for arch/c6x/platforms
 #
index ce07990..cf798a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CSKY
        def_bool y
        select ARCH_32BIT_OFF_T
index 22a162c..295942f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # dummy file, do not delete
index 6b87f6c..f9aab91 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 OBJCOPYFLAGS           :=-O binary
 GZFLAGS                        :=-9
 KBUILD_DEFCONFIG       := defconfig
index 7c06276..e52b42b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CPU_NEED_SOFTALIGN)       += alignment.o
 obj-y                                  += bswapdi.o
 obj-y                                  += bswapsi.o
index b1d44f6..c561efa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += cacheflush.o
 obj-$(CONFIG_CPU_HAS_FPU)      += fpu.o
 obj-y                          += memcmp.o
index 47d3d72..dbc9b1b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 targets := Image zImage uImage
 targets += $(dtb-y)
 
index c57ad3c..5f1f55e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtstree        := $(srctree)/$(src)
 
 dtb-y := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/csky/boot/dts/include/dt-bindings b/arch/csky/boot/dts/include/dt-bindings
deleted file mode 120000 (symlink)
index 08c00e4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/dt-bindings
\ No newline at end of file
index a9b63ef..c1a6c0f 100644 (file)
@@ -1,6 +1,5 @@
 generic-y += asm-offsets.h
 generic-y += bugs.h
-generic-y += clkdev.h
 generic-y += compat.h
 generic-y += current.h
 generic-y += delay.h
@@ -29,15 +28,12 @@ generic-y += local64.h
 generic-y += mm-arch-hooks.h
 generic-y += mmiowb.h
 generic-y += module.h
-generic-y += mutex.h
 generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += qrwlock.h
-generic-y += scatterlist.h
 generic-y += sections.h
 generic-y += serial.h
-generic-y += shm.h
 generic-y += timex.h
 generic-y += topology.h
 generic-y += trace_clock.h
index 1624b04..071d659 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 extra-y := head.o vmlinux.lds
 
 obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o
index d1f368c..078e2d5 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 lib-y  := usercopy.o delay.o
index c870eb3..4eebebd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifeq ($(CONFIG_CPU_HAS_CACHEV2),y)
 obj-y +=                       cachev2.o
 else
index 61c01db..ecfc4b4 100644 (file)
@@ -23,6 +23,7 @@ config H8300
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_HASH
        select CPU_NO_EFFICIENT_FFS
+       select UACCESS_MEMCPY
 
 config CPU_BIG_ENDIAN
        def_bool y
index 22a162c..295942f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # dummy file, do not delete
index 123d8f5..789214a 100644 (file)
@@ -38,16 +38,15 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += pgalloc.h
 generic-y += preempt.h
-generic-y += scatterlist.h
 generic-y += sections.h
 generic-y += serial.h
 generic-y += shmparam.h
-generic-y += sizes.h
 generic-y += spinlock.h
 generic-y += timex.h
 generic-y += tlbflush.h
 generic-y += topology.h
 generic-y += trace_clock.h
+generic-y += uaccess.h
 generic-y += unaligned.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h
deleted file mode 100644 (file)
index bc80319..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_UACCESS_H
-#define _ASM_UACCESS_H
-
-#include <linux/string.h>
-
-static inline __must_check unsigned long
-raw_copy_from_user(void *to, const void __user * from, unsigned long n)
-{
-       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;
-               }
-       }
-
-       memcpy(to, (const void __force *)from, n);
-       return 0;
-}
-
-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;
-               default:
-                       break;
-               }
-       }
-
-       memcpy((void __force *)to, from, n);
-       return 0;
-}
-#define INLINE_COPY_FROM_USER
-#define INLINE_COPY_TO_USER
-
-#include <asm-generic/uaccess.h>
-
-#endif
index b32bfa1..23a979a 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/sched.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/console.h>
index 28ff560..685fa83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for H8/300-specific library files..
 #
index 508697f..e85b5c9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux h8300-specific parts of the memory manager.
 #
index 22a162c..295942f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # dummy file, do not delete
index 6234a30..84bb1ed 100644 (file)
@@ -29,10 +29,8 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
-generic-y += sizes.h
 generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += unaligned.h
index a30e58d..7a34092 100644 (file)
@@ -24,7 +24,6 @@
  * User space memory access functions
  */
 #include <linux/mm.h>
-#include <asm/segment.h>
 #include <asm/sections.h>
 
 /*
index 874655e..54be529 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for hexagon-specific library files.
 #
index 1a0be4d..1894263 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Hexagon memory management subsystem
 #
index 9e179dd..6026308 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ia64/platform/hp/common/Makefile
 #
index 61e8787..46b37d8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ia64/hp/zx1/Makefile
 #
diff --git a/arch/ia64/include/asm/segment.h b/arch/ia64/include/asm/segment.h
deleted file mode 100644 (file)
index b89e2b3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_IA64_SEGMENT_H
-#define _ASM_IA64_SEGMENT_H
-
-/* Only here because we have some old header files that expect it.. */
-
-#endif /* _ASM_IA64_SEGMENT_H */
index f53faf4..846867b 100644 (file)
@@ -11,7 +11,7 @@ quiet_cmd_gate = GATE    $@
       cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@
 
 GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \
-                    $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+                    -Wl,--hash-style=sysv
 $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
        $(call if_changed,gate)
 
index b091111..cb51412 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Extensible SAL Interface (ESI) support routines.
  *
index 2c369bf..821e68d 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * ESI call stub.
  *
index 1b604d0..ebd8253 100644 (file)
@@ -10,7 +10,9 @@
 
 #include <asm/page.h>
 
-struct ia64_machine_vector ia64_mv;
+struct ia64_machine_vector ia64_mv = {
+       .mmiowb = ___ia64_mmiowb
+};
 EXPORT_SYMBOL(ia64_mv);
 
 static struct ia64_machine_vector * __init
index 5cabb3f..6a52d76 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * File:       mca.c
  * Purpose:    Generic MCA handling layer
index 45f956a..cd7972e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * File:       mca_drv.c
  * Purpose:    Generic MCA handling layer
index f4a9424..78fa657 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * palinfo.c
  *
index 7a969f4..58a6337 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file implements the perfmon-2 subsystem which is used
  * to program the IA-64 Performance Monitoring Unit (PMU).
index 30c644e..a40c560 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2002-2003 Hewlett-Packard Co
  *               Stephane Eranian <eranian@hpl.hp.com>
index 0464173..9b2331a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * System Abstraction Layer (SAL) interface routines.
  *
index aba1f46..b392c0a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * salinfo.c
  *
index 7f706d4..133b633 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SMP Support
  *
index 51ec944..d0474a0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SMP boot-related support
  *
index 56e3d0b..e01df3f 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 9025699..4ecd81b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/arch/ia64/kernel/time.c
  *
index 9a5a2f9..8573d59 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Cache flushing routines.
  *
index 5158bd2..0714df1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TLB support routines.
  *
index fb14dc5..81ea50e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the ia64-specific parts of the pci bus
 #
index 196a0dd..e308196 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pci.c - Low-Level PCI Access in IA-64
  *
index 11dd30b..d179342 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/amiga source directory
 #
index 01856a8..676c74b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/apollo source directory
 #
index 0b86bb6..2e3607f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/atari source directory
 #
index d817400..41bd4fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/bvme6000 source directory
 #
index 7dc2010..4c16e3e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/emu source directory
 #
index 96d4244..d873761 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/hp300 source directory
 #
index df4ec3e..7e3d073 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 3a8b47f..c2697a4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/arch/m68k/kernel/time.c
  *
index b8d4c83..aa0eae5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/mac source directory
 #
index 8d547df..0d0965b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Apple Peripheral System Controller (PSC)
  *
index 547c23c..b520d53 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index a36d38d..d78f6f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/mvme147 source directory
 #
index edb3f6e..a8a368c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/mvme16x source directory
 #
index 27eb427..4e4dc91 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/q40 source directory
 #
index 38ba0e0..9960c46 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/sun3 source directory
 #
index da7eac0..2f8c591 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the Sun Boot PROM interface library under
 # Linux.
 #
index be5776d..f36020e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux arch/m68k/sun3x source directory
 #
index adb179f..f11433d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MICROBLAZE
        def_bool y
        select ARCH_32BIT_OFF_T
index dc2e3c4..3a34318 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
 
index 7361974..5bf54c1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
 #
index 4964947..26339e4 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 7313bd8..1b16875 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile
 #
index d1114fb..0251c20 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile
 #
index 677e5bf..70d3200 100644 (file)
@@ -674,7 +674,10 @@ config SGI_IP27
        select SYS_HAS_EARLY_PRINTK
        select HAVE_PCI
        select IRQ_MIPS_CPU
+       select IRQ_DOMAIN_HIERARCHY
        select NR_CPUS_DEFAULT_64
+       select PCI_DRIVERS_GENERIC
+       select PCI_XTALK_BRIDGE
        select SYS_HAS_CPU_R10000
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
@@ -1241,6 +1244,9 @@ config IRQ_GT641XX
 config PCI_GT64XXX_PCI0
        bool
 
+config PCI_XTALK_BRIDGE
+       bool
+
 config NO_EXCEPT_FILL
        bool
 
index aac3b17..fabbc70 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MIPS_GPR) += board-gpr.o
 obj-$(CONFIG_MIPS_MTX1) += board-mtx1.o
 obj-$(CONFIG_MIPS_XXS1500) += board-xxs1500.o
index 23800b8..a0e9438 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Copyright 2000, 2008 MontaVista Software Inc.
 #  Author: MontaVista Software, Inc. <source@mvista.com>
index 1454d9f..b8f3397 100644 (file)
@@ -131,9 +131,7 @@ static void __init alchemy_setup_uarts(int ctype)
 }
 
 
-/* The dmamask must be set for OHCI/EHCI to work */
-static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32);
-static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32);
+static u64 alchemy_all_dmamask = DMA_BIT_MASK(32);
 
 /* Power on callback for the ehci platform driver */
 static int alchemy_ehci_power_on(struct platform_device *pdev)
@@ -231,7 +229,7 @@ static void __init alchemy_setup_usb(int ctype)
        res[1].flags = IORESOURCE_IRQ;
        pdev->name = "ohci-platform";
        pdev->id = 0;
-       pdev->dev.dma_mask = &alchemy_ohci_dmamask;
+       pdev->dev.dma_mask = &alchemy_all_dmamask;
        pdev->dev.platform_data = &alchemy_ohci_pdata;
 
        if (platform_device_register(pdev))
@@ -251,7 +249,7 @@ static void __init alchemy_setup_usb(int ctype)
                res[1].flags = IORESOURCE_IRQ;
                pdev->name = "ehci-platform";
                pdev->id = 0;
-               pdev->dev.dma_mask = &alchemy_ehci_dmamask;
+               pdev->dev.dma_mask = &alchemy_all_dmamask;
                pdev->dev.platform_data = &alchemy_ehci_pdata;
 
                if (platform_device_register(pdev))
@@ -271,7 +269,7 @@ static void __init alchemy_setup_usb(int ctype)
                res[1].flags = IORESOURCE_IRQ;
                pdev->name = "ohci-platform";
                pdev->id = 1;
-               pdev->dev.dma_mask = &alchemy_ohci_dmamask;
+               pdev->dev.dma_mask = &alchemy_all_dmamask;
                pdev->dev.platform_data = &alchemy_ohci_pdata;
 
                if (platform_device_register(pdev))
@@ -338,7 +336,11 @@ static struct platform_device au1xxx_eth0_device = {
        .name           = "au1000-eth",
        .id             = 0,
        .num_resources  = MAC_RES_COUNT,
-       .dev.platform_data = &au1xxx_eth0_platform_data,
+       .dev = {
+               .dma_mask               = &alchemy_all_dmamask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &au1xxx_eth0_platform_data,
+       },
 };
 
 static struct resource au1xxx_eth1_resources[][MAC_RES_COUNT] __initdata = {
@@ -370,7 +372,11 @@ static struct platform_device au1xxx_eth1_device = {
        .name           = "au1000-eth",
        .id             = 1,
        .num_resources  = MAC_RES_COUNT,
-       .dev.platform_data = &au1xxx_eth1_platform_data,
+       .dev = {
+               .dma_mask               = &alchemy_all_dmamask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+               .platform_data          = &au1xxx_eth1_platform_data,
+       },
 };
 
 void __init au1xxx_override_eth_cfg(unsigned int port,
index 634edd3..5d61854 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * USB block power/access management abstraction.
  *
index a7bd32e..3d0d468 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Au1300 media block power gating (VSS)
  *
index 9da3659..10a5228 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Alchemy Develboards
 #
index c1a2daa..8df0ccd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * bcsr.h -- Db1xxx/Pb1xxx Devboard CPLD registers ("BCSR") abstraction.
  *
index d4ca97e..228cdc7 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
index 25a5789..298b46b 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/memblock.h>
 #include <linux/err.h>
 #include <linux/clk.h>
index 6d86150..c7438a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the BCM47XX specific kernel interface routines
 # under Linux.
index af07c1a..a74b9c8 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BOARD_BCM963XX)           += board_bcm963xx.o
index a393955..1165bf2 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y          += setup.o irq.o dma.o
index ec6f5b2..eb71515 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_MSCC_OCELOT)      += ocelot_pcb123.dtb ocelot_pcb120.dtb
 
 obj-$(CONFIG_BUILTIN_DTB)      += $(addsuffix .o, $(dtb-y))
index 9e2c9fa..93867e1 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 dtb-$(CONFIG_FIT_IMAGE_FDT_NI169445)   += 169445.dtb
index 13f6c77..99e2715 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <asm/octeon/octeon.h>
index 68f0c58..f0e2c26 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Cobalt micro systems family specific parts of the kernel
 #
index 4eaec8b..0f9299f 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Cobalt buttons platform device.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <linux/platform_device.h>
index 0f1cd90..7d43b5e 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Registration of Cobalt LCD platform device.
  *
  *  Copyright (C) 2008  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index 32265f5..196660c 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Registration of Cobalt LED platform device.
  *
  *  Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index 83e1b10..95f579d 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Registration of Cobalt MTD device.
  *
  *  Copyright (C) 2006  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/init.h>
 #include <linux/platform_device.h>
index a6bc75a..0f9ca45 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Registration of Cobalt RTC platform device.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index 7cb51f5..5fb6767 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Registration of Cobalt UART platform device.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index 3bff3b8..1b6fa66 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Cobalt time initialization.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/i8253.h>
 #include <linux/init.h>
index ff40fbc..21a1168 100644 (file)
@@ -228,7 +228,7 @@ CONFIG_SERIAL_IP22_ZILOG=m
 # CONFIG_HW_RANDOM is not set
 CONFIG_RAW_DRIVER=m
 # CONFIG_HWMON is not set
-CONFIG_THERMAL=m
+CONFIG_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_INDYDOG=m
 # CONFIG_VGA_CONSOLE is not set
index 81c47e1..54db5de 100644 (file)
@@ -271,7 +271,7 @@ CONFIG_I2C_PARPORT_LIGHT=m
 CONFIG_I2C_TAOS_EVM=m
 CONFIG_I2C_STUB=m
 # CONFIG_HWMON is not set
-CONFIG_THERMAL=m
+CONFIG_THERMAL=y
 CONFIG_MFD_PCF50633=m
 CONFIG_PCF50633_ADC=m
 CONFIG_PCF50633_GPIO=m
index bd74e05..c9f62f1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the DECstation family specific parts of the kernel
 #
index ae73e42..d950160 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the DECstation prom monitor library routines
 # under Linux.
index 4254a31..bc03082 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SOC_EMMA2RH)      += common/
 
 #
index 8f20044..55b7763 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Broadcom Common Firmware Environment support
 #
index 5291505..cf96345 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for generic prom monitor library routines under Linux.
 #
index 3f01dd3..e5ba8e8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SNI prom monitor routines under Linux.
 #
index a106f81..a84475f 100644 (file)
@@ -43,14 +43,14 @@ void __init *plat_get_fdt(void)
                /* Already set up */
                return (void *)fdt;
 
-       if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_arg1)) {
+       if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_passed_dtb)) {
                /*
                 * We booted using the UHI boot protocol, so we have been
                 * provided with the appropriate device tree for the board.
                 * Make use of it & search for any machine struct based upon
                 * the root compatible string.
                 */
-               fdt = (void *)fw_arg1;
+               fdt = (void *)fw_passed_dtb;
 
                for_each_mips_machine(check_mach) {
                        match = mips_machine_is_compatible(check_mach, fdt);
index 87b86cd..a03cd4e 100644 (file)
@@ -19,7 +19,6 @@ generic-y += preempt.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += trace_clock.h
 generic-y += unaligned.h
 generic-y += user.h
index 830c93a..9a466dd 100644 (file)
@@ -482,7 +482,7 @@ static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *
  * Return the bit position (0..63) of the most significant 1 bit in a word
  * Returns -1 if no 1 bit exists
  */
-static inline unsigned long __fls(unsigned long word)
+static __always_inline unsigned long __fls(unsigned long word)
 {
        int num;
 
@@ -548,7 +548,7 @@ static inline unsigned long __fls(unsigned long word)
  * Returns 0..SZLONG-1
  * Undefined if no bit exists, so code should check against 0 first.
  */
-static inline unsigned long __ffs(unsigned long word)
+static __always_inline unsigned long __ffs(unsigned long word)
 {
        return __fls(word & -word);
 }
index 3af0b8f..46cfb01 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  DS1287 timer functions.
  *
  *  Copyright (C) 2008  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #ifndef __ASM_DS1287_H
 #define __ASM_DS1287_H
index 250a240..d689c1c 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Galileo/Marvell GT641xx IRQ definitions.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef _ASM_IRQ_GT641XX_H
 #define _ASM_IRQ_GT641XX_H
index 6fe475b..ddb968a 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Copyright (C) 2006 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef _COBALT_MACH_GT64120_H
 #define _COBALT_MACH_GT64120_H
index 42ea131..965f079 100644 (file)
@@ -7,18 +7,9 @@
 #include <asm/mmzone.h>
 
 struct cpuinfo_ip27 {
-//     cpuid_t         p_cpuid;        /* PROM assigned cpuid */
        cnodeid_t       p_nodeid;       /* my node ID in compact-id-space */
        nasid_t         p_nasid;        /* my node ID in numa-as-id-space */
        unsigned char   p_slice;        /* Physical position on node board */
-#if 0
-       unsigned long           loops_per_sec;
-       unsigned long           ipi_count;
-       unsigned long           irq_attempt[NR_IRQS];
-       unsigned long           smp_local_irq_count;
-       unsigned long           prof_multiplier;
-       unsigned long           prof_counter;
-#endif
 };
 
 extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
@@ -30,7 +21,7 @@ extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
 struct pci_bus;
 extern int pcibus_to_node(struct pci_bus *);
 
-#define cpumask_of_pcibus(bus) (cpu_online_mask)
+#define cpumask_of_pcibus(bus) (cpumask_of_node(pcibus_to_node(bus)))
 
 extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
 
index 6a1087e..bc46179 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  IDT RC32434 specific CPU feature overrides
  *
@@ -6,21 +7,6 @@
  *  This file was derived from: include/asm-mips/cpu-features.h
  *     Copyright (C) 2003, 2004 Ralf Baechle
  *     Copyright (C) 2004 Maciej W. Rozycki
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the
- *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA  02110-1301, USA.
  */
 #ifndef __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
 #define __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
index 23574c2..a92cd30 100644 (file)
@@ -801,15 +801,13 @@ struct bridge_err_cmdword {
 #define PCI64_ATTR_RMF_SHFT    48
 
 struct bridge_controller {
-       struct pci_controller   pc;
-       struct resource         mem;
-       struct resource         io;
        struct resource         busn;
        struct bridge_regs      *base;
-       nasid_t                 nasid;
-       unsigned int            widget_id;
-       u64                     baddr;
+       unsigned long           baddr;
+       unsigned long           intr_addr;
+       struct irq_domain       *domain;
        unsigned int            pci_int[8];
+       nasid_t                 nasid;
 };
 
 #define BRIDGE_CONTROLLER(bus) \
@@ -822,8 +820,4 @@ struct bridge_controller {
 #define bridge_clr(bc, reg, val)       \
        __raw_writel(__raw_readl(&bc->base->reg) & ~(val), &bc->base->reg)
 
-extern int request_bridge_irq(struct bridge_controller *bc, int pin);
-
-extern struct pci_ops bridge_pci_ops;
-
 #endif /* _ASM_PCI_BRIDGE_H */
diff --git a/arch/mips/include/asm/sn/irq_alloc.h b/arch/mips/include/asm/sn/irq_alloc.h
new file mode 100644 (file)
index 0000000..09b89ce
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_SN_IRQ_ALLOC_H
+#define __ASM_SN_IRQ_ALLOC_H
+
+struct irq_alloc_info {
+       void *ctrl;
+       nasid_t nasid;
+       int pin;
+};
+
+#endif /* __ASM_SN_IRQ_ALLOC_H */
index 26d2ed1..680e7ef 100644 (file)
@@ -47,15 +47,6 @@ typedef struct xtalk_piomap_s *xtalk_piomap_t;
 #define XIO_PORT(x)    ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
 #define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
 
-#ifdef CONFIG_PCI
-extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
-#else
-static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
-{
-       return 0;
-}
-#endif
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_XTALK_XTALK_H */
index 624b0ee..5815e1c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Jazz family specific parts of the kernel
 #
index 6718efb..071e9d9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/arch/mips/jz4740/board-qi_lb60.c
  *
@@ -6,10 +7,6 @@
  * Copyright (c) 2009 Qi Hardware inc.,
  * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
  * Copyright 2010, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 or later
- * as published by the Free Software Foundation.
  */
 
 #include <linux/kernel.h>
index 61ad907..1e1edab 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  DS1287 clockevent driver
  *
  *  Copyright (C) 2008 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/clockchips.h>
 #include <linux/init.h>
index fd90c82..eb53548 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  GT641xx clockevent routines.
  *
  *  Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/clockchips.h>
 #include <linux/init.h>
index bada74a..c04b97a 100644 (file)
@@ -42,8 +42,8 @@ static inline void align_mod(const int align, const int mod)
                : "n"(align), "n"(mod));
 }
 
-static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
-                                    const int align, const int mod)
+static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w,
+                                             const int align, const int mod)
 {
        unsigned long flags;
        int m1, m2;
index d5e335e..6126b77 100644 (file)
@@ -1973,6 +1973,14 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
                panic("Unknown Ingenic Processor ID!");
                break;
        }
+
+       /*
+        * The config0 register in the Xburst CPUs with a processor ID of
+        * PRID_COMP_INGENIC_D0 report themselves as MIPS32r2 compatible,
+        * but they don't actually support this ISA.
+        */
+       if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D0)
+               c->isa_level &= ~MIPS_CPU_ISA_M32R2;
 }
 
 static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
index ea26614..567c6ec 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  8250/16550-type serial ports prom_putchar()
  *
  *  Copyright (C) 2010  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/io.h>
 #include <linux/serial_core.h>
index 44a1f79..93bcf57 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  GT641xx IRQ routines.
  *
  *  Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/hardirq.h>
 #include <linux/init.h>
index 4138635..d67fb64 100644 (file)
@@ -64,17 +64,11 @@ struct mips_perf_event {
        #define CNTR_EVEN       0x55555555
        #define CNTR_ODD        0xaaaaaaaa
        #define CNTR_ALL        0xffffffff
-#ifdef CONFIG_MIPS_MT_SMP
        enum {
                T  = 0,
                V  = 1,
                P  = 2,
        } range;
-#else
-       #define T
-       #define V
-       #define P
-#endif
 };
 
 static struct mips_perf_event raw_event;
@@ -325,9 +319,7 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
 {
        struct perf_event *event = container_of(evt, struct perf_event, hw);
        struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
-#ifdef CONFIG_MIPS_MT_SMP
        unsigned int range = evt->event_base >> 24;
-#endif /* CONFIG_MIPS_MT_SMP */
 
        WARN_ON(idx < 0 || idx >= mipspmu.num_counters);
 
@@ -336,21 +328,15 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
                /* Make sure interrupt enabled. */
                MIPS_PERFCTRL_IE;
 
-#ifdef CONFIG_CPU_BMIPS5000
-       {
+       if (IS_ENABLED(CONFIG_CPU_BMIPS5000)) {
                /* enable the counter for the calling thread */
                cpuc->saved_ctrl[idx] |=
                        (1 << (12 + vpe_id())) | BRCM_PERFCTRL_TC;
-       }
-#else
-#ifdef CONFIG_MIPS_MT_SMP
-       if (range > V) {
+       } else if (IS_ENABLED(CONFIG_MIPS_MT_SMP) && range > V) {
                /* The counter is processor wide. Set it up to count all TCs. */
                pr_debug("Enabling perf counter for all TCs\n");
                cpuc->saved_ctrl[idx] |= M_TC_EN_ALL;
-       } else
-#endif /* CONFIG_MIPS_MT_SMP */
-       {
+       } else {
                unsigned int cpu, ctrl;
 
                /*
@@ -365,7 +351,6 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
                cpuc->saved_ctrl[idx] |= ctrl;
                pr_debug("Enabling perf counter for CPU%d\n", cpu);
        }
-#endif /* CONFIG_CPU_BMIPS5000 */
        /*
         * We do not actually let the counter run. Leave it until start().
         */
index 7c7c902..f2e7209 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Stack trace management functions
  *
index 9392dfe..0e2dd68 100644 (file)
 425    n32     io_uring_setup                  sys_io_uring_setup
 426    n32     io_uring_enter                  sys_io_uring_enter
 427    n32     io_uring_register               sys_io_uring_register
+428    n32     open_tree                       sys_open_tree
+429    n32     move_mount                      sys_move_mount
+430    n32     fsopen                          sys_fsopen
+431    n32     fsconfig                        sys_fsconfig
+432    n32     fsmount                         sys_fsmount
+433    n32     fspick                          sys_fspick
index cd0c8aa..5eebfa0 100644 (file)
 425    n64     io_uring_setup                  sys_io_uring_setup
 426    n64     io_uring_enter                  sys_io_uring_enter
 427    n64     io_uring_register               sys_io_uring_register
+428    n64     open_tree                       sys_open_tree
+429    n64     move_mount                      sys_move_mount
+430    n64     fsopen                          sys_fsopen
+431    n64     fsconfig                        sys_fsconfig
+432    n64     fsmount                         sys_fsmount
+433    n64     fspick                          sys_fspick
index e849e8f..3cc1374 100644 (file)
 425    o32     io_uring_setup                  sys_io_uring_setup
 426    o32     io_uring_enter                  sys_io_uring_enter
 427    o32     io_uring_register               sys_io_uring_register
+428    o32     open_tree                       sys_open_tree
+429    o32     move_mount                      sys_move_mount
+430    o32     fsopen                          sys_fsopen
+431    o32     fsconfig                        sys_fsconfig
+432    o32     fsmount                         sys_fsmount
+433    o32     fspick                          sys_fspick
index ff220f9..98da1e0 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := prom.o reset.o sysctrl.o
index fbb0747..c0f02da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := prom.o sysctrl.o clk.o dma.o gptu.o dcdc.o
 
 obj-y += vmmc.o
index d613b97..08298cc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Picvue PVC160206 display driver
  *
index 5d89e1e..8126f15 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Picvue PVC160206 display driver
  *
index 1ab2c5b..ba10954 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Common code for all Loongson 1 based systems
 #
index 723b4ce..7b49c82 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for common code of loongson1 based machines.
 #
index 891eac4..33c574d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for loongson1B based machines.
 #
index a92c6cd..1cf3aa2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for loongson1C based machines.
 #
index 4fe3d88..1a5df77 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Common code for all Loongson based systems
 #
index f12e640..b32b296 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for CS5536 support.
 #
index 0a9a472..bb58edb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Lemote Fuloong2e mini-PC board.
 #
index b5792c3..881a0ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for lemote loongson2f family machines
 #
index b5a0c2f..df39598 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Loongson-3 family machines
 #
index 72a7846..2d03af7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # MIPS networking code
 
 obj-$(CONFIG_MIPS_EBPF_JIT) += ebpf_jit.o
index 36d169b..c535615 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NLM_COMMON)       +=      common/
 obj-$(CONFIG_CPU_XLR)          +=      xlr/
 obj-$(CONFIG_CPU_XLP)          +=      xlp/
index 05902bc..7c83100 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                  +=  fmn.o fmn-config.o setup.o platform.o platform-flash.o
 obj-$(CONFIG_SMP)      += wakeup.o
index c4f9765..d6de4cb 100644 (file)
@@ -26,6 +26,7 @@ obj-$(CONFIG_PCI_AR2315)      += pci-ar2315.o
 obj-$(CONFIG_SOC_AR71XX)       += pci-ar71xx.o
 obj-$(CONFIG_PCI_AR724X)       += pci-ar724x.o
 obj-$(CONFIG_MIPS_PCI_VIRTIO)  += pci-virtio-guest.o
+obj-$(CONFIG_PCI_XTALK_BRIDGE) += pci-xtalk-bridge.o
 #
 # These are still pretty much in the old state, watch, go blind.
 #
@@ -39,7 +40,7 @@ obj-$(CONFIG_MIPS_MALTA)      += fixup-malta.o pci-malta.o
 obj-$(CONFIG_PMC_MSP7120_GW)   += fixup-pmcmsp.o ops-pmcmsp.o
 obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
 obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o
-obj-$(CONFIG_SGI_IP27)         += ops-bridge.o pci-ip27.o
+obj-$(CONFIG_SGI_IP27)         += pci-ip27.o
 obj-$(CONFIG_SGI_IP32)         += fixup-ip32.o ops-mace.o pci-ip32.o
 obj-$(CONFIG_SIBYTE_SB1250)    += fixup-sb1250.o pci-sb1250.o
 obj-$(CONFIG_SIBYTE_BCM112X)   += fixup-sb1250.o pci-sb1250.o
diff --git a/arch/mips/pci/ops-bridge.c b/arch/mips/pci/ops-bridge.c
deleted file mode 100644 (file)
index df95b0d..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1999, 2000, 04, 06 Ralf Baechle (ralf@linux-mips.org)
- * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
- */
-#include <linux/pci.h>
-#include <asm/paccess.h>
-#include <asm/pci/bridge.h>
-#include <asm/sn/arch.h>
-#include <asm/sn/intr.h>
-#include <asm/sn/sn0/hub.h>
-
-/*
- * Most of the IOC3 PCI config register aren't present
- * we emulate what is needed for a normal PCI enumeration
- */
-static u32 emulate_ioc3_cfg(int where, int size)
-{
-       if (size == 1 && where == 0x3d)
-               return 0x01;
-       else if (size == 2 && where == 0x3c)
-               return 0x0100;
-       else if (size == 4 && where == 0x3c)
-               return 0x00000100;
-
-       return 0;
-}
-
-/*
- * The Bridge ASIC supports both type 0 and type 1 access.  Type 1 is
- * not really documented, so right now I can't write code which uses it.
- * Therefore we use type 0 accesses for now even though they won't work
- * correctly for PCI-to-PCI bridges.
- *
- * The function is complicated by the ultimate brokenness of the IOC3 chip
- * which is used in SGI systems.  The IOC3 can only handle 32-bit PCI
- * accesses and does only decode parts of it's address space.
- */
-
-static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
-                                int where, int size, u32 * value)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
-       struct bridge_regs *bridge = bc->base;
-       int slot = PCI_SLOT(devfn);
-       int fn = PCI_FUNC(devfn);
-       volatile void *addr;
-       u32 cf, shift, mask;
-       int res;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       /*
-        * IOC3 is broken beyond belief ...  Don't even give the
-        * generic PCI code a chance to look at it for real ...
-        */
-       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
-               goto is_ioc3;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
-
-       if (size == 1)
-               res = get_dbe(*value, (u8 *) addr);
-       else if (size == 2)
-               res = get_dbe(*value, (u16 *) addr);
-       else
-               res = get_dbe(*value, (u32 *) addr);
-
-       return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
-
-is_ioc3:
-
-       /*
-        * IOC3 special handling
-        */
-       if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
-               *value = emulate_ioc3_cfg(where, size);
-               return PCIBIOS_SUCCESSFUL;
-       }
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
-
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       shift = ((where & 3) << 3);
-       mask = (0xffffffffU >> ((4 - size) << 3));
-       *value = (cf >> shift) & mask;
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
-                                int where, int size, u32 * value)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
-       struct bridge_regs *bridge = bc->base;
-       int busno = bus->number;
-       int slot = PCI_SLOT(devfn);
-       int fn = PCI_FUNC(devfn);
-       volatile void *addr;
-       u32 cf, shift, mask;
-       int res;
-
-       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
-       addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       /*
-        * IOC3 is broken beyond belief ...  Don't even give the
-        * generic PCI code a chance to look at it for real ...
-        */
-       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
-               goto is_ioc3;
-
-       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
-       addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
-
-       if (size == 1)
-               res = get_dbe(*value, (u8 *) addr);
-       else if (size == 2)
-               res = get_dbe(*value, (u16 *) addr);
-       else
-               res = get_dbe(*value, (u32 *) addr);
-
-       return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
-
-is_ioc3:
-
-       /*
-        * IOC3 special handling
-        */
-       if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
-               *value = emulate_ioc3_cfg(where, size);
-               return PCIBIOS_SUCCESSFUL;
-       }
-
-       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
-       addr = &bridge->b_type1_cfg.c[(fn << 8) | where];
-
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       shift = ((where & 3) << 3);
-       mask = (0xffffffffU >> ((4 - size) << 3));
-       *value = (cf >> shift) & mask;
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
-                          int where, int size, u32 * value)
-{
-       if (!pci_is_root_bus(bus))
-               return pci_conf1_read_config(bus, devfn, where, size, value);
-
-       return pci_conf0_read_config(bus, devfn, where, size, value);
-}
-
-static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
-                                 int where, int size, u32 value)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
-       struct bridge_regs *bridge = bc->base;
-       int slot = PCI_SLOT(devfn);
-       int fn = PCI_FUNC(devfn);
-       volatile void *addr;
-       u32 cf, shift, mask, smask;
-       int res;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       /*
-        * IOC3 is broken beyond belief ...  Don't even give the
-        * generic PCI code a chance to look at it for real ...
-        */
-       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
-               goto is_ioc3;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
-
-       if (size == 1) {
-               res = put_dbe(value, (u8 *) addr);
-       } else if (size == 2) {
-               res = put_dbe(value, (u16 *) addr);
-       } else {
-               res = put_dbe(value, (u32 *) addr);
-       }
-
-       if (res)
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       return PCIBIOS_SUCCESSFUL;
-
-is_ioc3:
-
-       /*
-        * IOC3 special handling
-        */
-       if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
-               return PCIBIOS_SUCCESSFUL;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
-
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       shift = ((where & 3) << 3);
-       mask = (0xffffffffU >> ((4 - size) << 3));
-       smask = mask << shift;
-
-       cf = (cf & ~smask) | ((value & mask) << shift);
-       if (put_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
-                                 int where, int size, u32 value)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
-       struct bridge_regs *bridge = bc->base;
-       int slot = PCI_SLOT(devfn);
-       int fn = PCI_FUNC(devfn);
-       int busno = bus->number;
-       volatile void *addr;
-       u32 cf, shift, mask, smask;
-       int res;
-
-       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
-       addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       /*
-        * IOC3 is broken beyond belief ...  Don't even give the
-        * generic PCI code a chance to look at it for real ...
-        */
-       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
-               goto is_ioc3;
-
-       addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
-
-       if (size == 1) {
-               res = put_dbe(value, (u8 *) addr);
-       } else if (size == 2) {
-               res = put_dbe(value, (u16 *) addr);
-       } else {
-               res = put_dbe(value, (u32 *) addr);
-       }
-
-       if (res)
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       return PCIBIOS_SUCCESSFUL;
-
-is_ioc3:
-
-       /*
-        * IOC3 special handling
-        */
-       if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
-               return PCIBIOS_SUCCESSFUL;
-
-       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
-
-       if (get_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       shift = ((where & 3) << 3);
-       mask = (0xffffffffU >> ((4 - size) << 3));
-       smask = mask << shift;
-
-       cf = (cf & ~smask) | ((value & mask) << shift);
-       if (put_dbe(cf, (u32 *) addr))
-               return PCIBIOS_DEVICE_NOT_FOUND;
-
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
-       int where, int size, u32 value)
-{
-       if (!pci_is_root_bus(bus))
-               return pci_conf1_write_config(bus, devfn, where, size, value);
-
-       return pci_conf0_write_config(bus, devfn, where, size, value);
-}
-
-struct pci_ops bridge_pci_ops = {
-       .read   = pci_read_config,
-       .write  = pci_write_config,
-};
index c539d0d..0fed6fc 100644 (file)
@@ -1,16 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /**
index 3c177b4..441eb93 100644 (file)
@@ -7,162 +7,7 @@
  * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org)
  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  */
-#include <linux/kernel.h>
-#include <linux/export.h>
-#include <linux/pci.h>
-#include <linux/smp.h>
-#include <linux/dma-direct.h>
-#include <asm/sn/arch.h>
 #include <asm/pci/bridge.h>
-#include <asm/paccess.h>
-#include <asm/sn/intr.h>
-#include <asm/sn/sn0/hub.h>
-
-/*
- * Max #PCI busses we can handle; ie, max #PCI bridges.
- */
-#define MAX_PCI_BUSSES         40
-
-/*
- * XXX: No kmalloc available when we do our crosstalk scan,
- *     we should try to move it later in the boot process.
- */
-static struct bridge_controller bridges[MAX_PCI_BUSSES];
-
-extern struct pci_ops bridge_pci_ops;
-
-int bridge_probe(nasid_t nasid, int widget_id, int masterwid)
-{
-       unsigned long offset = NODE_OFFSET(nasid);
-       struct bridge_controller *bc;
-       static int num_bridges = 0;
-       int slot;
-
-       pci_set_flags(PCI_PROBE_ONLY);
-
-       printk("a bridge\n");
-
-       /* XXX: kludge alert.. */
-       if (!num_bridges)
-               ioport_resource.end = ~0UL;
-
-       bc = &bridges[num_bridges];
-
-       bc->pc.pci_ops          = &bridge_pci_ops;
-       bc->pc.mem_resource     = &bc->mem;
-       bc->pc.io_resource      = &bc->io;
-
-       bc->pc.index            = num_bridges;
-
-       bc->mem.name            = "Bridge PCI MEM";
-       bc->pc.mem_offset       = offset;
-       bc->mem.start           = 0;
-       bc->mem.end             = ~0UL;
-       bc->mem.flags           = IORESOURCE_MEM;
-
-       bc->io.name             = "Bridge IO MEM";
-       bc->pc.io_offset        = offset;
-       bc->io.start            = 0UL;
-       bc->io.end              = ~0UL;
-       bc->io.flags            = IORESOURCE_IO;
-
-       bc->widget_id = widget_id;
-       bc->nasid = nasid;
-
-       bc->baddr = (u64)masterwid << 60 | PCI64_ATTR_BAR;
-
-       /*
-        * point to this bridge
-        */
-       bc->base = (struct bridge_regs *)RAW_NODE_SWIN_BASE(nasid, widget_id);
-
-       /*
-        * Clear all pending interrupts.
-        */
-       bridge_write(bc, b_int_rst_stat, BRIDGE_IRR_ALL_CLR);
-
-       /*
-        * Until otherwise set up, assume all interrupts are from slot 0
-        */
-       bridge_write(bc, b_int_device, 0x0);
-
-       /*
-        * swap pio's to pci mem and io space (big windows)
-        */
-       bridge_set(bc, b_wid_control, BRIDGE_CTRL_IO_SWAP |
-                                     BRIDGE_CTRL_MEM_SWAP);
-#ifdef CONFIG_PAGE_SIZE_4KB
-       bridge_clr(bc, b_wid_control, BRIDGE_CTRL_PAGE_SIZE);
-#else /* 16kB or larger */
-       bridge_set(bc, b_wid_control, BRIDGE_CTRL_PAGE_SIZE);
-#endif
-
-       /*
-        * Hmm...  IRIX sets additional bits in the address which
-        * are documented as reserved in the bridge docs.
-        */
-       bridge_write(bc, b_wid_int_upper, 0x8000 | (masterwid << 16));
-       bridge_write(bc, b_wid_int_lower, 0x01800090); /* PI_INT_PEND_MOD off*/
-       bridge_write(bc, b_dir_map, (masterwid << 20)); /* DMA */
-       bridge_write(bc, b_int_enable, 0);
-
-       for (slot = 0; slot < 8; slot ++) {
-               bridge_set(bc, b_device[slot].reg, BRIDGE_DEV_SWAP_DIR);
-               bc->pci_int[slot] = -1;
-       }
-       bridge_read(bc, b_wid_tflush);    /* wait until Bridge PIO complete */
-
-       register_pci_controller(&bc->pc);
-
-       num_bridges++;
-
-       return 0;
-}
-
-/*
- * All observed requests have pin == 1. We could have a global here, that
- * gets incremented and returned every time - unfortunately, pci_map_irq
- * may be called on the same device over and over, and need to return the
- * same value. On O2000, pin can be 0 or 1, and PCI slots can be [0..7].
- *
- * A given PCI device, in general, should be able to intr any of the cpus
- * on any one of the hubs connected to its xbow.
- */
-int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
-       return 0;
-}
-
-static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
-{
-       while (dev->bus->parent) {
-               /* Move up the chain of bridges. */
-               dev = dev->bus->self;
-       }
-
-       return dev;
-}
-
-/* Do platform specific device initialization at pci_enable_device() time */
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
-       struct pci_dev *rdev = bridge_root_dev(dev);
-       int slot = PCI_SLOT(rdev->devfn);
-       int irq;
-
-       irq = bc->pci_int[slot];
-       if (irq == -1) {
-               irq = request_bridge_irq(bc, slot);
-               if (irq < 0)
-                       return irq;
-
-               bc->pci_int[slot] = irq;
-       }
-       dev->irq = irq;
-
-       return 0;
-}
 
 dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
 {
@@ -177,29 +22,6 @@ phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
        return dma_addr & ~(0xffUL << 56);
 }
 
-/*
- * Device might live on a subordinate PCI bus. XXX Walk up the chain of buses
- * to find the slot number in sense of the bridge device register.
- * XXX This also means multiple devices might rely on conflicting bridge
- * settings.
- */
-
-static inline void pci_disable_swapping(struct pci_dev *dev)
-{
-       struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
-       struct bridge_regs *bridge = bc->base;
-       int slot = PCI_SLOT(dev->devfn);
-
-       /* Turn off byte swapping */
-       bridge->b_device[slot].reg &= ~BRIDGE_DEV_SWAP_DIR;
-       bridge->b_widget.w_tflush;      /* Flush */
-}
-
-static void pci_fixup_ioc3(struct pci_dev *d)
-{
-       pci_disable_swapping(d);
-}
-
 #ifdef CONFIG_NUMA
 int pcibus_to_node(struct pci_bus *bus)
 {
@@ -209,6 +31,3 @@ int pcibus_to_node(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pcibus_to_node);
 #endif /* CONFIG_NUMA */
-
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
-       pci_fixup_ioc3);
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
new file mode 100644 (file)
index 0000000..bcf7f55
--- /dev/null
@@ -0,0 +1,610 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2003 Christoph Hellwig (hch@lst.de)
+ * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
+ */
+#include <linux/kernel.h>
+#include <linux/export.h>
+#include <linux/pci.h>
+#include <linux/smp.h>
+#include <linux/dma-direct.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/xtalk-bridge.h>
+
+#include <asm/pci/bridge.h>
+#include <asm/paccess.h>
+#include <asm/sn/irq_alloc.h>
+
+/*
+ * Most of the IOC3 PCI config register aren't present
+ * we emulate what is needed for a normal PCI enumeration
+ */
+static u32 emulate_ioc3_cfg(int where, int size)
+{
+       if (size == 1 && where == 0x3d)
+               return 0x01;
+       else if (size == 2 && where == 0x3c)
+               return 0x0100;
+       else if (size == 4 && where == 0x3c)
+               return 0x00000100;
+
+       return 0;
+}
+
+static void bridge_disable_swapping(struct pci_dev *dev)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
+       int slot = PCI_SLOT(dev->devfn);
+
+       /* Turn off byte swapping */
+       bridge_clr(bc, b_device[slot].reg, BRIDGE_DEV_SWAP_DIR);
+       bridge_read(bc, b_widget.w_tflush);     /* Flush */
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
+       bridge_disable_swapping);
+
+
+/*
+ * The Bridge ASIC supports both type 0 and type 1 access.  Type 1 is
+ * not really documented, so right now I can't write code which uses it.
+ * Therefore we use type 0 accesses for now even though they won't work
+ * correctly for PCI-to-PCI bridges.
+ *
+ * The function is complicated by the ultimate brokenness of the IOC3 chip
+ * which is used in SGI systems.  The IOC3 can only handle 32-bit PCI
+ * accesses and does only decode parts of it's address space.
+ */
+static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
+                                int where, int size, u32 *value)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
+       struct bridge_regs *bridge = bc->base;
+       int slot = PCI_SLOT(devfn);
+       int fn = PCI_FUNC(devfn);
+       void *addr;
+       u32 cf, shift, mask;
+       int res;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       /*
+        * IOC3 is broken beyond belief ...  Don't even give the
+        * generic PCI code a chance to look at it for real ...
+        */
+       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
+               goto is_ioc3;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
+
+       if (size == 1)
+               res = get_dbe(*value, (u8 *)addr);
+       else if (size == 2)
+               res = get_dbe(*value, (u16 *)addr);
+       else
+               res = get_dbe(*value, (u32 *)addr);
+
+       return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
+
+is_ioc3:
+
+       /*
+        * IOC3 special handling
+        */
+       if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
+               *value = emulate_ioc3_cfg(where, size);
+               return PCIBIOS_SUCCESSFUL;
+       }
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       shift = ((where & 3) << 3);
+       mask = (0xffffffffU >> ((4 - size) << 3));
+       *value = (cf >> shift) & mask;
+
+       return PCIBIOS_SUCCESSFUL;
+}
+
+static int pci_conf1_read_config(struct pci_bus *bus, unsigned int devfn,
+                                int where, int size, u32 *value)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
+       struct bridge_regs *bridge = bc->base;
+       int busno = bus->number;
+       int slot = PCI_SLOT(devfn);
+       int fn = PCI_FUNC(devfn);
+       void *addr;
+       u32 cf, shift, mask;
+       int res;
+
+       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
+       addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       /*
+        * IOC3 is broken beyond belief ...  Don't even give the
+        * generic PCI code a chance to look at it for real ...
+        */
+       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
+               goto is_ioc3;
+
+       addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
+
+       if (size == 1)
+               res = get_dbe(*value, (u8 *)addr);
+       else if (size == 2)
+               res = get_dbe(*value, (u16 *)addr);
+       else
+               res = get_dbe(*value, (u32 *)addr);
+
+       return res ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
+
+is_ioc3:
+
+       /*
+        * IOC3 special handling
+        */
+       if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
+               *value = emulate_ioc3_cfg(where, size);
+               return PCIBIOS_SUCCESSFUL;
+       }
+
+       addr = &bridge->b_type1_cfg.c[(fn << 8) | where];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       shift = ((where & 3) << 3);
+       mask = (0xffffffffU >> ((4 - size) << 3));
+       *value = (cf >> shift) & mask;
+
+       return PCIBIOS_SUCCESSFUL;
+}
+
+static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
+                          int where, int size, u32 *value)
+{
+       if (!pci_is_root_bus(bus))
+               return pci_conf1_read_config(bus, devfn, where, size, value);
+
+       return pci_conf0_read_config(bus, devfn, where, size, value);
+}
+
+static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
+                                 int where, int size, u32 value)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
+       struct bridge_regs *bridge = bc->base;
+       int slot = PCI_SLOT(devfn);
+       int fn = PCI_FUNC(devfn);
+       void *addr;
+       u32 cf, shift, mask, smask;
+       int res;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       /*
+        * IOC3 is broken beyond belief ...  Don't even give the
+        * generic PCI code a chance to look at it for real ...
+        */
+       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
+               goto is_ioc3;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[where ^ (4 - size)];
+
+       if (size == 1)
+               res = put_dbe(value, (u8 *)addr);
+       else if (size == 2)
+               res = put_dbe(value, (u16 *)addr);
+       else
+               res = put_dbe(value, (u32 *)addr);
+
+       if (res)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       return PCIBIOS_SUCCESSFUL;
+
+is_ioc3:
+
+       /*
+        * IOC3 special handling
+        */
+       if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
+               return PCIBIOS_SUCCESSFUL;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
+
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       shift = ((where & 3) << 3);
+       mask = (0xffffffffU >> ((4 - size) << 3));
+       smask = mask << shift;
+
+       cf = (cf & ~smask) | ((value & mask) << shift);
+       if (put_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       return PCIBIOS_SUCCESSFUL;
+}
+
+static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
+                                 int where, int size, u32 value)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
+       struct bridge_regs *bridge = bc->base;
+       int slot = PCI_SLOT(devfn);
+       int fn = PCI_FUNC(devfn);
+       int busno = bus->number;
+       void *addr;
+       u32 cf, shift, mask, smask;
+       int res;
+
+       bridge_write(bc, b_pci_cfg, (busno << 16) | (slot << 11));
+       addr = &bridge->b_type1_cfg.c[(fn << 8) | PCI_VENDOR_ID];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       /*
+        * IOC3 is broken beyond belief ...  Don't even give the
+        * generic PCI code a chance to look at it for real ...
+        */
+       if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
+               goto is_ioc3;
+
+       addr = &bridge->b_type1_cfg.c[(fn << 8) | (where ^ (4 - size))];
+
+       if (size == 1)
+               res = put_dbe(value, (u8 *)addr);
+       else if (size == 2)
+               res = put_dbe(value, (u16 *)addr);
+       else
+               res = put_dbe(value, (u32 *)addr);
+
+       if (res)
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       return PCIBIOS_SUCCESSFUL;
+
+is_ioc3:
+
+       /*
+        * IOC3 special handling
+        */
+       if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
+               return PCIBIOS_SUCCESSFUL;
+
+       addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
+       if (get_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       shift = ((where & 3) << 3);
+       mask = (0xffffffffU >> ((4 - size) << 3));
+       smask = mask << shift;
+
+       cf = (cf & ~smask) | ((value & mask) << shift);
+       if (put_dbe(cf, (u32 *)addr))
+               return PCIBIOS_DEVICE_NOT_FOUND;
+
+       return PCIBIOS_SUCCESSFUL;
+}
+
+static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
+       int where, int size, u32 value)
+{
+       if (!pci_is_root_bus(bus))
+               return pci_conf1_write_config(bus, devfn, where, size, value);
+
+       return pci_conf0_write_config(bus, devfn, where, size, value);
+}
+
+static struct pci_ops bridge_pci_ops = {
+       .read    = pci_read_config,
+       .write   = pci_write_config,
+};
+
+struct bridge_irq_chip_data {
+       struct bridge_controller *bc;
+       nasid_t nasid;
+};
+
+static int bridge_set_affinity(struct irq_data *d, const struct cpumask *mask,
+                              bool force)
+{
+#ifdef CONFIG_NUMA
+       struct bridge_irq_chip_data *data = d->chip_data;
+       int bit = d->parent_data->hwirq;
+       int pin = d->hwirq;
+       nasid_t nasid;
+       int ret, cpu;
+
+       ret = irq_chip_set_affinity_parent(d, mask, force);
+       if (ret >= 0) {
+               cpu = cpumask_first_and(mask, cpu_online_mask);
+               nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
+               bridge_write(data->bc, b_int_addr[pin].addr,
+                            (((data->bc->intr_addr >> 30) & 0x30000) |
+                             bit | (nasid << 8)));
+               bridge_read(data->bc, b_wid_tflush);
+       }
+       return ret;
+#else
+       return irq_chip_set_affinity_parent(d, mask, force);
+#endif
+}
+
+struct irq_chip bridge_irq_chip = {
+       .name             = "BRIDGE",
+       .irq_mask         = irq_chip_mask_parent,
+       .irq_unmask       = irq_chip_unmask_parent,
+       .irq_set_affinity = bridge_set_affinity
+};
+
+static int bridge_domain_alloc(struct irq_domain *domain, unsigned int virq,
+                              unsigned int nr_irqs, void *arg)
+{
+       struct bridge_irq_chip_data *data;
+       struct irq_alloc_info *info = arg;
+       int ret;
+
+       if (nr_irqs > 1 || !info)
+               return -EINVAL;
+
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg);
+       if (ret >= 0) {
+               data->bc = info->ctrl;
+               data->nasid = info->nasid;
+               irq_domain_set_info(domain, virq, info->pin, &bridge_irq_chip,
+                                   data, handle_level_irq, NULL, NULL);
+       } else {
+               kfree(data);
+       }
+
+       return ret;
+}
+
+static void bridge_domain_free(struct irq_domain *domain, unsigned int virq,
+                              unsigned int nr_irqs)
+{
+       struct irq_data *irqd = irq_domain_get_irq_data(domain, virq);
+
+       if (nr_irqs)
+               return;
+
+       kfree(irqd->chip_data);
+       irq_domain_free_irqs_top(domain, virq, nr_irqs);
+}
+
+static int bridge_domain_activate(struct irq_domain *domain,
+                                 struct irq_data *irqd, bool reserve)
+{
+       struct bridge_irq_chip_data *data = irqd->chip_data;
+       struct bridge_controller *bc = data->bc;
+       int bit = irqd->parent_data->hwirq;
+       int pin = irqd->hwirq;
+       u32 device;
+
+       bridge_write(bc, b_int_addr[pin].addr,
+                    (((bc->intr_addr >> 30) & 0x30000) |
+                     bit | (data->nasid << 8)));
+       bridge_set(bc, b_int_enable, (1 << pin));
+       bridge_set(bc, b_int_enable, 0x7ffffe00); /* more stuff in int_enable */
+
+       /*
+        * Enable sending of an interrupt clear packt to the hub on a high to
+        * low transition of the interrupt pin.
+        *
+        * IRIX sets additional bits in the address which are documented as
+        * reserved in the bridge docs.
+        */
+       bridge_set(bc, b_int_mode, (1UL << pin));
+
+       /*
+        * We assume the bridge to have a 1:1 mapping between devices
+        * (slots) and intr pins.
+        */
+       device = bridge_read(bc, b_int_device);
+       device &= ~(7 << (pin*3));
+       device |= (pin << (pin*3));
+       bridge_write(bc, b_int_device, device);
+
+       bridge_read(bc, b_wid_tflush);
+       return 0;
+}
+
+static void bridge_domain_deactivate(struct irq_domain *domain,
+                                    struct irq_data *irqd)
+{
+       struct bridge_irq_chip_data *data = irqd->chip_data;
+
+       bridge_clr(data->bc, b_int_enable, (1 << irqd->hwirq));
+       bridge_read(data->bc, b_wid_tflush);
+}
+
+static const struct irq_domain_ops bridge_domain_ops = {
+       .alloc      = bridge_domain_alloc,
+       .free       = bridge_domain_free,
+       .activate   = bridge_domain_activate,
+       .deactivate = bridge_domain_deactivate
+};
+
+/*
+ * All observed requests have pin == 1. We could have a global here, that
+ * gets incremented and returned every time - unfortunately, pci_map_irq
+ * may be called on the same device over and over, and need to return the
+ * same value. On O2000, pin can be 0 or 1, and PCI slots can be [0..7].
+ *
+ * A given PCI device, in general, should be able to intr any of the cpus
+ * on any one of the hubs connected to its xbow.
+ */
+static int bridge_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
+       struct irq_alloc_info info;
+       int irq;
+
+       irq = bc->pci_int[slot];
+       if (irq == -1) {
+               info.ctrl = bc;
+               info.nasid = bc->nasid;
+               info.pin = slot;
+
+               irq = irq_domain_alloc_irqs(bc->domain, 1, bc->nasid, &info);
+               if (irq < 0)
+                       return irq;
+
+               bc->pci_int[slot] = irq;
+       }
+       return irq;
+}
+
+static int bridge_probe(struct platform_device *pdev)
+{
+       struct xtalk_bridge_platform_data *bd = dev_get_platdata(&pdev->dev);
+       struct device *dev = &pdev->dev;
+       struct bridge_controller *bc;
+       struct pci_host_bridge *host;
+       struct irq_domain *domain, *parent;
+       struct fwnode_handle *fn;
+       int slot;
+       int err;
+
+       parent = irq_get_default_host();
+       if (!parent)
+               return -ENODEV;
+       fn = irq_domain_alloc_named_fwnode("BRIDGE");
+       if (!fn)
+               return -ENOMEM;
+       domain = irq_domain_create_hierarchy(parent, 0, 8, fn,
+                                            &bridge_domain_ops, NULL);
+       irq_domain_free_fwnode(fn);
+       if (!domain)
+               return -ENOMEM;
+
+       pci_set_flags(PCI_PROBE_ONLY);
+
+       host = devm_pci_alloc_host_bridge(dev, sizeof(*bc));
+       if (!host) {
+               err = -ENOMEM;
+               goto err_remove_domain;
+       }
+
+       bc = pci_host_bridge_priv(host);
+
+       bc->busn.name           = "Bridge PCI busn";
+       bc->busn.start          = 0;
+       bc->busn.end            = 0xff;
+       bc->busn.flags          = IORESOURCE_BUS;
+
+       bc->domain              = domain;
+
+       pci_add_resource_offset(&host->windows, &bd->mem, bd->mem_offset);
+       pci_add_resource_offset(&host->windows, &bd->io, bd->io_offset);
+       pci_add_resource(&host->windows, &bc->busn);
+
+       err = devm_request_pci_bus_resources(dev, &host->windows);
+       if (err < 0)
+               goto err_free_resource;
+
+       bc->nasid = bd->nasid;
+
+       bc->baddr = (u64)bd->masterwid << 60 | PCI64_ATTR_BAR;
+       bc->base = (struct bridge_regs *)bd->bridge_addr;
+       bc->intr_addr = bd->intr_addr;
+
+       /*
+        * Clear all pending interrupts.
+        */
+       bridge_write(bc, b_int_rst_stat, BRIDGE_IRR_ALL_CLR);
+
+       /*
+        * Until otherwise set up, assume all interrupts are from slot 0
+        */
+       bridge_write(bc, b_int_device, 0x0);
+
+       /*
+        * disable swapping for big windows
+        */
+       bridge_clr(bc, b_wid_control,
+                  BRIDGE_CTRL_IO_SWAP | BRIDGE_CTRL_MEM_SWAP);
+#ifdef CONFIG_PAGE_SIZE_4KB
+       bridge_clr(bc, b_wid_control, BRIDGE_CTRL_PAGE_SIZE);
+#else /* 16kB or larger */
+       bridge_set(bc, b_wid_control, BRIDGE_CTRL_PAGE_SIZE);
+#endif
+
+       /*
+        * Hmm...  IRIX sets additional bits in the address which
+        * are documented as reserved in the bridge docs.
+        */
+       bridge_write(bc, b_wid_int_upper,
+                    ((bc->intr_addr >> 32) & 0xffff) | (bd->masterwid << 16));
+       bridge_write(bc, b_wid_int_lower, bc->intr_addr & 0xffffffff);
+       bridge_write(bc, b_dir_map, (bd->masterwid << 20));     /* DMA */
+       bridge_write(bc, b_int_enable, 0);
+
+       for (slot = 0; slot < 8; slot++) {
+               bridge_set(bc, b_device[slot].reg, BRIDGE_DEV_SWAP_DIR);
+               bc->pci_int[slot] = -1;
+       }
+       bridge_read(bc, b_wid_tflush);    /* wait until Bridge PIO complete */
+
+       host->dev.parent = dev;
+       host->sysdata = bc;
+       host->busnr = 0;
+       host->ops = &bridge_pci_ops;
+       host->map_irq = bridge_map_irq;
+       host->swizzle_irq = pci_common_swizzle;
+
+       err = pci_scan_root_bus_bridge(host);
+       if (err < 0)
+               goto err_free_resource;
+
+       pci_bus_claim_resources(host->bus);
+       pci_bus_add_devices(host->bus);
+
+       platform_set_drvdata(pdev, host->bus);
+
+       return 0;
+
+err_free_resource:
+       pci_free_resource_list(&host->windows);
+err_remove_domain:
+       irq_domain_remove(domain);
+       return err;
+}
+
+static int bridge_remove(struct platform_device *pdev)
+{
+       struct pci_bus *bus = platform_get_drvdata(pdev);
+       struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
+
+       irq_domain_remove(bc->domain);
+       pci_lock_rescan_remove();
+       pci_stop_root_bus(bus);
+       pci_remove_root_bus(bus);
+       pci_unlock_rescan_remove();
+
+       return 0;
+}
+
+static struct platform_driver bridge_driver = {
+       .probe  = bridge_probe,
+       .remove = bridge_remove,
+       .driver = {
+               .name = "xtalk-bridge",
+       }
+};
+
+builtin_platform_driver(bridge_driver);
index fd357f4..6183e4a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Joshua Henderson, <joshua.henderson@microchip.com>
 # Copyright (C) 2015 Microchip Technology, Inc.  All rights reserved.
index be1909c..a60750a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Joshua Henderson, <joshua.henderson@microchip.com>
 # Copyright (C) 2015 Microchip Technology, Inc.  All rights reserved.
index c286496..3b50514 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Joshua Henderson, <joshua.henderson@microchip.com>
 # Copyright (C) 2015 Microchip Technology, Inc.  All rights reserved.
index 32189c6..66f4af1 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += init.o irq.o time.o
index 02c4698..927268a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SOC_PNX833X)      += common/
 obj-$(CONFIG_NXP_STB220)       += stb22x/
 obj-$(CONFIG_NXP_STB225)       += stb22x/
index 794526c..6b1a847 100644 (file)
@@ -1,5 +1,5 @@
 # NXP STB225
 platform-$(CONFIG_SOC_PNX833X) += pnx833x/
-cflags-$(CONFIG_SOC_PNX833X)   += -Iarch/mips/include/asm/mach-pnx833x
+cflags-$(CONFIG_SOC_PNX833X)   += -I $(srctree)/arch/mips/include/asm/mach-pnx833x
 load-$(CONFIG_NXP_STB220)      += 0xffffffff80001000
 load-$(CONFIG_NXP_STB225)      += 0xffffffff80001000
index 1a46dd2..9b4d394 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := interrupts.o platform.o prom.o setup.o reset.o
index 7b58006..7c5ddf3 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := board.o
index 70bd788..14b7d9e 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HIBERNATION) += cpu.o hibernate.o hibernate_asm.o
index 8186afc..fb4b4bf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the RB532 board specific parts of the kernel
 #
index 361a690..26e957b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  RouterBoard 500 specific prom routines
  *
@@ -6,22 +7,6 @@
  *  Copyright (C) 2007, Gabor Juhos <juhosg@openwrt.org>
  *                     Felix Fietkau <nbd@openwrt.org>
  *                     Florian Fainelli <florian@openwrt.org>
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the
- *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA  02110-1301, USA.
- *
  */
 
 #include <linux/init.h>
index b225033..282b47c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
index 37ad267..0b2002e 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/if_ether.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/paccess.h>
 #include <asm/sgi/ip22.h>
@@ -25,6 +26,8 @@ static struct sgiwd93_platform_data sgiwd93_0_pd = {
        .irq    = SGI_WD93_0_IRQ,
 };
 
+static u64 sgiwd93_0_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device sgiwd93_0_device = {
        .name           = "sgiwd93",
        .id             = 0,
@@ -32,6 +35,8 @@ static struct platform_device sgiwd93_0_device = {
        .resource       = sgiwd93_0_resources,
        .dev = {
                .platform_data = &sgiwd93_0_pd,
+               .dma_mask = &sgiwd93_0_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
@@ -49,6 +54,8 @@ static struct sgiwd93_platform_data sgiwd93_1_pd = {
        .irq    = SGI_WD93_1_IRQ,
 };
 
+static u64 sgiwd93_1_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device sgiwd93_1_device = {
        .name           = "sgiwd93",
        .id             = 1,
@@ -56,6 +63,8 @@ static struct platform_device sgiwd93_1_device = {
        .resource       = sgiwd93_1_resources,
        .dev = {
                .platform_data = &sgiwd93_1_pd,
+               .dma_mask = &sgiwd93_1_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
@@ -96,6 +105,8 @@ static struct resource sgiseeq_0_resources[] = {
 
 static struct sgiseeq_platform_data eth0_pd;
 
+static u64 sgiseeq_dma_mask = DMA_BIT_MASK(32);
+
 static struct platform_device eth0_device = {
        .name           = "sgiseeq",
        .id             = 0,
@@ -103,6 +114,8 @@ static struct platform_device eth0_device = {
        .resource       = sgiseeq_0_resources,
        .dev = {
                .platform_data = &eth0_pd,
+               .dma_mask = &sgiseeq_dma_mask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
index 6074efe..066b33f 100644 (file)
@@ -184,5 +184,7 @@ void __init plat_mem_setup(void)
 
        ioc3_eth_init();
 
+       ioport_resource.start = 0;
+       ioport_resource.end = ~0UL;
        set_io_port_base(IO_BASE);
 }
index a32f843..37be049 100644 (file)
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
+#include <linux/sched.h>
 
 #include <asm/io.h>
 #include <asm/irq_cpu.h>
-#include <asm/pci/bridge.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/agent.h>
 #include <asm/sn/arch.h>
 #include <asm/sn/hub.h>
 #include <asm/sn/intr.h>
+#include <asm/sn/irq_alloc.h>
 
 struct hub_irq_data {
-       struct bridge_controller *bc;
        u64     *irq_mask[2];
        cpuid_t cpu;
-       int     bit;
-       int     pin;
 };
 
 static DECLARE_BITMAP(hub_irq_map, IP27_HUB_IRQ_COUNT);
@@ -54,7 +52,7 @@ static void enable_hub_irq(struct irq_data *d)
        struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
        unsigned long *mask = per_cpu(irq_enable_mask, hd->cpu);
 
-       set_bit(hd->bit, mask);
+       set_bit(d->hwirq, mask);
        __raw_writeq(mask[0], hd->irq_mask[0]);
        __raw_writeq(mask[1], hd->irq_mask[1]);
 }
@@ -64,71 +62,11 @@ static void disable_hub_irq(struct irq_data *d)
        struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
        unsigned long *mask = per_cpu(irq_enable_mask, hd->cpu);
 
-       clear_bit(hd->bit, mask);
+       clear_bit(d->hwirq, mask);
        __raw_writeq(mask[0], hd->irq_mask[0]);
        __raw_writeq(mask[1], hd->irq_mask[1]);
 }
 
-static unsigned int startup_bridge_irq(struct irq_data *d)
-{
-       struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
-       struct bridge_controller *bc;
-       nasid_t nasid;
-       u32 device;
-       int pin;
-
-       if (!hd)
-               return -EINVAL;
-
-       pin = hd->pin;
-       bc = hd->bc;
-
-       nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(hd->cpu));
-       bridge_write(bc, b_int_addr[pin].addr,
-                    (0x20000 | hd->bit | (nasid << 8)));
-       bridge_set(bc, b_int_enable, (1 << pin));
-       bridge_set(bc, b_int_enable, 0x7ffffe00); /* more stuff in int_enable */
-
-       /*
-        * Enable sending of an interrupt clear packt to the hub on a high to
-        * low transition of the interrupt pin.
-        *
-        * IRIX sets additional bits in the address which are documented as
-        * reserved in the bridge docs.
-        */
-       bridge_set(bc, b_int_mode, (1UL << pin));
-
-       /*
-        * We assume the bridge to have a 1:1 mapping between devices
-        * (slots) and intr pins.
-        */
-       device = bridge_read(bc, b_int_device);
-       device &= ~(7 << (pin*3));
-       device |= (pin << (pin*3));
-       bridge_write(bc, b_int_device, device);
-
-       bridge_read(bc, b_wid_tflush);
-
-       enable_hub_irq(d);
-
-       return 0;       /* Never anything pending.  */
-}
-
-static void shutdown_bridge_irq(struct irq_data *d)
-{
-       struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
-       struct bridge_controller *bc;
-
-       if (!hd)
-               return;
-
-       disable_hub_irq(d);
-
-       bc = hd->bc;
-       bridge_clr(bc, b_int_enable, (1 << hd->pin));
-       bridge_read(bc, b_wid_tflush);
-}
-
 static void setup_hub_mask(struct hub_irq_data *hd, const struct cpumask *mask)
 {
        nasid_t nasid;
@@ -144,9 +82,6 @@ static void setup_hub_mask(struct hub_irq_data *hd, const struct cpumask *mask)
                hd->irq_mask[0] = REMOTE_HUB_PTR(nasid, PI_INT_MASK0_B);
                hd->irq_mask[1] = REMOTE_HUB_PTR(nasid, PI_INT_MASK1_B);
        }
-
-       /* Make sure it's not already pending when we connect it. */
-       REMOTE_HUB_CLR_INTR(nasid, hd->bit);
 }
 
 static int set_affinity_hub_irq(struct irq_data *d, const struct cpumask *mask,
@@ -163,7 +98,7 @@ static int set_affinity_hub_irq(struct irq_data *d, const struct cpumask *mask,
        setup_hub_mask(hd, mask);
 
        if (irqd_is_started(d))
-               startup_bridge_irq(d);
+               enable_hub_irq(d);
 
        irq_data_update_effective_affinity(d, cpumask_of(hd->cpu));
 
@@ -172,20 +107,22 @@ static int set_affinity_hub_irq(struct irq_data *d, const struct cpumask *mask,
 
 static struct irq_chip hub_irq_type = {
        .name             = "HUB",
-       .irq_startup      = startup_bridge_irq,
-       .irq_shutdown     = shutdown_bridge_irq,
        .irq_mask         = disable_hub_irq,
        .irq_unmask       = enable_hub_irq,
        .irq_set_affinity = set_affinity_hub_irq,
 };
 
-int request_bridge_irq(struct bridge_controller *bc, int pin)
+static int hub_domain_alloc(struct irq_domain *domain, unsigned int virq,
+                           unsigned int nr_irqs, void *arg)
 {
+       struct irq_alloc_info *info = arg;
        struct hub_irq_data *hd;
        struct hub_data *hub;
        struct irq_desc *desc;
        int swlevel;
-       int irq;
+
+       if (nr_irqs > 1 || !info)
+               return -EINVAL;
 
        hd = kzalloc(sizeof(*hd), GFP_KERNEL);
        if (!hd)
@@ -196,46 +133,41 @@ int request_bridge_irq(struct bridge_controller *bc, int pin)
                kfree(hd);
                return -EAGAIN;
        }
-       irq = swlevel + IP27_HUB_IRQ_BASE;
-
-       hd->bc = bc;
-       hd->bit = swlevel;
-       hd->pin = pin;
-       irq_set_chip_data(irq, hd);
+       irq_domain_set_info(domain, virq, swlevel, &hub_irq_type, hd,
+                           handle_level_irq, NULL, NULL);
 
        /* use CPU connected to nearest hub */
-       hub = hub_data(NASID_TO_COMPACT_NODEID(bc->nasid));
+       hub = hub_data(NASID_TO_COMPACT_NODEID(info->nasid));
        setup_hub_mask(hd, &hub->h_cpus);
 
-       desc = irq_to_desc(irq);
-       desc->irq_common_data.node = bc->nasid;
+       /* Make sure it's not already pending when we connect it. */
+       REMOTE_HUB_CLR_INTR(info->nasid, swlevel);
+
+       desc = irq_to_desc(virq);
+       desc->irq_common_data.node = info->nasid;
        cpumask_copy(desc->irq_common_data.affinity, &hub->h_cpus);
 
-       return irq;
+       return 0;
 }
 
-void ip27_hub_irq_init(void)
+static void hub_domain_free(struct irq_domain *domain,
+                           unsigned int virq, unsigned int nr_irqs)
 {
-       int i;
+       struct irq_data *irqd;
 
-       for (i = IP27_HUB_IRQ_BASE;
-            i < (IP27_HUB_IRQ_BASE + IP27_HUB_IRQ_COUNT); i++)
-               irq_set_chip_and_handler(i, &hub_irq_type, handle_level_irq);
-
-       /*
-        * Some interrupts are reserved by hardware or by software convention.
-        * Mark these as reserved right away so they won't be used accidentally
-        * later.
-        */
-       for (i = 0; i <= BASE_PCI_IRQ; i++)
-               set_bit(i, hub_irq_map);
-
-       set_bit(IP_PEND0_6_63, hub_irq_map);
+       if (nr_irqs > 1)
+               return;
 
-       for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++)
-               set_bit(i, hub_irq_map);
+       irqd = irq_domain_get_irq_data(domain, virq);
+       if (irqd && irqd->chip_data)
+               kfree(irqd->chip_data);
 }
 
+static const struct irq_domain_ops hub_domain_ops = {
+       .alloc = hub_domain_alloc,
+       .free  = hub_domain_free,
+};
+
 /*
  * This code is unnecessarily complex, because we do
  * intr enabling. Basically, once we grab the set of intrs we need
@@ -252,7 +184,9 @@ static void ip27_do_irq_mask0(struct irq_desc *desc)
 {
        cpuid_t cpu = smp_processor_id();
        unsigned long *mask = per_cpu(irq_enable_mask, cpu);
+       struct irq_domain *domain;
        u64 pend0;
+       int irq;
 
        /* copied from Irix intpend0() */
        pend0 = LOCAL_HUB_L(PI_INT_PEND0);
@@ -276,7 +210,14 @@ static void ip27_do_irq_mask0(struct irq_desc *desc)
                generic_smp_call_function_interrupt();
        } else
 #endif
-               generic_handle_irq(__ffs(pend0) + IP27_HUB_IRQ_BASE);
+       {
+               domain = irq_desc_get_handler_data(desc);
+               irq = irq_linear_revmap(domain, __ffs(pend0));
+               if (irq)
+                       generic_handle_irq(irq);
+               else
+                       spurious_interrupt();
+       }
 
        LOCAL_HUB_L(PI_INT_PEND0);
 }
@@ -285,7 +226,9 @@ static void ip27_do_irq_mask1(struct irq_desc *desc)
 {
        cpuid_t cpu = smp_processor_id();
        unsigned long *mask = per_cpu(irq_enable_mask, cpu);
+       struct irq_domain *domain;
        u64 pend1;
+       int irq;
 
        /* copied from Irix intpend0() */
        pend1 = LOCAL_HUB_L(PI_INT_PEND1);
@@ -294,7 +237,12 @@ static void ip27_do_irq_mask1(struct irq_desc *desc)
        if (!pend1)
                return;
 
-       generic_handle_irq(__ffs(pend1) + IP27_HUB_IRQ_BASE + 64);
+       domain = irq_desc_get_handler_data(desc);
+       irq = irq_linear_revmap(domain, __ffs(pend1) + 64);
+       if (irq)
+               generic_handle_irq(irq);
+       else
+               spurious_interrupt();
 
        LOCAL_HUB_L(PI_INT_PEND1);
 }
@@ -325,11 +273,41 @@ void install_ipi(void)
 
 void __init arch_init_irq(void)
 {
+       struct irq_domain *domain;
+       struct fwnode_handle *fn;
+       int i;
+
        mips_cpu_irq_init();
-       ip27_hub_irq_init();
+
+       /*
+        * Some interrupts are reserved by hardware or by software convention.
+        * Mark these as reserved right away so they won't be used accidentally
+        * later.
+        */
+       for (i = 0; i <= BASE_PCI_IRQ; i++)
+               set_bit(i, hub_irq_map);
+
+       set_bit(IP_PEND0_6_63, hub_irq_map);
+
+       for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++)
+               set_bit(i, hub_irq_map);
+
+       fn = irq_domain_alloc_named_fwnode("HUB");
+       WARN_ON(fn == NULL);
+       if (!fn)
+               return;
+       domain = irq_domain_create_linear(fn, IP27_HUB_IRQ_COUNT,
+                                         &hub_domain_ops, NULL);
+       WARN_ON(domain == NULL);
+       if (!domain)
+               return;
+
+       irq_set_default_host(domain);
 
        irq_set_percpu_devid(IP27_HUB_PEND0_IRQ);
-       irq_set_chained_handler(IP27_HUB_PEND0_IRQ, ip27_do_irq_mask0);
+       irq_set_chained_handler_and_data(IP27_HUB_PEND0_IRQ, ip27_do_irq_mask0,
+                                        domain);
        irq_set_percpu_devid(IP27_HUB_PEND1_IRQ);
-       irq_set_chained_handler(IP27_HUB_PEND1_IRQ, ip27_do_irq_mask1);
+       irq_set_chained_handler_and_data(IP27_HUB_PEND1_IRQ, ip27_do_irq_mask1,
+                                        domain);
 }
index ce06aaa..bd5cb85 100644 (file)
@@ -9,6 +9,9 @@
 
 #include <linux/kernel.h>
 #include <linux/smp.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/xtalk-bridge.h>
+#include <asm/sn/addrs.h>
 #include <asm/sn/types.h>
 #include <asm/sn/klconfig.h>
 #include <asm/sn/hub.h>
 #define XXBOW_WIDGET_PART_NUM  0xd000  /* Xbow in Xbridge */
 #define BASE_XBOW_PORT         8     /* Lowest external port */
 
-extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
+static void bridge_platform_create(nasid_t nasid, int widget, int masterwid)
+{
+       struct xtalk_bridge_platform_data *bd;
+       struct platform_device *pdev;
+       unsigned long offset;
+
+       bd = kzalloc(sizeof(*bd), GFP_KERNEL);
+       if (!bd)
+               goto no_mem;
+       pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO);
+       if (!pdev) {
+               kfree(bd);
+               goto no_mem;
+       }
+
+       offset = NODE_OFFSET(nasid);
+
+       bd->bridge_addr = RAW_NODE_SWIN_BASE(nasid, widget);
+       bd->intr_addr   = BIT_ULL(47) + 0x01800000 + PI_INT_PEND_MOD;
+       bd->nasid       = nasid;
+       bd->masterwid   = masterwid;
+
+       bd->mem.name    = "Bridge PCI MEM";
+       bd->mem.start   = offset + (widget << SWIN_SIZE_BITS);
+       bd->mem.end     = bd->mem.start + SWIN_SIZE - 1;
+       bd->mem.flags   = IORESOURCE_MEM;
+       bd->mem_offset  = offset;
+
+       bd->io.name     = "Bridge PCI IO";
+       bd->io.start    = offset + (widget << SWIN_SIZE_BITS);
+       bd->io.end      = bd->io.start + SWIN_SIZE - 1;
+       bd->io.flags    = IORESOURCE_IO;
+       bd->io_offset   = offset;
+
+       platform_device_add_data(pdev, bd, sizeof(*bd));
+       platform_device_add(pdev);
+       pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget);
+       return;
+
+no_mem:
+       pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget);
+}
 
 static int probe_one_port(nasid_t nasid, int widget, int masterwid)
 {
@@ -31,13 +75,10 @@ static int probe_one_port(nasid_t nasid, int widget, int masterwid)
                (RAW_NODE_SWIN_BASE(nasid, widget) + WIDGET_ID);
        partnum = XWIDGET_PART_NUM(widget_id);
 
-       printk(KERN_INFO "Cpu %d, Nasid 0x%x, widget 0x%x (partnum 0x%x) is ",
-                       smp_processor_id(), nasid, widget, partnum);
-
        switch (partnum) {
        case BRIDGE_WIDGET_PART_NUM:
        case XBRIDGE_WIDGET_PART_NUM:
-               bridge_probe(nasid, widget, masterwid);
+               bridge_platform_create(nasid, widget, masterwid);
                break;
        default:
                break;
@@ -52,8 +93,6 @@ static int xbow_probe(nasid_t nasid)
        klxbow_t *xbow_p;
        unsigned masterwid, i;
 
-       printk("is xbow\n");
-
        /*
         * found xbow, so may have multiple bridges
         * need to probe xbow
@@ -117,19 +156,17 @@ static void xtalk_probe_node(cnodeid_t nid)
                       (RAW_NODE_SWIN_BASE(nasid, 0x0) + WIDGET_ID);
        partnum = XWIDGET_PART_NUM(widget_id);
 
-       printk(KERN_INFO "Cpu %d, Nasid 0x%x: partnum 0x%x is ",
-                       smp_processor_id(), nasid, partnum);
-
        switch (partnum) {
        case BRIDGE_WIDGET_PART_NUM:
-               bridge_probe(nasid, 0x8, 0xa);
+               bridge_platform_create(nasid, 0x8, 0xa);
                break;
        case XBOW_WIDGET_PART_NUM:
        case XXBOW_WIDGET_PART_NUM:
+               pr_info("xtalk:n%d/0 xbow widget\n", nasid);
                xbow_probe(nasid);
                break;
        default:
-               printk(" unknown widget??\n");
+               pr_info("xtalk:n%d/0 unknown widget (0x%x)\n", nasid, partnum);
                break;
        }
 }
index 4745cd9..de02224 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SGI specific kernel interface routines
 # under Linux.
index cdc4c56..cf1327d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := setup.o irq.o time.o
 
 obj-$(CONFIG_SMP)                      += smp.o
index 3ef3fb6..57f670a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := cfe.o
 obj-$(CONFIG_SWIOTLB)                  += dma.o
 obj-$(CONFIG_SIBYTE_BUS_WATCHER)       += bus_watcher.o
index cdc4c56..cf1327d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := setup.o irq.o time.o
 
 obj-$(CONFIG_SMP)                      += smp.o
index 7b45f19..96b41a2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          := platform.o setup.o rtc_xicor1241.o \
                                   rtc_m41t81.o
 
index 9d3bad3..6d97c3e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SNI specific part of the kernel
 #
index 70a1ab6..46537c2 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/leds.h>
 #include <linux/device.h>
 #include <linux/slab.h>
+#include <linux/io.h>
 #include <linux/irq.h>
 #include <asm/bootinfo.h>
 #include <asm/idle.h>
index 9f5d5b6..4bda061 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for TOSHIBA JMR-TX3927 board
 #
index 60b24c8..08a02ae 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += prom.o setup.o irq.o
index 60b24c8..08a02ae 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += prom.o setup.o irq.o
index 5c84625..840496e 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y   += irq.o setup.o prom.o
index d4c03cc..65d30d7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the CASIO CASSIOPEIA E-55/65 specific parts of the kernel
 #
index d0d84ec..57d3eee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for common code of the NEC VR4100 series.
 #
index 32cc8d6..398c626 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  NEC VR4100 series GIU platform device.
  *
  *  Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index c1e3d20..5ce6683 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  NEC VR4100 series RTC platform device.
  *
  *  Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index bbd45d2..b37a791 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  NEC VR4100 series SIU platform device.
  *
  *  Copyright (C) 2007-2008  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <linux/errno.h>
 #include <linux/init.h>
index 5ffaff0..c7be704 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the IBM WorkPad z50 specific parts of the kernel
 #
index 55559ca..3299e28 100644 (file)
@@ -1,10 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
 #
 
 config NDS32
-        def_bool y
+       def_bool y
        select ARCH_32BIT_OFF_T
        select ARCH_HAS_SYNC_DMA_FOR_CPU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE
@@ -51,20 +52,20 @@ config GENERIC_CALIBRATE_DELAY
        def_bool y
 
 config GENERIC_CSUM
-        def_bool y
+       def_bool y
 
 config GENERIC_HWEIGHT
-        def_bool y
+       def_bool y
 
 config GENERIC_LOCKBREAK
-        def_bool y
+       def_bool y
        depends on PREEMPT
 
 config TRACE_IRQFLAGS_SUPPORT
        def_bool y
 
 config STACKTRACE_SUPPORT
-        def_bool y
+       def_bool y
 
 config FIX_EARLYCON_MEM
        def_bool y
@@ -79,11 +80,11 @@ config NR_CPUS
        default 1
 
 config MMU
-        def_bool y
+       def_bool y
 
 config NDS32_BUILTIN_DTB
-        string "Builtin DTB"
-        default ""
+       string "Builtin DTB"
+       default ""
        help
          User can use it to specify the dts of the SoC
 endmenu
index f16edf0..f80a4ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 comment "Processor Features"
 
 config CPU_BIG_ENDIAN
index 22a162c..295942f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # dummy file, do not delete
index ac34828..14dab5a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 LDFLAGS_vmlinux        := --no-undefined -X
 OBJCOPYFLAGS   := -O binary -R .note -R .note.gnu.build-id -R .comment -S
 
index 3f9b86f..c4cc0c2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 targets := Image Image.gz
 
 $(obj)/Image: vmlinux FORCE
index d31faa8..fff8ade 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
 BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o
 else
index 688b6ed..f37d500 100644 (file)
@@ -4,11 +4,8 @@ generic-y += bitops.h
 generic-y += bug.h
 generic-y += bugs.h
 generic-y += checksum.h
-generic-y += clkdev.h
 generic-y += cmpxchg.h
-generic-y += cmpxchg-local.h
 generic-y += compat.h
-generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
@@ -27,7 +24,6 @@ generic-y += kdebug.h
 generic-y += kmap_types.h
 generic-y += kprobes.h
 generic-y += kvm_para.h
-generic-y += limits.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mm-arch-hooks.h
@@ -37,9 +33,7 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
-generic-y += sizes.h
 generic-y += switch_to.h
 generic-y += timex.h
 generic-y += topology.h
index c385578..5e7c569 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_ASSEMBLER_H__
index faafc37..1641317 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_ASM_BARRIER_H
index 7414fcb..e75212c 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_BITFIELD_H__
index 347db48..fc3c41b 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_CACHE_H__
index 38ec458..e89d807 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 struct cache_info {
index 8b26198..d9ac7e6 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_CACHEFLUSH_H__
index b4dcd22..65d3009 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASM_NDS32_CURRENT_H
index 519ba97..56ea389 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_DELAY_H__
index 0225062..1c8e56d 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASMNDS32_ELF_H
index 0e60e15..5a4bf11 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_FIXMAP_H
index baf178b..5213c65 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_FUTEX_H__
index 425d546..b3a82c9 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASM_HIGHMEM_H
index 5ef8ae5..16f2623 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_IO_H
index 2bfd00f..fb45ec4 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #include <asm/nds32.h>
index 37dd5ef..3ea48e1 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef L2_CACHE_H
index e708c8b..a696469 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_LINKAGE_H
index 60efc72..940d328 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_MEMORY_H
 #define PHYS_OFFSET     (0x0)
 #endif
 
-#ifndef __virt_to_bus
-#define __virt_to_bus  __virt_to_phys
-#endif
-
-#ifndef __bus_to_virt
-#define __bus_to_virt  __phys_to_virt
-#endif
-
 /*
  * TASK_SIZE - the maximum size of a user space task.
  * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
index 88b9ee8..89d63af 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_MMU_H
index fd7d13c..b8fd3d1 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_MMU_CONTEXT_H
index 16cf9c7..a3a08e9 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASM_NDS32_MODULE_H
index 68c3815..4994f6a 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASM_NDS32_NDS32_H_
index 947f049..8feb1fa 100644 (file)
@@ -1,5 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
- * SPDX-License-Identifier: GPL-2.0
  * Copyright (C) 2005-2017 Andes Technology Corporation
  */
 
index 3c5fee5..3cbc749 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMNDS32_PGALLOC_H
index 9f52db9..c70cc56 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMNDS32_PGTABLE_H
@@ -6,7 +6,7 @@
 
 #define __PAGETABLE_PMD_FOLDED 1
 #include <asm-generic/4level-fixup.h>
-#include <asm-generic/sizes.h>
+#include <linux/sizes.h>
 
 #include <asm/memory.h>
 #include <asm/nds32.h>
index bedc4f5..27c617f 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_PROCFNS_H__
index 72024f8..b82369c 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_PROCESSOR_H
index c453883..919ee22 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_PTRACE_H
index fd1cff6..3aeee94 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMNDS32_SHMPARAM_H
index 179272c..cae8fe1 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_STRING_H
index e01a755..362a466 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_SWAB_H__
index 174b857..899b2fb 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2008-2009 Red Hat, Inc.  All rights reserved.
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
index da32101..f3b16f6 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_SYSCALLS_H
index bff741f..c135111 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_THREAD_INFO_H
@@ -42,7 +42,6 @@ struct thread_info {
  *  TIF_SIGPENDING     - signal pending
  *  TIF_NEED_RESCHED   - rescheduling necessary
  *  TIF_NOTIFY_RESUME  - callback before returning to user
- *  TIF_USEDFPU                - FPU was used by this task this quantum (SMP)
  *  TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
  */
 #define TIF_SIGPENDING         1
@@ -50,7 +49,6 @@ struct thread_info {
 #define TIF_SINGLESTEP         3
 #define TIF_NOTIFY_RESUME      4       /* callback before returning to user */
 #define TIF_SYSCALL_TRACE      8
-#define TIF_USEDFPU             16
 #define TIF_POLLING_NRFLAG     17
 #define TIF_MEMDIE             18
 #define TIF_FREEZE             19
index d5ae571..a8aff1c 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASMNDS32_TLB_H
index 38ee769..9715536 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMNDS32_TLBFLUSH_H
index 116598b..8916ad9 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMANDES_UACCESS_H
index b586a28..bf5e2d4 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #define __ARCH_WANT_SYS_CLONE
index af2c6af..89b113f 100644 (file)
@@ -1,5 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
- * SPDX-License-Identifier: GPL-2.0
  * Copyright (C) 2005-2017 Andes Technology Corporation
  */
 
index 79db5a1..74c6880 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2012 ARM Limited
 // Copyright (C) 2005-2017 Andes Technology Corporation
 #ifndef __ASM_VDSO_DATAPAGE_H
@@ -20,6 +20,7 @@ struct vdso_data {
        u32 xtime_clock_sec;    /* CLOCK_REALTIME - seconds */
        u32 cs_mult;            /* clocksource multiplier */
        u32 cs_shift;           /* Cycle to nanosecond divisor (power of two) */
+       u32 hrtimer_res;        /* hrtimer resolution */
 
        u64 cs_cycle_last;      /* last cycle value */
        u64 cs_mask;            /* clocksource mask */
index 50ba117..328439c 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 extern struct timer_info_t timer_info;
index 2d3213f..b5d58ea 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_AUXVEC_H
index a23f6f3..511e653 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __NDS32_BYTEORDER_H__
index 4cdca9b..7379366 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 1994, 1995, 1996 by Ralf Baechle
 // Copyright (C) 2005-2017 Andes Technology Corporation
 #ifndef        _ASM_CACHECTL
index e3fb723..2977534 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __ASM_NDS32_PARAM_H
index 358c99e..1a6e01c 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef __UAPI_ASM_NDS32_PTRACE_H
index 58afc41..628ff6b 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #ifndef _ASMNDS32_SIGCONTEXT_H
index 4ec8f54..c691735 100644 (file)
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #define __ARCH_WANT_STAT64
diff --git a/arch/nds32/kernel/.gitignore b/arch/nds32/kernel/.gitignore
new file mode 100644 (file)
index 0000000..c5f676c
--- /dev/null
@@ -0,0 +1 @@
+vmlinux.lds
index a1a1d61..394df3f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 0a7bc69..aab98e4 100644 (file)
@@ -13,7 +13,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
        this_leaf->level = level;
        this_leaf->type = type;
        this_leaf->coherency_line_size = CACHE_LINE_SIZE(cache_type);
-       this_leaf->number_of_sets = CACHE_SET(cache_type);;
+       this_leaf->number_of_sets = CACHE_SET(cache_type);
        this_leaf->ways_of_associativity = CACHE_WAY(cache_type);
        this_leaf->size = this_leaf->number_of_sets *
            this_leaf->coherency_line_size * this_leaf->ways_of_associativity;
index 97ba15c..1df02a7 100644 (file)
@@ -163,7 +163,7 @@ resume_kernel:
        gie_disable
        lwi     $t0, [tsk+#TSK_TI_PREEMPT]
        bnez    $t0, no_work_pending
-need_resched:
+
        lwi     $t0, [tsk+#TSK_TI_FLAGS]
        andi    $p1, $t0, #_TIF_NEED_RESCHED
        beqz    $p1, no_work_pending
@@ -173,7 +173,7 @@ need_resched:
        beqz    $t0, no_work_pending
 
        jal     preempt_schedule_irq
-       b       need_resched
+       b       no_work_pending
 #endif
 
 /*
index 8a41372..fd2a54b 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef CONFIG_DYNAMIC_FTRACE
 extern void (*ftrace_trace_function)(unsigned long, unsigned long,
                                     struct ftrace_ops*, struct pt_regs*);
-extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
 extern void ftrace_graph_caller(void);
 
 noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,
index db64b78..fcefb62 100644 (file)
@@ -7,7 +7,7 @@
 #include <asm/asm-offsets.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/thread_info.h>
 
 #ifdef CONFIG_CPU_BIG_ENDIAN
index 5ecebd0..20719e4 100644 (file)
@@ -23,9 +23,3 @@ EXPORT_SYMBOL(memzero);
 EXPORT_SYMBOL(__arch_copy_from_user);
 EXPORT_SYMBOL(__arch_copy_to_user);
 EXPORT_SYMBOL(__arch_clear_user);
-
-/* cache handling */
-EXPORT_SYMBOL(cpu_icache_inval_all);
-EXPORT_SYMBOL(cpu_dcache_wbinval_all);
-EXPORT_SYMBOL(cpu_dma_inval_range);
-EXPORT_SYMBOL(cpu_dma_wb_range);
index 016f158..90bcae6 100644 (file)
@@ -220,6 +220,7 @@ void update_vsyscall(struct timekeeper *tk)
        vdso_data->xtime_coarse_sec = tk->xtime_sec;
        vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >>
            tk->tkr_mono.shift;
+       vdso_data->hrtimer_res = hrtimer_resolution;
        vdso_write_end(vdso_data);
 }
 
diff --git a/arch/nds32/kernel/vdso/.gitignore b/arch/nds32/kernel/vdso/.gitignore
new file mode 100644 (file)
index 0000000..f8b69d8
--- /dev/null
@@ -0,0 +1 @@
+vdso.lds
index e6c50a7..7c3c1cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Building a vDSO image for AArch64.
 #
@@ -11,10 +12,8 @@ obj-vdso := note.o datapage.o sigreturn.o gettimeofday.o
 targets := $(obj-vdso) vdso.so vdso.so.dbg
 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 
-ccflags-y := -shared -fno-common -fno-builtin
-ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
-               $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
-ccflags-y += -fPIC -Wl,-shared -g
+ccflags-y := -shared -fno-common -fno-builtin -nostdlib -fPIC -Wl,-shared -g \
+       -Wl,-soname=linux-vdso.so.1 -Wl,--hash-style=sysv
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
@@ -28,7 +27,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 $(obj)/vdso.o : $(obj)/vdso.so
 
 # Link rule for the .so file, .lds has to be first
-$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
        $(call if_changed,vdsold)
 
 
@@ -40,9 +39,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
 # Generate VDSO offsets using helper script
 gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh
 quiet_cmd_vdsosym = VDSOSYM $@
-define cmd_vdsosym
-       $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
-endef
+      cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
 
 include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
        $(call if_changed,vdsosym)
@@ -65,7 +62,7 @@ gettimeofday.o : gettimeofday.c FORCE
 
 # Actual build commands
 quiet_cmd_vdsold = VDSOL   $@
-      cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@
+      cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $(real-prereqs) -o $@
 quiet_cmd_vdsoas = VDSOA   $@
       cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<
 quiet_cmd_vdsocc = VDSOA   $@
index 038721a..b025818 100644 (file)
@@ -208,6 +208,8 @@ static notrace int clock_getres_fallback(clockid_t _clk_id,
 
 notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res)
 {
+       struct vdso_data *vdata = __get_datapage();
+
        if (res == NULL)
                return 0;
        switch (clk_id) {
@@ -215,7 +217,7 @@ notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res)
        case CLOCK_MONOTONIC:
        case CLOCK_MONOTONIC_RAW:
                res->tv_sec = 0;
-               res->tv_nsec = CLOCK_REALTIME_RES;
+               res->tv_nsec = vdata->hrtimer_res;
                break;
        case CLOCK_REALTIME_COARSE:
        case CLOCK_MONOTONIC_COARSE:
index 0f98401..dddbc15 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 lib-y          := copy_page.o memcpy.o memmove.o   \
                   memset.o memzero.o \
                   copy_from_user.o copy_to_user.o clear_user.o
index 947fe0c..14fa01f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux/nds32 kernel FPU emulation.
 #
index 7c5c15a..bd360e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          := extable.o tlb.o \
                                   fault.o init.o ioremap.o mmap.o \
                                    mm-nds32.o cacheflush.o proc.o
index 1a4ab1b..55703b0 100644 (file)
@@ -260,7 +260,7 @@ void __set_fixmap(enum fixed_addresses idx,
 
        BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses);
 
-       pte = (pte_t *)&fixmap_pmd_p[pte_index(addr)];;
+       pte = (pte_t *)&fixmap_pmd_p[pte_index(addr)];
 
        if (pgprot_val(flags)) {
                set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
index 2675e87..2cb2e7c 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2008-2010 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/io.h>
index 8437782..42fc4bb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
  *
  * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
  *
  * Based on arch/sh/boot/compressed/misc.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/string.h>
index e867b37..9b02d0c 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <asm-generic/vmlinux.lds.h>
index 56f4b5d..d10fb81 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2013 Altera Corporation
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * This file is generated by sopc2dts.
  */
 
index d7ef351..a8ffdd0 100644 (file)
@@ -33,7 +33,6 @@ generic-y += pci.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += spinlock.h
 generic-y += topology.h
index 29fa2e4..522e50a 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Macro used to simplify coding multi-line assembler.
  * Some of the bit test macro can simplify down to one line
@@ -6,18 +7,6 @@
  * Copyright (C) 2004 Microtronix Datacom Ltd.
  *
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
  */
 #ifndef _ASM_NIOS2_ASMMACROS_H
 #define _ASM_NIOS2_ASMMACROS_H
index 5b9f5e0..e514652 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
  *  Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <generated/asm-offsets.h>
index 2293cf5..43695f3 100644 (file)
@@ -1,18 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2004 Microtronix Datacom Ltd.
  *
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
  */
 
 #ifndef _ASM_NIOS2_CACHE_H
index dbdaf96..61349e0 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_CPUINFO_H
index b7d655d..984dd6d 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_ELF_H
index 8e40fd9..13ce372 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2013 Altera Corporation
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_IRQ_H
index 75ab92e..b3ec3e5 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H
index 8fd5e3b..1fe8a6b 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Altera Corporation
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  *
  * Based on the code posted by Kazuyasu on the Altera Forum at:
  * http://www.alteraforum.com/forum/showpost.php?p=77003&postcount=20
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_KGDB_H
index e0c6dec..2113023 100644 (file)
@@ -1,18 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
  *
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
  */
 
 #ifndef _ASM_NIOS2_LINKAGE_H
index 615bce1..183c720 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_REGISTERS_H
index ac9bff2..908a152 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_SETUP_H
index b4bf487..362d6da 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _ASM_NIOS2_TLBFLUSH_H
index c3ee73c..e3d9b7b 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/stddef.h>
index ccc1d2a..203870c 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2013 Altera Corporation
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  *
  * Based on cpuinfo.c from microblaze
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/kernel.h>
index 1c6b651..a027cc6 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Copyright (C) 2003-2013 Altera Corporation
  *  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 
index 6c833a9..5f3555c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2013 Altera Corporation
  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
@@ -6,20 +7,6 @@
  * based on irq.c from m68k which is:
  *
  * Copyright (C) 2007 Greg Ungerer <gerg@snapgear.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index 37b25f8..d0963fc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Nios2 KGDB support
  *
@@ -6,20 +7,6 @@
  *
  * Based on the code posted by Kazuyasu on the Altera Forum at:
  * http://www.alteraforum.com/forum/showpost.php?p=77003&postcount=20
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <linux/ptrace.h>
 #include <linux/kgdb.h>
index 232a36b..8d98af5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Device tree support
  *
@@ -7,20 +8,6 @@
  * Based on MIPS support for CONFIG_OF device tree support
  *
  * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index 6a8045b..6ad64f1 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <asm/page.h>
 #include <asm-generic/vmlinux.lds.h>
index 5572566..9d5bf1d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Nios2-specific library files.
 #
index c72074f..9e32fb7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Platform options"
 
 comment "Memory settings"
index 46364f1..fb5bdb4 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += platform.o
index 22a162c..295942f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # dummy file, do not delete
index 1919cc5..164be10 100644 (file)
@@ -34,7 +34,6 @@ generic-y += qspinlock.h
 generic-y += qrwlock_types.h
 generic-y += qrwlock.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += shmparam.h
 generic-y += switch_to.h
 generic-y += topology.h
index eb97a8e..e8fb2a7 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/elf.h>
 
 #include <asm/thread_info.h>
-#include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
index c605bda..17c00d0 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/device.h>
 
 #include <asm/sections.h>
-#include <asm/segment.h>
 #include <asm/pgtable.h>
 #include <asm/types.h>
 #include <asm/setup.h>
index d8981cb..6ed7293 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 
-#include <asm/segment.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/unwinder.h>
index 17d9d37..79775aa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for or32 specific library files..
 #
index a31b2a4..8a0e580 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux openrisc-specific parts of the memory manager.
 #
index abe87e5..e63cb4a 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/blkdev.h>      /* for initrd_* */
 #include <linux/pagemap.h>
 
-#include <asm/segment.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/dma.h>
index 6c253a2..7f9f501 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 
-#include <asm/segment.h>
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
index 41cce07..61f4414 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux parisc-specific parts of the boot image creator.
 #
index 777533c..2da8624 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # linux/arch/parisc/boot/compressed/Makefile
 #
index ed2d8cc..005ee8a 100644 (file)
@@ -19,7 +19,6 @@ generic-y += mmiowb.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += seccomp.h
-generic-y += segment.h
 generic-y += trace_clock.h
 generic-y += user.h
 generic-y += vga.h
index e46a415..a28f915 100644 (file)
@@ -51,7 +51,6 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent,
                                unsigned long org_sp_gr3)
 {
        extern ftrace_func_t ftrace_trace_function;  /* depends on CONFIG_DYNAMIC_FTRACE */
-       extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
 
        if (ftrace_trace_function != ftrace_stub) {
                /* struct ftrace_ops *op, struct pt_regs *regs); */
index 6f0b9c8..34bf6d6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Stack trace management functions
  *
index fe8ca62..c9e377d 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index f2dac4d..7b19766 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for parisc-specific library files
 #
index 20e39b0..ffdb5c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for arch/parisc/mm
 #
index 258ea6b..c345b79 100644 (file)
@@ -211,7 +211,7 @@ endif
 
 asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
 
-KBUILD_CPPFLAGS        += -Iarch/$(ARCH) $(asinstr)
+KBUILD_CPPFLAGS        += -I $(srctree)/arch/$(ARCH) $(asinstr)
 KBUILD_AFLAGS  += $(AFLAGS-y)
 KBUILD_CFLAGS  += $(call cc-option,-msoft-float)
 KBUILD_CFLAGS  += -pipe $(CFLAGS-y)
index c4fa242..2c23289 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/crc32.h>
 #include <crypto/internal/hash.h>
 #include <crypto/internal/simd.h>
index 1d11830..2781ebf 100644 (file)
@@ -93,6 +93,7 @@
 #define VMALLOC_REGION_ID      NON_LINEAR_REGION_ID(H_VMALLOC_START)
 #define IO_REGION_ID           NON_LINEAR_REGION_ID(H_KERN_IO_START)
 #define VMEMMAP_REGION_ID      NON_LINEAR_REGION_ID(H_VMEMMAP_START)
+#define INVALID_REGION_ID      (VMEMMAP_REGION_ID + 1)
 
 /*
  * Defines the address of the vmemap area, in its own region on
@@ -119,14 +120,15 @@ static inline int get_region_id(unsigned long ea)
        if (id == 0)
                return USER_REGION_ID;
 
+       if (id != (PAGE_OFFSET >> 60))
+               return INVALID_REGION_ID;
+
        if (ea < H_KERN_VIRT_START)
                return LINEAR_MAP_REGION_ID;
 
-       VM_BUG_ON(id != 0xc);
        BUILD_BUG_ON(NON_LINEAR_REGION_ID(H_VMALLOC_START) != 2);
 
        region_id = NON_LINEAR_REGION_ID(ea);
-       VM_BUG_ON(region_id > VMEMMAP_REGION_ID);
        return region_id;
 }
 
index f96dd09..01567ea 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Support PCI IO workaround
  *
  * (C) Copyright 2007-2008 TOSHIBA CORPORATION
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef _IO_WORKAROUNDS_H
index e6b5bb0..013c76a 100644 (file)
@@ -201,6 +201,8 @@ struct kvmppc_spapr_tce_iommu_table {
        struct kref kref;
 };
 
+#define TCES_PER_PAGE  (PAGE_SIZE / sizeof(u64))
+
 struct kvmppc_spapr_tce_table {
        struct list_head list;
        struct kvm *kvm;
@@ -210,6 +212,7 @@ struct kvmppc_spapr_tce_table {
        u64 offset;             /* in pages */
        u64 size;               /* window size in pages */
        struct list_head iommu_tables;
+       struct mutex alloc_lock;
        struct page *pages[0];
 };
 
@@ -222,6 +225,7 @@ extern struct kvm_device_ops kvm_xics_ops;
 struct kvmppc_xive;
 struct kvmppc_xive_vcpu;
 extern struct kvm_device_ops kvm_xive_ops;
+extern struct kvm_device_ops kvm_xive_native_ops;
 
 struct kvmppc_passthru_irqmap;
 
@@ -312,7 +316,11 @@ struct kvm_arch {
 #endif
 #ifdef CONFIG_KVM_XICS
        struct kvmppc_xics *xics;
-       struct kvmppc_xive *xive;
+       struct kvmppc_xive *xive;    /* Current XIVE device in use */
+       struct {
+               struct kvmppc_xive *native;
+               struct kvmppc_xive *xics_on_xive;
+       } xive_devices;
        struct kvmppc_passthru_irqmap *pimap;
 #endif
        struct kvmppc_ops *kvm_ops;
@@ -449,6 +457,7 @@ struct kvmppc_passthru_irqmap {
 #define KVMPPC_IRQ_DEFAULT     0
 #define KVMPPC_IRQ_MPIC                1
 #define KVMPPC_IRQ_XICS                2 /* Includes a XIVE option */
+#define KVMPPC_IRQ_XIVE                3 /* XIVE native exploitation mode */
 
 #define MMIO_HPTE_CACHE_SIZE   4
 
index ac22b28..bc89238 100644 (file)
@@ -197,10 +197,6 @@ extern struct kvmppc_spapr_tce_table *kvmppc_find_table(
                (iommu_tce_check_ioba((stt)->page_shift, (stt)->offset, \
                                (stt)->size, (ioba), (npages)) ?        \
                                H_PARAMETER : H_SUCCESS)
-extern long kvmppc_tce_to_ua(struct kvm *kvm, unsigned long tce,
-               unsigned long *ua, unsigned long **prmap);
-extern void kvmppc_tce_put(struct kvmppc_spapr_tce_table *tt,
-               unsigned long idx, unsigned long tce);
 extern long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
                             unsigned long ioba, unsigned long tce);
 extern long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu,
@@ -273,6 +269,7 @@ union kvmppc_one_reg {
                u64     addr;
                u64     length;
        }       vpaval;
+       u64     xive_timaval[2];
 };
 
 struct kvmppc_ops {
@@ -480,6 +477,9 @@ extern void kvm_hv_vm_activated(void);
 extern void kvm_hv_vm_deactivated(void);
 extern bool kvm_hv_mode_active(void);
 
+extern void kvmppc_check_need_tlb_flush(struct kvm *kvm, int pcpu,
+                                       struct kvm_nested_guest *nested);
+
 #else
 static inline void __init kvm_cma_reserve(void)
 {}
@@ -594,6 +594,22 @@ extern int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
 extern int kvmppc_xive_set_irq(struct kvm *kvm, int irq_source_id, u32 irq,
                               int level, bool line_status);
 extern void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu);
+
+static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu)
+{
+       return vcpu->arch.irq_type == KVMPPC_IRQ_XIVE;
+}
+
+extern int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev,
+                                          struct kvm_vcpu *vcpu, u32 cpu);
+extern void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu);
+extern void kvmppc_xive_native_init_module(void);
+extern void kvmppc_xive_native_exit_module(void);
+extern int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu,
+                                    union kvmppc_one_reg *val);
+extern int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu,
+                                    union kvmppc_one_reg *val);
+
 #else
 static inline int kvmppc_xive_set_xive(struct kvm *kvm, u32 irq, u32 server,
                                       u32 priority) { return -1; }
@@ -617,6 +633,21 @@ static inline int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval) { retur
 static inline int kvmppc_xive_set_irq(struct kvm *kvm, int irq_source_id, u32 irq,
                                      int level, bool line_status) { return -ENODEV; }
 static inline void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu) { }
+
+static inline int kvmppc_xive_enabled(struct kvm_vcpu *vcpu)
+       { return 0; }
+static inline int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev,
+                         struct kvm_vcpu *vcpu, u32 cpu) { return -EBUSY; }
+static inline void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu) { }
+static inline void kvmppc_xive_native_init_module(void) { }
+static inline void kvmppc_xive_native_exit_module(void) { }
+static inline int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu,
+                                           union kvmppc_one_reg *val)
+{ return 0; }
+static inline int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu,
+                                           union kvmppc_one_reg *val)
+{ return -ENOENT; }
+
 #endif /* CONFIG_KVM_XIVE */
 
 #if defined(CONFIG_PPC_POWERNV) && defined(CONFIG_KVM_BOOK3S_64_HANDLER)
@@ -665,6 +696,8 @@ long kvmppc_h_clear_ref(struct kvm_vcpu *vcpu, unsigned long flags,
                         unsigned long pte_index);
 long kvmppc_h_clear_mod(struct kvm_vcpu *vcpu, unsigned long flags,
                         unsigned long pte_index);
+long kvmppc_rm_h_page_init(struct kvm_vcpu *vcpu, unsigned long flags,
+                          unsigned long dest, unsigned long src);
 long kvmppc_hpte_hv_fault(struct kvm_vcpu *vcpu, unsigned long addr,
                           unsigned long slb_v, unsigned int status, bool data);
 unsigned long kvmppc_rm_h_xirr(struct kvm_vcpu *vcpu);
index 5070df1..4a3d5d2 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * livepatch.h - powerpc-specific Kernel Live Patching Core
  *
  * Copyright (C) 2015-2016, SUSE, IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef _ASM_POWERPC_LIVEPATCH_H
 #define _ASM_POWERPC_LIVEPATCH_H
 #include <linux/sched/task_stack.h>
 
 #ifdef CONFIG_LIVEPATCH
-static inline int klp_check_compiler_support(void)
-{
-       return 0;
-}
-
 static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
 {
        regs->nip = ip;
index 611204e..58efca9 100644 (file)
@@ -232,7 +232,6 @@ static inline void enter_lazy_tlb(struct mm_struct *mm,
 extern void arch_exit_mmap(struct mm_struct *mm);
 
 static inline void arch_unmap(struct mm_struct *mm,
-                             struct vm_area_struct *vma,
                              unsigned long start, unsigned long end)
 {
        if (start <= mm->context.vdso_base && mm->context.vdso_base < end)
index b579a94..eaf76f5 100644 (file)
@@ -23,6 +23,7 @@
  * same offset regardless of where the code is executing
  */
 extern void __iomem *xive_tima;
+extern unsigned long xive_tima_os;
 
 /*
  * Offset in the TM area of our current execution level (provided by
@@ -73,6 +74,8 @@ struct xive_q {
        u32                     esc_irq;
        atomic_t                count;
        atomic_t                pending_count;
+       u64                     guest_qaddr;
+       u32                     guest_qshift;
 };
 
 /* Global enable flags for the XIVE support */
index 26ca425..b0f72de 100644 (file)
@@ -482,6 +482,8 @@ struct kvm_ppc_cpu_char {
 #define  KVM_REG_PPC_ICP_PPRI_SHIFT    16      /* pending irq priority */
 #define  KVM_REG_PPC_ICP_PPRI_MASK     0xff
 
+#define KVM_REG_PPC_VP_STATE   (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d)
+
 /* Device control API: PPC-specific devices */
 #define KVM_DEV_MPIC_GRP_MISC          1
 #define   KVM_DEV_MPIC_BASE_ADDR       0       /* 64-bit */
@@ -677,4 +679,48 @@ struct kvm_ppc_cpu_char {
 #define  KVM_XICS_PRESENTED            (1ULL << 43)
 #define  KVM_XICS_QUEUED               (1ULL << 44)
 
+/* POWER9 XIVE Native Interrupt Controller */
+#define KVM_DEV_XIVE_GRP_CTRL          1
+#define   KVM_DEV_XIVE_RESET           1
+#define   KVM_DEV_XIVE_EQ_SYNC         2
+#define KVM_DEV_XIVE_GRP_SOURCE                2       /* 64-bit source identifier */
+#define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3       /* 64-bit source identifier */
+#define KVM_DEV_XIVE_GRP_EQ_CONFIG     4       /* 64-bit EQ identifier */
+#define KVM_DEV_XIVE_GRP_SOURCE_SYNC   5       /* 64-bit source identifier */
+
+/* Layout of 64-bit XIVE source attribute values */
+#define KVM_XIVE_LEVEL_SENSITIVE       (1ULL << 0)
+#define KVM_XIVE_LEVEL_ASSERTED                (1ULL << 1)
+
+/* Layout of 64-bit XIVE source configuration attribute values */
+#define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0
+#define KVM_XIVE_SOURCE_PRIORITY_MASK  0x7
+#define KVM_XIVE_SOURCE_SERVER_SHIFT   3
+#define KVM_XIVE_SOURCE_SERVER_MASK    0xfffffff8ULL
+#define KVM_XIVE_SOURCE_MASKED_SHIFT   32
+#define KVM_XIVE_SOURCE_MASKED_MASK    0x100000000ULL
+#define KVM_XIVE_SOURCE_EISN_SHIFT     33
+#define KVM_XIVE_SOURCE_EISN_MASK      0xfffffffe00000000ULL
+
+/* Layout of 64-bit EQ identifier */
+#define KVM_XIVE_EQ_PRIORITY_SHIFT     0
+#define KVM_XIVE_EQ_PRIORITY_MASK      0x7
+#define KVM_XIVE_EQ_SERVER_SHIFT       3
+#define KVM_XIVE_EQ_SERVER_MASK                0xfffffff8ULL
+
+/* Layout of EQ configuration values (64 bytes) */
+struct kvm_ppc_xive_eq {
+       __u32 flags;
+       __u32 qshift;
+       __u64 qaddr;
+       __u32 qtoggle;
+       __u32 qindex;
+       __u8  pad[40];
+};
+
+#define KVM_XIVE_EQ_ALWAYS_NOTIFY      0x00000001
+
+#define KVM_XIVE_TIMA_PAGE_OFFSET      0
+#define KVM_XIVE_ESB_PAGE_OFFSET       4
+
 #endif /* __LINUX_KVM_POWERPC_H */
index f2ed3ef..862e289 100644 (file)
@@ -767,7 +767,6 @@ static void cacheinfo_create_index_dir(struct cache *cache, int index,
                                  cache_dir->kobj, "index%d", index);
        if (rc) {
                kobject_put(&index_dir->kobj);
-               kfree(index_dir);
                return;
        }
 
index 0417fda..50942a1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common pmac/prep/chrp pci routines. -- Cort
  */
index 523bb99..00682b8 100644 (file)
@@ -628,14 +628,14 @@ static int __init prom_next_node(phandle *nodep)
        }
 }
 
-static inline int prom_getprop(phandle node, const char *pname,
-                              void *value, size_t valuelen)
+static inline int __init prom_getprop(phandle node, const char *pname,
+                                     void *value, size_t valuelen)
 {
        return call_prom("getprop", 4, 1, node, ADDR(pname),
                         (u32)(unsigned long) value, (u32) valuelen);
 }
 
-static inline int prom_getproplen(phandle node, const char *pname)
+static inline int __init prom_getproplen(phandle node, const char *pname)
 {
        return call_prom("getproplen", 2, 1, node, ADDR(pname));
 }
index 3fb9f64..94517e4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common prep/pmac/chrp boot and setup code.
  */
index 00f5a63..103655d 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index e8e93c2..e2147d7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/device.h>
 #include <linux/cpu.h>
 #include <linux/smp.h>
@@ -610,7 +611,7 @@ SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
 SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
 SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
 SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
 SYSFS_SPRSETUP(hid0, SPRN_HID0);
 SYSFS_SPRSETUP(hid1, SPRN_HID1);
 SYSFS_SPRSETUP(hid4, SPRN_HID4);
@@ -639,7 +640,7 @@ SYSFS_SPRSETUP(tsr0, SPRN_PA6T_TSR0);
 SYSFS_SPRSETUP(tsr1, SPRN_PA6T_TSR1);
 SYSFS_SPRSETUP(tsr2, SPRN_PA6T_TSR2);
 SYSFS_SPRSETUP(tsr3, SPRN_PA6T_TSR3);
-#endif /* CONFIG_DEBUG_KERNEL */
+#endif /* CONFIG_DEBUG_MISC */
 #endif /* HAS_PPC_PMC_PA6T */
 
 #ifdef HAS_PPC_PMC_IBM
@@ -680,7 +681,7 @@ static struct device_attribute pa6t_attrs[] = {
        __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
        __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
        __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
        __ATTR(hid0, 0600, show_hid0, store_hid0),
        __ATTR(hid1, 0600, show_hid1, store_hid1),
        __ATTR(hid4, 0600, show_hid4, store_hid4),
@@ -709,7 +710,7 @@ static struct device_attribute pa6t_attrs[] = {
        __ATTR(tsr1, 0600, show_tsr1, store_tsr1),
        __ATTR(tsr2, 0600, show_tsr2, store_tsr2),
        __ATTR(tsr3, 0600, show_tsr3, store_tsr3),
-#endif /* CONFIG_DEBUG_KERNEL */
+#endif /* CONFIG_DEBUG_MISC */
 };
 #endif /* HAS_PPC_PMC_PA6T */
 #endif /* HAS_PPC_PMC_CLASSIC */
index 665f294..83e59fd 100644 (file)
@@ -179,7 +179,7 @@ extern void panic_flush_kmsg_end(void)
        kmsg_dump(KMSG_DUMP_PANIC);
        bust_spinlocks(0);
        debug_locks_off();
-       console_flush_on_panic();
+       console_flush_on_panic(CONSOLE_FLUSH_PENDING);
 }
 
 static unsigned long oops_begin(struct pt_regs *regs)
index 3223aec..4c67cc7 100644 (file)
@@ -94,7 +94,7 @@ endif
 kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
        book3s_xics.o
 
-kvm-book3s_64-objs-$(CONFIG_KVM_XIVE) += book3s_xive.o
+kvm-book3s_64-objs-$(CONFIG_KVM_XIVE) += book3s_xive.o book3s_xive_native.o
 kvm-book3s_64-objs-$(CONFIG_SPAPR_TCE_IOMMU) += book3s_64_vio.o
 
 kvm-book3s_64-module-objs := \
index 10c5579..61a212d 100644 (file)
@@ -651,6 +651,18 @@ int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
                                *val = get_reg_val(id, kvmppc_xics_get_icp(vcpu));
                        break;
 #endif /* CONFIG_KVM_XICS */
+#ifdef CONFIG_KVM_XIVE
+               case KVM_REG_PPC_VP_STATE:
+                       if (!vcpu->arch.xive_vcpu) {
+                               r = -ENXIO;
+                               break;
+                       }
+                       if (xive_enabled())
+                               r = kvmppc_xive_native_get_vp(vcpu, val);
+                       else
+                               r = -ENXIO;
+                       break;
+#endif /* CONFIG_KVM_XIVE */
                case KVM_REG_PPC_FSCR:
                        *val = get_reg_val(id, vcpu->arch.fscr);
                        break;
@@ -724,6 +736,18 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
                                r = kvmppc_xics_set_icp(vcpu, set_reg_val(id, *val));
                        break;
 #endif /* CONFIG_KVM_XICS */
+#ifdef CONFIG_KVM_XIVE
+               case KVM_REG_PPC_VP_STATE:
+                       if (!vcpu->arch.xive_vcpu) {
+                               r = -ENXIO;
+                               break;
+                       }
+                       if (xive_enabled())
+                               r = kvmppc_xive_native_set_vp(vcpu, val);
+                       else
+                               r = -ENXIO;
+                       break;
+#endif /* CONFIG_KVM_XIVE */
                case KVM_REG_PPC_FSCR:
                        vcpu->arch.fscr = set_reg_val(id, *val);
                        break;
@@ -891,6 +915,17 @@ void kvmppc_core_destroy_vm(struct kvm *kvm)
        kvmppc_rtas_tokens_free(kvm);
        WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
 #endif
+
+#ifdef CONFIG_KVM_XICS
+       /*
+        * Free the XIVE devices which are not directly freed by the
+        * device 'release' method
+        */
+       kfree(kvm->arch.xive_devices.native);
+       kvm->arch.xive_devices.native = NULL;
+       kfree(kvm->arch.xive_devices.xics_on_xive);
+       kvm->arch.xive_devices.xics_on_xive = NULL;
+#endif /* CONFIG_KVM_XICS */
 }
 
 int kvmppc_h_logical_ci_load(struct kvm_vcpu *vcpu)
@@ -1050,6 +1085,9 @@ static int kvmppc_book3s_init(void)
        if (xics_on_xive()) {
                kvmppc_xive_init_module();
                kvm_register_device_ops(&kvm_xive_ops, KVM_DEV_TYPE_XICS);
+               kvmppc_xive_native_init_module();
+               kvm_register_device_ops(&kvm_xive_native_ops,
+                                       KVM_DEV_TYPE_XIVE);
        } else
 #endif
                kvm_register_device_ops(&kvm_xics_ops, KVM_DEV_TYPE_XICS);
@@ -1060,8 +1098,10 @@ static int kvmppc_book3s_init(void)
 static void kvmppc_book3s_exit(void)
 {
 #ifdef CONFIG_KVM_XICS
-       if (xics_on_xive())
+       if (xics_on_xive()) {
                kvmppc_xive_exit_module();
+               kvmppc_xive_native_exit_module();
+       }
 #endif
 #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
        kvmppc_book3s_exit_pr();
index f100e33..66270e0 100644 (file)
@@ -228,11 +228,33 @@ static void release_spapr_tce_table(struct rcu_head *head)
        unsigned long i, npages = kvmppc_tce_pages(stt->size);
 
        for (i = 0; i < npages; i++)
-               __free_page(stt->pages[i]);
+               if (stt->pages[i])
+                       __free_page(stt->pages[i]);
 
        kfree(stt);
 }
 
+static struct page *kvm_spapr_get_tce_page(struct kvmppc_spapr_tce_table *stt,
+               unsigned long sttpage)
+{
+       struct page *page = stt->pages[sttpage];
+
+       if (page)
+               return page;
+
+       mutex_lock(&stt->alloc_lock);
+       page = stt->pages[sttpage];
+       if (!page) {
+               page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+               WARN_ON_ONCE(!page);
+               if (page)
+                       stt->pages[sttpage] = page;
+       }
+       mutex_unlock(&stt->alloc_lock);
+
+       return page;
+}
+
 static vm_fault_t kvm_spapr_tce_fault(struct vm_fault *vmf)
 {
        struct kvmppc_spapr_tce_table *stt = vmf->vma->vm_file->private_data;
@@ -241,7 +263,10 @@ static vm_fault_t kvm_spapr_tce_fault(struct vm_fault *vmf)
        if (vmf->pgoff >= kvmppc_tce_pages(stt->size))
                return VM_FAULT_SIGBUS;
 
-       page = stt->pages[vmf->pgoff];
+       page = kvm_spapr_get_tce_page(stt, vmf->pgoff);
+       if (!page)
+               return VM_FAULT_OOM;
+
        get_page(page);
        vmf->page = page;
        return 0;
@@ -296,7 +321,6 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
        struct kvmppc_spapr_tce_table *siter;
        unsigned long npages, size = args->size;
        int ret = -ENOMEM;
-       int i;
 
        if (!args->size || args->page_shift < 12 || args->page_shift > 34 ||
                (args->offset + args->size > (ULLONG_MAX >> args->page_shift)))
@@ -318,14 +342,9 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
        stt->offset = args->offset;
        stt->size = size;
        stt->kvm = kvm;
+       mutex_init(&stt->alloc_lock);
        INIT_LIST_HEAD_RCU(&stt->iommu_tables);
 
-       for (i = 0; i < npages; i++) {
-               stt->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO);
-               if (!stt->pages[i])
-                       goto fail;
-       }
-
        mutex_lock(&kvm->lock);
 
        /* Check this LIOBN hasn't been previously allocated */
@@ -352,17 +371,28 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
        if (ret >= 0)
                return ret;
 
- fail:
-       for (i = 0; i < npages; i++)
-               if (stt->pages[i])
-                       __free_page(stt->pages[i]);
-
        kfree(stt);
  fail_acct:
        kvmppc_account_memlimit(kvmppc_stt_pages(npages), false);
        return ret;
 }
 
+static long kvmppc_tce_to_ua(struct kvm *kvm, unsigned long tce,
+               unsigned long *ua)
+{
+       unsigned long gfn = tce >> PAGE_SHIFT;
+       struct kvm_memory_slot *memslot;
+
+       memslot = search_memslots(kvm_memslots(kvm), gfn);
+       if (!memslot)
+               return -EINVAL;
+
+       *ua = __gfn_to_hva_memslot(memslot, gfn) |
+               (tce & ~(PAGE_MASK | TCE_PCI_READ | TCE_PCI_WRITE));
+
+       return 0;
+}
+
 static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt,
                unsigned long tce)
 {
@@ -378,7 +408,7 @@ static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt,
        if (iommu_tce_check_gpa(stt->page_shift, gpa))
                return H_TOO_HARD;
 
-       if (kvmppc_tce_to_ua(stt->kvm, tce, &ua, NULL))
+       if (kvmppc_tce_to_ua(stt->kvm, tce, &ua))
                return H_TOO_HARD;
 
        list_for_each_entry_rcu(stit, &stt->iommu_tables, next) {
@@ -397,6 +427,36 @@ static long kvmppc_tce_validate(struct kvmppc_spapr_tce_table *stt,
        return H_SUCCESS;
 }
 
+/*
+ * Handles TCE requests for emulated devices.
+ * Puts guest TCE values to the table and expects user space to convert them.
+ * Cannot fail so kvmppc_tce_validate must be called before it.
+ */
+static void kvmppc_tce_put(struct kvmppc_spapr_tce_table *stt,
+               unsigned long idx, unsigned long tce)
+{
+       struct page *page;
+       u64 *tbl;
+       unsigned long sttpage;
+
+       idx -= stt->offset;
+       sttpage = idx / TCES_PER_PAGE;
+       page = stt->pages[sttpage];
+
+       if (!page) {
+               /* We allow any TCE, not just with read|write permissions */
+               if (!tce)
+                       return;
+
+               page = kvm_spapr_get_tce_page(stt, sttpage);
+               if (!page)
+                       return;
+       }
+       tbl = page_to_virt(page);
+
+       tbl[idx % TCES_PER_PAGE] = tce;
+}
+
 static void kvmppc_clear_tce(struct mm_struct *mm, struct iommu_table *tbl,
                unsigned long entry)
 {
@@ -551,7 +611,7 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
 
        dir = iommu_tce_direction(tce);
 
-       if ((dir != DMA_NONE) && kvmppc_tce_to_ua(vcpu->kvm, tce, &ua, NULL)) {
+       if ((dir != DMA_NONE) && kvmppc_tce_to_ua(vcpu->kvm, tce, &ua)) {
                ret = H_PARAMETER;
                goto unlock_exit;
        }
@@ -612,7 +672,7 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                return ret;
 
        idx = srcu_read_lock(&vcpu->kvm->srcu);
-       if (kvmppc_tce_to_ua(vcpu->kvm, tce_list, &ua, NULL)) {
+       if (kvmppc_tce_to_ua(vcpu->kvm, tce_list, &ua)) {
                ret = H_TOO_HARD;
                goto unlock_exit;
        }
@@ -647,7 +707,7 @@ long kvmppc_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                }
                tce = be64_to_cpu(tce);
 
-               if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua, NULL))
+               if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua))
                        return H_PARAMETER;
 
                list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
index 2206bc7..484b47f 100644 (file)
@@ -66,8 +66,6 @@
 
 #endif
 
-#define TCES_PER_PAGE  (PAGE_SIZE / sizeof(u64))
-
 /*
  * Finds a TCE table descriptor by LIOBN.
  *
@@ -88,6 +86,25 @@ struct kvmppc_spapr_tce_table *kvmppc_find_table(struct kvm *kvm,
 EXPORT_SYMBOL_GPL(kvmppc_find_table);
 
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
+static long kvmppc_rm_tce_to_ua(struct kvm *kvm, unsigned long tce,
+               unsigned long *ua, unsigned long **prmap)
+{
+       unsigned long gfn = tce >> PAGE_SHIFT;
+       struct kvm_memory_slot *memslot;
+
+       memslot = search_memslots(kvm_memslots_raw(kvm), gfn);
+       if (!memslot)
+               return -EINVAL;
+
+       *ua = __gfn_to_hva_memslot(memslot, gfn) |
+               (tce & ~(PAGE_MASK | TCE_PCI_READ | TCE_PCI_WRITE));
+
+       if (prmap)
+               *prmap = &memslot->arch.rmap[gfn - memslot->base_gfn];
+
+       return 0;
+}
+
 /*
  * Validates TCE address.
  * At the moment flags and page mask are validated.
@@ -111,7 +128,7 @@ static long kvmppc_rm_tce_validate(struct kvmppc_spapr_tce_table *stt,
        if (iommu_tce_check_gpa(stt->page_shift, gpa))
                return H_PARAMETER;
 
-       if (kvmppc_tce_to_ua(stt->kvm, tce, &ua, NULL))
+       if (kvmppc_rm_tce_to_ua(stt->kvm, tce, &ua, NULL))
                return H_TOO_HARD;
 
        list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
@@ -129,7 +146,6 @@ static long kvmppc_rm_tce_validate(struct kvmppc_spapr_tce_table *stt,
 
        return H_SUCCESS;
 }
-#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
 
 /* Note on the use of page_address() in real mode,
  *
@@ -161,13 +177,9 @@ static u64 *kvmppc_page_address(struct page *page)
 /*
  * Handles TCE requests for emulated devices.
  * Puts guest TCE values to the table and expects user space to convert them.
- * Called in both real and virtual modes.
- * Cannot fail so kvmppc_tce_validate must be called before it.
- *
- * WARNING: This will be called in real-mode on HV KVM and virtual
- *          mode on PR KVM
+ * Cannot fail so kvmppc_rm_tce_validate must be called before it.
  */
-void kvmppc_tce_put(struct kvmppc_spapr_tce_table *stt,
+static void kvmppc_rm_tce_put(struct kvmppc_spapr_tce_table *stt,
                unsigned long idx, unsigned long tce)
 {
        struct page *page;
@@ -175,35 +187,48 @@ void kvmppc_tce_put(struct kvmppc_spapr_tce_table *stt,
 
        idx -= stt->offset;
        page = stt->pages[idx / TCES_PER_PAGE];
+       /*
+        * page must not be NULL in real mode,
+        * kvmppc_rm_ioba_validate() must have taken care of this.
+        */
+       WARN_ON_ONCE_RM(!page);
        tbl = kvmppc_page_address(page);
 
        tbl[idx % TCES_PER_PAGE] = tce;
 }
-EXPORT_SYMBOL_GPL(kvmppc_tce_put);
 
-long kvmppc_tce_to_ua(struct kvm *kvm, unsigned long tce,
-               unsigned long *ua, unsigned long **prmap)
+/*
+ * TCEs pages are allocated in kvmppc_rm_tce_put() which won't be able to do so
+ * in real mode.
+ * Check if kvmppc_rm_tce_put() can succeed in real mode, i.e. a TCEs page is
+ * allocated or not required (when clearing a tce entry).
+ */
+static long kvmppc_rm_ioba_validate(struct kvmppc_spapr_tce_table *stt,
+               unsigned long ioba, unsigned long npages, bool clearing)
 {
-       unsigned long gfn = tce >> PAGE_SHIFT;
-       struct kvm_memory_slot *memslot;
+       unsigned long i, idx, sttpage, sttpages;
+       unsigned long ret = kvmppc_ioba_validate(stt, ioba, npages);
 
-       memslot = search_memslots(kvm_memslots(kvm), gfn);
-       if (!memslot)
-               return -EINVAL;
-
-       *ua = __gfn_to_hva_memslot(memslot, gfn) |
-               (tce & ~(PAGE_MASK | TCE_PCI_READ | TCE_PCI_WRITE));
+       if (ret)
+               return ret;
+       /*
+        * clearing==true says kvmppc_rm_tce_put won't be allocating pages
+        * for empty tces.
+        */
+       if (clearing)
+               return H_SUCCESS;
 
-#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
-       if (prmap)
-               *prmap = &memslot->arch.rmap[gfn - memslot->base_gfn];
-#endif
+       idx = (ioba >> stt->page_shift) - stt->offset;
+       sttpage = idx / TCES_PER_PAGE;
+       sttpages = _ALIGN_UP(idx % TCES_PER_PAGE + npages, TCES_PER_PAGE) /
+                       TCES_PER_PAGE;
+       for (i = sttpage; i < sttpage + sttpages; ++i)
+               if (!stt->pages[i])
+                       return H_TOO_HARD;
 
-       return 0;
+       return H_SUCCESS;
 }
-EXPORT_SYMBOL_GPL(kvmppc_tce_to_ua);
 
-#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
 static long iommu_tce_xchg_rm(struct mm_struct *mm, struct iommu_table *tbl,
                unsigned long entry, unsigned long *hpa,
                enum dma_data_direction *direction)
@@ -381,7 +406,7 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
        if (!stt)
                return H_TOO_HARD;
 
-       ret = kvmppc_ioba_validate(stt, ioba, 1);
+       ret = kvmppc_rm_ioba_validate(stt, ioba, 1, tce == 0);
        if (ret != H_SUCCESS)
                return ret;
 
@@ -390,7 +415,7 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
                return ret;
 
        dir = iommu_tce_direction(tce);
-       if ((dir != DMA_NONE) && kvmppc_tce_to_ua(vcpu->kvm, tce, &ua, NULL))
+       if ((dir != DMA_NONE) && kvmppc_rm_tce_to_ua(vcpu->kvm, tce, &ua, NULL))
                return H_PARAMETER;
 
        entry = ioba >> stt->page_shift;
@@ -409,7 +434,7 @@ long kvmppc_rm_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
                }
        }
 
-       kvmppc_tce_put(stt, entry, tce);
+       kvmppc_rm_tce_put(stt, entry, tce);
 
        return H_SUCCESS;
 }
@@ -480,7 +505,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
        if (tce_list & (SZ_4K - 1))
                return H_PARAMETER;
 
-       ret = kvmppc_ioba_validate(stt, ioba, npages);
+       ret = kvmppc_rm_ioba_validate(stt, ioba, npages, false);
        if (ret != H_SUCCESS)
                return ret;
 
@@ -492,7 +517,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                 */
                struct mm_iommu_table_group_mem_t *mem;
 
-               if (kvmppc_tce_to_ua(vcpu->kvm, tce_list, &ua, NULL))
+               if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce_list, &ua, NULL))
                        return H_TOO_HARD;
 
                mem = mm_iommu_lookup_rm(vcpu->kvm->mm, ua, IOMMU_PAGE_SIZE_4K);
@@ -508,7 +533,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                 * We do not require memory to be preregistered in this case
                 * so lock rmap and do __find_linux_pte_or_hugepte().
                 */
-               if (kvmppc_tce_to_ua(vcpu->kvm, tce_list, &ua, &rmap))
+               if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce_list, &ua, &rmap))
                        return H_TOO_HARD;
 
                rmap = (void *) vmalloc_to_phys(rmap);
@@ -542,7 +567,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                unsigned long tce = be64_to_cpu(((u64 *)tces)[i]);
 
                ua = 0;
-               if (kvmppc_tce_to_ua(vcpu->kvm, tce, &ua, NULL))
+               if (kvmppc_rm_tce_to_ua(vcpu->kvm, tce, &ua, NULL))
                        return H_PARAMETER;
 
                list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
@@ -557,7 +582,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
                        }
                }
 
-               kvmppc_tce_put(stt, entry + i, tce);
+               kvmppc_rm_tce_put(stt, entry + i, tce);
        }
 
 unlock_exit:
@@ -583,7 +608,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu,
        if (!stt)
                return H_TOO_HARD;
 
-       ret = kvmppc_ioba_validate(stt, ioba, npages);
+       ret = kvmppc_rm_ioba_validate(stt, ioba, npages, tce_value == 0);
        if (ret != H_SUCCESS)
                return ret;
 
@@ -610,7 +635,7 @@ long kvmppc_rm_h_stuff_tce(struct kvm_vcpu *vcpu,
        }
 
        for (i = 0; i < npages; ++i, ioba += (1ULL << stt->page_shift))
-               kvmppc_tce_put(stt, ioba >> stt->page_shift, tce_value);
+               kvmppc_rm_tce_put(stt, ioba >> stt->page_shift, tce_value);
 
        return H_SUCCESS;
 }
@@ -635,6 +660,10 @@ long kvmppc_h_get_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
 
        idx = (ioba >> stt->page_shift) - stt->offset;
        page = stt->pages[idx / TCES_PER_PAGE];
+       if (!page) {
+               vcpu->arch.regs.gpr[4] = 0;
+               return H_SUCCESS;
+       }
        tbl = (u64 *)page_address(page);
 
        vcpu->arch.regs.gpr[4] = tbl[idx % TCES_PER_PAGE];
index 7bdcd4d..d5fc624 100644 (file)
@@ -750,7 +750,7 @@ static bool kvmppc_doorbell_pending(struct kvm_vcpu *vcpu)
        /*
         * Ensure that the read of vcore->dpdes comes after the read
         * of vcpu->doorbell_request.  This barrier matches the
-        * smb_wmb() in kvmppc_guest_entry_inject().
+        * smp_wmb() in kvmppc_guest_entry_inject().
         */
        smp_rmb();
        vc = vcpu->arch.vcore;
@@ -802,6 +802,80 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
        }
 }
 
+/* Copy guest memory in place - must reside within a single memslot */
+static int kvmppc_copy_guest(struct kvm *kvm, gpa_t to, gpa_t from,
+                                 unsigned long len)
+{
+       struct kvm_memory_slot *to_memslot = NULL;
+       struct kvm_memory_slot *from_memslot = NULL;
+       unsigned long to_addr, from_addr;
+       int r;
+
+       /* Get HPA for from address */
+       from_memslot = gfn_to_memslot(kvm, from >> PAGE_SHIFT);
+       if (!from_memslot)
+               return -EFAULT;
+       if ((from + len) >= ((from_memslot->base_gfn + from_memslot->npages)
+                            << PAGE_SHIFT))
+               return -EINVAL;
+       from_addr = gfn_to_hva_memslot(from_memslot, from >> PAGE_SHIFT);
+       if (kvm_is_error_hva(from_addr))
+               return -EFAULT;
+       from_addr |= (from & (PAGE_SIZE - 1));
+
+       /* Get HPA for to address */
+       to_memslot = gfn_to_memslot(kvm, to >> PAGE_SHIFT);
+       if (!to_memslot)
+               return -EFAULT;
+       if ((to + len) >= ((to_memslot->base_gfn + to_memslot->npages)
+                          << PAGE_SHIFT))
+               return -EINVAL;
+       to_addr = gfn_to_hva_memslot(to_memslot, to >> PAGE_SHIFT);
+       if (kvm_is_error_hva(to_addr))
+               return -EFAULT;
+       to_addr |= (to & (PAGE_SIZE - 1));
+
+       /* Perform copy */
+       r = raw_copy_in_user((void __user *)to_addr, (void __user *)from_addr,
+                            len);
+       if (r)
+               return -EFAULT;
+       mark_page_dirty(kvm, to >> PAGE_SHIFT);
+       return 0;
+}
+
+static long kvmppc_h_page_init(struct kvm_vcpu *vcpu, unsigned long flags,
+                              unsigned long dest, unsigned long src)
+{
+       u64 pg_sz = SZ_4K;              /* 4K page size */
+       u64 pg_mask = SZ_4K - 1;
+       int ret;
+
+       /* Check for invalid flags (H_PAGE_SET_LOANED covers all CMO flags) */
+       if (flags & ~(H_ICACHE_INVALIDATE | H_ICACHE_SYNCHRONIZE |
+                     H_ZERO_PAGE | H_COPY_PAGE | H_PAGE_SET_LOANED))
+               return H_PARAMETER;
+
+       /* dest (and src if copy_page flag set) must be page aligned */
+       if ((dest & pg_mask) || ((flags & H_COPY_PAGE) && (src & pg_mask)))
+               return H_PARAMETER;
+
+       /* zero and/or copy the page as determined by the flags */
+       if (flags & H_COPY_PAGE) {
+               ret = kvmppc_copy_guest(vcpu->kvm, dest, src, pg_sz);
+               if (ret < 0)
+                       return H_PARAMETER;
+       } else if (flags & H_ZERO_PAGE) {
+               ret = kvm_clear_guest(vcpu->kvm, dest, pg_sz);
+               if (ret < 0)
+                       return H_PARAMETER;
+       }
+
+       /* We can ignore the remaining flags */
+
+       return H_SUCCESS;
+}
+
 static int kvm_arch_vcpu_yield_to(struct kvm_vcpu *target)
 {
        struct kvmppc_vcore *vcore = target->arch.vcore;
@@ -1004,6 +1078,11 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
                if (nesting_enabled(vcpu->kvm))
                        ret = kvmhv_copy_tofrom_guest_nested(vcpu);
                break;
+       case H_PAGE_INIT:
+               ret = kvmppc_h_page_init(vcpu, kvmppc_get_gpr(vcpu, 4),
+                                        kvmppc_get_gpr(vcpu, 5),
+                                        kvmppc_get_gpr(vcpu, 6));
+               break;
        default:
                return RESUME_HOST;
        }
@@ -1048,6 +1127,7 @@ static int kvmppc_hcall_impl_hv(unsigned long cmd)
        case H_IPOLL:
        case H_XIRR_X:
 #endif
+       case H_PAGE_INIT:
                return 1;
        }
 
@@ -2505,37 +2585,6 @@ static void kvmppc_prepare_radix_vcpu(struct kvm_vcpu *vcpu, int pcpu)
        }
 }
 
-static void kvmppc_radix_check_need_tlb_flush(struct kvm *kvm, int pcpu,
-                                             struct kvm_nested_guest *nested)
-{
-       cpumask_t *need_tlb_flush;
-       int lpid;
-
-       if (!cpu_has_feature(CPU_FTR_HVMODE))
-               return;
-
-       if (cpu_has_feature(CPU_FTR_ARCH_300))
-               pcpu &= ~0x3UL;
-
-       if (nested) {
-               lpid = nested->shadow_lpid;
-               need_tlb_flush = &nested->need_tlb_flush;
-       } else {
-               lpid = kvm->arch.lpid;
-               need_tlb_flush = &kvm->arch.need_tlb_flush;
-       }
-
-       mtspr(SPRN_LPID, lpid);
-       isync();
-       smp_mb();
-
-       if (cpumask_test_cpu(pcpu, need_tlb_flush)) {
-               radix__local_flush_tlb_lpid_guest(lpid);
-               /* Clear the bit after the TLB flush */
-               cpumask_clear_cpu(pcpu, need_tlb_flush);
-       }
-}
-
 static void kvmppc_start_thread(struct kvm_vcpu *vcpu, struct kvmppc_vcore *vc)
 {
        int cpu;
@@ -3229,19 +3278,11 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
        for (sub = 0; sub < core_info.n_subcores; ++sub)
                spin_unlock(&core_info.vc[sub]->lock);
 
-       if (kvm_is_radix(vc->kvm)) {
-               /*
-                * Do we need to flush the process scoped TLB for the LPAR?
-                *
-                * On POWER9, individual threads can come in here, but the
-                * TLB is shared between the 4 threads in a core, hence
-                * invalidating on one thread invalidates for all.
-                * Thus we make all 4 threads use the same bit here.
-                *
-                * Hash must be flushed in realmode in order to use tlbiel.
-                */
-               kvmppc_radix_check_need_tlb_flush(vc->kvm, pcpu, NULL);
-       }
+       guest_enter_irqoff();
+
+       srcu_idx = srcu_read_lock(&vc->kvm->srcu);
+
+       this_cpu_disable_ftrace();
 
        /*
         * Interrupts will be enabled once we get into the guest,
@@ -3249,19 +3290,14 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
         */
        trace_hardirqs_on();
 
-       guest_enter_irqoff();
-
-       srcu_idx = srcu_read_lock(&vc->kvm->srcu);
-
-       this_cpu_disable_ftrace();
-
        trap = __kvmppc_vcore_entry();
 
+       trace_hardirqs_off();
+
        this_cpu_enable_ftrace();
 
        srcu_read_unlock(&vc->kvm->srcu, srcu_idx);
 
-       trace_hardirqs_off();
        set_irq_happened(trap);
 
        spin_lock(&vc->lock);
@@ -3514,6 +3550,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
 #ifdef CONFIG_ALTIVEC
        load_vr_state(&vcpu->arch.vr);
 #endif
+       mtspr(SPRN_VRSAVE, vcpu->arch.vrsave);
 
        mtspr(SPRN_DSCR, vcpu->arch.dscr);
        mtspr(SPRN_IAMR, vcpu->arch.iamr);
@@ -3605,6 +3642,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
 #ifdef CONFIG_ALTIVEC
        store_vr_state(&vcpu->arch.vr);
 #endif
+       vcpu->arch.vrsave = mfspr(SPRN_VRSAVE);
 
        if (cpu_has_feature(CPU_FTR_TM) ||
            cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST))
@@ -3970,7 +4008,7 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
                          unsigned long lpcr)
 {
        int trap, r, pcpu;
-       int srcu_idx;
+       int srcu_idx, lpid;
        struct kvmppc_vcore *vc;
        struct kvm *kvm = vcpu->kvm;
        struct kvm_nested_guest *nested = vcpu->arch.nested;
@@ -4046,8 +4084,12 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
        vc->vcore_state = VCORE_RUNNING;
        trace_kvmppc_run_core(vc, 0);
 
-       if (cpu_has_feature(CPU_FTR_HVMODE))
-               kvmppc_radix_check_need_tlb_flush(kvm, pcpu, nested);
+       if (cpu_has_feature(CPU_FTR_HVMODE)) {
+               lpid = nested ? nested->shadow_lpid : kvm->arch.lpid;
+               mtspr(SPRN_LPID, lpid);
+               isync();
+               kvmppc_check_need_tlb_flush(kvm, pcpu, nested);
+       }
 
        trace_hardirqs_on();
        guest_enter_irqoff();
index b0cf224..6035d24 100644 (file)
@@ -805,3 +805,60 @@ void kvmppc_guest_entry_inject_int(struct kvm_vcpu *vcpu)
                vcpu->arch.doorbell_request = 0;
        }
 }
+
+static void flush_guest_tlb(struct kvm *kvm)
+{
+       unsigned long rb, set;
+
+       rb = PPC_BIT(52);       /* IS = 2 */
+       if (kvm_is_radix(kvm)) {
+               /* R=1 PRS=1 RIC=2 */
+               asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
+                            : : "r" (rb), "i" (1), "i" (1), "i" (2),
+                              "r" (0) : "memory");
+               for (set = 1; set < kvm->arch.tlb_sets; ++set) {
+                       rb += PPC_BIT(51);      /* increment set number */
+                       /* R=1 PRS=1 RIC=0 */
+                       asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
+                                    : : "r" (rb), "i" (1), "i" (1), "i" (0),
+                                      "r" (0) : "memory");
+               }
+       } else {
+               for (set = 0; set < kvm->arch.tlb_sets; ++set) {
+                       /* R=0 PRS=0 RIC=0 */
+                       asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
+                                    : : "r" (rb), "i" (0), "i" (0), "i" (0),
+                                      "r" (0) : "memory");
+                       rb += PPC_BIT(51);      /* increment set number */
+               }
+       }
+       asm volatile("ptesync": : :"memory");
+}
+
+void kvmppc_check_need_tlb_flush(struct kvm *kvm, int pcpu,
+                                struct kvm_nested_guest *nested)
+{
+       cpumask_t *need_tlb_flush;
+
+       /*
+        * On POWER9, individual threads can come in here, but the
+        * TLB is shared between the 4 threads in a core, hence
+        * invalidating on one thread invalidates for all.
+        * Thus we make all 4 threads use the same bit.
+        */
+       if (cpu_has_feature(CPU_FTR_ARCH_300))
+               pcpu = cpu_first_thread_sibling(pcpu);
+
+       if (nested)
+               need_tlb_flush = &nested->need_tlb_flush;
+       else
+               need_tlb_flush = &kvm->arch.need_tlb_flush;
+
+       if (cpumask_test_cpu(pcpu, need_tlb_flush)) {
+               flush_guest_tlb(kvm);
+
+               /* Clear the bit after the TLB flush */
+               cpumask_clear_cpu(pcpu, need_tlb_flush);
+       }
+}
+EXPORT_SYMBOL_GPL(kvmppc_check_need_tlb_flush);
index 3b3791e..8431ad1 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/hugetlb.h>
 #include <linux/module.h>
 #include <linux/log2.h>
+#include <linux/sizes.h>
 
 #include <asm/trace.h>
 #include <asm/kvm_ppc.h>
@@ -867,6 +868,149 @@ long kvmppc_h_clear_mod(struct kvm_vcpu *vcpu, unsigned long flags,
        return ret;
 }
 
+static int kvmppc_get_hpa(struct kvm_vcpu *vcpu, unsigned long gpa,
+                         int writing, unsigned long *hpa,
+                         struct kvm_memory_slot **memslot_p)
+{
+       struct kvm *kvm = vcpu->kvm;
+       struct kvm_memory_slot *memslot;
+       unsigned long gfn, hva, pa, psize = PAGE_SHIFT;
+       unsigned int shift;
+       pte_t *ptep, pte;
+
+       /* Find the memslot for this address */
+       gfn = gpa >> PAGE_SHIFT;
+       memslot = __gfn_to_memslot(kvm_memslots_raw(kvm), gfn);
+       if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
+               return H_PARAMETER;
+
+       /* Translate to host virtual address */
+       hva = __gfn_to_hva_memslot(memslot, gfn);
+
+       /* Try to find the host pte for that virtual address */
+       ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
+       if (!ptep)
+               return H_TOO_HARD;
+       pte = kvmppc_read_update_linux_pte(ptep, writing);
+       if (!pte_present(pte))
+               return H_TOO_HARD;
+
+       /* Convert to a physical address */
+       if (shift)
+               psize = 1UL << shift;
+       pa = pte_pfn(pte) << PAGE_SHIFT;
+       pa |= hva & (psize - 1);
+       pa |= gpa & ~PAGE_MASK;
+
+       if (hpa)
+               *hpa = pa;
+       if (memslot_p)
+               *memslot_p = memslot;
+
+       return H_SUCCESS;
+}
+
+static long kvmppc_do_h_page_init_zero(struct kvm_vcpu *vcpu,
+                                      unsigned long dest)
+{
+       struct kvm_memory_slot *memslot;
+       struct kvm *kvm = vcpu->kvm;
+       unsigned long pa, mmu_seq;
+       long ret = H_SUCCESS;
+       int i;
+
+       /* Used later to detect if we might have been invalidated */
+       mmu_seq = kvm->mmu_notifier_seq;
+       smp_rmb();
+
+       ret = kvmppc_get_hpa(vcpu, dest, 1, &pa, &memslot);
+       if (ret != H_SUCCESS)
+               return ret;
+
+       /* Check if we've been invalidated */
+       raw_spin_lock(&kvm->mmu_lock.rlock);
+       if (mmu_notifier_retry(kvm, mmu_seq)) {
+               ret = H_TOO_HARD;
+               goto out_unlock;
+       }
+
+       /* Zero the page */
+       for (i = 0; i < SZ_4K; i += L1_CACHE_BYTES, pa += L1_CACHE_BYTES)
+               dcbz((void *)pa);
+       kvmppc_update_dirty_map(memslot, dest >> PAGE_SHIFT, PAGE_SIZE);
+
+out_unlock:
+       raw_spin_unlock(&kvm->mmu_lock.rlock);
+       return ret;
+}
+
+static long kvmppc_do_h_page_init_copy(struct kvm_vcpu *vcpu,
+                                      unsigned long dest, unsigned long src)
+{
+       unsigned long dest_pa, src_pa, mmu_seq;
+       struct kvm_memory_slot *dest_memslot;
+       struct kvm *kvm = vcpu->kvm;
+       long ret = H_SUCCESS;
+
+       /* Used later to detect if we might have been invalidated */
+       mmu_seq = kvm->mmu_notifier_seq;
+       smp_rmb();
+
+       ret = kvmppc_get_hpa(vcpu, dest, 1, &dest_pa, &dest_memslot);
+       if (ret != H_SUCCESS)
+               return ret;
+       ret = kvmppc_get_hpa(vcpu, src, 0, &src_pa, NULL);
+       if (ret != H_SUCCESS)
+               return ret;
+
+       /* Check if we've been invalidated */
+       raw_spin_lock(&kvm->mmu_lock.rlock);
+       if (mmu_notifier_retry(kvm, mmu_seq)) {
+               ret = H_TOO_HARD;
+               goto out_unlock;
+       }
+
+       /* Copy the page */
+       memcpy((void *)dest_pa, (void *)src_pa, SZ_4K);
+
+       kvmppc_update_dirty_map(dest_memslot, dest >> PAGE_SHIFT, PAGE_SIZE);
+
+out_unlock:
+       raw_spin_unlock(&kvm->mmu_lock.rlock);
+       return ret;
+}
+
+long kvmppc_rm_h_page_init(struct kvm_vcpu *vcpu, unsigned long flags,
+                          unsigned long dest, unsigned long src)
+{
+       struct kvm *kvm = vcpu->kvm;
+       u64 pg_mask = SZ_4K - 1;        /* 4K page size */
+       long ret = H_SUCCESS;
+
+       /* Don't handle radix mode here, go up to the virtual mode handler */
+       if (kvm_is_radix(kvm))
+               return H_TOO_HARD;
+
+       /* Check for invalid flags (H_PAGE_SET_LOANED covers all CMO flags) */
+       if (flags & ~(H_ICACHE_INVALIDATE | H_ICACHE_SYNCHRONIZE |
+                     H_ZERO_PAGE | H_COPY_PAGE | H_PAGE_SET_LOANED))
+               return H_PARAMETER;
+
+       /* dest (and src if copy_page flag set) must be page aligned */
+       if ((dest & pg_mask) || ((flags & H_COPY_PAGE) && (src & pg_mask)))
+               return H_PARAMETER;
+
+       /* zero and/or copy the page as determined by the flags */
+       if (flags & H_COPY_PAGE)
+               ret = kvmppc_do_h_page_init_copy(vcpu, dest, src);
+       else if (flags & H_ZERO_PAGE)
+               ret = kvmppc_do_h_page_init_zero(vcpu, dest);
+
+       /* We can ignore the other flags */
+
+       return ret;
+}
+
 void kvmppc_invalidate_hpte(struct kvm *kvm, __be64 *hptep,
                        unsigned long pte_index)
 {
index dd01430..f9b2620 100644 (file)
@@ -589,11 +589,8 @@ kvmppc_hv_entry:
 1:
 #endif
 
-       /* Use cr7 as an indication of radix mode */
        ld      r5, HSTATE_KVM_VCORE(r13)
        ld      r9, VCORE_KVM(r5)       /* pointer to struct kvm */
-       lbz     r0, KVM_RADIX(r9)
-       cmpwi   cr7, r0, 0
 
        /*
         * POWER7/POWER8 host -> guest partition switch code.
@@ -616,9 +613,6 @@ kvmppc_hv_entry:
        cmpwi   r6,0
        bne     10f
 
-       /* Radix has already switched LPID and flushed core TLB */
-       bne     cr7, 22f
-
        lwz     r7,KVM_LPID(r9)
 BEGIN_FTR_SECTION
        ld      r6,KVM_SDR1(r9)
@@ -630,41 +624,13 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
        mtspr   SPRN_LPID,r7
        isync
 
-       /* See if we need to flush the TLB. Hash has to be done in RM */
-       lhz     r6,PACAPACAINDEX(r13)   /* test_bit(cpu, need_tlb_flush) */
-BEGIN_FTR_SECTION
-       /*
-        * On POWER9, individual threads can come in here, but the
-        * TLB is shared between the 4 threads in a core, hence
-        * invalidating on one thread invalidates for all.
-        * Thus we make all 4 threads use the same bit here.
-        */
-       clrrdi  r6,r6,2
-END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
-       clrldi  r7,r6,64-6              /* extract bit number (6 bits) */
-       srdi    r6,r6,6                 /* doubleword number */
-       sldi    r6,r6,3                 /* address offset */
-       add     r6,r6,r9
-       addi    r6,r6,KVM_NEED_FLUSH    /* dword in kvm->arch.need_tlb_flush */
-       li      r8,1
-       sld     r8,r8,r7
-       ld      r7,0(r6)
-       and.    r7,r7,r8
-       beq     22f
-       /* Flush the TLB of any entries for this LPID */
-       lwz     r0,KVM_TLB_SETS(r9)
-       mtctr   r0
-       li      r7,0x800                /* IS field = 0b10 */
-       ptesync
-       li      r0,0                    /* RS for P9 version of tlbiel */
-28:    tlbiel  r7                      /* On P9, rs=0, RIC=0, PRS=0, R=0 */
-       addi    r7,r7,0x1000
-       bdnz    28b
-       ptesync
-23:    ldarx   r7,0,r6                 /* clear the bit after TLB flushed */
-       andc    r7,r7,r8
-       stdcx.  r7,0,r6
-       bne     23b
+       /* See if we need to flush the TLB. */
+       mr      r3, r9                  /* kvm pointer */
+       lhz     r4, PACAPACAINDEX(r13)  /* physical cpu number */
+       li      r5, 0                   /* nested vcpu pointer */
+       bl      kvmppc_check_need_tlb_flush
+       nop
+       ld      r5, HSTATE_KVM_VCORE(r13)
 
        /* Add timebase offset onto timebase */
 22:    ld      r8,VCORE_TB_OFFSET(r5)
@@ -980,17 +946,27 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
 
 #ifdef CONFIG_KVM_XICS
        /* We are entering the guest on that thread, push VCPU to XIVE */
-       ld      r10, HSTATE_XIVE_TIMA_PHYS(r13)
-       cmpldi  cr0, r10, 0
-       beq     no_xive
        ld      r11, VCPU_XIVE_SAVED_STATE(r4)
        li      r9, TM_QW1_OS
+       lwz     r8, VCPU_XIVE_CAM_WORD(r4)
+       li      r7, TM_QW1_OS + TM_WORD2
+       mfmsr   r0
+       andi.   r0, r0, MSR_DR          /* in real mode? */
+       beq     2f
+       ld      r10, HSTATE_XIVE_TIMA_VIRT(r13)
+       cmpldi  cr1, r10, 0
+       beq     cr1, no_xive
+       eieio
+       stdx    r11,r9,r10
+       stwx    r8,r7,r10
+       b       3f
+2:     ld      r10, HSTATE_XIVE_TIMA_PHYS(r13)
+       cmpldi  cr1, r10, 0
+       beq     cr1, no_xive
        eieio
        stdcix  r11,r9,r10
-       lwz     r11, VCPU_XIVE_CAM_WORD(r4)
-       li      r9, TM_QW1_OS + TM_WORD2
-       stwcix  r11,r9,r10
-       li      r9, 1
+       stwcix  r8,r7,r10
+3:     li      r9, 1
        stb     r9, VCPU_XIVE_PUSHED(r4)
        eieio
 
@@ -1009,12 +985,16 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
         * on, we mask it.
         */
        lbz     r0, VCPU_XIVE_ESC_ON(r4)
-       cmpwi   r0,0
-       beq     1f
-       ld      r10, VCPU_XIVE_ESC_RADDR(r4)
+       cmpwi   cr1, r0,0
+       beq     cr1, 1f
        li      r9, XIVE_ESB_SET_PQ_01
+       beq     4f                      /* in real mode? */
+       ld      r10, VCPU_XIVE_ESC_VADDR(r4)
+       ldx     r0, r10, r9
+       b       5f
+4:     ld      r10, VCPU_XIVE_ESC_RADDR(r4)
        ldcix   r0, r10, r9
-       sync
+5:     sync
 
        /* We have a possible subtle race here: The escalation interrupt might
         * have fired and be on its way to the host queue while we mask it,
@@ -2292,7 +2272,7 @@ hcall_real_table:
 #endif
        .long   0               /* 0x24 - H_SET_SPRG0 */
        .long   DOTSYM(kvmppc_h_set_dabr) - hcall_real_table
-       .long   0               /* 0x2c */
+       .long   DOTSYM(kvmppc_rm_h_page_init) - hcall_real_table
        .long   0               /* 0x30 */
        .long   0               /* 0x34 */
        .long   0               /* 0x38 */
index f78d002..4953957 100644 (file)
@@ -166,7 +166,8 @@ static irqreturn_t xive_esc_irq(int irq, void *data)
        return IRQ_HANDLED;
 }
 
-static int xive_attach_escalation(struct kvm_vcpu *vcpu, u8 prio)
+int kvmppc_xive_attach_escalation(struct kvm_vcpu *vcpu, u8 prio,
+                                 bool single_escalation)
 {
        struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
        struct xive_q *q = &xc->queues[prio];
@@ -185,7 +186,7 @@ static int xive_attach_escalation(struct kvm_vcpu *vcpu, u8 prio)
                return -EIO;
        }
 
-       if (xc->xive->single_escalation)
+       if (single_escalation)
                name = kasprintf(GFP_KERNEL, "kvm-%d-%d",
                                 vcpu->kvm->arch.lpid, xc->server_num);
        else
@@ -217,7 +218,7 @@ static int xive_attach_escalation(struct kvm_vcpu *vcpu, u8 prio)
         * interrupt, thus leaving it effectively masked after
         * it fires once.
         */
-       if (xc->xive->single_escalation) {
+       if (single_escalation) {
                struct irq_data *d = irq_get_irq_data(xc->esc_virq[prio]);
                struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
 
@@ -291,7 +292,8 @@ static int xive_check_provisioning(struct kvm *kvm, u8 prio)
                        continue;
                rc = xive_provision_queue(vcpu, prio);
                if (rc == 0 && !xive->single_escalation)
-                       xive_attach_escalation(vcpu, prio);
+                       kvmppc_xive_attach_escalation(vcpu, prio,
+                                                     xive->single_escalation);
                if (rc)
                        return rc;
        }
@@ -342,7 +344,7 @@ static int xive_try_pick_queue(struct kvm_vcpu *vcpu, u8 prio)
        return atomic_add_unless(&q->count, 1, max) ? 0 : -EBUSY;
 }
 
-static int xive_select_target(struct kvm *kvm, u32 *server, u8 prio)
+int kvmppc_xive_select_target(struct kvm *kvm, u32 *server, u8 prio)
 {
        struct kvm_vcpu *vcpu;
        int i, rc;
@@ -380,11 +382,6 @@ static int xive_select_target(struct kvm *kvm, u32 *server, u8 prio)
        return -EBUSY;
 }
 
-static u32 xive_vp(struct kvmppc_xive *xive, u32 server)
-{
-       return xive->vp_base + kvmppc_pack_vcpu_id(xive->kvm, server);
-}
-
 static u8 xive_lock_and_mask(struct kvmppc_xive *xive,
                             struct kvmppc_xive_src_block *sb,
                             struct kvmppc_xive_irq_state *state)
@@ -430,8 +427,8 @@ static u8 xive_lock_and_mask(struct kvmppc_xive *xive,
         */
        if (xd->flags & OPAL_XIVE_IRQ_MASK_VIA_FW) {
                xive_native_configure_irq(hw_num,
-                                         xive_vp(xive, state->act_server),
-                                         MASKED, state->number);
+                               kvmppc_xive_vp(xive, state->act_server),
+                               MASKED, state->number);
                /* set old_p so we can track if an H_EOI was done */
                state->old_p = true;
                state->old_q = false;
@@ -486,8 +483,8 @@ static void xive_finish_unmask(struct kvmppc_xive *xive,
         */
        if (xd->flags & OPAL_XIVE_IRQ_MASK_VIA_FW) {
                xive_native_configure_irq(hw_num,
-                                         xive_vp(xive, state->act_server),
-                                         state->act_priority, state->number);
+                               kvmppc_xive_vp(xive, state->act_server),
+                               state->act_priority, state->number);
                /* If an EOI is needed, do it here */
                if (!state->old_p)
                        xive_vm_source_eoi(hw_num, xd);
@@ -535,7 +532,7 @@ static int xive_target_interrupt(struct kvm *kvm,
         * priority. The count for that new target will have
         * already been incremented.
         */
-       rc = xive_select_target(kvm, &server, prio);
+       rc = kvmppc_xive_select_target(kvm, &server, prio);
 
        /*
         * We failed to find a target ? Not much we can do
@@ -563,7 +560,7 @@ static int xive_target_interrupt(struct kvm *kvm,
        kvmppc_xive_select_irq(state, &hw_num, NULL);
 
        return xive_native_configure_irq(hw_num,
-                                        xive_vp(xive, server),
+                                        kvmppc_xive_vp(xive, server),
                                         prio, state->number);
 }
 
@@ -849,7 +846,8 @@ int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval)
 
        /*
         * We can't update the state of a "pushed" VCPU, but that
-        * shouldn't happen.
+        * shouldn't happen because the vcpu->mutex makes running a
+        * vcpu mutually exclusive with doing one_reg get/set on it.
         */
        if (WARN_ON(vcpu->arch.xive_pushed))
                return -EIO;
@@ -940,6 +938,13 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
        /* Turn the IPI hard off */
        xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_01);
 
+       /*
+        * Reset ESB guest mapping. Needed when ESB pages are exposed
+        * to the guest in XIVE native mode
+        */
+       if (xive->ops && xive->ops->reset_mapped)
+               xive->ops->reset_mapped(kvm, guest_irq);
+
        /* Grab info about irq */
        state->pt_number = hw_irq;
        state->pt_data = irq_data_get_irq_handler_data(host_data);
@@ -951,7 +956,7 @@ int kvmppc_xive_set_mapped(struct kvm *kvm, unsigned long guest_irq,
         * which is fine for a never started interrupt.
         */
        xive_native_configure_irq(hw_irq,
-                                 xive_vp(xive, state->act_server),
+                                 kvmppc_xive_vp(xive, state->act_server),
                                  state->act_priority, state->number);
 
        /*
@@ -1025,9 +1030,17 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
        state->pt_number = 0;
        state->pt_data = NULL;
 
+       /*
+        * Reset ESB guest mapping. Needed when ESB pages are exposed
+        * to the guest in XIVE native mode
+        */
+       if (xive->ops && xive->ops->reset_mapped) {
+               xive->ops->reset_mapped(kvm, guest_irq);
+       }
+
        /* Reconfigure the IPI */
        xive_native_configure_irq(state->ipi_number,
-                                 xive_vp(xive, state->act_server),
+                                 kvmppc_xive_vp(xive, state->act_server),
                                  state->act_priority, state->number);
 
        /*
@@ -1049,7 +1062,7 @@ int kvmppc_xive_clr_mapped(struct kvm *kvm, unsigned long guest_irq,
 }
 EXPORT_SYMBOL_GPL(kvmppc_xive_clr_mapped);
 
-static void kvmppc_xive_disable_vcpu_interrupts(struct kvm_vcpu *vcpu)
+void kvmppc_xive_disable_vcpu_interrupts(struct kvm_vcpu *vcpu)
 {
        struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
        struct kvm *kvm = vcpu->kvm;
@@ -1083,14 +1096,35 @@ static void kvmppc_xive_disable_vcpu_interrupts(struct kvm_vcpu *vcpu)
                        arch_spin_unlock(&sb->lock);
                }
        }
+
+       /* Disable vcpu's escalation interrupt */
+       if (vcpu->arch.xive_esc_on) {
+               __raw_readq((void __iomem *)(vcpu->arch.xive_esc_vaddr +
+                                            XIVE_ESB_SET_PQ_01));
+               vcpu->arch.xive_esc_on = false;
+       }
+
+       /*
+        * Clear pointers to escalation interrupt ESB.
+        * This is safe because the vcpu->mutex is held, preventing
+        * any other CPU from concurrently executing a KVM_RUN ioctl.
+        */
+       vcpu->arch.xive_esc_vaddr = 0;
+       vcpu->arch.xive_esc_raddr = 0;
 }
 
 void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu)
 {
        struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
-       struct kvmppc_xive *xive = xc->xive;
+       struct kvmppc_xive *xive = vcpu->kvm->arch.xive;
        int i;
 
+       if (!kvmppc_xics_enabled(vcpu))
+               return;
+
+       if (!xc)
+               return;
+
        pr_devel("cleanup_vcpu(cpu=%d)\n", xc->server_num);
 
        /* Ensure no interrupt is still routed to that VP */
@@ -1129,6 +1163,10 @@ void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu)
        }
        /* Free the VP */
        kfree(xc);
+
+       /* Cleanup the vcpu */
+       vcpu->arch.irq_type = KVMPPC_IRQ_DEFAULT;
+       vcpu->arch.xive_vcpu = NULL;
 }
 
 int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
@@ -1146,7 +1184,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
        }
        if (xive->kvm != vcpu->kvm)
                return -EPERM;
-       if (vcpu->arch.irq_type)
+       if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT)
                return -EBUSY;
        if (kvmppc_xive_find_server(vcpu->kvm, cpu)) {
                pr_devel("Duplicate !\n");
@@ -1166,7 +1204,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
        xc->xive = xive;
        xc->vcpu = vcpu;
        xc->server_num = cpu;
-       xc->vp_id = xive_vp(xive, cpu);
+       xc->vp_id = kvmppc_xive_vp(xive, cpu);
        xc->mfrr = 0xff;
        xc->valid = true;
 
@@ -1219,7 +1257,8 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
                if (xive->qmap & (1 << i)) {
                        r = xive_provision_queue(vcpu, i);
                        if (r == 0 && !xive->single_escalation)
-                               xive_attach_escalation(vcpu, i);
+                               kvmppc_xive_attach_escalation(
+                                       vcpu, i, xive->single_escalation);
                        if (r)
                                goto bail;
                } else {
@@ -1234,7 +1273,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
        }
 
        /* If not done above, attach priority 0 escalation */
-       r = xive_attach_escalation(vcpu, 0);
+       r = kvmppc_xive_attach_escalation(vcpu, 0, xive->single_escalation);
        if (r)
                goto bail;
 
@@ -1485,8 +1524,8 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr)
        return 0;
 }
 
-static struct kvmppc_xive_src_block *xive_create_src_block(struct kvmppc_xive *xive,
-                                                          int irq)
+struct kvmppc_xive_src_block *kvmppc_xive_create_src_block(
+       struct kvmppc_xive *xive, int irq)
 {
        struct kvm *kvm = xive->kvm;
        struct kvmppc_xive_src_block *sb;
@@ -1509,6 +1548,7 @@ static struct kvmppc_xive_src_block *xive_create_src_block(struct kvmppc_xive *x
 
        for (i = 0; i < KVMPPC_XICS_IRQ_PER_ICS; i++) {
                sb->irq_state[i].number = (bid << KVMPPC_XICS_ICS_SHIFT) | i;
+               sb->irq_state[i].eisn = 0;
                sb->irq_state[i].guest_priority = MASKED;
                sb->irq_state[i].saved_priority = MASKED;
                sb->irq_state[i].act_priority = MASKED;
@@ -1565,7 +1605,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr)
        sb = kvmppc_xive_find_source(xive, irq, &idx);
        if (!sb) {
                pr_devel("No source, creating source block...\n");
-               sb = xive_create_src_block(xive, irq);
+               sb = kvmppc_xive_create_src_block(xive, irq);
                if (!sb) {
                        pr_devel("Failed to create block...\n");
                        return -ENOMEM;
@@ -1789,7 +1829,7 @@ static void kvmppc_xive_cleanup_irq(u32 hw_num, struct xive_irq_data *xd)
        xive_cleanup_irq_data(xd);
 }
 
-static void kvmppc_xive_free_sources(struct kvmppc_xive_src_block *sb)
+void kvmppc_xive_free_sources(struct kvmppc_xive_src_block *sb)
 {
        int i;
 
@@ -1810,16 +1850,55 @@ static void kvmppc_xive_free_sources(struct kvmppc_xive_src_block *sb)
        }
 }
 
-static void kvmppc_xive_free(struct kvm_device *dev)
+/*
+ * Called when device fd is closed.  kvm->lock is held.
+ */
+static void kvmppc_xive_release(struct kvm_device *dev)
 {
        struct kvmppc_xive *xive = dev->private;
        struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
        int i;
+       int was_ready;
+
+       pr_devel("Releasing xive device\n");
 
        debugfs_remove(xive->dentry);
 
-       if (kvm)
-               kvm->arch.xive = NULL;
+       /*
+        * Clearing mmu_ready temporarily while holding kvm->lock
+        * is a way of ensuring that no vcpus can enter the guest
+        * until we drop kvm->lock.  Doing kick_all_cpus_sync()
+        * ensures that any vcpu executing inside the guest has
+        * exited the guest.  Once kick_all_cpus_sync() has finished,
+        * we know that no vcpu can be executing the XIVE push or
+        * pull code, or executing a XICS hcall.
+        *
+        * Since this is the device release function, we know that
+        * userspace does not have any open fd referring to the
+        * device.  Therefore there can not be any of the device
+        * attribute set/get functions being executed concurrently,
+        * and similarly, the connect_vcpu and set/clr_mapped
+        * functions also cannot be being executed.
+        */
+       was_ready = kvm->arch.mmu_ready;
+       kvm->arch.mmu_ready = 0;
+       kick_all_cpus_sync();
+
+       /*
+        * We should clean up the vCPU interrupt presenters first.
+        */
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               /*
+                * Take vcpu->mutex to ensure that no one_reg get/set ioctl
+                * (i.e. kvmppc_xive_[gs]et_icp) can be done concurrently.
+                */
+               mutex_lock(&vcpu->mutex);
+               kvmppc_xive_cleanup_vcpu(vcpu);
+               mutex_unlock(&vcpu->mutex);
+       }
+
+       kvm->arch.xive = NULL;
 
        /* Mask and free interrupts */
        for (i = 0; i <= xive->max_sbid; i++) {
@@ -1832,11 +1911,47 @@ static void kvmppc_xive_free(struct kvm_device *dev)
        if (xive->vp_base != XIVE_INVALID_VP)
                xive_native_free_vp_block(xive->vp_base);
 
+       kvm->arch.mmu_ready = was_ready;
+
+       /*
+        * A reference of the kvmppc_xive pointer is now kept under
+        * the xive_devices struct of the machine for reuse. It is
+        * freed when the VM is destroyed for now until we fix all the
+        * execution paths.
+        */
 
-       kfree(xive);
        kfree(dev);
 }
 
+/*
+ * When the guest chooses the interrupt mode (XICS legacy or XIVE
+ * native), the VM will switch of KVM device. The previous device will
+ * be "released" before the new one is created.
+ *
+ * Until we are sure all execution paths are well protected, provide a
+ * fail safe (transitional) method for device destruction, in which
+ * the XIVE device pointer is recycled and not directly freed.
+ */
+struct kvmppc_xive *kvmppc_xive_get_device(struct kvm *kvm, u32 type)
+{
+       struct kvmppc_xive **kvm_xive_device = type == KVM_DEV_TYPE_XIVE ?
+               &kvm->arch.xive_devices.native :
+               &kvm->arch.xive_devices.xics_on_xive;
+       struct kvmppc_xive *xive = *kvm_xive_device;
+
+       if (!xive) {
+               xive = kzalloc(sizeof(*xive), GFP_KERNEL);
+               *kvm_xive_device = xive;
+       } else {
+               memset(xive, 0, sizeof(*xive));
+       }
+
+       return xive;
+}
+
+/*
+ * Create a XICS device with XIVE backend.  kvm->lock is held.
+ */
 static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
 {
        struct kvmppc_xive *xive;
@@ -1845,7 +1960,7 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
 
        pr_devel("Creating xive for partition\n");
 
-       xive = kzalloc(sizeof(*xive), GFP_KERNEL);
+       xive = kvmppc_xive_get_device(kvm, type);
        if (!xive)
                return -ENOMEM;
 
@@ -1883,6 +1998,43 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
        return 0;
 }
 
+int kvmppc_xive_debug_show_queues(struct seq_file *m, struct kvm_vcpu *vcpu)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       unsigned int i;
+
+       for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
+               struct xive_q *q = &xc->queues[i];
+               u32 i0, i1, idx;
+
+               if (!q->qpage && !xc->esc_virq[i])
+                       continue;
+
+               seq_printf(m, " [q%d]: ", i);
+
+               if (q->qpage) {
+                       idx = q->idx;
+                       i0 = be32_to_cpup(q->qpage + idx);
+                       idx = (idx + 1) & q->msk;
+                       i1 = be32_to_cpup(q->qpage + idx);
+                       seq_printf(m, "T=%d %08x %08x...\n", q->toggle,
+                                  i0, i1);
+               }
+               if (xc->esc_virq[i]) {
+                       struct irq_data *d = irq_get_irq_data(xc->esc_virq[i]);
+                       struct xive_irq_data *xd =
+                               irq_data_get_irq_handler_data(d);
+                       u64 pq = xive_vm_esb_load(xd, XIVE_ESB_GET);
+
+                       seq_printf(m, "E:%c%c I(%d:%llx:%llx)",
+                                  (pq & XIVE_ESB_VAL_P) ? 'P' : 'p',
+                                  (pq & XIVE_ESB_VAL_Q) ? 'Q' : 'q',
+                                  xc->esc_virq[i], pq, xd->eoi_page);
+                       seq_puts(m, "\n");
+               }
+       }
+       return 0;
+}
 
 static int xive_debug_show(struct seq_file *m, void *private)
 {
@@ -1908,7 +2060,6 @@ static int xive_debug_show(struct seq_file *m, void *private)
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
-               unsigned int i;
 
                if (!xc)
                        continue;
@@ -1918,33 +2069,8 @@ static int xive_debug_show(struct seq_file *m, void *private)
                           xc->server_num, xc->cppr, xc->hw_cppr,
                           xc->mfrr, xc->pending,
                           xc->stat_rm_h_xirr, xc->stat_vm_h_xirr);
-               for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
-                       struct xive_q *q = &xc->queues[i];
-                       u32 i0, i1, idx;
-
-                       if (!q->qpage && !xc->esc_virq[i])
-                               continue;
 
-                       seq_printf(m, " [q%d]: ", i);
-
-                       if (q->qpage) {
-                               idx = q->idx;
-                               i0 = be32_to_cpup(q->qpage + idx);
-                               idx = (idx + 1) & q->msk;
-                               i1 = be32_to_cpup(q->qpage + idx);
-                               seq_printf(m, "T=%d %08x %08x... \n", q->toggle, i0, i1);
-                       }
-                       if (xc->esc_virq[i]) {
-                               struct irq_data *d = irq_get_irq_data(xc->esc_virq[i]);
-                               struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
-                               u64 pq = xive_vm_esb_load(xd, XIVE_ESB_GET);
-                               seq_printf(m, "E:%c%c I(%d:%llx:%llx)",
-                                          (pq & XIVE_ESB_VAL_P) ? 'P' : 'p',
-                                          (pq & XIVE_ESB_VAL_Q) ? 'Q' : 'q',
-                                          xc->esc_virq[i], pq, xd->eoi_page);
-                               seq_printf(m, "\n");
-                       }
-               }
+               kvmppc_xive_debug_show_queues(m, vcpu);
 
                t_rm_h_xirr += xc->stat_rm_h_xirr;
                t_rm_h_ipoll += xc->stat_rm_h_ipoll;
@@ -1999,7 +2125,7 @@ struct kvm_device_ops kvm_xive_ops = {
        .name = "kvm-xive",
        .create = kvmppc_xive_create,
        .init = kvmppc_xive_init,
-       .destroy = kvmppc_xive_free,
+       .release = kvmppc_xive_release,
        .set_attr = xive_set_attr,
        .get_attr = xive_get_attr,
        .has_attr = xive_has_attr,
index a08ae6f..4261463 100644 (file)
 #include "book3s_xics.h"
 
 /*
+ * The XIVE Interrupt source numbers are within the range 0 to
+ * KVMPPC_XICS_NR_IRQS.
+ */
+#define KVMPPC_XIVE_FIRST_IRQ  0
+#define KVMPPC_XIVE_NR_IRQS    KVMPPC_XICS_NR_IRQS
+
+/*
  * State for one guest irq source.
  *
  * For each guest source we allocate a HW interrupt in the XIVE
@@ -54,6 +61,9 @@ struct kvmppc_xive_irq_state {
        bool saved_p;
        bool saved_q;
        u8 saved_scan_prio;
+
+       /* Xive native */
+       u32 eisn;                       /* Guest Effective IRQ number */
 };
 
 /* Select the "right" interrupt (IPI vs. passthrough) */
@@ -84,6 +94,11 @@ struct kvmppc_xive_src_block {
        struct kvmppc_xive_irq_state irq_state[KVMPPC_XICS_IRQ_PER_ICS];
 };
 
+struct kvmppc_xive;
+
+struct kvmppc_xive_ops {
+       int (*reset_mapped)(struct kvm *kvm, unsigned long guest_irq);
+};
 
 struct kvmppc_xive {
        struct kvm *kvm;
@@ -122,6 +137,10 @@ struct kvmppc_xive {
 
        /* Flags */
        u8      single_escalation;
+
+       struct kvmppc_xive_ops *ops;
+       struct address_space   *mapping;
+       struct mutex mapping_lock;
 };
 
 #define KVMPPC_XIVE_Q_COUNT    8
@@ -198,6 +217,11 @@ static inline struct kvmppc_xive_src_block *kvmppc_xive_find_source(struct kvmpp
        return xive->src_blocks[bid];
 }
 
+static inline u32 kvmppc_xive_vp(struct kvmppc_xive *xive, u32 server)
+{
+       return xive->vp_base + kvmppc_pack_vcpu_id(xive->kvm, server);
+}
+
 /*
  * Mapping between guest priorities and host priorities
  * is as follow.
@@ -248,5 +272,18 @@ extern int (*__xive_vm_h_ipi)(struct kvm_vcpu *vcpu, unsigned long server,
 extern int (*__xive_vm_h_cppr)(struct kvm_vcpu *vcpu, unsigned long cppr);
 extern int (*__xive_vm_h_eoi)(struct kvm_vcpu *vcpu, unsigned long xirr);
 
+/*
+ * Common Xive routines for XICS-over-XIVE and XIVE native
+ */
+void kvmppc_xive_disable_vcpu_interrupts(struct kvm_vcpu *vcpu);
+int kvmppc_xive_debug_show_queues(struct seq_file *m, struct kvm_vcpu *vcpu);
+struct kvmppc_xive_src_block *kvmppc_xive_create_src_block(
+       struct kvmppc_xive *xive, int irq);
+void kvmppc_xive_free_sources(struct kvmppc_xive_src_block *sb);
+int kvmppc_xive_select_target(struct kvm *kvm, u32 *server, u8 prio);
+int kvmppc_xive_attach_escalation(struct kvm_vcpu *vcpu, u8 prio,
+                                 bool single_escalation);
+struct kvmppc_xive *kvmppc_xive_get_device(struct kvm *kvm, u32 type);
+
 #endif /* CONFIG_KVM_XICS */
 #endif /* _KVM_PPC_BOOK3S_XICS_H */
diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c
new file mode 100644 (file)
index 0000000..6a8e698
--- /dev/null
@@ -0,0 +1,1249 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2017-2019, IBM Corporation.
+ */
+
+#define pr_fmt(fmt) "xive-kvm: " fmt
+
+#include <linux/kernel.h>
+#include <linux/kvm_host.h>
+#include <linux/err.h>
+#include <linux/gfp.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/file.h>
+#include <asm/uaccess.h>
+#include <asm/kvm_book3s.h>
+#include <asm/kvm_ppc.h>
+#include <asm/hvcall.h>
+#include <asm/xive.h>
+#include <asm/xive-regs.h>
+#include <asm/debug.h>
+#include <asm/debugfs.h>
+#include <asm/opal.h>
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+#include "book3s_xive.h"
+
+static u8 xive_vm_esb_load(struct xive_irq_data *xd, u32 offset)
+{
+       u64 val;
+
+       if (xd->flags & XIVE_IRQ_FLAG_SHIFT_BUG)
+               offset |= offset << 4;
+
+       val = in_be64(xd->eoi_mmio + offset);
+       return (u8)val;
+}
+
+static void kvmppc_xive_native_cleanup_queue(struct kvm_vcpu *vcpu, int prio)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       struct xive_q *q = &xc->queues[prio];
+
+       xive_native_disable_queue(xc->vp_id, q, prio);
+       if (q->qpage) {
+               put_page(virt_to_page(q->qpage));
+               q->qpage = NULL;
+       }
+}
+
+void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       int i;
+
+       if (!kvmppc_xive_enabled(vcpu))
+               return;
+
+       if (!xc)
+               return;
+
+       pr_devel("native_cleanup_vcpu(cpu=%d)\n", xc->server_num);
+
+       /* Ensure no interrupt is still routed to that VP */
+       xc->valid = false;
+       kvmppc_xive_disable_vcpu_interrupts(vcpu);
+
+       /* Disable the VP */
+       xive_native_disable_vp(xc->vp_id);
+
+       /* Free the queues & associated interrupts */
+       for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
+               /* Free the escalation irq */
+               if (xc->esc_virq[i]) {
+                       free_irq(xc->esc_virq[i], vcpu);
+                       irq_dispose_mapping(xc->esc_virq[i]);
+                       kfree(xc->esc_virq_names[i]);
+                       xc->esc_virq[i] = 0;
+               }
+
+               /* Free the queue */
+               kvmppc_xive_native_cleanup_queue(vcpu, i);
+       }
+
+       /* Free the VP */
+       kfree(xc);
+
+       /* Cleanup the vcpu */
+       vcpu->arch.irq_type = KVMPPC_IRQ_DEFAULT;
+       vcpu->arch.xive_vcpu = NULL;
+}
+
+int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev,
+                                   struct kvm_vcpu *vcpu, u32 server_num)
+{
+       struct kvmppc_xive *xive = dev->private;
+       struct kvmppc_xive_vcpu *xc = NULL;
+       int rc;
+
+       pr_devel("native_connect_vcpu(server=%d)\n", server_num);
+
+       if (dev->ops != &kvm_xive_native_ops) {
+               pr_devel("Wrong ops !\n");
+               return -EPERM;
+       }
+       if (xive->kvm != vcpu->kvm)
+               return -EPERM;
+       if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT)
+               return -EBUSY;
+       if (server_num >= KVM_MAX_VCPUS) {
+               pr_devel("Out of bounds !\n");
+               return -EINVAL;
+       }
+
+       mutex_lock(&vcpu->kvm->lock);
+
+       if (kvmppc_xive_find_server(vcpu->kvm, server_num)) {
+               pr_devel("Duplicate !\n");
+               rc = -EEXIST;
+               goto bail;
+       }
+
+       xc = kzalloc(sizeof(*xc), GFP_KERNEL);
+       if (!xc) {
+               rc = -ENOMEM;
+               goto bail;
+       }
+
+       vcpu->arch.xive_vcpu = xc;
+       xc->xive = xive;
+       xc->vcpu = vcpu;
+       xc->server_num = server_num;
+
+       xc->vp_id = kvmppc_xive_vp(xive, server_num);
+       xc->valid = true;
+       vcpu->arch.irq_type = KVMPPC_IRQ_XIVE;
+
+       rc = xive_native_get_vp_info(xc->vp_id, &xc->vp_cam, &xc->vp_chip_id);
+       if (rc) {
+               pr_err("Failed to get VP info from OPAL: %d\n", rc);
+               goto bail;
+       }
+
+       /*
+        * Enable the VP first as the single escalation mode will
+        * affect escalation interrupts numbering
+        */
+       rc = xive_native_enable_vp(xc->vp_id, xive->single_escalation);
+       if (rc) {
+               pr_err("Failed to enable VP in OPAL: %d\n", rc);
+               goto bail;
+       }
+
+       /* Configure VCPU fields for use by assembly push/pull */
+       vcpu->arch.xive_saved_state.w01 = cpu_to_be64(0xff000000);
+       vcpu->arch.xive_cam_word = cpu_to_be32(xc->vp_cam | TM_QW1W2_VO);
+
+       /* TODO: reset all queues to a clean state ? */
+bail:
+       mutex_unlock(&vcpu->kvm->lock);
+       if (rc)
+               kvmppc_xive_native_cleanup_vcpu(vcpu);
+
+       return rc;
+}
+
+/*
+ * Device passthrough support
+ */
+static int kvmppc_xive_native_reset_mapped(struct kvm *kvm, unsigned long irq)
+{
+       struct kvmppc_xive *xive = kvm->arch.xive;
+
+       if (irq >= KVMPPC_XIVE_NR_IRQS)
+               return -EINVAL;
+
+       /*
+        * Clear the ESB pages of the IRQ number being mapped (or
+        * unmapped) into the guest and let the the VM fault handler
+        * repopulate with the appropriate ESB pages (device or IC)
+        */
+       pr_debug("clearing esb pages for girq 0x%lx\n", irq);
+       mutex_lock(&xive->mapping_lock);
+       if (xive->mapping)
+               unmap_mapping_range(xive->mapping,
+                                   irq * (2ull << PAGE_SHIFT),
+                                   2ull << PAGE_SHIFT, 1);
+       mutex_unlock(&xive->mapping_lock);
+       return 0;
+}
+
+static struct kvmppc_xive_ops kvmppc_xive_native_ops =  {
+       .reset_mapped = kvmppc_xive_native_reset_mapped,
+};
+
+static vm_fault_t xive_native_esb_fault(struct vm_fault *vmf)
+{
+       struct vm_area_struct *vma = vmf->vma;
+       struct kvm_device *dev = vma->vm_file->private_data;
+       struct kvmppc_xive *xive = dev->private;
+       struct kvmppc_xive_src_block *sb;
+       struct kvmppc_xive_irq_state *state;
+       struct xive_irq_data *xd;
+       u32 hw_num;
+       u16 src;
+       u64 page;
+       unsigned long irq;
+       u64 page_offset;
+
+       /*
+        * Linux/KVM uses a two pages ESB setting, one for trigger and
+        * one for EOI
+        */
+       page_offset = vmf->pgoff - vma->vm_pgoff;
+       irq = page_offset / 2;
+
+       sb = kvmppc_xive_find_source(xive, irq, &src);
+       if (!sb) {
+               pr_devel("%s: source %lx not found !\n", __func__, irq);
+               return VM_FAULT_SIGBUS;
+       }
+
+       state = &sb->irq_state[src];
+       kvmppc_xive_select_irq(state, &hw_num, &xd);
+
+       arch_spin_lock(&sb->lock);
+
+       /*
+        * first/even page is for trigger
+        * second/odd page is for EOI and management.
+        */
+       page = page_offset % 2 ? xd->eoi_page : xd->trig_page;
+       arch_spin_unlock(&sb->lock);
+
+       if (WARN_ON(!page)) {
+               pr_err("%s: accessing invalid ESB page for source %lx !\n",
+                      __func__, irq);
+               return VM_FAULT_SIGBUS;
+       }
+
+       vmf_insert_pfn(vma, vmf->address, page >> PAGE_SHIFT);
+       return VM_FAULT_NOPAGE;
+}
+
+static const struct vm_operations_struct xive_native_esb_vmops = {
+       .fault = xive_native_esb_fault,
+};
+
+static vm_fault_t xive_native_tima_fault(struct vm_fault *vmf)
+{
+       struct vm_area_struct *vma = vmf->vma;
+
+       switch (vmf->pgoff - vma->vm_pgoff) {
+       case 0: /* HW - forbid access */
+       case 1: /* HV - forbid access */
+               return VM_FAULT_SIGBUS;
+       case 2: /* OS */
+               vmf_insert_pfn(vma, vmf->address, xive_tima_os >> PAGE_SHIFT);
+               return VM_FAULT_NOPAGE;
+       case 3: /* USER - TODO */
+       default:
+               return VM_FAULT_SIGBUS;
+       }
+}
+
+static const struct vm_operations_struct xive_native_tima_vmops = {
+       .fault = xive_native_tima_fault,
+};
+
+static int kvmppc_xive_native_mmap(struct kvm_device *dev,
+                                  struct vm_area_struct *vma)
+{
+       struct kvmppc_xive *xive = dev->private;
+
+       /* We only allow mappings at fixed offset for now */
+       if (vma->vm_pgoff == KVM_XIVE_TIMA_PAGE_OFFSET) {
+               if (vma_pages(vma) > 4)
+                       return -EINVAL;
+               vma->vm_ops = &xive_native_tima_vmops;
+       } else if (vma->vm_pgoff == KVM_XIVE_ESB_PAGE_OFFSET) {
+               if (vma_pages(vma) > KVMPPC_XIVE_NR_IRQS * 2)
+                       return -EINVAL;
+               vma->vm_ops = &xive_native_esb_vmops;
+       } else {
+               return -EINVAL;
+       }
+
+       vma->vm_flags |= VM_IO | VM_PFNMAP;
+       vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
+
+       /*
+        * Grab the KVM device file address_space to be able to clear
+        * the ESB pages mapping when a device is passed-through into
+        * the guest.
+        */
+       xive->mapping = vma->vm_file->f_mapping;
+       return 0;
+}
+
+static int kvmppc_xive_native_set_source(struct kvmppc_xive *xive, long irq,
+                                        u64 addr)
+{
+       struct kvmppc_xive_src_block *sb;
+       struct kvmppc_xive_irq_state *state;
+       u64 __user *ubufp = (u64 __user *) addr;
+       u64 val;
+       u16 idx;
+       int rc;
+
+       pr_devel("%s irq=0x%lx\n", __func__, irq);
+
+       if (irq < KVMPPC_XIVE_FIRST_IRQ || irq >= KVMPPC_XIVE_NR_IRQS)
+               return -E2BIG;
+
+       sb = kvmppc_xive_find_source(xive, irq, &idx);
+       if (!sb) {
+               pr_debug("No source, creating source block...\n");
+               sb = kvmppc_xive_create_src_block(xive, irq);
+               if (!sb) {
+                       pr_err("Failed to create block...\n");
+                       return -ENOMEM;
+               }
+       }
+       state = &sb->irq_state[idx];
+
+       if (get_user(val, ubufp)) {
+               pr_err("fault getting user info !\n");
+               return -EFAULT;
+       }
+
+       arch_spin_lock(&sb->lock);
+
+       /*
+        * If the source doesn't already have an IPI, allocate
+        * one and get the corresponding data
+        */
+       if (!state->ipi_number) {
+               state->ipi_number = xive_native_alloc_irq();
+               if (state->ipi_number == 0) {
+                       pr_err("Failed to allocate IRQ !\n");
+                       rc = -ENXIO;
+                       goto unlock;
+               }
+               xive_native_populate_irq_data(state->ipi_number,
+                                             &state->ipi_data);
+               pr_debug("%s allocated hw_irq=0x%x for irq=0x%lx\n", __func__,
+                        state->ipi_number, irq);
+       }
+
+       /* Restore LSI state */
+       if (val & KVM_XIVE_LEVEL_SENSITIVE) {
+               state->lsi = true;
+               if (val & KVM_XIVE_LEVEL_ASSERTED)
+                       state->asserted = true;
+               pr_devel("  LSI ! Asserted=%d\n", state->asserted);
+       }
+
+       /* Mask IRQ to start with */
+       state->act_server = 0;
+       state->act_priority = MASKED;
+       xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_01);
+       xive_native_configure_irq(state->ipi_number, 0, MASKED, 0);
+
+       /* Increment the number of valid sources and mark this one valid */
+       if (!state->valid)
+               xive->src_count++;
+       state->valid = true;
+
+       rc = 0;
+
+unlock:
+       arch_spin_unlock(&sb->lock);
+
+       return rc;
+}
+
+static int kvmppc_xive_native_update_source_config(struct kvmppc_xive *xive,
+                                       struct kvmppc_xive_src_block *sb,
+                                       struct kvmppc_xive_irq_state *state,
+                                       u32 server, u8 priority, bool masked,
+                                       u32 eisn)
+{
+       struct kvm *kvm = xive->kvm;
+       u32 hw_num;
+       int rc = 0;
+
+       arch_spin_lock(&sb->lock);
+
+       if (state->act_server == server && state->act_priority == priority &&
+           state->eisn == eisn)
+               goto unlock;
+
+       pr_devel("new_act_prio=%d new_act_server=%d mask=%d act_server=%d act_prio=%d\n",
+                priority, server, masked, state->act_server,
+                state->act_priority);
+
+       kvmppc_xive_select_irq(state, &hw_num, NULL);
+
+       if (priority != MASKED && !masked) {
+               rc = kvmppc_xive_select_target(kvm, &server, priority);
+               if (rc)
+                       goto unlock;
+
+               state->act_priority = priority;
+               state->act_server = server;
+               state->eisn = eisn;
+
+               rc = xive_native_configure_irq(hw_num,
+                                              kvmppc_xive_vp(xive, server),
+                                              priority, eisn);
+       } else {
+               state->act_priority = MASKED;
+               state->act_server = 0;
+               state->eisn = 0;
+
+               rc = xive_native_configure_irq(hw_num, 0, MASKED, 0);
+       }
+
+unlock:
+       arch_spin_unlock(&sb->lock);
+       return rc;
+}
+
+static int kvmppc_xive_native_set_source_config(struct kvmppc_xive *xive,
+                                               long irq, u64 addr)
+{
+       struct kvmppc_xive_src_block *sb;
+       struct kvmppc_xive_irq_state *state;
+       u64 __user *ubufp = (u64 __user *) addr;
+       u16 src;
+       u64 kvm_cfg;
+       u32 server;
+       u8 priority;
+       bool masked;
+       u32 eisn;
+
+       sb = kvmppc_xive_find_source(xive, irq, &src);
+       if (!sb)
+               return -ENOENT;
+
+       state = &sb->irq_state[src];
+
+       if (!state->valid)
+               return -EINVAL;
+
+       if (get_user(kvm_cfg, ubufp))
+               return -EFAULT;
+
+       pr_devel("%s irq=0x%lx cfg=%016llx\n", __func__, irq, kvm_cfg);
+
+       priority = (kvm_cfg & KVM_XIVE_SOURCE_PRIORITY_MASK) >>
+               KVM_XIVE_SOURCE_PRIORITY_SHIFT;
+       server = (kvm_cfg & KVM_XIVE_SOURCE_SERVER_MASK) >>
+               KVM_XIVE_SOURCE_SERVER_SHIFT;
+       masked = (kvm_cfg & KVM_XIVE_SOURCE_MASKED_MASK) >>
+               KVM_XIVE_SOURCE_MASKED_SHIFT;
+       eisn = (kvm_cfg & KVM_XIVE_SOURCE_EISN_MASK) >>
+               KVM_XIVE_SOURCE_EISN_SHIFT;
+
+       if (priority != xive_prio_from_guest(priority)) {
+               pr_err("invalid priority for queue %d for VCPU %d\n",
+                      priority, server);
+               return -EINVAL;
+       }
+
+       return kvmppc_xive_native_update_source_config(xive, sb, state, server,
+                                                      priority, masked, eisn);
+}
+
+static int kvmppc_xive_native_sync_source(struct kvmppc_xive *xive,
+                                         long irq, u64 addr)
+{
+       struct kvmppc_xive_src_block *sb;
+       struct kvmppc_xive_irq_state *state;
+       struct xive_irq_data *xd;
+       u32 hw_num;
+       u16 src;
+       int rc = 0;
+
+       pr_devel("%s irq=0x%lx", __func__, irq);
+
+       sb = kvmppc_xive_find_source(xive, irq, &src);
+       if (!sb)
+               return -ENOENT;
+
+       state = &sb->irq_state[src];
+
+       rc = -EINVAL;
+
+       arch_spin_lock(&sb->lock);
+
+       if (state->valid) {
+               kvmppc_xive_select_irq(state, &hw_num, &xd);
+               xive_native_sync_source(hw_num);
+               rc = 0;
+       }
+
+       arch_spin_unlock(&sb->lock);
+       return rc;
+}
+
+static int xive_native_validate_queue_size(u32 qshift)
+{
+       /*
+        * We only support 64K pages for the moment. This is also
+        * advertised in the DT property "ibm,xive-eq-sizes"
+        */
+       switch (qshift) {
+       case 0: /* EQ reset */
+       case 16:
+               return 0;
+       case 12:
+       case 21:
+       case 24:
+       default:
+               return -EINVAL;
+       }
+}
+
+static int kvmppc_xive_native_set_queue_config(struct kvmppc_xive *xive,
+                                              long eq_idx, u64 addr)
+{
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       struct kvmppc_xive_vcpu *xc;
+       void __user *ubufp = (void __user *) addr;
+       u32 server;
+       u8 priority;
+       struct kvm_ppc_xive_eq kvm_eq;
+       int rc;
+       __be32 *qaddr = 0;
+       struct page *page;
+       struct xive_q *q;
+       gfn_t gfn;
+       unsigned long page_size;
+
+       /*
+        * Demangle priority/server tuple from the EQ identifier
+        */
+       priority = (eq_idx & KVM_XIVE_EQ_PRIORITY_MASK) >>
+               KVM_XIVE_EQ_PRIORITY_SHIFT;
+       server = (eq_idx & KVM_XIVE_EQ_SERVER_MASK) >>
+               KVM_XIVE_EQ_SERVER_SHIFT;
+
+       if (copy_from_user(&kvm_eq, ubufp, sizeof(kvm_eq)))
+               return -EFAULT;
+
+       vcpu = kvmppc_xive_find_server(kvm, server);
+       if (!vcpu) {
+               pr_err("Can't find server %d\n", server);
+               return -ENOENT;
+       }
+       xc = vcpu->arch.xive_vcpu;
+
+       if (priority != xive_prio_from_guest(priority)) {
+               pr_err("Trying to restore invalid queue %d for VCPU %d\n",
+                      priority, server);
+               return -EINVAL;
+       }
+       q = &xc->queues[priority];
+
+       pr_devel("%s VCPU %d priority %d fl:%x shift:%d addr:%llx g:%d idx:%d\n",
+                __func__, server, priority, kvm_eq.flags,
+                kvm_eq.qshift, kvm_eq.qaddr, kvm_eq.qtoggle, kvm_eq.qindex);
+
+       /*
+        * sPAPR specifies a "Unconditional Notify (n) flag" for the
+        * H_INT_SET_QUEUE_CONFIG hcall which forces notification
+        * without using the coalescing mechanisms provided by the
+        * XIVE END ESBs. This is required on KVM as notification
+        * using the END ESBs is not supported.
+        */
+       if (kvm_eq.flags != KVM_XIVE_EQ_ALWAYS_NOTIFY) {
+               pr_err("invalid flags %d\n", kvm_eq.flags);
+               return -EINVAL;
+       }
+
+       rc = xive_native_validate_queue_size(kvm_eq.qshift);
+       if (rc) {
+               pr_err("invalid queue size %d\n", kvm_eq.qshift);
+               return rc;
+       }
+
+       /* reset queue and disable queueing */
+       if (!kvm_eq.qshift) {
+               q->guest_qaddr  = 0;
+               q->guest_qshift = 0;
+
+               rc = xive_native_configure_queue(xc->vp_id, q, priority,
+                                                NULL, 0, true);
+               if (rc) {
+                       pr_err("Failed to reset queue %d for VCPU %d: %d\n",
+                              priority, xc->server_num, rc);
+                       return rc;
+               }
+
+               if (q->qpage) {
+                       put_page(virt_to_page(q->qpage));
+                       q->qpage = NULL;
+               }
+
+               return 0;
+       }
+
+       if (kvm_eq.qaddr & ((1ull << kvm_eq.qshift) - 1)) {
+               pr_err("queue page is not aligned %llx/%llx\n", kvm_eq.qaddr,
+                      1ull << kvm_eq.qshift);
+               return -EINVAL;
+       }
+
+       gfn = gpa_to_gfn(kvm_eq.qaddr);
+       page = gfn_to_page(kvm, gfn);
+       if (is_error_page(page)) {
+               pr_err("Couldn't get queue page %llx!\n", kvm_eq.qaddr);
+               return -EINVAL;
+       }
+
+       page_size = kvm_host_page_size(kvm, gfn);
+       if (1ull << kvm_eq.qshift > page_size) {
+               pr_warn("Incompatible host page size %lx!\n", page_size);
+               return -EINVAL;
+       }
+
+       qaddr = page_to_virt(page) + (kvm_eq.qaddr & ~PAGE_MASK);
+
+       /*
+        * Backup the queue page guest address to the mark EQ page
+        * dirty for migration.
+        */
+       q->guest_qaddr  = kvm_eq.qaddr;
+       q->guest_qshift = kvm_eq.qshift;
+
+        /*
+         * Unconditional Notification is forced by default at the
+         * OPAL level because the use of END ESBs is not supported by
+         * Linux.
+         */
+       rc = xive_native_configure_queue(xc->vp_id, q, priority,
+                                        (__be32 *) qaddr, kvm_eq.qshift, true);
+       if (rc) {
+               pr_err("Failed to configure queue %d for VCPU %d: %d\n",
+                      priority, xc->server_num, rc);
+               put_page(page);
+               return rc;
+       }
+
+       /*
+        * Only restore the queue state when needed. When doing the
+        * H_INT_SET_SOURCE_CONFIG hcall, it should not.
+        */
+       if (kvm_eq.qtoggle != 1 || kvm_eq.qindex != 0) {
+               rc = xive_native_set_queue_state(xc->vp_id, priority,
+                                                kvm_eq.qtoggle,
+                                                kvm_eq.qindex);
+               if (rc)
+                       goto error;
+       }
+
+       rc = kvmppc_xive_attach_escalation(vcpu, priority,
+                                          xive->single_escalation);
+error:
+       if (rc)
+               kvmppc_xive_native_cleanup_queue(vcpu, priority);
+       return rc;
+}
+
+static int kvmppc_xive_native_get_queue_config(struct kvmppc_xive *xive,
+                                              long eq_idx, u64 addr)
+{
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       struct kvmppc_xive_vcpu *xc;
+       struct xive_q *q;
+       void __user *ubufp = (u64 __user *) addr;
+       u32 server;
+       u8 priority;
+       struct kvm_ppc_xive_eq kvm_eq;
+       u64 qaddr;
+       u64 qshift;
+       u64 qeoi_page;
+       u32 escalate_irq;
+       u64 qflags;
+       int rc;
+
+       /*
+        * Demangle priority/server tuple from the EQ identifier
+        */
+       priority = (eq_idx & KVM_XIVE_EQ_PRIORITY_MASK) >>
+               KVM_XIVE_EQ_PRIORITY_SHIFT;
+       server = (eq_idx & KVM_XIVE_EQ_SERVER_MASK) >>
+               KVM_XIVE_EQ_SERVER_SHIFT;
+
+       vcpu = kvmppc_xive_find_server(kvm, server);
+       if (!vcpu) {
+               pr_err("Can't find server %d\n", server);
+               return -ENOENT;
+       }
+       xc = vcpu->arch.xive_vcpu;
+
+       if (priority != xive_prio_from_guest(priority)) {
+               pr_err("invalid priority for queue %d for VCPU %d\n",
+                      priority, server);
+               return -EINVAL;
+       }
+       q = &xc->queues[priority];
+
+       memset(&kvm_eq, 0, sizeof(kvm_eq));
+
+       if (!q->qpage)
+               return 0;
+
+       rc = xive_native_get_queue_info(xc->vp_id, priority, &qaddr, &qshift,
+                                       &qeoi_page, &escalate_irq, &qflags);
+       if (rc)
+               return rc;
+
+       kvm_eq.flags = 0;
+       if (qflags & OPAL_XIVE_EQ_ALWAYS_NOTIFY)
+               kvm_eq.flags |= KVM_XIVE_EQ_ALWAYS_NOTIFY;
+
+       kvm_eq.qshift = q->guest_qshift;
+       kvm_eq.qaddr  = q->guest_qaddr;
+
+       rc = xive_native_get_queue_state(xc->vp_id, priority, &kvm_eq.qtoggle,
+                                        &kvm_eq.qindex);
+       if (rc)
+               return rc;
+
+       pr_devel("%s VCPU %d priority %d fl:%x shift:%d addr:%llx g:%d idx:%d\n",
+                __func__, server, priority, kvm_eq.flags,
+                kvm_eq.qshift, kvm_eq.qaddr, kvm_eq.qtoggle, kvm_eq.qindex);
+
+       if (copy_to_user(ubufp, &kvm_eq, sizeof(kvm_eq)))
+               return -EFAULT;
+
+       return 0;
+}
+
+static void kvmppc_xive_reset_sources(struct kvmppc_xive_src_block *sb)
+{
+       int i;
+
+       for (i = 0; i < KVMPPC_XICS_IRQ_PER_ICS; i++) {
+               struct kvmppc_xive_irq_state *state = &sb->irq_state[i];
+
+               if (!state->valid)
+                       continue;
+
+               if (state->act_priority == MASKED)
+                       continue;
+
+               state->eisn = 0;
+               state->act_server = 0;
+               state->act_priority = MASKED;
+               xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_01);
+               xive_native_configure_irq(state->ipi_number, 0, MASKED, 0);
+               if (state->pt_number) {
+                       xive_vm_esb_load(state->pt_data, XIVE_ESB_SET_PQ_01);
+                       xive_native_configure_irq(state->pt_number,
+                                                 0, MASKED, 0);
+               }
+       }
+}
+
+static int kvmppc_xive_reset(struct kvmppc_xive *xive)
+{
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       unsigned int i;
+
+       pr_devel("%s\n", __func__);
+
+       mutex_lock(&kvm->lock);
+
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+               unsigned int prio;
+
+               if (!xc)
+                       continue;
+
+               kvmppc_xive_disable_vcpu_interrupts(vcpu);
+
+               for (prio = 0; prio < KVMPPC_XIVE_Q_COUNT; prio++) {
+
+                       /* Single escalation, no queue 7 */
+                       if (prio == 7 && xive->single_escalation)
+                               break;
+
+                       if (xc->esc_virq[prio]) {
+                               free_irq(xc->esc_virq[prio], vcpu);
+                               irq_dispose_mapping(xc->esc_virq[prio]);
+                               kfree(xc->esc_virq_names[prio]);
+                               xc->esc_virq[prio] = 0;
+                       }
+
+                       kvmppc_xive_native_cleanup_queue(vcpu, prio);
+               }
+       }
+
+       for (i = 0; i <= xive->max_sbid; i++) {
+               struct kvmppc_xive_src_block *sb = xive->src_blocks[i];
+
+               if (sb) {
+                       arch_spin_lock(&sb->lock);
+                       kvmppc_xive_reset_sources(sb);
+                       arch_spin_unlock(&sb->lock);
+               }
+       }
+
+       mutex_unlock(&kvm->lock);
+
+       return 0;
+}
+
+static void kvmppc_xive_native_sync_sources(struct kvmppc_xive_src_block *sb)
+{
+       int j;
+
+       for (j = 0; j < KVMPPC_XICS_IRQ_PER_ICS; j++) {
+               struct kvmppc_xive_irq_state *state = &sb->irq_state[j];
+               struct xive_irq_data *xd;
+               u32 hw_num;
+
+               if (!state->valid)
+                       continue;
+
+               /*
+                * The struct kvmppc_xive_irq_state reflects the state
+                * of the EAS configuration and not the state of the
+                * source. The source is masked setting the PQ bits to
+                * '-Q', which is what is being done before calling
+                * the KVM_DEV_XIVE_EQ_SYNC control.
+                *
+                * If a source EAS is configured, OPAL syncs the XIVE
+                * IC of the source and the XIVE IC of the previous
+                * target if any.
+                *
+                * So it should be fine ignoring MASKED sources as
+                * they have been synced already.
+                */
+               if (state->act_priority == MASKED)
+                       continue;
+
+               kvmppc_xive_select_irq(state, &hw_num, &xd);
+               xive_native_sync_source(hw_num);
+               xive_native_sync_queue(hw_num);
+       }
+}
+
+static int kvmppc_xive_native_vcpu_eq_sync(struct kvm_vcpu *vcpu)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       unsigned int prio;
+
+       if (!xc)
+               return -ENOENT;
+
+       for (prio = 0; prio < KVMPPC_XIVE_Q_COUNT; prio++) {
+               struct xive_q *q = &xc->queues[prio];
+
+               if (!q->qpage)
+                       continue;
+
+               /* Mark EQ page dirty for migration */
+               mark_page_dirty(vcpu->kvm, gpa_to_gfn(q->guest_qaddr));
+       }
+       return 0;
+}
+
+static int kvmppc_xive_native_eq_sync(struct kvmppc_xive *xive)
+{
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       unsigned int i;
+
+       pr_devel("%s\n", __func__);
+
+       mutex_lock(&kvm->lock);
+       for (i = 0; i <= xive->max_sbid; i++) {
+               struct kvmppc_xive_src_block *sb = xive->src_blocks[i];
+
+               if (sb) {
+                       arch_spin_lock(&sb->lock);
+                       kvmppc_xive_native_sync_sources(sb);
+                       arch_spin_unlock(&sb->lock);
+               }
+       }
+
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               kvmppc_xive_native_vcpu_eq_sync(vcpu);
+       }
+       mutex_unlock(&kvm->lock);
+
+       return 0;
+}
+
+static int kvmppc_xive_native_set_attr(struct kvm_device *dev,
+                                      struct kvm_device_attr *attr)
+{
+       struct kvmppc_xive *xive = dev->private;
+
+       switch (attr->group) {
+       case KVM_DEV_XIVE_GRP_CTRL:
+               switch (attr->attr) {
+               case KVM_DEV_XIVE_RESET:
+                       return kvmppc_xive_reset(xive);
+               case KVM_DEV_XIVE_EQ_SYNC:
+                       return kvmppc_xive_native_eq_sync(xive);
+               }
+               break;
+       case KVM_DEV_XIVE_GRP_SOURCE:
+               return kvmppc_xive_native_set_source(xive, attr->attr,
+                                                    attr->addr);
+       case KVM_DEV_XIVE_GRP_SOURCE_CONFIG:
+               return kvmppc_xive_native_set_source_config(xive, attr->attr,
+                                                           attr->addr);
+       case KVM_DEV_XIVE_GRP_EQ_CONFIG:
+               return kvmppc_xive_native_set_queue_config(xive, attr->attr,
+                                                          attr->addr);
+       case KVM_DEV_XIVE_GRP_SOURCE_SYNC:
+               return kvmppc_xive_native_sync_source(xive, attr->attr,
+                                                     attr->addr);
+       }
+       return -ENXIO;
+}
+
+static int kvmppc_xive_native_get_attr(struct kvm_device *dev,
+                                      struct kvm_device_attr *attr)
+{
+       struct kvmppc_xive *xive = dev->private;
+
+       switch (attr->group) {
+       case KVM_DEV_XIVE_GRP_EQ_CONFIG:
+               return kvmppc_xive_native_get_queue_config(xive, attr->attr,
+                                                          attr->addr);
+       }
+       return -ENXIO;
+}
+
+static int kvmppc_xive_native_has_attr(struct kvm_device *dev,
+                                      struct kvm_device_attr *attr)
+{
+       switch (attr->group) {
+       case KVM_DEV_XIVE_GRP_CTRL:
+               switch (attr->attr) {
+               case KVM_DEV_XIVE_RESET:
+               case KVM_DEV_XIVE_EQ_SYNC:
+                       return 0;
+               }
+               break;
+       case KVM_DEV_XIVE_GRP_SOURCE:
+       case KVM_DEV_XIVE_GRP_SOURCE_CONFIG:
+       case KVM_DEV_XIVE_GRP_SOURCE_SYNC:
+               if (attr->attr >= KVMPPC_XIVE_FIRST_IRQ &&
+                   attr->attr < KVMPPC_XIVE_NR_IRQS)
+                       return 0;
+               break;
+       case KVM_DEV_XIVE_GRP_EQ_CONFIG:
+               return 0;
+       }
+       return -ENXIO;
+}
+
+/*
+ * Called when device fd is closed
+ */
+static void kvmppc_xive_native_release(struct kvm_device *dev)
+{
+       struct kvmppc_xive *xive = dev->private;
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       int i;
+       int was_ready;
+
+       debugfs_remove(xive->dentry);
+
+       pr_devel("Releasing xive native device\n");
+
+       /*
+        * Clearing mmu_ready temporarily while holding kvm->lock
+        * is a way of ensuring that no vcpus can enter the guest
+        * until we drop kvm->lock.  Doing kick_all_cpus_sync()
+        * ensures that any vcpu executing inside the guest has
+        * exited the guest.  Once kick_all_cpus_sync() has finished,
+        * we know that no vcpu can be executing the XIVE push or
+        * pull code or accessing the XIVE MMIO regions.
+        *
+        * Since this is the device release function, we know that
+        * userspace does not have any open fd or mmap referring to
+        * the device.  Therefore there can not be any of the
+        * device attribute set/get, mmap, or page fault functions
+        * being executed concurrently, and similarly, the
+        * connect_vcpu and set/clr_mapped functions also cannot
+        * be being executed.
+        */
+       was_ready = kvm->arch.mmu_ready;
+       kvm->arch.mmu_ready = 0;
+       kick_all_cpus_sync();
+
+       /*
+        * We should clean up the vCPU interrupt presenters first.
+        */
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               /*
+                * Take vcpu->mutex to ensure that no one_reg get/set ioctl
+                * (i.e. kvmppc_xive_native_[gs]et_vp) can be being done.
+                */
+               mutex_lock(&vcpu->mutex);
+               kvmppc_xive_native_cleanup_vcpu(vcpu);
+               mutex_unlock(&vcpu->mutex);
+       }
+
+       kvm->arch.xive = NULL;
+
+       for (i = 0; i <= xive->max_sbid; i++) {
+               if (xive->src_blocks[i])
+                       kvmppc_xive_free_sources(xive->src_blocks[i]);
+               kfree(xive->src_blocks[i]);
+               xive->src_blocks[i] = NULL;
+       }
+
+       if (xive->vp_base != XIVE_INVALID_VP)
+               xive_native_free_vp_block(xive->vp_base);
+
+       kvm->arch.mmu_ready = was_ready;
+
+       /*
+        * A reference of the kvmppc_xive pointer is now kept under
+        * the xive_devices struct of the machine for reuse. It is
+        * freed when the VM is destroyed for now until we fix all the
+        * execution paths.
+        */
+
+       kfree(dev);
+}
+
+/*
+ * Create a XIVE device.  kvm->lock is held.
+ */
+static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
+{
+       struct kvmppc_xive *xive;
+       struct kvm *kvm = dev->kvm;
+       int ret = 0;
+
+       pr_devel("Creating xive native device\n");
+
+       if (kvm->arch.xive)
+               return -EEXIST;
+
+       xive = kvmppc_xive_get_device(kvm, type);
+       if (!xive)
+               return -ENOMEM;
+
+       dev->private = xive;
+       xive->dev = dev;
+       xive->kvm = kvm;
+       kvm->arch.xive = xive;
+       mutex_init(&xive->mapping_lock);
+
+       /*
+        * Allocate a bunch of VPs. KVM_MAX_VCPUS is a large value for
+        * a default. Getting the max number of CPUs the VM was
+        * configured with would improve our usage of the XIVE VP space.
+        */
+       xive->vp_base = xive_native_alloc_vp_block(KVM_MAX_VCPUS);
+       pr_devel("VP_Base=%x\n", xive->vp_base);
+
+       if (xive->vp_base == XIVE_INVALID_VP)
+               ret = -ENXIO;
+
+       xive->single_escalation = xive_native_has_single_escalation();
+       xive->ops = &kvmppc_xive_native_ops;
+
+       if (ret)
+               kfree(xive);
+
+       return ret;
+}
+
+/*
+ * Interrupt Pending Buffer (IPB) offset
+ */
+#define TM_IPB_SHIFT 40
+#define TM_IPB_MASK  (((u64) 0xFF) << TM_IPB_SHIFT)
+
+int kvmppc_xive_native_get_vp(struct kvm_vcpu *vcpu, union kvmppc_one_reg *val)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       u64 opal_state;
+       int rc;
+
+       if (!kvmppc_xive_enabled(vcpu))
+               return -EPERM;
+
+       if (!xc)
+               return -ENOENT;
+
+       /* Thread context registers. We only care about IPB and CPPR */
+       val->xive_timaval[0] = vcpu->arch.xive_saved_state.w01;
+
+       /* Get the VP state from OPAL */
+       rc = xive_native_get_vp_state(xc->vp_id, &opal_state);
+       if (rc)
+               return rc;
+
+       /*
+        * Capture the backup of IPB register in the NVT structure and
+        * merge it in our KVM VP state.
+        */
+       val->xive_timaval[0] |= cpu_to_be64(opal_state & TM_IPB_MASK);
+
+       pr_devel("%s NSR=%02x CPPR=%02x IBP=%02x PIPR=%02x w01=%016llx w2=%08x opal=%016llx\n",
+                __func__,
+                vcpu->arch.xive_saved_state.nsr,
+                vcpu->arch.xive_saved_state.cppr,
+                vcpu->arch.xive_saved_state.ipb,
+                vcpu->arch.xive_saved_state.pipr,
+                vcpu->arch.xive_saved_state.w01,
+                (u32) vcpu->arch.xive_cam_word, opal_state);
+
+       return 0;
+}
+
+int kvmppc_xive_native_set_vp(struct kvm_vcpu *vcpu, union kvmppc_one_reg *val)
+{
+       struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+       struct kvmppc_xive *xive = vcpu->kvm->arch.xive;
+
+       pr_devel("%s w01=%016llx vp=%016llx\n", __func__,
+                val->xive_timaval[0], val->xive_timaval[1]);
+
+       if (!kvmppc_xive_enabled(vcpu))
+               return -EPERM;
+
+       if (!xc || !xive)
+               return -ENOENT;
+
+       /* We can't update the state of a "pushed" VCPU  */
+       if (WARN_ON(vcpu->arch.xive_pushed))
+               return -EBUSY;
+
+       /*
+        * Restore the thread context registers. IPB and CPPR should
+        * be the only ones that matter.
+        */
+       vcpu->arch.xive_saved_state.w01 = val->xive_timaval[0];
+
+       /*
+        * There is no need to restore the XIVE internal state (IPB
+        * stored in the NVT) as the IPB register was merged in KVM VP
+        * state when captured.
+        */
+       return 0;
+}
+
+static int xive_native_debug_show(struct seq_file *m, void *private)
+{
+       struct kvmppc_xive *xive = m->private;
+       struct kvm *kvm = xive->kvm;
+       struct kvm_vcpu *vcpu;
+       unsigned int i;
+
+       if (!kvm)
+               return 0;
+
+       seq_puts(m, "=========\nVCPU state\n=========\n");
+
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
+
+               if (!xc)
+                       continue;
+
+               seq_printf(m, "cpu server %#x NSR=%02x CPPR=%02x IBP=%02x PIPR=%02x w01=%016llx w2=%08x\n",
+                          xc->server_num,
+                          vcpu->arch.xive_saved_state.nsr,
+                          vcpu->arch.xive_saved_state.cppr,
+                          vcpu->arch.xive_saved_state.ipb,
+                          vcpu->arch.xive_saved_state.pipr,
+                          vcpu->arch.xive_saved_state.w01,
+                          (u32) vcpu->arch.xive_cam_word);
+
+               kvmppc_xive_debug_show_queues(m, vcpu);
+       }
+
+       return 0;
+}
+
+static int xive_native_debug_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, xive_native_debug_show, inode->i_private);
+}
+
+static const struct file_operations xive_native_debug_fops = {
+       .open = xive_native_debug_open,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
+};
+
+static void xive_native_debugfs_init(struct kvmppc_xive *xive)
+{
+       char *name;
+
+       name = kasprintf(GFP_KERNEL, "kvm-xive-%p", xive);
+       if (!name) {
+               pr_err("%s: no memory for name\n", __func__);
+               return;
+       }
+
+       xive->dentry = debugfs_create_file(name, 0444, powerpc_debugfs_root,
+                                          xive, &xive_native_debug_fops);
+
+       pr_debug("%s: created %s\n", __func__, name);
+       kfree(name);
+}
+
+static void kvmppc_xive_native_init(struct kvm_device *dev)
+{
+       struct kvmppc_xive *xive = (struct kvmppc_xive *)dev->private;
+
+       /* Register some debug interfaces */
+       xive_native_debugfs_init(xive);
+}
+
+struct kvm_device_ops kvm_xive_native_ops = {
+       .name = "kvm-xive-native",
+       .create = kvmppc_xive_native_create,
+       .init = kvmppc_xive_native_init,
+       .release = kvmppc_xive_native_release,
+       .set_attr = kvmppc_xive_native_set_attr,
+       .get_attr = kvmppc_xive_native_get_attr,
+       .has_attr = kvmppc_xive_native_has_attr,
+       .mmap = kvmppc_xive_native_mmap,
+};
+
+void kvmppc_xive_native_init_module(void)
+{
+       ;
+}
+
+void kvmppc_xive_native_exit_module(void)
+{
+       ;
+}
index 033363d..0737acf 100644 (file)
@@ -130,24 +130,14 @@ static u32 GLUE(X_PFX,scan_interrupts)(struct kvmppc_xive_vcpu *xc,
                 */
                prio = ffs(pending) - 1;
 
-               /*
-                * If the most favoured prio we found pending is less
-                * favored (or equal) than a pending IPI, we return
-                * the IPI instead.
-                *
-                * Note: If pending was 0 and mfrr is 0xff, we will
-                * not spurriously take an IPI because mfrr cannot
-                * then be smaller than cppr.
-                */
-               if (prio >= xc->mfrr && xc->mfrr < xc->cppr) {
-                       prio = xc->mfrr;
-                       hirq = XICS_IPI;
-                       break;
-               }
-
                /* Don't scan past the guest cppr */
-               if (prio >= xc->cppr || prio > 7)
+               if (prio >= xc->cppr || prio > 7) {
+                       if (xc->mfrr < xc->cppr) {
+                               prio = xc->mfrr;
+                               hirq = XICS_IPI;
+                       }
                        break;
+               }
 
                /* Grab queue and pointers */
                q = &xc->queues[prio];
@@ -184,9 +174,12 @@ skip_ipi:
                 * been set and another occurrence of the IPI will trigger.
                 */
                if (hirq == XICS_IPI || (prio == 0 && !qpage)) {
-                       if (scan_type == scan_fetch)
+                       if (scan_type == scan_fetch) {
                                GLUE(X_PFX,source_eoi)(xc->vp_ipi,
                                                       &xc->vp_ipi_data);
+                               q->idx = idx;
+                               q->toggle = toggle;
+                       }
                        /* Loop back on same queue with updated idx/toggle */
 #ifdef XIVE_RUNTIME_CHECKS
                        WARN_ON(hirq && hirq != XICS_IPI);
@@ -199,32 +192,41 @@ skip_ipi:
                if (hirq == XICS_DUMMY)
                        goto skip_ipi;
 
-               /* If fetching, update queue pointers */
-               if (scan_type == scan_fetch) {
-                       q->idx = idx;
-                       q->toggle = toggle;
-               }
-
-               /* Something found, stop searching */
-               if (hirq)
-                       break;
-
-               /* Clear the pending bit on the now empty queue */
-               pending &= ~(1 << prio);
+               /* Clear the pending bit if the queue is now empty */
+               if (!hirq) {
+                       pending &= ~(1 << prio);
 
-               /*
-                * Check if the queue count needs adjusting due to
-                * interrupts being moved away.
-                */
-               if (atomic_read(&q->pending_count)) {
-                       int p = atomic_xchg(&q->pending_count, 0);
-                       if (p) {
+                       /*
+                        * Check if the queue count needs adjusting due to
+                        * interrupts being moved away.
+                        */
+                       if (atomic_read(&q->pending_count)) {
+                               int p = atomic_xchg(&q->pending_count, 0);
+                               if (p) {
 #ifdef XIVE_RUNTIME_CHECKS
-                               WARN_ON(p > atomic_read(&q->count));
+                                       WARN_ON(p > atomic_read(&q->count));
 #endif
-                               atomic_sub(p, &q->count);
+                                       atomic_sub(p, &q->count);
+                               }
                        }
                }
+
+               /*
+                * If the most favoured prio we found pending is less
+                * favored (or equal) than a pending IPI, we return
+                * the IPI instead.
+                */
+               if (prio >= xc->mfrr && xc->mfrr < xc->cppr) {
+                       prio = xc->mfrr;
+                       hirq = XICS_IPI;
+                       break;
+               }
+
+               /* If fetching, update queue pointers */
+               if (scan_type == scan_fetch) {
+                       q->idx = idx;
+                       q->toggle = toggle;
+               }
        }
 
        /* If we are just taking a "peek", do nothing else */
index 8885377..3393b16 100644 (file)
@@ -570,6 +570,16 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_PPC_GET_CPU_CHAR:
                r = 1;
                break;
+#ifdef CONFIG_KVM_XIVE
+       case KVM_CAP_PPC_IRQ_XIVE:
+               /*
+                * We need XIVE to be enabled on the platform (implies
+                * a POWER9 processor) and the PowerNV platform, as
+                * nested is not yet supported.
+                */
+               r = xive_enabled() && !!cpu_has_feature(CPU_FTR_HVMODE);
+               break;
+#endif
 
        case KVM_CAP_PPC_ALLOC_HTAB:
                r = hv_enabled;
@@ -644,9 +654,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                else
                        r = num_online_cpus();
                break;
-       case KVM_CAP_NR_MEMSLOTS:
-               r = KVM_USER_MEM_SLOTS;
-               break;
        case KVM_CAP_MAX_VCPUS:
                r = KVM_MAX_VCPUS;
                break;
@@ -753,6 +760,9 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
                else
                        kvmppc_xics_free_icp(vcpu);
                break;
+       case KVMPPC_IRQ_XIVE:
+               kvmppc_xive_native_cleanup_vcpu(vcpu);
+               break;
        }
 
        kvmppc_core_vcpu_free(vcpu);
@@ -1941,6 +1951,30 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
                break;
        }
 #endif /* CONFIG_KVM_XICS */
+#ifdef CONFIG_KVM_XIVE
+       case KVM_CAP_PPC_IRQ_XIVE: {
+               struct fd f;
+               struct kvm_device *dev;
+
+               r = -EBADF;
+               f = fdget(cap->args[0]);
+               if (!f.file)
+                       break;
+
+               r = -ENXIO;
+               if (!xive_enabled())
+                       break;
+
+               r = -EPERM;
+               dev = kvm_device_from_filp(f.file);
+               if (dev)
+                       r = kvmppc_xive_native_connect_vcpu(dev, vcpu,
+                                                           cap->args[1]);
+
+               fdput(f);
+               break;
+       }
+#endif /* CONFIG_KVM_XIVE */
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
        case KVM_CAP_PPC_FWNMI:
                r = -EINVAL;
index e27792d..8366c2a 100644 (file)
@@ -539,7 +539,8 @@ _GLOBAL(flush_hash_pages)
 #ifdef CONFIG_SMP
        lis     r9, (mmu_hash_lock - PAGE_OFFSET)@ha
        addi    r9, r9, (mmu_hash_lock - PAGE_OFFSET)@l
-       lwz     r8,TASK_CPU(r2)
+       tophys  (r8, r2)
+       lwz     r8, TASK_CPU(r8)
        oris    r8,r8,9
 10:    lwarx   r0,0,r9
        cmpi    0,r0,0
index 6a23b9e..4d84136 100644 (file)
@@ -90,7 +90,7 @@ void radix__tlbiel_all(unsigned int action)
        asm volatile(PPC_INVALIDATE_ERAT "; isync" : : :"memory");
 }
 
-static inline void __tlbiel_pid(unsigned long pid, int set,
+static __always_inline void __tlbiel_pid(unsigned long pid, int set,
                                unsigned long ric)
 {
        unsigned long rb,rs,prs,r;
@@ -106,7 +106,7 @@ static inline void __tlbiel_pid(unsigned long pid, int set,
        trace_tlbie(0, 1, rb, rs, ric, prs, r);
 }
 
-static inline void __tlbie_pid(unsigned long pid, unsigned long ric)
+static __always_inline void __tlbie_pid(unsigned long pid, unsigned long ric)
 {
        unsigned long rb,rs,prs,r;
 
@@ -120,7 +120,7 @@ static inline void __tlbie_pid(unsigned long pid, unsigned long ric)
        trace_tlbie(0, 0, rb, rs, ric, prs, r);
 }
 
-static inline void __tlbiel_lpid(unsigned long lpid, int set,
+static __always_inline void __tlbiel_lpid(unsigned long lpid, int set,
                                unsigned long ric)
 {
        unsigned long rb,rs,prs,r;
@@ -136,7 +136,7 @@ static inline void __tlbiel_lpid(unsigned long lpid, int set,
        trace_tlbie(lpid, 1, rb, rs, ric, prs, r);
 }
 
-static inline void __tlbie_lpid(unsigned long lpid, unsigned long ric)
+static __always_inline void __tlbie_lpid(unsigned long lpid, unsigned long ric)
 {
        unsigned long rb,rs,prs,r;
 
@@ -928,7 +928,7 @@ void radix__tlb_flush(struct mmu_gather *tlb)
        tlb->need_flush_all = 0;
 }
 
-static inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
+static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
                                unsigned long start, unsigned long end,
                                int psize, bool also_pwc)
 {
index c5c9ff2..b5d92dc 100644 (file)
@@ -556,7 +556,7 @@ static int __init add_huge_page_size(unsigned long long size)
        if (size <= PAGE_SIZE || !is_power_of_2(size))
                return -EINVAL;
 
-       mmu_psize = check_and_get_huge_psize(size);
+       mmu_psize = check_and_get_huge_psize(shift);
        if (mmu_psize < 0)
                return -EINVAL;
 
index 88c22de..828d783 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_WALNUT)                           += walnut.o
 obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD)      += virtex.o
 obj-$(CONFIG_EP405)                            += ep405.o
index 9779c32..f5ae27c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += uic.o machine_check.o
 obj-$(CONFIG_PPC4xx_OCM)       += ocm.o
 obj-$(CONFIG_4xx_SOC)          += soc.o
index e6885b3..e95e4e3 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += setup.o
index 27ee65b..0be212a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * cbe_regs.c
  *
index 1200d0d..93ea416 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * IO workarounds for PCI on Celleb/Cell platform
  *
  * (C) Copyright 2006-2007 TOSHIBA CORPORATION
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #undef DEBUG
index b5f35cb..cbee366 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * System call callback functions for SPUs
  */
index dc3465c..05639db 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += setup.o time.o pegasos_eth.o pci.o
 obj-$(CONFIG_SMP)              += smp.o
 obj-$(CONFIG_NVRAM:m=y)                += nvram.o
index 1be1a99..19f35ab 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += setup.o pci.o time.o
index 60b4e0f..d2ce954 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o misc.o
 obj-$(CONFIG_PPC_PASEMI_MDIO)  += gpio_mdio.o
 obj-$(CONFIG_PCI_MSI)          += msi.o
index 6b5dccc..32224cb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Miscellaneous procedures for dealing with the PowerMac hardware.
  * Contains support for the backlight.
index e0462fe..94df0a9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * FIXME: Properly make this race free with refcounting etc...
index 586ec71..5cae375 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * OPAL hypervisor Maintenance interrupt handling support in PowerNV.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
- *
  * Copyright 2014 IBM Corporation
  * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
  */
index 8731ffc..a63fdb3 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_GE_FPGA)          += ge_pic.o
index dea2abc..e510888 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-y                          += common.o
 obj-$(CONFIG_PPC_XIVE_NATIVE)  += native.o
index 0c037e9..7782201 100644 (file)
@@ -521,6 +521,9 @@ u32 xive_native_default_eq_shift(void)
 }
 EXPORT_SYMBOL_GPL(xive_native_default_eq_shift);
 
+unsigned long xive_tima_os;
+EXPORT_SYMBOL_GPL(xive_tima_os);
+
 bool __init xive_native_init(void)
 {
        struct device_node *np;
@@ -573,6 +576,14 @@ bool __init xive_native_init(void)
        for_each_possible_cpu(cpu)
                kvmppc_set_xive_tima(cpu, r.start, tima);
 
+       /* Resource 2 is OS window */
+       if (of_address_to_resource(np, 2, &r)) {
+               pr_err("Failed to get thread mgmnt area resource\n");
+               return false;
+       }
+
+       xive_tima_os = r.start;
+
        /* Grab size of provisionning pages */
        xive_parse_provisioning(np);
 
index 4cbc7da..4b0a4e6 100644 (file)
@@ -1,22 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Disassemble SPU instructions
 
    Copyright 2006 Free Software Foundation, Inc.
 
    This file is part of GDB, GAS, and the GNU binutils.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This 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.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+ */
 
 #include <linux/string.h>
 #include "nonstdio.h"
index 99dc452..7e1126a 100644 (file)
@@ -1,22 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* SPU ELF support for BFD.
 
    Copyright 2006 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This 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.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+ */
 
 /* SPU Opcode Table
 
index 7d37597..6d8197c 100644 (file)
@@ -1,22 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* SPU opcode list
 
    Copyright 2006 Free Software Foundation, Inc.
 
    This file is part of GDB, GAS, and the GNU binutils.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This 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.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+ */
 
 #include <linux/kernel.h>
 #include <linux/bug.h>
index c761fc8..2d13b1a 100644 (file)
@@ -1,22 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* SPU ELF support for BFD.
 
    Copyright 2006 Free Software Foundation, Inc.
 
    This file is part of GDB, GAS, and the GNU binutils.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This 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.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+ */
 
 
 /* These two enums are from rel_apu/common/spu_asm_format.h */
index e66745d..0c4b122 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
@@ -27,7 +28,7 @@ config RISCV
        select GENERIC_STRNCPY_FROM_USER
        select GENERIC_STRNLEN_USER
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A
+       select GENERIC_ATOMIC64 if !64BIT
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_DMA_CONTIGUOUS
@@ -35,7 +36,6 @@ config RISCV
        select HAVE_PERF_EVENTS
        select HAVE_SYSCALL_TRACEPOINTS
        select IRQ_DOMAIN
-       select RISCV_ISA_A if SMP
        select SPARSE_IRQ
        select SYSCTL_EXCEPTION_TRACE
        select HAVE_ARCH_TRACEHOOK
@@ -195,9 +195,6 @@ config RISCV_ISA_C
 
           If you don't know what to do here, say Y.
 
-config RISCV_ISA_A
-       def_bool y
-
 menu "supported PMU type"
        depends on PERF_EVENTS
 
index c6342e6..6b0741c 100644 (file)
@@ -39,9 +39,8 @@ endif
 KBUILD_CFLAGS += -Wall
 
 # ISA string setting
-riscv-march-$(CONFIG_ARCH_RV32I)       := rv32im
-riscv-march-$(CONFIG_ARCH_RV64I)       := rv64im
-riscv-march-$(CONFIG_RISCV_ISA_A)      := $(riscv-march-y)a
+riscv-march-$(CONFIG_ARCH_RV32I)       := rv32ima
+riscv-march-$(CONFIG_ARCH_RV64I)       := rv64ima
 riscv-march-$(CONFIG_FPU)              := $(riscv-march-y)fd
 riscv-march-$(CONFIG_RISCV_ISA_C)      := $(riscv-march-y)c
 KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
index cccd12c..3d019e0 100644 (file)
@@ -1,9 +1,9 @@
 generic-y += bugs.h
 generic-y += checksum.h
 generic-y += compat.h
-generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += extable.h
 generic-y += dma.h
 generic-y += dma-contiguous.h
 generic-y += dma-mapping.h
@@ -11,7 +11,6 @@ generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += fb.h
 generic-y += hardirq.h
-generic-y += hash.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
@@ -21,10 +20,8 @@ generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mm-arch-hooks.h
-generic-y += mutex.h
 generic-y += percpu.h
 generic-y += preempt.h
-generic-y += scatterlist.h
 generic-y += sections.h
 generic-y += serial.h
 generic-y += shmparam.h
index bfc7f09..52a1fbd 100644 (file)
 #include <asm/asm.h>
 
 #ifdef CONFIG_GENERIC_BUG
-#define __BUG_INSN     _AC(0x00100073, UL) /* ebreak */
+#define __INSN_LENGTH_MASK  _UL(0x3)
+#define __INSN_LENGTH_32    _UL(0x3)
+#define __COMPRESSED_INSN_MASK _UL(0xffff)
+
+#define __BUG_INSN_32  _UL(0x00100073) /* ebreak */
+#define __BUG_INSN_16  _UL(0x9002) /* c.ebreak */
 
 #ifndef __ASSEMBLY__
 typedef u32 bug_insn_t;
@@ -38,38 +43,46 @@ typedef u32 bug_insn_t;
 #define __BUG_ENTRY                    \
        __BUG_ENTRY_ADDR "\n\t"         \
        __BUG_ENTRY_FILE "\n\t"         \
-       RISCV_SHORT " %1"
+       RISCV_SHORT " %1\n\t"           \
+       RISCV_SHORT " %2"
 #else
 #define __BUG_ENTRY                    \
-       __BUG_ENTRY_ADDR
+       __BUG_ENTRY_ADDR "\n\t"         \
+       RISCV_SHORT " %2"
 #endif
 
-#define BUG()                                                  \
+#define __BUG_FLAGS(flags)                                     \
 do {                                                           \
        __asm__ __volatile__ (                                  \
                "1:\n\t"                                        \
                        "ebreak\n"                              \
-                       ".pushsection __bug_table,\"a\"\n\t"    \
+                       ".pushsection __bug_table,\"aw\"\n\t"   \
                "2:\n\t"                                        \
                        __BUG_ENTRY "\n\t"                      \
-                       ".org 2b + %2\n\t"                      \
+                       ".org 2b + %3\n\t"                      \
                        ".popsection"                           \
                :                                               \
                : "i" (__FILE__), "i" (__LINE__),               \
-                 "i" (sizeof(struct bug_entry)));              \
-       unreachable();                                          \
+                 "i" (flags),                                  \
+                 "i" (sizeof(struct bug_entry)));              \
 } while (0)
+
 #endif /* !__ASSEMBLY__ */
 #else /* CONFIG_GENERIC_BUG */
 #ifndef __ASSEMBLY__
-#define BUG()                                                  \
-do {                                                           \
+#define __BUG_FLAGS(flags) do {                                        \
        __asm__ __volatile__ ("ebreak\n");                      \
-       unreachable();                                          \
 } while (0)
 #endif /* !__ASSEMBLY__ */
 #endif /* CONFIG_GENERIC_BUG */
 
+#define BUG() do {                                             \
+       __BUG_FLAGS(0);                                         \
+       unreachable();                                          \
+} while (0)
+
+#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))
+
 #define HAVE_ARCH_BUG
 
 #include <asm-generic/bug.h>
index 8f13074..1f4ba68 100644 (file)
@@ -47,7 +47,7 @@ static inline void flush_dcache_page(struct page *page)
 
 #else /* CONFIG_SMP */
 
-#define flush_icache_all() sbi_remote_fence_i(NULL)
+void flush_icache_all(void);
 void flush_icache_mm(struct mm_struct *mm, bool local);
 
 #endif /* CONFIG_SMP */
index 28a0d1c..3c3c26c 100644 (file)
 #ifndef _ASM_RISCV_CSR_H
 #define _ASM_RISCV_CSR_H
 
+#include <asm/asm.h>
 #include <linux/const.h>
 
 /* Status register flags */
-#define SR_SIE _AC(0x00000002, UL) /* Supervisor Interrupt Enable */
-#define SR_SPIE        _AC(0x00000020, UL) /* Previous Supervisor IE */
-#define SR_SPP _AC(0x00000100, UL) /* Previously Supervisor */
-#define SR_SUM _AC(0x00040000, UL) /* Supervisor may access User Memory */
-
-#define SR_FS           _AC(0x00006000, UL) /* Floating-point Status */
-#define SR_FS_OFF       _AC(0x00000000, UL)
-#define SR_FS_INITIAL   _AC(0x00002000, UL)
-#define SR_FS_CLEAN     _AC(0x00004000, UL)
-#define SR_FS_DIRTY     _AC(0x00006000, UL)
-
-#define SR_XS           _AC(0x00018000, UL) /* Extension Status */
-#define SR_XS_OFF       _AC(0x00000000, UL)
-#define SR_XS_INITIAL   _AC(0x00008000, UL)
-#define SR_XS_CLEAN     _AC(0x00010000, UL)
-#define SR_XS_DIRTY     _AC(0x00018000, UL)
+#define SR_SIE         _AC(0x00000002, UL) /* Supervisor Interrupt Enable */
+#define SR_SPIE                _AC(0x00000020, UL) /* Previous Supervisor IE */
+#define SR_SPP         _AC(0x00000100, UL) /* Previously Supervisor */
+#define SR_SUM         _AC(0x00040000, UL) /* Supervisor User Memory Access */
+
+#define SR_FS          _AC(0x00006000, UL) /* Floating-point Status */
+#define SR_FS_OFF      _AC(0x00000000, UL)
+#define SR_FS_INITIAL  _AC(0x00002000, UL)
+#define SR_FS_CLEAN    _AC(0x00004000, UL)
+#define SR_FS_DIRTY    _AC(0x00006000, UL)
+
+#define SR_XS          _AC(0x00018000, UL) /* Extension Status */
+#define SR_XS_OFF      _AC(0x00000000, UL)
+#define SR_XS_INITIAL  _AC(0x00008000, UL)
+#define SR_XS_CLEAN    _AC(0x00010000, UL)
+#define SR_XS_DIRTY    _AC(0x00018000, UL)
 
 #ifndef CONFIG_64BIT
-#define SR_SD   _AC(0x80000000, UL) /* FS/XS dirty */
+#define SR_SD          _AC(0x80000000, UL) /* FS/XS dirty */
 #else
-#define SR_SD   _AC(0x8000000000000000, UL) /* FS/XS dirty */
+#define SR_SD          _AC(0x8000000000000000, UL) /* FS/XS dirty */
 #endif
 
 /* SATP flags */
-#if __riscv_xlen == 32
-#define SATP_PPN     _AC(0x003FFFFF, UL)
-#define SATP_MODE_32 _AC(0x80000000, UL)
-#define SATP_MODE    SATP_MODE_32
+#ifndef CONFIG_64BIT
+#define SATP_PPN       _AC(0x003FFFFF, UL)
+#define SATP_MODE_32   _AC(0x80000000, UL)
+#define SATP_MODE      SATP_MODE_32
 #else
-#define SATP_PPN     _AC(0x00000FFFFFFFFFFF, UL)
-#define SATP_MODE_39 _AC(0x8000000000000000, UL)
-#define SATP_MODE    SATP_MODE_39
+#define SATP_PPN       _AC(0x00000FFFFFFFFFFF, UL)
+#define SATP_MODE_39   _AC(0x8000000000000000, UL)
+#define SATP_MODE      SATP_MODE_39
 #endif
 
-/* Interrupt Enable and Interrupt Pending flags */
-#define SIE_SSIE _AC(0x00000002, UL) /* Software Interrupt Enable */
-#define SIE_STIE _AC(0x00000020, UL) /* Timer Interrupt Enable */
-#define SIE_SEIE _AC(0x00000200, UL) /* External Interrupt Enable */
-
-#define EXC_INST_MISALIGNED     0
-#define EXC_INST_ACCESS         1
-#define EXC_BREAKPOINT          3
-#define EXC_LOAD_ACCESS         5
-#define EXC_STORE_ACCESS        7
-#define EXC_SYSCALL             8
-#define EXC_INST_PAGE_FAULT     12
-#define EXC_LOAD_PAGE_FAULT     13
-#define EXC_STORE_PAGE_FAULT    15
+/* SCAUSE */
+#define SCAUSE_IRQ_FLAG                (_AC(1, UL) << (__riscv_xlen - 1))
+
+#define IRQ_U_SOFT             0
+#define IRQ_S_SOFT             1
+#define IRQ_M_SOFT             3
+#define IRQ_U_TIMER            4
+#define IRQ_S_TIMER            5
+#define IRQ_M_TIMER            7
+#define IRQ_U_EXT              8
+#define IRQ_S_EXT              9
+#define IRQ_M_EXT              11
+
+#define EXC_INST_MISALIGNED    0
+#define EXC_INST_ACCESS                1
+#define EXC_BREAKPOINT         3
+#define EXC_LOAD_ACCESS                5
+#define EXC_STORE_ACCESS       7
+#define EXC_SYSCALL            8
+#define EXC_INST_PAGE_FAULT    12
+#define EXC_LOAD_PAGE_FAULT    13
+#define EXC_STORE_PAGE_FAULT   15
+
+/* SIE (Interrupt Enable) and SIP (Interrupt Pending) flags */
+#define SIE_SSIE               (_AC(0x1, UL) << IRQ_S_SOFT)
+#define SIE_STIE               (_AC(0x1, UL) << IRQ_S_TIMER)
+#define SIE_SEIE               (_AC(0x1, UL) << IRQ_S_EXT)
+
+#define CSR_CYCLE              0xc00
+#define CSR_TIME               0xc01
+#define CSR_INSTRET            0xc02
+#define CSR_SSTATUS            0x100
+#define CSR_SIE                        0x104
+#define CSR_STVEC              0x105
+#define CSR_SCOUNTEREN         0x106
+#define CSR_SSCRATCH           0x140
+#define CSR_SEPC               0x141
+#define CSR_SCAUSE             0x142
+#define CSR_STVAL              0x143
+#define CSR_SIP                        0x144
+#define CSR_SATP               0x180
+#define CSR_CYCLEH             0xc80
+#define CSR_TIMEH              0xc81
+#define CSR_INSTRETH           0xc82
 
 #ifndef __ASSEMBLY__
 
 #define csr_swap(csr, val)                                     \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrrw %0, " #csr ", %1"          \
+       __asm__ __volatile__ ("csrrw %0, " __ASM_STR(csr) ", %1"\
                              : "=r" (__v) : "rK" (__v)         \
                              : "memory");                      \
        __v;                                                    \
 #define csr_read(csr)                                          \
 ({                                                             \
        register unsigned long __v;                             \
-       __asm__ __volatile__ ("csrr %0, " #csr                  \
+       __asm__ __volatile__ ("csrr %0, " __ASM_STR(csr)        \
                              : "=r" (__v) :                    \
                              : "memory");                      \
        __v;                                                    \
 #define csr_write(csr, val)                                    \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrw " #csr ", %0"               \
+       __asm__ __volatile__ ("csrw " __ASM_STR(csr) ", %0"     \
                              : : "rK" (__v)                    \
                              : "memory");                      \
 })
 #define csr_read_set(csr, val)                                 \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrrs %0, " #csr ", %1"          \
+       __asm__ __volatile__ ("csrrs %0, " __ASM_STR(csr) ", %1"\
                              : "=r" (__v) : "rK" (__v)         \
                              : "memory");                      \
        __v;                                                    \
 #define csr_set(csr, val)                                      \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrs " #csr ", %0"               \
+       __asm__ __volatile__ ("csrs " __ASM_STR(csr) ", %0"     \
                              : : "rK" (__v)                    \
                              : "memory");                      \
 })
 #define csr_read_clear(csr, val)                               \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrrc %0, " #csr ", %1"          \
+       __asm__ __volatile__ ("csrrc %0, " __ASM_STR(csr) ", %1"\
                              : "=r" (__v) : "rK" (__v)         \
                              : "memory");                      \
        __v;                                                    \
 #define csr_clear(csr, val)                                    \
 ({                                                             \
        unsigned long __v = (unsigned long)(val);               \
-       __asm__ __volatile__ ("csrc " #csr ", %0"               \
+       __asm__ __volatile__ ("csrc " __ASM_STR(csr) ", %0"     \
                              : : "rK" (__v)                    \
                              : "memory");                      \
 })
index 697fc23..ce0cd7d 100644 (file)
 #define ELF_CLASS      ELFCLASS32
 #endif
 
-#if defined(__LITTLE_ENDIAN)
 #define ELF_DATA       ELFDATA2LSB
-#elif defined(__BIG_ENDIAN)
-#define ELF_DATA       ELFDATA2MSB
-#else
-#error "Unknown endianness"
-#endif
 
 /*
  * This is used to ensure we don't load something for the wrong architecture.
index 6664162..4ad6409 100644 (file)
@@ -7,18 +7,6 @@
 #ifndef _ASM_FUTEX_H
 #define _ASM_FUTEX_H
 
-#ifndef CONFIG_RISCV_ISA_A
-/*
- * Use the generic interrupt disabling versions if the A extension
- * is not supported.
- */
-#ifdef CONFIG_SMP
-#error "Can't support generic futex calls without A extension on SMP"
-#endif
-#include <asm-generic/futex.h>
-
-#else /* CONFIG_RISCV_ISA_A */
-
 #include <linux/futex.h>
 #include <linux/uaccess.h>
 #include <linux/errno.h>
@@ -124,5 +112,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
        return ret;
 }
 
-#endif /* CONFIG_RISCV_ISA_A */
 #endif /* _ASM_FUTEX_H */
index 07a3c6d..1a69b3b 100644 (file)
 /* read interrupt enabled status */
 static inline unsigned long arch_local_save_flags(void)
 {
-       return csr_read(sstatus);
+       return csr_read(CSR_SSTATUS);
 }
 
 /* unconditionally enable interrupts */
 static inline void arch_local_irq_enable(void)
 {
-       csr_set(sstatus, SR_SIE);
+       csr_set(CSR_SSTATUS, SR_SIE);
 }
 
 /* unconditionally disable interrupts */
 static inline void arch_local_irq_disable(void)
 {
-       csr_clear(sstatus, SR_SIE);
+       csr_clear(CSR_SSTATUS, SR_SIE);
 }
 
 /* get status and disable interrupts */
 static inline unsigned long arch_local_irq_save(void)
 {
-       return csr_read_clear(sstatus, SR_SIE);
+       return csr_read_clear(CSR_SSTATUS, SR_SIE);
 }
 
 /* test flags */
@@ -57,7 +57,7 @@ static inline int arch_irqs_disabled(void)
 /* set interrupt enabled status */
 static inline void arch_local_irq_restore(unsigned long flags)
 {
-       csr_set(sstatus, flags & SR_SIE);
+       csr_set(CSR_SSTATUS, flags & SR_SIE);
 }
 
 #endif /* _ASM_RISCV_IRQFLAGS_H */
index 336d60e..bf4f097 100644 (file)
@@ -20,8 +20,6 @@
 
 #include <linux/mm.h>
 #include <linux/sched.h>
-#include <asm/tlbflush.h>
-#include <asm/cacheflush.h>
 
 static inline void enter_lazy_tlb(struct mm_struct *mm,
        struct task_struct *task)
@@ -39,61 +37,8 @@ static inline void destroy_context(struct mm_struct *mm)
 {
 }
 
-/*
- * When necessary, performs a deferred icache flush for the given MM context,
- * on the local CPU.  RISC-V has no direct mechanism for instruction cache
- * shoot downs, so instead we send an IPI that informs the remote harts they
- * need to flush their local instruction caches.  To avoid pathologically slow
- * behavior in a common case (a bunch of single-hart processes on a many-hart
- * machine, ie 'make -j') we avoid the IPIs for harts that are not currently
- * executing a MM context and instead schedule a deferred local instruction
- * cache flush to be performed before execution resumes on each hart.  This
- * actually performs that local instruction cache flush, which implicitly only
- * refers to the current hart.
- */
-static inline void flush_icache_deferred(struct mm_struct *mm)
-{
-#ifdef CONFIG_SMP
-       unsigned int cpu = smp_processor_id();
-       cpumask_t *mask = &mm->context.icache_stale_mask;
-
-       if (cpumask_test_cpu(cpu, mask)) {
-               cpumask_clear_cpu(cpu, mask);
-               /*
-                * Ensure the remote hart's writes are visible to this hart.
-                * This pairs with a barrier in flush_icache_mm.
-                */
-               smp_mb();
-               local_flush_icache_all();
-       }
-#endif
-}
-
-static inline void switch_mm(struct mm_struct *prev,
-       struct mm_struct *next, struct task_struct *task)
-{
-       if (likely(prev != next)) {
-               /*
-                * Mark the current MM context as inactive, and the next as
-                * active.  This is at least used by the icache flushing
-                * routines in order to determine who should
-                */
-               unsigned int cpu = smp_processor_id();
-
-               cpumask_clear_cpu(cpu, mm_cpumask(prev));
-               cpumask_set_cpu(cpu, mm_cpumask(next));
-
-               /*
-                * Use the old spbtr name instead of using the current satp
-                * name to support binutils 2.29 which doesn't know about the
-                * privileged ISA 1.10 yet.
-                */
-               csr_write(sptbr, virt_to_pfn(next->pgd) | SATP_MODE);
-               local_flush_tlb_all();
-
-               flush_icache_deferred(next);
-       }
-}
+void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+       struct task_struct *task);
 
 static inline void activate_mm(struct mm_struct *prev,
                               struct mm_struct *next)
index d35ec2f..9c867a4 100644 (file)
@@ -70,47 +70,38 @@ struct pt_regs {
 
 
 /* Helpers for working with the instruction pointer */
-#define GET_IP(regs) ((regs)->sepc)
-#define SET_IP(regs, val) (GET_IP(regs) = (val))
-
 static inline unsigned long instruction_pointer(struct pt_regs *regs)
 {
-       return GET_IP(regs);
+       return regs->sepc;
 }
 static inline void instruction_pointer_set(struct pt_regs *regs,
                                           unsigned long val)
 {
-       SET_IP(regs, val);
+       regs->sepc = val;
 }
 
 #define profile_pc(regs) instruction_pointer(regs)
 
 /* Helpers for working with the user stack pointer */
-#define GET_USP(regs) ((regs)->sp)
-#define SET_USP(regs, val) (GET_USP(regs) = (val))
-
 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
 {
-       return GET_USP(regs);
+       return regs->sp;
 }
 static inline void user_stack_pointer_set(struct pt_regs *regs,
                                          unsigned long val)
 {
-       SET_USP(regs, val);
+       regs->sp =  val;
 }
 
 /* Helpers for working with the frame pointer */
-#define GET_FP(regs) ((regs)->s0)
-#define SET_FP(regs, val) (GET_FP(regs) = (val))
-
 static inline unsigned long frame_pointer(struct pt_regs *regs)
 {
-       return GET_FP(regs);
+       return regs->s0;
 }
 static inline void frame_pointer_set(struct pt_regs *regs,
                                     unsigned long val)
 {
-       SET_FP(regs, val);
+       regs->s0 = val;
 }
 
 static inline unsigned long regs_return_value(struct pt_regs *regs)
index b6bb10b..19f2316 100644 (file)
 #define SBI_REMOTE_SFENCE_VMA_ASID 7
 #define SBI_SHUTDOWN 8
 
-#define SBI_CALL(which, arg0, arg1, arg2) ({                   \
+#define SBI_CALL(which, arg0, arg1, arg2, arg3) ({             \
        register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);   \
        register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);   \
        register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);   \
+       register uintptr_t a3 asm ("a3") = (uintptr_t)(arg3);   \
        register uintptr_t a7 asm ("a7") = (uintptr_t)(which);  \
        asm volatile ("ecall"                                   \
                      : "+r" (a0)                               \
-                     : "r" (a1), "r" (a2), "r" (a7)            \
+                     : "r" (a1), "r" (a2), "r" (a3), "r" (a7)  \
                      : "memory");                              \
        a0;                                                     \
 })
 
 /* Lazy implementations until SBI is finalized */
-#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0)
-#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0)
-#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0)
+#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0, 0)
+#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0, 0)
+#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0, 0)
+#define SBI_CALL_3(which, arg0, arg1, arg2) \
+               SBI_CALL(which, arg0, arg1, arg2, 0)
+#define SBI_CALL_4(which, arg0, arg1, arg2, arg3) \
+               SBI_CALL(which, arg0, arg1, arg2, arg3)
 
 static inline void sbi_console_putchar(int ch)
 {
@@ -86,7 +91,7 @@ static inline void sbi_remote_sfence_vma(const unsigned long *hart_mask,
                                         unsigned long start,
                                         unsigned long size)
 {
-       SBI_CALL_1(SBI_REMOTE_SFENCE_VMA, hart_mask);
+       SBI_CALL_3(SBI_REMOTE_SFENCE_VMA, hart_mask, start, size);
 }
 
 static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
@@ -94,7 +99,7 @@ static inline void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
                                              unsigned long size,
                                              unsigned long asid)
 {
-       SBI_CALL_1(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask);
+       SBI_CALL_4(SBI_REMOTE_SFENCE_VMA_ASID, hart_mask, start, size, asid);
 }
 
 #endif
diff --git a/arch/riscv/include/asm/sifive_l2_cache.h b/arch/riscv/include/asm/sifive_l2_cache.h
new file mode 100644 (file)
index 0000000..04f6748
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * SiFive L2 Cache Controller header file
+ *
+ */
+
+#ifndef _ASM_RISCV_SIFIVE_L2_CACHE_H
+#define _ASM_RISCV_SIFIVE_L2_CACHE_H
+
+extern int register_sifive_l2_error_notifier(struct notifier_block *nb);
+extern int unregister_sifive_l2_error_notifier(struct notifier_block *nb);
+
+#define SIFIVE_L2_ERR_TYPE_CE 0
+#define SIFIVE_L2_ERR_TYPE_UE 1
+
+#endif /* _ASM_RISCV_SIFIVE_L2_CACHE_H */
index 1c9cc83..9c03987 100644 (file)
@@ -28,7 +28,9 @@
 #include <asm/processor.h>
 #include <asm/csr.h>
 
-typedef unsigned long mm_segment_t;
+typedef struct {
+       unsigned long seg;
+} mm_segment_t;
 
 /*
  * low level task data that entry.S needs immediate access to
index fb53a80..b26f407 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/compiler.h>
 #include <linux/thread_info.h>
 #include <asm/byteorder.h>
+#include <asm/extable.h>
 #include <asm/asm.h>
 
 #define __enable_user_access()                                                 \
  * For historical reasons, these macros are grossly misnamed.
  */
 
-#define KERNEL_DS      (~0UL)
-#define USER_DS                (TASK_SIZE)
+#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)
 
@@ -48,9 +51,9 @@ static inline void set_fs(mm_segment_t fs)
        current_thread_info()->addr_limit = fs;
 }
 
-#define segment_eq(a, b) ((a) == (b))
+#define segment_eq(a, b) ((a).seg == (b).seg)
 
-#define user_addr_max()        (get_fs())
+#define user_addr_max()        (get_fs().seg)
 
 
 /**
@@ -82,7 +85,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
 {
        const mm_segment_t fs = get_fs();
 
-       return (size <= fs) && (addr <= (fs - size));
+       return size <= fs.seg && addr <= fs.seg - size;
 }
 
 /*
@@ -98,21 +101,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
  * on our cache or tlb entries.
  */
 
-struct exception_table_entry {
-       unsigned long insn, fixup;
-};
-
-extern int fixup_exception(struct pt_regs *state);
-
-#if defined(__LITTLE_ENDIAN)
-#define __MSW  1
 #define __LSW  0
-#elif defined(__BIG_ENDIAN)
-#define __MSW  0
-#define        __LSW   1
-#else
-#error "Unknown endianness"
-#endif
+#define __MSW  1
 
 /*
  * The "__xxx" versions of the user access functions do not verify the address
index 5985681..2420d37 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the RISC-V Linux kernel
 #
index dac9834..578bb5e 100644 (file)
@@ -312,9 +312,6 @@ void asm_offsets(void)
                - offsetof(struct task_struct, thread.fstate.f[0])
        );
 
-       /* The assembler needs access to THREAD_SIZE as well. */
-       DEFINE(ASM_THREAD_SIZE, THREAD_SIZE);
-
        /*
         * We allocate a pt_regs on the stack when entering the kernel.  This
         * ensures the alignment is sane.
index cf2fca1..c8d2a32 100644 (file)
@@ -136,8 +136,7 @@ static void c_stop(struct seq_file *m, void *v)
 static int c_show(struct seq_file *m, void *v)
 {
        unsigned long cpu_id = (unsigned long)v - 1;
-       struct device_node *node = of_get_cpu_node(cpuid_to_hartid_map(cpu_id),
-                                                  NULL);
+       struct device_node *node = of_get_cpu_node(cpu_id, NULL);
        const char *compat, *isa, *mmu;
 
        seq_printf(m, "processor\t: %lu\n", cpu_id);
index fd9b57c..1c1ecc2 100644 (file)
         * the kernel thread pointer.  If we came from the kernel, sscratch
         * will contain 0, and we should continue on the current TP.
         */
-       csrrw tp, sscratch, tp
+       csrrw tp, CSR_SSCRATCH, tp
        bnez tp, _save_context
 
 _restore_kernel_tpsp:
-       csrr tp, sscratch
+       csrr tp, CSR_SSCRATCH
        REG_S sp, TASK_TI_KERNEL_SP(tp)
 _save_context:
        REG_S sp, TASK_TI_USER_SP(tp)
@@ -87,11 +87,11 @@ _save_context:
        li t0, SR_SUM | SR_FS
 
        REG_L s0, TASK_TI_USER_SP(tp)
-       csrrc s1, sstatus, t0
-       csrr s2, sepc
-       csrr s3, sbadaddr
-       csrr s4, scause
-       csrr s5, sscratch
+       csrrc s1, CSR_SSTATUS, t0
+       csrr s2, CSR_SEPC
+       csrr s3, CSR_STVAL
+       csrr s4, CSR_SCAUSE
+       csrr s5, CSR_SSCRATCH
        REG_S s0, PT_SP(sp)
        REG_S s1, PT_SSTATUS(sp)
        REG_S s2, PT_SEPC(sp)
@@ -107,8 +107,8 @@ _save_context:
        .macro RESTORE_ALL
        REG_L a0, PT_SSTATUS(sp)
        REG_L a2, PT_SEPC(sp)
-       csrw sstatus, a0
-       csrw sepc, a2
+       csrw CSR_SSTATUS, a0
+       csrw CSR_SEPC, a2
 
        REG_L x1,  PT_RA(sp)
        REG_L x3,  PT_GP(sp)
@@ -155,7 +155,7 @@ ENTRY(handle_exception)
         * Set sscratch register to 0, so that if a recursive exception
         * occurs, the exception vector knows it came from the kernel
         */
-       csrw sscratch, x0
+       csrw CSR_SSCRATCH, x0
 
        /* Load the global pointer */
 .option push
@@ -248,7 +248,7 @@ resume_userspace:
         * Save TP into sscratch, so we can find the kernel data structures
         * again.
         */
-       csrw sscratch, tp
+       csrw CSR_SSCRATCH, tp
 
 restore_all:
        RESTORE_ALL
index fe884cd..370c66c 100644 (file)
@@ -23,7 +23,8 @@
 __INIT
 ENTRY(_start)
        /* Mask all interrupts */
-       csrw sie, zero
+       csrw CSR_SIE, zero
+       csrw CSR_SIP, zero
 
        /* Load the global pointer */
 .option push
@@ -68,14 +69,10 @@ clear_bss_done:
        /* Restore C environment */
        la tp, init_task
        sw zero, TASK_TI_CPU(tp)
-
-       la sp, init_thread_union
-       li a0, ASM_THREAD_SIZE
-       add sp, sp, a0
+       la sp, init_thread_union + THREAD_SIZE
 
        /* Start the kernel */
-       mv a0, s0
-       mv a1, s1
+       mv a0, s1
        call parse_dtb
        tail start_kernel
 
@@ -89,7 +86,7 @@ relocate:
        /* Point stvec to virtual address of intruction after satp write */
        la a0, 1f
        add a0, a0, a1
-       csrw stvec, a0
+       csrw CSR_STVEC, a0
 
        /* Compute satp for kernel page tables, but don't load it yet */
        la a2, swapper_pg_dir
@@ -99,18 +96,20 @@ relocate:
 
        /*
         * Load trampoline page directory, which will cause us to trap to
-        * stvec if VA != PA, or simply fall through if VA == PA
+        * stvec if VA != PA, or simply fall through if VA == PA.  We need a
+        * full fence here because setup_vm() just wrote these PTEs and we need
+        * to ensure the new translations are in use.
         */
        la a0, trampoline_pg_dir
        srl a0, a0, PAGE_SHIFT
        or a0, a0, a1
        sfence.vma
-       csrw sptbr, a0
+       csrw CSR_SATP, a0
 .align 2
 1:
        /* Set trap vector to spin forever to help debug */
        la a0, .Lsecondary_park
-       csrw stvec, a0
+       csrw CSR_STVEC, a0
 
        /* Reload the global pointer */
 .option push
@@ -118,8 +117,14 @@ relocate:
        la gp, __global_pointer$
 .option pop
 
-       /* Switch to kernel page tables */
-       csrw sptbr, a2
+       /*
+        * Switch to kernel page tables.  A full fence is necessary in order to
+        * avoid using the trampoline translations, which are only correct for
+        * the first superpage.  Fetching the fence is guarnteed to work
+        * because that first superpage is translated the same way.
+        */
+       csrw CSR_SATP, a2
+       sfence.vma
 
        ret
 
@@ -130,7 +135,7 @@ relocate:
 
        /* Set trap vector to spin forever to help debug */
        la a3, .Lsecondary_park
-       csrw stvec, a3
+       csrw CSR_STVEC, a3
 
        slli a3, a0, LGREG
        la a1, __cpu_up_stack_pointer
index 48e6b7d..6d86593 100644 (file)
 /*
  * Possible interrupt causes:
  */
-#define INTERRUPT_CAUSE_SOFTWARE    1
-#define INTERRUPT_CAUSE_TIMER       5
-#define INTERRUPT_CAUSE_EXTERNAL    9
-
-/*
- * The high order bit of the trap cause register is always set for
- * interrupts, which allows us to differentiate them from exceptions
- * quickly.  The INTERRUPT_CAUSE_* macros don't contain that bit, so we
- * need to mask it off.
- */
-#define INTERRUPT_CAUSE_FLAG   (1UL << (__riscv_xlen - 1))
+#define INTERRUPT_CAUSE_SOFTWARE       IRQ_S_SOFT
+#define INTERRUPT_CAUSE_TIMER          IRQ_S_TIMER
+#define INTERRUPT_CAUSE_EXTERNAL       IRQ_S_EXT
 
 int arch_show_interrupts(struct seq_file *p, int prec)
 {
@@ -37,7 +29,7 @@ asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs)
        struct pt_regs *old_regs = set_irq_regs(regs);
 
        irq_enter();
-       switch (regs->scause & ~INTERRUPT_CAUSE_FLAG) {
+       switch (regs->scause & ~SCAUSE_IRQ_FLAG) {
        case INTERRUPT_CAUSE_TIMER:
                riscv_timer_interrupt();
                break;
@@ -54,7 +46,8 @@ asmlinkage void __irq_entry do_IRQ(struct pt_regs *regs)
                handle_arch_irq(regs);
                break;
        default:
-               panic("unexpected interrupt cause");
+               pr_alert("unexpected interrupt cause 0x%lx", regs->scause);
+               BUG();
        }
        irq_exit();
 
index 667ee70..91626d9 100644 (file)
@@ -185,10 +185,10 @@ static inline u64 read_counter(int idx)
 
        switch (idx) {
        case RISCV_PMU_CYCLE:
-               val = csr_read(cycle);
+               val = csr_read(CSR_CYCLE);
                break;
        case RISCV_PMU_INSTRET:
-               val = csr_read(instret);
+               val = csr_read(CSR_INSTRET);
                break;
        default:
                WARN_ON_ONCE(idx < 0 || idx > RISCV_MAX_COUNTERS);
index 2a53d26..ed637ae 100644 (file)
  */
 
 #include <linux/reboot.h>
-#include <linux/export.h>
 #include <asm/sbi.h>
 
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
+static void default_power_off(void)
+{
+       sbi_shutdown();
+       while (1);
+}
+
+void (*pm_power_off)(void) = default_power_off;
 
 void machine_restart(char *cmd)
 {
@@ -26,11 +30,10 @@ void machine_restart(char *cmd)
 
 void machine_halt(void)
 {
-       machine_power_off();
+       pm_power_off();
 }
 
 void machine_power_off(void)
 {
-       sbi_shutdown();
-       while (1);
+       pm_power_off();
 }
index 540a331..d93bcce 100644 (file)
@@ -52,9 +52,11 @@ struct screen_info screen_info = {
 atomic_t hart_lottery;
 unsigned long boot_cpu_hartid;
 
-void __init parse_dtb(unsigned int hartid, void *dtb)
+void __init parse_dtb(phys_addr_t dtb_phys)
 {
-       if (early_init_dt_scan(__va(dtb)))
+       void *dtb = __va(dtb_phys);
+
+       if (early_init_dt_scan(dtb))
                return;
 
        pr_err("No DTB passed to the kernel\n");
index 837e164..804d6ee 100644 (file)
@@ -234,6 +234,9 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 
        /* Are we from a system call? */
        if (regs->scause == EXC_SYSCALL) {
+               /* Avoid additional syscall restarting via ret_from_exception */
+               regs->scause = -1UL;
+
                /* If so, check system call restarting.. */
                switch (regs->a0) {
                case -ERESTART_RESTARTBLOCK:
@@ -272,6 +275,9 @@ static void do_signal(struct pt_regs *regs)
 
        /* Did we come from a system call? */
        if (regs->scause == EXC_SYSCALL) {
+               /* Avoid additional syscall restarting via ret_from_exception */
+               regs->scause = -1UL;
+
                /* Restart the system call - no handlers present */
                switch (regs->a0) {
                case -ERESTARTNOHAND:
index 0c41d07..b2537ff 100644 (file)
@@ -42,7 +42,7 @@ unsigned long __cpuid_to_hartid_map[NR_CPUS] = {
 
 void __init smp_setup_processor_id(void)
 {
-       cpuid_to_hartid_map(0) = boot_cpu_hartid;
+       cpuid_to_hartid_map(0) = boot_cpu_hartid;
 }
 
 /* A collection of single bit ipi messages.  */
@@ -53,7 +53,7 @@ static struct {
 
 int riscv_hartid_to_cpuid(int hartid)
 {
-       int i = -1;
+       int i;
 
        for (i = 0; i < NR_CPUS; i++)
                if (cpuid_to_hartid_map(i) == hartid)
@@ -70,6 +70,12 @@ void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out)
        for_each_cpu(cpu, in)
                cpumask_set_cpu(cpuid_to_hartid_map(cpu), out);
 }
+
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+       return phys_id == cpuid_to_hartid_map(cpu);
+}
+
 /* Unsupported */
 int setup_profiling_timer(unsigned int multiplier)
 {
@@ -89,7 +95,7 @@ void riscv_software_interrupt(void)
        unsigned long *stats = ipi_data[smp_processor_id()].stats;
 
        /* Clear pending IPI */
-       csr_clear(sip, SIE_SSIE);
+       csr_clear(CSR_SIP, SIE_SSIE);
 
        while (true) {
                unsigned long ops;
@@ -199,52 +205,3 @@ void smp_send_reschedule(int cpu)
        send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE);
 }
 
-/*
- * Performs an icache flush for the given MM context.  RISC-V has no direct
- * mechanism for instruction cache shoot downs, so instead we send an IPI that
- * informs the remote harts they need to flush their local instruction caches.
- * To avoid pathologically slow behavior in a common case (a bunch of
- * single-hart processes on a many-hart machine, ie 'make -j') we avoid the
- * IPIs for harts that are not currently executing a MM context and instead
- * schedule a deferred local instruction cache flush to be performed before
- * execution resumes on each hart.
- */
-void flush_icache_mm(struct mm_struct *mm, bool local)
-{
-       unsigned int cpu;
-       cpumask_t others, hmask, *mask;
-
-       preempt_disable();
-
-       /* Mark every hart's icache as needing a flush for this MM. */
-       mask = &mm->context.icache_stale_mask;
-       cpumask_setall(mask);
-       /* Flush this hart's I$ now, and mark it as flushed. */
-       cpu = smp_processor_id();
-       cpumask_clear_cpu(cpu, mask);
-       local_flush_icache_all();
-
-       /*
-        * Flush the I$ of other harts concurrently executing, and mark them as
-        * flushed.
-        */
-       cpumask_andnot(&others, mm_cpumask(mm), cpumask_of(cpu));
-       local |= cpumask_empty(&others);
-       if (mm != current->active_mm || !local) {
-               cpumask_clear(&hmask);
-               riscv_cpuid_to_hartid_mask(&others, &hmask);
-               sbi_remote_fence_i(hmask.bits);
-       } else {
-               /*
-                * It's assumed that at least one strongly ordered operation is
-                * performed on this hart between setting a hart's cpumask bit
-                * and scheduling this MM context on that hart.  Sending an SBI
-                * remote message will do this, but in the case where no
-                * messages are sent we still need to order this hart's writes
-                * with flush_icache_deferred().
-                */
-               smp_mb();
-       }
-
-       preempt_enable();
-}
index eb533b5..7a0b622 100644 (file)
@@ -47,6 +47,17 @@ void __init smp_prepare_boot_cpu(void)
 
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
+       int cpuid;
+
+       /* This covers non-smp usecase mandated by "nosmp" option */
+       if (max_cpus == 0)
+               return;
+
+       for_each_possible_cpu(cpuid) {
+               if (cpuid == smp_processor_id())
+                       continue;
+               set_cpu_present(cpuid, true);
+       }
 }
 
 void __init setup_smp(void)
@@ -73,12 +84,19 @@ void __init setup_smp(void)
                }
 
                cpuid_to_hartid_map(cpuid) = hart;
-               set_cpu_possible(cpuid, true);
-               set_cpu_present(cpuid, true);
                cpuid++;
        }
 
        BUG_ON(!found_boot_cpu);
+
+       if (cpuid > nr_cpu_ids)
+               pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n",
+                       cpuid, nr_cpu_ids);
+
+       for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) {
+               if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID)
+                       set_cpu_possible(cpuid, true);
+       }
 }
 
 int __cpu_up(unsigned int cpu, struct task_struct *tidle)
index 4d40327..e80a5e8 100644 (file)
@@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task,
        unsigned long fp, sp, pc;
 
        if (regs) {
-               fp = GET_FP(regs);
-               sp = GET_USP(regs);
-               pc = GET_IP(regs);
+               fp = frame_pointer(regs);
+               sp = user_stack_pointer(regs);
+               pc = instruction_pointer(regs);
        } else if (task == NULL || task == current) {
                const register unsigned long current_sp __asm__ ("sp");
                fp = (unsigned long)__builtin_frame_address(0);
@@ -64,12 +64,8 @@ static void notrace walk_stackframe(struct task_struct *task,
                frame = (struct stackframe *)fp - 1;
                sp = fp;
                fp = frame->fp;
-#ifdef HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
                pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
                                           (unsigned long *)(fp - 8));
-#else
-               pc = frame->ra - 0x4;
-#endif
        }
 }
 
@@ -82,8 +78,8 @@ static void notrace walk_stackframe(struct task_struct *task,
        unsigned long *ksp;
 
        if (regs) {
-               sp = GET_USP(regs);
-               pc = GET_IP(regs);
+               sp = user_stack_pointer(regs);
+               pc = instruction_pointer(regs);
        } else if (task == NULL || task == current) {
                const register unsigned long current_sp __asm__ ("sp");
                sp = current_sp;
index 24a9333..3d1a651 100644 (file)
@@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code,
            && printk_ratelimit()) {
                pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT,
                        tsk->comm, task_pid_nr(tsk), signo, code, addr);
-               print_vma_addr(KERN_CONT " in ", GET_IP(regs));
+               print_vma_addr(KERN_CONT " in ", instruction_pointer(regs));
                pr_cont("\n");
                show_regs(regs);
        }
@@ -118,6 +118,17 @@ DO_ERROR_INFO(do_trap_ecall_s,
 DO_ERROR_INFO(do_trap_ecall_m,
        SIGILL, ILL_ILLTRP, "environment call from M-mode");
 
+#ifdef CONFIG_GENERIC_BUG
+static inline unsigned long get_break_insn_length(unsigned long pc)
+{
+       bug_insn_t insn;
+
+       if (probe_kernel_address((bug_insn_t *)pc, insn))
+               return 0;
+       return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
+}
+#endif /* CONFIG_GENERIC_BUG */
+
 asmlinkage void do_trap_break(struct pt_regs *regs)
 {
 #ifdef CONFIG_GENERIC_BUG
@@ -129,8 +140,8 @@ asmlinkage void do_trap_break(struct pt_regs *regs)
                case BUG_TRAP_TYPE_NONE:
                        break;
                case BUG_TRAP_TYPE_WARN:
-                       regs->sepc += sizeof(bug_insn_t);
-                       return;
+                       regs->sepc += get_break_insn_length(regs->sepc);
+                       break;
                case BUG_TRAP_TYPE_BUG:
                        die(regs, "Kernel BUG");
                }
@@ -145,11 +156,14 @@ int is_valid_bugaddr(unsigned long pc)
 {
        bug_insn_t insn;
 
-       if (pc < PAGE_OFFSET)
+       if (pc < VMALLOC_START)
                return 0;
        if (probe_kernel_address((bug_insn_t *)pc, insn))
                return 0;
-       return (insn == __BUG_INSN);
+       if ((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32)
+               return (insn == __BUG_INSN_32);
+       else
+               return ((insn & __COMPRESSED_INSN_MASK) == __BUG_INSN_16);
 }
 #endif /* CONFIG_GENERIC_BUG */
 
@@ -159,9 +173,9 @@ void __init trap_init(void)
         * Set sup0 scratch register to 0, indicating to exception vector
         * that we are presently executing in the kernel
         */
-       csr_write(sscratch, 0);
+       csr_write(CSR_SSCRATCH, 0);
        /* Set the exception vector address */
-       csr_write(stvec, &handle_exception);
+       csr_write(CSR_STVEC, &handle_exception);
        /* Enable all interrupts */
-       csr_write(sie, -1);
+       csr_write(CSR_SIE, -1);
 }
index fec62b2..f1d6ffe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Copied from arch/tile/kernel/vdso/Makefile
 
 # Symbols present in the vdso
@@ -36,7 +37,7 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
 # these symbols in the kernel code rather than hand-coded addresses.
 
 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
-                            $(call cc-ldoption, -Wl$(comma)--hash-style=both)
+       -Wl,--hash-style=both
 $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
        $(call if_changed,vdsold)
 
index 4e2e600..8e364eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 lib-y  += delay.o
 lib-y  += memcpy.o
 lib-y  += memset.o
index b68aac7..fc51d3b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 CFLAGS_init.o := -mcmodel=medany
 ifdef CONFIG_FTRACE
@@ -9,3 +10,5 @@ obj-y += fault.o
 obj-y += extable.o
 obj-y += ioremap.o
 obj-y += cacheflush.o
+obj-y += context.o
+obj-y += sifive_l2_cache.o
index 498c0a0..497b7d0 100644 (file)
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 
+#ifdef CONFIG_SMP
+
+#include <asm/sbi.h>
+
+void flush_icache_all(void)
+{
+       sbi_remote_fence_i(NULL);
+}
+
+/*
+ * Performs an icache flush for the given MM context.  RISC-V has no direct
+ * mechanism for instruction cache shoot downs, so instead we send an IPI that
+ * informs the remote harts they need to flush their local instruction caches.
+ * To avoid pathologically slow behavior in a common case (a bunch of
+ * single-hart processes on a many-hart machine, ie 'make -j') we avoid the
+ * IPIs for harts that are not currently executing a MM context and instead
+ * schedule a deferred local instruction cache flush to be performed before
+ * execution resumes on each hart.
+ */
+void flush_icache_mm(struct mm_struct *mm, bool local)
+{
+       unsigned int cpu;
+       cpumask_t others, hmask, *mask;
+
+       preempt_disable();
+
+       /* Mark every hart's icache as needing a flush for this MM. */
+       mask = &mm->context.icache_stale_mask;
+       cpumask_setall(mask);
+       /* Flush this hart's I$ now, and mark it as flushed. */
+       cpu = smp_processor_id();
+       cpumask_clear_cpu(cpu, mask);
+       local_flush_icache_all();
+
+       /*
+        * Flush the I$ of other harts concurrently executing, and mark them as
+        * flushed.
+        */
+       cpumask_andnot(&others, mm_cpumask(mm), cpumask_of(cpu));
+       local |= cpumask_empty(&others);
+       if (mm != current->active_mm || !local) {
+               cpumask_clear(&hmask);
+               riscv_cpuid_to_hartid_mask(&others, &hmask);
+               sbi_remote_fence_i(hmask.bits);
+       } else {
+               /*
+                * It's assumed that at least one strongly ordered operation is
+                * performed on this hart between setting a hart's cpumask bit
+                * and scheduling this MM context on that hart.  Sending an SBI
+                * remote message will do this, but in the case where no
+                * messages are sent we still need to order this hart's writes
+                * with flush_icache_deferred().
+                */
+               smp_mb();
+       }
+
+       preempt_enable();
+}
+
+#endif /* CONFIG_SMP */
+
 void flush_icache_pte(pte_t pte)
 {
        struct page *page = pte_page(pte);
diff --git a/arch/riscv/mm/context.c b/arch/riscv/mm/context.c
new file mode 100644 (file)
index 0000000..89ceb3c
--- /dev/null
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2012 Regents of the University of California
+ * Copyright (C) 2017 SiFive
+ */
+
+#include <linux/mm.h>
+#include <asm/tlbflush.h>
+#include <asm/cacheflush.h>
+
+/*
+ * When necessary, performs a deferred icache flush for the given MM context,
+ * on the local CPU.  RISC-V has no direct mechanism for instruction cache
+ * shoot downs, so instead we send an IPI that informs the remote harts they
+ * need to flush their local instruction caches.  To avoid pathologically slow
+ * behavior in a common case (a bunch of single-hart processes on a many-hart
+ * machine, ie 'make -j') we avoid the IPIs for harts that are not currently
+ * executing a MM context and instead schedule a deferred local instruction
+ * cache flush to be performed before execution resumes on each hart.  This
+ * actually performs that local instruction cache flush, which implicitly only
+ * refers to the current hart.
+ */
+static inline void flush_icache_deferred(struct mm_struct *mm)
+{
+#ifdef CONFIG_SMP
+       unsigned int cpu = smp_processor_id();
+       cpumask_t *mask = &mm->context.icache_stale_mask;
+
+       if (cpumask_test_cpu(cpu, mask)) {
+               cpumask_clear_cpu(cpu, mask);
+               /*
+                * Ensure the remote hart's writes are visible to this hart.
+                * This pairs with a barrier in flush_icache_mm.
+                */
+               smp_mb();
+               local_flush_icache_all();
+       }
+
+#endif
+}
+
+void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+       struct task_struct *task)
+{
+       unsigned int cpu;
+
+       if (unlikely(prev == next))
+               return;
+
+       /*
+        * Mark the current MM context as inactive, and the next as
+        * active.  This is at least used by the icache flushing
+        * routines in order to determine who should be flushed.
+        */
+       cpu = smp_processor_id();
+
+       cpumask_clear_cpu(cpu, mm_cpumask(prev));
+       cpumask_set_cpu(cpu, mm_cpumask(next));
+
+       /*
+        * Use the old spbtr name instead of using the current satp
+        * name to support binutils 2.29 which doesn't know about the
+        * privileged ISA 1.10 yet.
+        */
+       csr_write(sptbr, virt_to_pfn(next->pgd) | SATP_MODE);
+       local_flush_tlb_all();
+
+       flush_icache_deferred(next);
+}
index 88401d5..cec8be9 100644 (file)
@@ -229,8 +229,9 @@ vmalloc_fault:
                pte_t *pte_k;
                int index;
 
+               /* User mode accesses just cause a SIGSEGV */
                if (user_mode(regs))
-                       goto bad_area;
+                       return do_trap(regs, SIGSEGV, code, addr, tsk);
 
                /*
                 * Synchronize this task's top level page-table
@@ -239,13 +240,9 @@ vmalloc_fault:
                 * Do _not_ use "tsk->active_mm->pgd" here.
                 * We might be inside an interrupt in the middle
                 * of a task switch.
-                *
-                * Note: Use the old spbtr name instead of using the current
-                * satp name to support binutils 2.29 which doesn't know about
-                * the privileged ISA 1.10 yet.
                 */
                index = pgd_index(addr);
-               pgd = (pgd_t *)pfn_to_virt(csr_read(sptbr)) + index;
+               pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index;
                pgd_k = init_mm.pgd + index;
 
                if (!pgd_present(*pgd_k))
diff --git a/arch/riscv/mm/sifive_l2_cache.c b/arch/riscv/mm/sifive_l2_cache.c
new file mode 100644 (file)
index 0000000..4eb6461
--- /dev/null
@@ -0,0 +1,175 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SiFive L2 cache controller Driver
+ *
+ * Copyright (C) 2018-2019 SiFive, Inc.
+ *
+ */
+#include <linux/debugfs.h>
+#include <linux/interrupt.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+#include <asm/sifive_l2_cache.h>
+
+#define SIFIVE_L2_DIRECCFIX_LOW 0x100
+#define SIFIVE_L2_DIRECCFIX_HIGH 0x104
+#define SIFIVE_L2_DIRECCFIX_COUNT 0x108
+
+#define SIFIVE_L2_DATECCFIX_LOW 0x140
+#define SIFIVE_L2_DATECCFIX_HIGH 0x144
+#define SIFIVE_L2_DATECCFIX_COUNT 0x148
+
+#define SIFIVE_L2_DATECCFAIL_LOW 0x160
+#define SIFIVE_L2_DATECCFAIL_HIGH 0x164
+#define SIFIVE_L2_DATECCFAIL_COUNT 0x168
+
+#define SIFIVE_L2_CONFIG 0x00
+#define SIFIVE_L2_WAYENABLE 0x08
+#define SIFIVE_L2_ECCINJECTERR 0x40
+
+#define SIFIVE_L2_MAX_ECCINTR 3
+
+static void __iomem *l2_base;
+static int g_irq[SIFIVE_L2_MAX_ECCINTR];
+
+enum {
+       DIR_CORR = 0,
+       DATA_CORR,
+       DATA_UNCORR,
+};
+
+#ifdef CONFIG_DEBUG_FS
+static struct dentry *sifive_test;
+
+static ssize_t l2_write(struct file *file, const char __user *data,
+                       size_t count, loff_t *ppos)
+{
+       unsigned int val;
+
+       if (kstrtouint_from_user(data, count, 0, &val))
+               return -EINVAL;
+       if ((val >= 0 && val < 0xFF) || (val >= 0x10000 && val < 0x100FF))
+               writel(val, l2_base + SIFIVE_L2_ECCINJECTERR);
+       else
+               return -EINVAL;
+       return count;
+}
+
+static const struct file_operations l2_fops = {
+       .owner = THIS_MODULE,
+       .open = simple_open,
+       .write = l2_write
+};
+
+static void setup_sifive_debug(void)
+{
+       sifive_test = debugfs_create_dir("sifive_l2_cache", NULL);
+
+       debugfs_create_file("sifive_debug_inject_error", 0200,
+                           sifive_test, NULL, &l2_fops);
+}
+#endif
+
+static void l2_config_read(void)
+{
+       u32 regval, val;
+
+       regval = readl(l2_base + SIFIVE_L2_CONFIG);
+       val = regval & 0xFF;
+       pr_info("L2CACHE: No. of Banks in the cache: %d\n", val);
+       val = (regval & 0xFF00) >> 8;
+       pr_info("L2CACHE: No. of ways per bank: %d\n", val);
+       val = (regval & 0xFF0000) >> 16;
+       pr_info("L2CACHE: Sets per bank: %llu\n", (uint64_t)1 << val);
+       val = (regval & 0xFF000000) >> 24;
+       pr_info("L2CACHE: Bytes per cache block: %llu\n", (uint64_t)1 << val);
+
+       regval = readl(l2_base + SIFIVE_L2_WAYENABLE);
+       pr_info("L2CACHE: Index of the largest way enabled: %d\n", regval);
+}
+
+static const struct of_device_id sifive_l2_ids[] = {
+       { .compatible = "sifive,fu540-c000-ccache" },
+       { /* end of table */ },
+};
+
+static ATOMIC_NOTIFIER_HEAD(l2_err_chain);
+
+int register_sifive_l2_error_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_register(&l2_err_chain, nb);
+}
+EXPORT_SYMBOL_GPL(register_sifive_l2_error_notifier);
+
+int unregister_sifive_l2_error_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_unregister(&l2_err_chain, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_sifive_l2_error_notifier);
+
+static irqreturn_t l2_int_handler(int irq, void *device)
+{
+       unsigned int regval, add_h, add_l;
+
+       if (irq == g_irq[DIR_CORR]) {
+               add_h = readl(l2_base + SIFIVE_L2_DIRECCFIX_HIGH);
+               add_l = readl(l2_base + SIFIVE_L2_DIRECCFIX_LOW);
+               pr_err("L2CACHE: DirError @ 0x%08X.%08X\n", add_h, add_l);
+               regval = readl(l2_base + SIFIVE_L2_DIRECCFIX_COUNT);
+               atomic_notifier_call_chain(&l2_err_chain, SIFIVE_L2_ERR_TYPE_CE,
+                                          "DirECCFix");
+       }
+       if (irq == g_irq[DATA_CORR]) {
+               add_h = readl(l2_base + SIFIVE_L2_DATECCFIX_HIGH);
+               add_l = readl(l2_base + SIFIVE_L2_DATECCFIX_LOW);
+               pr_err("L2CACHE: DataError @ 0x%08X.%08X\n", add_h, add_l);
+               regval = readl(l2_base + SIFIVE_L2_DATECCFIX_COUNT);
+               atomic_notifier_call_chain(&l2_err_chain, SIFIVE_L2_ERR_TYPE_CE,
+                                          "DatECCFix");
+       }
+       if (irq == g_irq[DATA_UNCORR]) {
+               add_h = readl(l2_base + SIFIVE_L2_DATECCFAIL_HIGH);
+               add_l = readl(l2_base + SIFIVE_L2_DATECCFAIL_LOW);
+               pr_err("L2CACHE: DataFail @ 0x%08X.%08X\n", add_h, add_l);
+               regval = readl(l2_base + SIFIVE_L2_DATECCFAIL_COUNT);
+               atomic_notifier_call_chain(&l2_err_chain, SIFIVE_L2_ERR_TYPE_UE,
+                                          "DatECCFail");
+       }
+
+       return IRQ_HANDLED;
+}
+
+int __init sifive_l2_init(void)
+{
+       struct device_node *np;
+       struct resource res;
+       int i, rc;
+
+       np = of_find_matching_node(NULL, sifive_l2_ids);
+       if (!np)
+               return -ENODEV;
+
+       if (of_address_to_resource(np, 0, &res))
+               return -ENODEV;
+
+       l2_base = ioremap(res.start, resource_size(&res));
+       if (!l2_base)
+               return -ENOMEM;
+
+       for (i = 0; i < SIFIVE_L2_MAX_ECCINTR; i++) {
+               g_irq[i] = irq_of_parse_and_map(np, i);
+               rc = request_irq(g_irq[i], l2_int_handler, 0, "l2_ecc", NULL);
+               if (rc) {
+                       pr_err("L2CACHE: Could not request IRQ %d\n", g_irq[i]);
+                       return rc;
+               }
+       }
+
+       l2_config_read();
+
+#ifdef CONFIG_DEBUG_FS
+       setup_sifive_debug();
+#endif
+       return 0;
+}
+device_initcall(sifive_l2_init);
index a132220..ec5b147 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
index df1d6a1..de8521f 100644 (file)
@@ -10,6 +10,8 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
+KBUILD_DEFCONFIG := defconfig
+
 LD_BFD         := elf64-s390
 KBUILD_LDFLAGS := -m elf64_s390
 KBUILD_AFLAGS_MODULE += -fPIC
index c51496b..7cba96e 100644 (file)
@@ -58,7 +58,6 @@ define cmd_section_cmp
        touch $@
 endef
 
-OBJCOPYFLAGS_bzImage := --pad-to $$(readelf -s $(obj)/compressed/vmlinux | awk '/\<_end\>/ {print or(strtonum("0x"$$2),4095)+1}')
 $(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE
        $(call if_changed,objcopy)
 
index 112b8d9..635217e 100644 (file)
@@ -77,6 +77,8 @@ SECTIONS
                _compressed_start = .;
                *(.vmlinux.bin.compressed)
                _compressed_end = .;
+               FILL(0xff);
+               . = ALIGN(4096);
        }
        . = ALIGN(256);
        .bss : {
index 3cc52e3..2769675 100644 (file)
@@ -28,6 +28,7 @@
 #define CPACF_KMCTR            0xb92d          /* MSA4 */
 #define CPACF_PRNO             0xb93c          /* MSA5 */
 #define CPACF_KMA              0xb929          /* MSA8 */
+#define CPACF_KDSA             0xb93a          /* MSA9 */
 
 /*
  * En/decryption modifier bits
@@ -202,7 +203,7 @@ static inline int __cpacf_check_opcode(unsigned int opcode)
        }
 }
 
-static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
+static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
 {
        if (__cpacf_check_opcode(opcode)) {
                __cpacf_query(opcode, mask);
index c47e22b..bdbc81b 100644 (file)
@@ -278,6 +278,7 @@ struct kvm_s390_sie_block {
 #define ECD_HOSTREGMGMT        0x20000000
 #define ECD_MEF                0x08000000
 #define ECD_ETOKENF    0x02000000
+#define ECD_ECC                0x00200000
        __u32   ecd;                    /* 0x01c8 */
        __u8    reserved1cc[18];        /* 0x01cc */
        __u64   pp;                     /* 0x01de */
@@ -312,6 +313,7 @@ struct kvm_vcpu_stat {
        u64 halt_successful_poll;
        u64 halt_attempted_poll;
        u64 halt_poll_invalid;
+       u64 halt_no_poll_steal;
        u64 halt_wakeup;
        u64 instruction_lctl;
        u64 instruction_lctlg;
index 672f95b..818612b 100644 (file)
 
 #include <asm/ptrace.h>
 
-static inline int klp_check_compiler_support(void)
-{
-       return 0;
-}
-
 static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
 {
        regs->psw.addr = ip;
diff --git a/arch/s390/include/asm/segment.h b/arch/s390/include/asm/segment.h
deleted file mode 100644 (file)
index 97a0582..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _ASM_SEGMENT_H
-#define _ASM_SEGMENT_H
-
-#endif
index 16511d9..47104e5 100644 (file)
@@ -152,7 +152,10 @@ struct kvm_s390_vm_cpu_subfunc {
        __u8 pcc[16];           /* with MSA4 */
        __u8 ppno[16];          /* with MSA5 */
        __u8 kma[16];           /* with MSA8 */
-       __u8 reserved[1808];
+       __u8 kdsa[16];          /* with MSA9 */
+       __u8 sortl[32];         /* with STFLE.150 */
+       __u8 dfltcc[32];        /* with STFLE.151 */
+       __u8 reserved[1728];
 };
 
 /* kvm attributes for crypto */
index cd3df55..ad71132 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/seccomp.h>
 #include <linux/compat.h>
 #include <trace/syscall.h>
-#include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
index 061418f..e822b29 100644 (file)
 425  common    io_uring_setup          sys_io_uring_setup              sys_io_uring_setup
 426  common    io_uring_enter          sys_io_uring_enter              sys_io_uring_enter
 427  common    io_uring_register       sys_io_uring_register           sys_io_uring_register
+428  common    open_tree               sys_open_tree                   sys_open_tree
+429  common    move_mount              sys_move_mount                  sys_move_mount
+430  common    fsopen                  sys_fsopen                      sys_fsopen
+431  common    fsconfig                sys_fsconfig                    sys_fsconfig
+432  common    fsmount                 sys_fsmount                     sys_fsmount
+433  common    fspick                  sys_fspick                      sys_fspick
index 1816ee4..d3db3d7 100644 (file)
@@ -30,6 +30,7 @@ config KVM
        select HAVE_KVM_IRQFD
        select HAVE_KVM_IRQ_ROUTING
        select HAVE_KVM_INVALID_WAKEUPS
+       select HAVE_KVM_NO_POLL
        select SRCU
        select KVM_VFIO
        ---help---
index 1fd706f..9dde4d7 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/kvm_host.h>
 #include <linux/hrtimer.h>
 #include <linux/mmu_context.h>
+#include <linux/nospec.h>
 #include <linux/signal.h>
 #include <linux/slab.h>
 #include <linux/bitmap.h>
@@ -2307,6 +2308,7 @@ static struct s390_io_adapter *get_io_adapter(struct kvm *kvm, unsigned int id)
 {
        if (id >= MAX_S390_IO_ADAPTERS)
                return NULL;
+       id = array_index_nospec(id, MAX_S390_IO_ADAPTERS);
        return kvm->arch.adapters[id];
 }
 
@@ -2320,8 +2322,13 @@ static int register_io_adapter(struct kvm_device *dev,
                           (void __user *)attr->addr, sizeof(adapter_info)))
                return -EFAULT;
 
-       if ((adapter_info.id >= MAX_S390_IO_ADAPTERS) ||
-           (dev->kvm->arch.adapters[adapter_info.id] != NULL))
+       if (adapter_info.id >= MAX_S390_IO_ADAPTERS)
+               return -EINVAL;
+
+       adapter_info.id = array_index_nospec(adapter_info.id,
+                                            MAX_S390_IO_ADAPTERS);
+
+       if (dev->kvm->arch.adapters[adapter_info.id] != NULL)
                return -EINVAL;
 
        adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
index 4638303..8d6d75d 100644 (file)
@@ -75,6 +75,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "halt_successful_poll", VCPU_STAT(halt_successful_poll) },
        { "halt_attempted_poll", VCPU_STAT(halt_attempted_poll) },
        { "halt_poll_invalid", VCPU_STAT(halt_poll_invalid) },
+       { "halt_no_poll_steal", VCPU_STAT(halt_no_poll_steal) },
        { "halt_wakeup", VCPU_STAT(halt_wakeup) },
        { "instruction_lctlg", VCPU_STAT(instruction_lctlg) },
        { "instruction_lctl", VCPU_STAT(instruction_lctl) },
@@ -177,6 +178,11 @@ static int hpage;
 module_param(hpage, int, 0444);
 MODULE_PARM_DESC(hpage, "1m huge page backing support");
 
+/* maximum percentage of steal time for polling.  >100 is treated like 100 */
+static u8 halt_poll_max_steal = 10;
+module_param(halt_poll_max_steal, byte, 0644);
+MODULE_PARM_DESC(hpage, "Maximum percentage of steal time to allow polling");
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -321,6 +327,22 @@ static inline int plo_test_bit(unsigned char nr)
        return cc == 0;
 }
 
+static inline void __insn32_query(unsigned int opcode, u8 query[32])
+{
+       register unsigned long r0 asm("0") = 0; /* query function */
+       register unsigned long r1 asm("1") = (unsigned long) query;
+
+       asm volatile(
+               /* Parameter regs are ignored */
+               "       .insn   rrf,%[opc] << 16,2,4,6,0\n"
+               : "=m" (*query)
+               : "d" (r0), "a" (r1), [opc] "i" (opcode)
+               : "cc");
+}
+
+#define INSN_SORTL 0xb938
+#define INSN_DFLTCC 0xb939
+
 static void kvm_s390_cpu_feat_init(void)
 {
        int i;
@@ -368,6 +390,16 @@ static void kvm_s390_cpu_feat_init(void)
                __cpacf_query(CPACF_KMA, (cpacf_mask_t *)
                              kvm_s390_available_subfunc.kma);
 
+       if (test_facility(155)) /* MSA9 */
+               __cpacf_query(CPACF_KDSA, (cpacf_mask_t *)
+                             kvm_s390_available_subfunc.kdsa);
+
+       if (test_facility(150)) /* SORTL */
+               __insn32_query(INSN_SORTL, kvm_s390_available_subfunc.sortl);
+
+       if (test_facility(151)) /* DFLTCC */
+               __insn32_query(INSN_DFLTCC, kvm_s390_available_subfunc.dfltcc);
+
        if (MACHINE_HAS_ESOP)
                allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
        /*
@@ -513,9 +545,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                else if (sclp.has_esca && sclp.has_64bscao)
                        r = KVM_S390_ESCA_CPU_SLOTS;
                break;
-       case KVM_CAP_NR_MEMSLOTS:
-               r = KVM_USER_MEM_SLOTS;
-               break;
        case KVM_CAP_S390_COW:
                r = MACHINE_HAS_ESOP;
                break;
@@ -657,6 +686,14 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
                                set_kvm_facility(kvm->arch.model.fac_mask, 135);
                                set_kvm_facility(kvm->arch.model.fac_list, 135);
                        }
+                       if (test_facility(148)) {
+                               set_kvm_facility(kvm->arch.model.fac_mask, 148);
+                               set_kvm_facility(kvm->arch.model.fac_list, 148);
+                       }
+                       if (test_facility(152)) {
+                               set_kvm_facility(kvm->arch.model.fac_mask, 152);
+                               set_kvm_facility(kvm->arch.model.fac_list, 152);
+                       }
                        r = 0;
                } else
                        r = -EINVAL;
@@ -1323,6 +1360,19 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
        VM_EVENT(kvm, 3, "SET: guest KMA    subfunc 0x%16.16lx.%16.16lx",
                 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0],
                 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]);
+       VM_EVENT(kvm, 3, "SET: guest KDSA   subfunc 0x%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
+       VM_EVENT(kvm, 3, "SET: guest SORTL  subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
+       VM_EVENT(kvm, 3, "SET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
 
        return 0;
 }
@@ -1491,6 +1541,19 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm,
        VM_EVENT(kvm, 3, "GET: guest KMA    subfunc 0x%16.16lx.%16.16lx",
                 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0],
                 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]);
+       VM_EVENT(kvm, 3, "GET: guest KDSA   subfunc 0x%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
+       VM_EVENT(kvm, 3, "GET: guest SORTL  subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
+       VM_EVENT(kvm, 3, "GET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
 
        return 0;
 }
@@ -1546,6 +1609,19 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm,
        VM_EVENT(kvm, 3, "GET: host  KMA    subfunc 0x%16.16lx.%16.16lx",
                 ((unsigned long *) &kvm_s390_available_subfunc.kma)[0],
                 ((unsigned long *) &kvm_s390_available_subfunc.kma)[1]);
+       VM_EVENT(kvm, 3, "GET: host  KDSA   subfunc 0x%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm_s390_available_subfunc.kdsa)[0],
+                ((unsigned long *) &kvm_s390_available_subfunc.kdsa)[1]);
+       VM_EVENT(kvm, 3, "GET: host  SORTL  subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm_s390_available_subfunc.sortl)[0],
+                ((unsigned long *) &kvm_s390_available_subfunc.sortl)[1],
+                ((unsigned long *) &kvm_s390_available_subfunc.sortl)[2],
+                ((unsigned long *) &kvm_s390_available_subfunc.sortl)[3]);
+       VM_EVENT(kvm, 3, "GET: host  DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[0],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[1],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[2],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[3]);
 
        return 0;
 }
@@ -2817,6 +2893,25 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
        vcpu->arch.enabled_gmap = vcpu->arch.gmap;
 }
 
+static bool kvm_has_pckmo_subfunc(struct kvm *kvm, unsigned long nr)
+{
+       if (test_bit_inv(nr, (unsigned long *)&kvm->arch.model.subfuncs.pckmo) &&
+           test_bit_inv(nr, (unsigned long *)&kvm_s390_available_subfunc.pckmo))
+               return true;
+       return false;
+}
+
+static bool kvm_has_pckmo_ecc(struct kvm *kvm)
+{
+       /* At least one ECC subfunction must be present */
+       return kvm_has_pckmo_subfunc(kvm, 32) ||
+              kvm_has_pckmo_subfunc(kvm, 33) ||
+              kvm_has_pckmo_subfunc(kvm, 34) ||
+              kvm_has_pckmo_subfunc(kvm, 40) ||
+              kvm_has_pckmo_subfunc(kvm, 41);
+
+}
+
 static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu)
 {
        /*
@@ -2829,13 +2924,19 @@ static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu)
        vcpu->arch.sie_block->crycbd = vcpu->kvm->arch.crypto.crycbd;
        vcpu->arch.sie_block->ecb3 &= ~(ECB3_AES | ECB3_DEA);
        vcpu->arch.sie_block->eca &= ~ECA_APIE;
+       vcpu->arch.sie_block->ecd &= ~ECD_ECC;
 
        if (vcpu->kvm->arch.crypto.apie)
                vcpu->arch.sie_block->eca |= ECA_APIE;
 
        /* Set up protected key support */
-       if (vcpu->kvm->arch.crypto.aes_kw)
+       if (vcpu->kvm->arch.crypto.aes_kw) {
                vcpu->arch.sie_block->ecb3 |= ECB3_AES;
+               /* ecc is also wrapped with AES key */
+               if (kvm_has_pckmo_ecc(vcpu->kvm))
+                       vcpu->arch.sie_block->ecd |= ECD_ECC;
+       }
+
        if (vcpu->kvm->arch.crypto.dea_kw)
                vcpu->arch.sie_block->ecb3 |= ECB3_DEA;
 }
@@ -3068,6 +3169,17 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
        }
 }
 
+bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
+{
+       /* do not poll with more than halt_poll_max_steal percent of steal time */
+       if (S390_lowcore.avg_steal_timer * 100 / (TICK_USEC << 12) >=
+           halt_poll_max_steal) {
+               vcpu->stat.halt_no_poll_steal++;
+               return true;
+       }
+       return false;
+}
+
 int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
 {
        /* kvm common code refers to this, but never calls it */
index d62fa14..076090f 100644 (file)
@@ -288,7 +288,9 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
        const u32 crycb_addr = crycbd_o & 0x7ffffff8U;
        unsigned long *b1, *b2;
        u8 ecb3_flags;
+       u32 ecd_flags;
        int apie_h;
+       int apie_s;
        int key_msk = test_kvm_facility(vcpu->kvm, 76);
        int fmt_o = crycbd_o & CRYCB_FORMAT_MASK;
        int fmt_h = vcpu->arch.sie_block->crycbd & CRYCB_FORMAT_MASK;
@@ -297,7 +299,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
        scb_s->crycbd = 0;
 
        apie_h = vcpu->arch.sie_block->eca & ECA_APIE;
-       if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0))
+       apie_s = apie_h & scb_o->eca;
+       if (!apie_s && (!key_msk || (fmt_o == CRYCB_FORMAT0)))
                return 0;
 
        if (!crycb_addr)
@@ -308,7 +311,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
                    ((crycb_addr + 128) & PAGE_MASK))
                        return set_validity_icpt(scb_s, 0x003CU);
 
-       if (apie_h && (scb_o->eca & ECA_APIE)) {
+       if (apie_s) {
                ret = setup_apcb(vcpu, &vsie_page->crycb, crycb_addr,
                                 vcpu->kvm->arch.crypto.crycb,
                                 fmt_o, fmt_h);
@@ -320,7 +323,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
        /* we may only allow it if enabled for guest 2 */
        ecb3_flags = scb_o->ecb3 & vcpu->arch.sie_block->ecb3 &
                     (ECB3_AES | ECB3_DEA);
-       if (!ecb3_flags)
+       ecd_flags = scb_o->ecd & vcpu->arch.sie_block->ecd & ECD_ECC;
+       if (!ecb3_flags && !ecd_flags)
                goto end;
 
        /* copy only the wrapping keys */
@@ -329,6 +333,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
                return set_validity_icpt(scb_s, 0x0035U);
 
        scb_s->ecb3 |= ecb3_flags;
+       scb_s->ecd |= ecd_flags;
 
        /* xor both blocks in one run */
        b1 = (unsigned long *) vsie_page->crycb.dea_wrapping_key_mask;
@@ -339,7 +344,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 end:
        switch (ret) {
        case -EINVAL:
-               return set_validity_icpt(scb_s, 0x0020U);
+               return set_validity_icpt(scb_s, 0x0022U);
        case -EFAULT:
                return set_validity_icpt(scb_s, 0x0035U);
        case -EACCES:
index 01892dc..0c1f257 100644 (file)
@@ -28,7 +28,7 @@ static void __init kasan_early_panic(const char *reason)
 {
        sclp_early_printk("The Linux kernel failed to boot with the KernelAddressSanitizer:\n");
        sclp_early_printk(reason);
-       disabled_wait(0);
+       disabled_wait();
 }
 
 static void * __init kasan_early_alloc_segment(void)
index fd788e0..cead9e0 100644 (file)
@@ -93,6 +93,9 @@ static struct facility_def facility_defs[] = {
                        131, /* enhanced-SOP 2 and side-effect */
                        139, /* multiple epoch facility */
                        146, /* msa extension 8 */
+                       150, /* enhanced sort */
+                       151, /* deflate conversion */
+                       155, /* msa extension 9 */
                        -1  /* END */
                }
        },
index 4009bef..b4a86f2 100644 (file)
@@ -191,8 +191,8 @@ cpuincdir-y                 += cpu-common   # Must be last
 drivers-y                      += arch/sh/drivers/
 drivers-$(CONFIG_OPROFILE)     += arch/sh/oprofile/
 
-cflags-y       += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
-                  $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
+cflags-y       += $(foreach d, $(cpuincdir-y), -I $(srctree)/arch/sh/include/$(d)) \
+                  $(foreach d, $(machdir-y), -I $(srctree)/arch/sh/include/$(d))
 
 KBUILD_CFLAGS          += -pipe $(cflags-y)
 KBUILD_CPPFLAGS                += $(cflags-y)
index 346eda7..abf19a9 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/irq.h>
 #include <linux/clk.h>
 #include <asm/machvec.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/clock.h>
 
 static struct mtd_partition nor_flash_partitions[] = {
index 4efa9c5..fa031a1 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/irq.h>
 #include <linux/clk.h>
 #include <asm/machvec.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /* Dummy supplies, where voltage doesn't matter */
 static struct regulator_consumer_supply dummy_supplies[] = {
index 67a8803..0de7d60 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/smc91x.h>
 #include <linux/sh_intc.h>
 #include <asm/machvec.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #define SMC_IOBASE     0xA2000000
 #define SMC_IO_OFFSET  0x300
index 0fbe91c..7569d85 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/addrspace.h>
 #include <asm/delay.h>
 #include <asm/i2c-sh7760.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /* Bus state controller registers for CS4 area */
 #define BSC_CS4BCR     0xA4FD0010
index f478fee..6e784b5 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/sh_eth.h>
 #include <linux/sh_intc.h>
 #include <asm/machvec.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 /* NOR Flash */
 static struct mtd_partition espt_nor_flash_partitions[] = {
index 799af57..dad2b3b 100644 (file)
@@ -21,7 +21,7 @@
 #include <mach/urquell.h>
 #include <cpu/sh7786.h>
 #include <asm/heartbeat.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/smp-ops.h>
 
 /*
index 706b48f..f4a777f 100644 (file)
@@ -15,7 +15,7 @@
 #include <mach/microdev.h>
 #include <asm/io.h>
 #include <asm/machvec.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 static struct resource smc91x_resources[] = {
        [0] = {
index 6d2a3d3..895576f 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/io.h>
 #include <linux/bcd.h>
 #include <mach/fpga.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #define FPGA_REGS_OFFSET       0x03fff800
 #define FPGA_REGS_SIZE         0x490
index 65721c3..d183026 100644 (file)
@@ -19,7 +19,7 @@
 #include <mach/irq.h>
 #include <asm/machvec.h>
 #include <asm/heartbeat.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/clock.h>
 #include <asm/reboot.h>
 #include <asm/smp-ops.h>
index d76cdb7..7c6ca97 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/string.h>
 #include <mach/fpga.h>
 #include <asm/sram.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 static int __init fpga_sram_init(void)
 {
index 39a3175..1aedbfe 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/irqdomain.h>
 #include <linux/io.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach-se/mach/se7343.h>
 
 #define PA_CPLD_BASE_ADDR      0x11400000
index f6e3009..6d34592 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/err.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach-se/mach/se7722.h>
 
 #define IRQ01_BASE_ADDR        0x11800000
index 541087d..f50fdd9 100644 (file)
@@ -1,3 +1,4 @@
 zImage
 vmlinux*
 uImage*
+!vmlinux.scr
index 2563d1e..c17d65b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
 obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
 endif
index 59c3483..6673e0a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HD64461)  += hd64461.o
 
 ccflags-y := -Werror
index 1b9e5ca..11ed21c 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/io.h>
 #include "pci-sh4.h"
 #include <asm/addrspace.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 static int __init __area_sdram_check(struct pci_channel *chan,
                                     unsigned int area)
index 3fd0f39..287b3a6 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/log2.h>
 #include "pci-sh4.h"
 #include <asm/mmu.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #if defined(CONFIG_CPU_BIG_ENDIAN)
 # define PCICR_ENDIANNESS SH4_PCICR_BSWP
index a58b77c..e0b568a 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/sh_intc.h>
 #include <cpu/sh7786.h>
 #include "pcie-sh7786.h"
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 struct sh7786_pcie_port {
        struct pci_channel      *hose;
index 73fff39..51a54df 100644 (file)
@@ -18,6 +18,5 @@ generic-y += parport.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += serial.h
-generic-y += sizes.h
 generic-y += trace_clock.h
 generic-y += xor.h
index 480b057..016a727 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 5db6579..6e86644 100644 (file)
@@ -15,8 +15,7 @@ quiet_cmd_syscall = SYSCALL $@
 
 export CPPFLAGS_vsyscall.lds += -P -C -Ush
 
-vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
-               $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 -Wl,--hash-style=sysv
 
 SYSCFLAGS_vsyscall-trapa.so    = $(vsyscall-flags)
 
index 638b342..ba06e42 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  := math.o
index b95e343..13c6a6b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/arch/sh/mm/init.c
  *
@@ -26,7 +27,7 @@
 #include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/cache.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
index 7b2cc49..a53a040 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/spinlock.h>
 #include <linux/vmalloc.h>
 #include <asm/cacheflush.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
index 010010b..bd1585e 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/init.h>
 #include <linux/module.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/page.h>
 #include <asm/addrspace.h>
 
index 7c93f31..26ab6f5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config 64BIT
        bool "64-bit kernel" if "$(ARCH)" = "sparc"
        default "$(ARCH)" = "sparc64"
index a9b8b0b..57b4741 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for AES encryption optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon arch/x86/crypto/aesni-intel_glue.c
index 900d5c6..3823f94 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for CAMELLIA encryption optimized for sparc64 crypto opcodes.
  *
  * Copyright (C) 2012 David S. Miller <davem@davemloft.net>
index 8aa6646..1299073 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for CRC32C optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon arch/x86/crypto/crc32c-intel.c
index 453a4cf..281448f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for DES encryption optimized for sparc64 crypto opcodes.
  *
  * Copyright (C) 2012 David S. Miller <davem@davemloft.net>
index bc9cc26..14f6c15 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for MD5 hashing optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon arch/x86/crypto/sha1_ssse3_glue.c
index 4d6d7fa..7c16663 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for SHA1 hashing optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon arch/x86/crypto/sha1_ssse3_glue.c
index 54c4de2..f403ce9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for SHA256 hashing optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon crypto/sha256_generic.c
index 4c55e97..a3b532e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Glue code for SHA512 hashing optimized for sparc64 crypto opcodes.
  *
  * This is based largely upon crypto/sha512_generic.c
index 36196c1..79938fb 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #ifndef _ASM_UPROBES_H
 #define _ASM_UPROBES_H
 /*
@@ -5,19 +6,6 @@
  *
  * Copyright (C) 2013 Oracle, Inc.
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * Authors:
  *     Jose E. Marchesi <jose.marchesi@oracle.com>
  *     Eric Saint Etienne <eric.saint.etienne@oracle.com>
index 4f6676f..64c67f2 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 61fe1b9..6ff43df 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* chmc.c: Driver for UltraSPARC-III memory controller.
  *
  * Copyright (C) 2001, 2007, 2008 David S. Miller (davem@davemloft.net)
index cad08cc..bbf59b3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* ds.c: Domain Services driver for Logical Domains
  *
  * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
index e4e5b83..9b3f747 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
        .align  32
        .globl  __flushw_user
        .type   __flushw_user,#function
index 519f5ba..a6292f8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 8babbeb..060fff9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Pseudo NMI support on sparc64 systems.
  *
  * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
index b186b7f..b32cc56 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
index eb978c7..c0886b4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* pcr.c: Generic sparc64 performance counter infrastructure.
  *
  * Copyright (C) 2009 David S. Miller (davem@davemloft.net)
index e1d965e..c9d41a9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* ptrace.c: Sparc process tracing support.
  *
  * Copyright (C) 1996, 2008 David S. Miller (davem@davemloft.net)
index dd654e6..d8eb1d1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/sched.h>
 #include <linux/sched/debug.h>
 #include <linux/stacktrace.h>
index a1dd243..e047480 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 3eb7794..89fb05f 100644 (file)
@@ -653,19 +653,23 @@ static int sparc64_cpufreq_notifier(struct notifier_block *nb, unsigned long val
                                    void *data)
 {
        struct cpufreq_freqs *freq = data;
-       unsigned int cpu = freq->cpu;
-       struct freq_table *ft = &per_cpu(sparc64_freq_table, cpu);
+       unsigned int cpu;
+       struct freq_table *ft;
 
-       if (!ft->ref_freq) {
-               ft->ref_freq = freq->old;
-               ft->clock_tick_ref = cpu_data(cpu).clock_tick;
-       }
-       if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
-           (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
-               cpu_data(cpu).clock_tick =
-                       cpufreq_scale(ft->clock_tick_ref,
-                                     ft->ref_freq,
-                                     freq->new);
+       for_each_cpu(cpu, freq->policy->cpus) {
+               ft = &per_cpu(sparc64_freq_table, cpu);
+
+               if (!ft->ref_freq) {
+                       ft->ref_freq = freq->old;
+                       ft->clock_tick_ref = cpu_data(cpu).clock_tick;
+               }
+
+               if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
+                   (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
+                       cpu_data(cpu).clock_tick =
+                               cpufreq_scale(ft->clock_tick_ref, ft->ref_freq,
+                                             freq->new);
+               }
        }
 
        return 0;
index 0cd02a6..04aa588 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* arch/sparc64/kernel/traps.c
  *
  * Copyright (C) 1995,1997,2008,2009,2012 David S. Miller (davem@davemloft.net)
index c44bf5b..1a06002 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * User-space Probes (UProbes) for sparc
  *
  * Copyright (C) 2013 Oracle Inc.
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * Authors:
  *     Jose E. Marchesi <jose.marchesi@oracle.com>
  *     Eric Saint Etienne <eric.saint.etienne@oracle.com>
index a2b5a97..a738940 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC 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.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+ */
 
 #include <asm/export.h>
        .text
index 17a0f49..53054de 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC 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.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+ */
 
 #include <asm/export.h>
        .text
index 24e0a35..7a1117e 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC 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.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+ */
 
        .text
        .align 4
index 825dbee..aea8059 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the FPU instruction emulation.
 #
index d32aac3..806267d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Arch-specific network modules
 #
index e9feca1..fe906e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_OPROFILE) += oprofile.o
 
 DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
index 3201ace..d8f75e7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for Sparc-specific hibernate files.
 
 obj-$(CONFIG_HIBERNATION)      += hibernate.o hibernate_asm.o
index 83c4b46..5a9e4e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Building vDSO images for sparc.
 #
index 3645fcb..0bf78ff 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * arch/um/drivers/mmapper_kern.c
  *
index fca34b2..9f4b4bb 100644 (file)
@@ -22,7 +22,6 @@ static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
 }
 extern void arch_exit_mmap(struct mm_struct *mm);
 static inline void arch_unmap(struct mm_struct *mm,
-                       struct vm_area_struct *vma,
                        unsigned long start, unsigned long end)
 {
 }
index aebd01f..360cc9a 100644 (file)
@@ -119,7 +119,7 @@ CONFIG_I2C_PUV3=y
 #      Hardware Monitoring support
 #CONFIG_SENSORS_LM75=m
 #      Generic Thermal sysfs driver
-#CONFIG_THERMAL=m
+#CONFIG_THERMAL=y
 #CONFIG_THERMAL_HWMON=y
 
 #      Multimedia support
index b301a0b..5fe2426 100644 (file)
@@ -28,10 +28,8 @@ generic-y += parport.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += segment.h
 generic-y += serial.h
 generic-y += shmparam.h
-generic-y += sizes.h
 generic-y += syscalls.h
 generic-y += topology.h
 generic-y += trace_clock.h
index 66bb9f6..46cf27e 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <linux/compiler.h>
 #include <linux/const.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <mach/memory.h>
 
 /*
index 5c205a9..9f06ea5 100644 (file)
@@ -88,7 +88,6 @@ static inline int arch_dup_mmap(struct mm_struct *oldmm,
 }
 
 static inline void arch_unmap(struct mm_struct *mm,
-                       struct vm_area_struct *vma,
                        unsigned long start, unsigned long end)
 {
 }
index b4442f3..c994cdf 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/tlb.h>
 #include <asm/memblock.h>
 #include <mach/map.h>
index bf012b2..b69cb18 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <mach/map.h>
 #include "mm.h"
index aa2060b..f0ae623 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/cputype.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/tlb.h>
 #include <asm/memblock.h>
 
index 818b361..2bbbd4d 100644 (file)
@@ -31,6 +31,17 @@ config X86_64
        select SWIOTLB
        select ARCH_HAS_SYSCALL_WRAPPER
 
+config FORCE_DYNAMIC_FTRACE
+       def_bool y
+       depends on X86_32
+       depends on FUNCTION_TRACER
+       select DYNAMIC_FTRACE
+       help
+        We keep the static function tracing (!DYNAMIC_FTRACE) around
+        in order to test the non static function tracing in the
+        generic code, as other architectures still use it. But we
+        only need to keep it around for x86_64. No need to keep it
+        for x86_32. For x86_32, force DYNAMIC_FTRACE. 
 #
 # Arch settings
 #
@@ -259,9 +270,6 @@ config GENERIC_BUG
 config GENERIC_BUG_RELATIVE_POINTERS
        bool
 
-config GENERIC_HWEIGHT
-       def_bool y
-
 config ARCH_MAY_HAVE_PC_FDC
        def_bool y
        depends on ISA_DMA_API
@@ -305,9 +313,6 @@ config ZONE_DMA32
 config AUDIT_ARCH
        def_bool y if X86_64
 
-config ARCH_SUPPORTS_OPTIMIZED_INLINING
-       def_bool y
-
 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
        def_bool y
 
index 15d0fbe..f730680 100644 (file)
@@ -266,20 +266,6 @@ config CPA_DEBUG
        ---help---
          Do change_page_attr() self-tests every 30 seconds.
 
-config OPTIMIZE_INLINING
-       bool "Allow gcc to uninline functions marked 'inline'"
-       ---help---
-         This option determines if the kernel forces gcc to inline the functions
-         developers have marked 'inline'. Doing so takes away freedom from gcc to
-         do what it thinks is best, which is desirable for the gcc 3.x series of
-         compilers. The gcc 4.x series have a rewritten inlining algorithm and
-         enabling this option will generate a smaller kernel there. Hopefully
-         this algorithm is so good that allowing gcc 4.x and above to make the
-         decision will become the default in the future. Until then this option
-         is there to test gcc for this.
-
-         If unsure, say N.
-
 config DEBUG_ENTRY
        bool "Debug low-level entry code"
        depends on DEBUG_KERNEL
index e26984f..9e9d819 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Glue Code for the asm optimized version of the AES Cipher Algorithm
  *
index 20e45d9..11aa3b2 100644 (file)
@@ -878,7 +878,7 @@ apicinterrupt IRQ_WORK_VECTOR                       irq_work_interrupt              smp_irq_work_interrupt
  * @paranoid == 2 is special: the stub will never switch stacks.  This is for
  * #DF: if the thread stack is somehow unusable, we'll still get a useful OOPS.
  */
-.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 ist_offset=0
+.macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 ist_offset=0 create_gap=0
 ENTRY(\sym)
        UNWIND_HINT_IRET_REGS offset=\has_error_code*8
 
@@ -898,6 +898,20 @@ ENTRY(\sym)
        jnz     .Lfrom_usermode_switch_stack_\@
        .endif
 
+       .if \create_gap == 1
+       /*
+        * If coming from kernel space, create a 6-word gap to allow the
+        * int3 handler to emulate a call instruction.
+        */
+       testb   $3, CS-ORIG_RAX(%rsp)
+       jnz     .Lfrom_usermode_no_gap_\@
+       .rept   6
+       pushq   5*8(%rsp)
+       .endr
+       UNWIND_HINT_IRET_REGS offset=8
+.Lfrom_usermode_no_gap_\@:
+       .endif
+
        .if \paranoid
        call    paranoid_entry
        .else
@@ -1129,7 +1143,7 @@ apicinterrupt3 HYPERV_STIMER0_VECTOR \
 #endif /* CONFIG_HYPERV */
 
 idtentry debug                 do_debug                has_error_code=0        paranoid=1 shift_ist=IST_INDEX_DB ist_offset=DB_STACK_OFFSET
-idtentry int3                  do_int3                 has_error_code=0
+idtentry int3                  do_int3                 has_error_code=0        create_gap=1
 idtentry stack_segment         do_stack_segment        has_error_code=1
 
 #ifdef CONFIG_XEN_PV
index 4cd5f98..ad968b7 100644 (file)
 384    i386    arch_prctl              sys_arch_prctl                  __ia32_compat_sys_arch_prctl
 385    i386    io_pgetevents           sys_io_pgetevents_time32        __ia32_compat_sys_io_pgetevents
 386    i386    rseq                    sys_rseq                        __ia32_sys_rseq
-387    i386    open_tree               sys_open_tree                   __ia32_sys_open_tree
-388    i386    move_mount              sys_move_mount                  __ia32_sys_move_mount
-389    i386    fsopen                  sys_fsopen                      __ia32_sys_fsopen
-390    i386    fsconfig                sys_fsconfig                    __ia32_sys_fsconfig
-391    i386    fsmount                 sys_fsmount                     __ia32_sys_fsmount
-392    i386    fspick                  sys_fspick                      __ia32_sys_fspick
 393    i386    semget                  sys_semget                      __ia32_sys_semget
 394    i386    semctl                  sys_semctl                      __ia32_compat_sys_semctl
 395    i386    shmget                  sys_shmget                      __ia32_sys_shmget
 425    i386    io_uring_setup          sys_io_uring_setup              __ia32_sys_io_uring_setup
 426    i386    io_uring_enter          sys_io_uring_enter              __ia32_sys_io_uring_enter
 427    i386    io_uring_register       sys_io_uring_register           __ia32_sys_io_uring_register
+428    i386    open_tree               sys_open_tree                   __ia32_sys_open_tree
+429    i386    move_mount              sys_move_mount                  __ia32_sys_move_mount
+430    i386    fsopen                  sys_fsopen                      __ia32_sys_fsopen
+431    i386    fsconfig                sys_fsconfig                    __ia32_sys_fsconfig
+432    i386    fsmount                 sys_fsmount                     __ia32_sys_fsmount
+433    i386    fspick                  sys_fspick                      __ia32_sys_fspick
index 64ca0d0..b4e6f9e 100644 (file)
 332    common  statx                   __x64_sys_statx
 333    common  io_pgetevents           __x64_sys_io_pgetevents
 334    common  rseq                    __x64_sys_rseq
-335    common  open_tree               __x64_sys_open_tree
-336    common  move_mount              __x64_sys_move_mount
-337    common  fsopen                  __x64_sys_fsopen
-338    common  fsconfig                __x64_sys_fsconfig
-339    common  fsmount                 __x64_sys_fsmount
-340    common  fspick                  __x64_sys_fspick
 # don't use numbers 387 through 423, add new calls after the last
 # 'common' entry
 424    common  pidfd_send_signal       __x64_sys_pidfd_send_signal
 425    common  io_uring_setup          __x64_sys_io_uring_setup
 426    common  io_uring_enter          __x64_sys_io_uring_enter
 427    common  io_uring_register       __x64_sys_io_uring_register
+428    common  open_tree               __x64_sys_open_tree
+429    common  move_mount              __x64_sys_move_mount
+430    common  fsopen                  __x64_sys_fsopen
+431    common  fsconfig                __x64_sys_fsconfig
+432    common  fsmount                 __x64_sys_fsmount
+433    common  fspick                  __x64_sys_fspick
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
index 8e470b0..3a4d8d4 100644 (file)
@@ -73,14 +73,12 @@ const char *outfilename;
 enum {
        sym_vvar_start,
        sym_vvar_page,
-       sym_hpet_page,
        sym_pvclock_page,
        sym_hvclock_page,
 };
 
 const int special_pages[] = {
        sym_vvar_page,
-       sym_hpet_page,
        sym_pvclock_page,
        sym_hvclock_page,
 };
@@ -93,7 +91,6 @@ struct vdso_sym {
 struct vdso_sym required_syms[] = {
        [sym_vvar_start] = {"vvar_start", true},
        [sym_vvar_page] = {"vvar_page", true},
-       [sym_hpet_page] = {"hpet_page", true},
        [sym_pvclock_page] = {"pvclock_page", true},
        [sym_hvclock_page] = {"hvclock_page", true},
        {"VDSO32_NOTE_MASK", true},
index a9f4856..1ac4dd1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the x86 low level vsyscall code
 #
index b8ccdb5..9cbfd34 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                                  += core.o
 obj-y                                  += amd/
 obj-$(CONFIG_X86_LOCAL_APIC)            += msr.o
index f15441b..e7d35f6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/perf_event.h>
 #include <linux/export.h>
 #include <linux/types.h>
index 7635c23..58a6993 100644 (file)
@@ -393,7 +393,7 @@ static __init int _init_events_attrs(void)
        return 0;
 }
 
-const struct attribute_group *amd_iommu_attr_groups[] = {
+static const struct attribute_group *amd_iommu_attr_groups[] = {
        &amd_iommu_format_group,
        &amd_iommu_cpumask_group,
        &amd_iommu_events_group,
index 7cdd7b1..890a3fb 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/device.h>
 #include <linux/coredump.h>
 
-#include <asm-generic/sizes.h>
+#include <linux/sizes.h>
 #include <asm/perf_event.h>
 
 #include "../perf_event.h"
index ef763f5..a5436ce 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Per core/cpu state
  *
@@ -2384,7 +2385,11 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
         */
        if (__test_and_clear_bit(55, (unsigned long *)&status)) {
                handled++;
-               intel_pt_interrupt();
+               if (unlikely(perf_guest_cbs && perf_guest_cbs->is_in_guest() &&
+                       perf_guest_cbs->handle_intel_pt_intr))
+                       perf_guest_cbs->handle_intel_pt_intr();
+               else
+                       intel_pt_interrupt();
        }
 
        /*
@@ -3265,7 +3270,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
                return ret;
 
        if (event->attr.precise_ip) {
-               if (!(event->attr.freq || event->attr.wakeup_events)) {
+               if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) {
                        event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
                        if (!(event->attr.sample_type &
                              ~intel_pmu_large_pebs_flags(event)))
index 37ebf6f..26c03f5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Support Intel RAPL energy consumption counters
  * Copyright (C) 2013 Google, Inc., Stephane Eranian
index fc40a14..9e3fbd4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 
 #include <asm/cpu_device_id.h>
index 07fc84b..a6ac2f4 100644 (file)
@@ -394,10 +394,10 @@ struct cpu_hw_events {
 
 /* Event constraint, but match on all event flags too. */
 #define INTEL_FLAGS_EVENT_CONSTRAINT(c, n) \
-       EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS)
+       EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT|X86_ALL_EVENT_FLAGS)
 
 #define INTEL_FLAGS_EVENT_CONSTRAINT_RANGE(c, e, n)                    \
-       EVENT_CONSTRAINT_RANGE(c, e, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS)
+       EVENT_CONSTRAINT_RANGE(c, e, n, ARCH_PERFMON_EVENTSEL_EVENT|X86_ALL_EVENT_FLAGS)
 
 /* Check only flags, but allow all event/umask */
 #define INTEL_ALL_EVENT_CONSTRAINT(code, n)    \
index 1c11f94..89b1f74 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                  := hv_init.o mmu.o nested.o
 obj-$(CONFIG_X86_64)   += hv_apic.o
 
index cd4339b..d13b352 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the ia32 kernel emulation subsystem.
 #
index 3c13508..9bb71ab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  a.out loader for x86-64
  *
index fc06935..ba88edd 100644 (file)
@@ -12,8 +12,6 @@
 #define REG_OUT "a"
 #endif
 
-#define __HAVE_ARCH_SW_HWEIGHT
-
 static __always_inline unsigned int __arch_hweight32(unsigned int w)
 {
        unsigned int res;
index 62be73b..e8f58dd 100644 (file)
@@ -10,6 +10,7 @@ extern struct e820_table *e820_table_firmware;
 
 extern unsigned long pci_mem_start;
 
+extern bool e820__mapped_raw_any(u64 start, u64 end, enum e820_type type);
 extern bool e820__mapped_any(u64 start, u64 end, enum e820_type type);
 extern bool e820__mapped_all(u64 start, u64 end, enum e820_type type);
 
index cf35063..287f1f7 100644 (file)
@@ -3,12 +3,10 @@
 #define _ASM_X86_FTRACE_H
 
 #ifdef CONFIG_FUNCTION_TRACER
-#ifdef CC_USING_FENTRY
-# define MCOUNT_ADDR           ((unsigned long)(__fentry__))
-#else
-# define MCOUNT_ADDR           ((unsigned long)(mcount))
-# define HAVE_FUNCTION_GRAPH_FP_TEST
+#ifndef CC_USING_FENTRY
+# error Compiler does not support fentry?
 #endif
+# define MCOUNT_ADDR           ((unsigned long)(__fentry__))
 #define MCOUNT_INSN_SIZE       5 /* sizeof mcount call */
 
 #ifdef CONFIG_DYNAMIC_FTRACE
index 2bdbbbc..cdf44aa 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* SPDX-License-Identifier: GPL-2.0 */
 
 /*
  * This file contains definitions from Hyper-V Hypervisor Top-Level Functional
index c79abe7..450d69a 100644 (file)
@@ -470,6 +470,7 @@ struct kvm_pmu {
        u64 global_ovf_ctrl;
        u64 counter_bitmask[2];
        u64 global_ctrl_mask;
+       u64 global_ovf_ctrl_mask;
        u64 reserved_bits;
        u8 version;
        struct kvm_pmc gp_counters[INTEL_PMC_MAX_GENERIC];
@@ -781,6 +782,9 @@ struct kvm_vcpu_arch {
 
        /* Flush the L1 Data cache for L1TF mitigation on VMENTER */
        bool l1tf_flush_l1d;
+
+       /* AMD MSRC001_0015 Hardware Configuration */
+       u64 msr_hwcr;
 };
 
 struct kvm_lpage_info {
@@ -1168,7 +1172,8 @@ struct kvm_x86_ops {
                              uint32_t guest_irq, bool set);
        void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu);
 
-       int (*set_hv_timer)(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc);
+       int (*set_hv_timer)(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc,
+                           bool *expired);
        void (*cancel_hv_timer)(struct kvm_vcpu *vcpu);
 
        void (*setup_mce)(struct kvm_vcpu *vcpu);
index ed80003..1fde1ab 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * livepatch.h - x86-specific Kernel Live Patching Core
  *
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
  * Copyright (C) 2014 SUSE
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ASM_X86_LIVEPATCH_H
 #include <asm/setup.h>
 #include <linux/ftrace.h>
 
-static inline int klp_check_compiler_support(void)
-{
-#ifndef CC_USING_FENTRY
-       return 1;
-#endif
-       return 0;
-}
-
 static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
 {
        regs->ip = ip;
index 93dff19..9024236 100644 (file)
@@ -278,8 +278,8 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm,
        mpx_mm_init(mm);
 }
 
-static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
-                             unsigned long start, unsigned long end)
+static inline void arch_unmap(struct mm_struct *mm, unsigned long start,
+                             unsigned long end)
 {
        /*
         * mpx_notify_unmap() goes and reads a rarely-hot
@@ -299,7 +299,7 @@ static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
         * consistently wrong.
         */
        if (unlikely(cpu_feature_enabled(X86_FEATURE_MPX)))
-               mpx_notify_unmap(mm, vma, start, end);
+               mpx_notify_unmap(mm, start, end);
 }
 
 /*
index d0b1434..143a5c1 100644 (file)
@@ -64,12 +64,15 @@ struct mpx_fault_info {
 };
 
 #ifdef CONFIG_X86_INTEL_MPX
-int mpx_fault_info(struct mpx_fault_info *info, struct pt_regs *regs);
-int mpx_handle_bd_fault(void);
+
+extern int mpx_fault_info(struct mpx_fault_info *info, struct pt_regs *regs);
+extern int mpx_handle_bd_fault(void);
+
 static inline int kernel_managing_mpx_tables(struct mm_struct *mm)
 {
        return (mm->context.bd_addr != MPX_INVALID_BOUNDS_DIR);
 }
+
 static inline void mpx_mm_init(struct mm_struct *mm)
 {
        /*
@@ -78,11 +81,10 @@ static inline void mpx_mm_init(struct mm_struct *mm)
         */
        mm->context.bd_addr = MPX_INVALID_BOUNDS_DIR;
 }
-void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
-                     unsigned long start, unsigned long end);
 
-unsigned long mpx_unmapped_area_check(unsigned long addr, unsigned long len,
-               unsigned long flags);
+extern void mpx_notify_unmap(struct mm_struct *mm, unsigned long start, unsigned long end);
+extern unsigned long mpx_unmapped_area_check(unsigned long addr, unsigned long len, unsigned long flags);
+
 #else
 static inline int mpx_fault_info(struct mpx_fault_info *info, struct pt_regs *regs)
 {
@@ -100,7 +102,6 @@ static inline void mpx_mm_init(struct mm_struct *mm)
 {
 }
 static inline void mpx_notify_unmap(struct mm_struct *mm,
-                                   struct vm_area_struct *vma,
                                    unsigned long start, unsigned long end)
 {
 }
index 88dd202..979ef97 100644 (file)
 #define MSR_CORE_PERF_GLOBAL_CTRL      0x0000038f
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL  0x00000390
 
+/* 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)
+#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF_BIT              62
+#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF                  (1ULL <<  MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF_BIT)
+#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD_BIT            63
+#define MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD                        (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD_BIT)
+
 /* Geode defined MSRs */
 #define MSR_GEODE_BUSCONT_CONF0                0x00001900
 
index 91c8d86..2416312 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef _ORC_LOOKUP_H
 #define _ORC_LOOKUP_H
index 46f516d..6e06090 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ORC_TYPES_H
index c90678f..880b551 100644 (file)
@@ -42,4 +42,34 @@ extern int after_bootmem;
 extern __ro_after_init struct mm_struct *poking_mm;
 extern __ro_after_init unsigned long poking_addr;
 
+#ifndef CONFIG_UML_X86
+static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
+{
+       regs->ip = ip;
+}
+
+#define INT3_INSN_SIZE 1
+#define CALL_INSN_SIZE 5
+
+#ifdef CONFIG_X86_64
+static inline void int3_emulate_push(struct pt_regs *regs, unsigned long val)
+{
+       /*
+        * The int3 handler in entry_64.S adds a gap between the
+        * stack where the break point happened, and the saving of
+        * pt_regs. We can extend the original stack because of
+        * this gap. See the idtentry macro's create_gap option.
+        */
+       regs->sp -= sizeof(unsigned long);
+       *(unsigned long *)regs->sp = val;
+}
+
+static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func)
+{
+       int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE);
+       int3_emulate_jmp(regs, func);
+}
+#endif /* CONFIG_X86_64 */
+#endif /* !CONFIG_UML_X86 */
+
 #endif /* _ASM_X86_TEXT_PATCHING_H */
index 27566e5..230474e 100644 (file)
@@ -19,7 +19,6 @@ struct vdso_image {
        long sym_vvar_start;  /* Negative offset to the vvar area */
 
        long sym_vvar_page;
-       long sym_hpet_page;
        long sym_pvclock_page;
        long sym_hvclock_page;
        long sym_VDSO32_NOTE_MASK;
index 00b7e27..ce1b5cc 100644 (file)
@@ -42,7 +42,7 @@ endif
 # non-deterministic coverage.
 KCOV_INSTRUMENT                := n
 
-CFLAGS_irq.o := -I$(src)/../include/asm/trace
+CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace
 
 obj-y                  := process_$(BITS).o signal.o
 obj-$(CONFIG_COMPAT)   += signal_compat.o
index cb6e076..a5e5484 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2005 Intel Corporation
  *     Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
index 7b9b49d..390596b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "SMP alternatives: " fmt
 
 #include <linux/module.h>
index ab6af77..177aa8e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Local APIC handling, local APIC timers
  *
index fb6a64b..80a405c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/bitops.h>
 #include <linux/elf.h>
index d7f55ad..2c57fff 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* cpu_feature_enabled() cannot be used this early */
 #define USE_EARLY_PGTABLE_L5
 
index f4dd733..ebb14a2 100644 (file)
@@ -97,6 +97,7 @@ static void intel_epb_restore(void)
        wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val);
 }
 
+#ifdef CONFIG_PM
 static struct syscore_ops intel_epb_syscore_ops = {
        .suspend = intel_epb_save,
        .resume = intel_epb_restore,
@@ -193,6 +194,25 @@ static int intel_epb_offline(unsigned int cpu)
        return 0;
 }
 
+static inline void register_intel_ebp_syscore_ops(void)
+{
+       register_syscore_ops(&intel_epb_syscore_ops);
+}
+#else /* !CONFIG_PM */
+static int intel_epb_online(unsigned int cpu)
+{
+       intel_epb_restore();
+       return 0;
+}
+
+static int intel_epb_offline(unsigned int cpu)
+{
+       return intel_epb_save();
+}
+
+static inline void register_intel_ebp_syscore_ops(void) {}
+#endif
+
 static __init int intel_epb_init(void)
 {
        int ret;
@@ -206,7 +226,7 @@ static __init int intel_epb_init(void)
        if (ret < 0)
                goto err_out_online;
 
-       register_syscore_ops(&intel_epb_syscore_ops);
+       register_intel_ebp_syscore_ops();
        return 0;
 
 err_out_online:
index 5112a50..282916f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Machine check handler.
  *
index 9690ec5..7c8958d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * /dev/mcelog driver
  *
index 10a3b05..6e2becf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Thermal throttle event support code (such as syslog messaging and rate
  * limiting) that was factored out from x86_64 (mce_intel.c) and i386 (p4.c).
index ba12e8a..34098d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 microcode-y                            := core.o
 obj-$(CONFIG_MICROCODE)                        += microcode.o
 microcode-$(CONFIG_MICROCODE_INTEL)    += intel.o
index 2ad9107..cc4f9f1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y          := mtrr.o if.o generic.o cleanup.o
 obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
 
index 86e277f..9356c1c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This only handles 32bit MTRR on 32bit hosts. This is strictly wrong
  * because MTRRs can span up to 40 bits (36bits on most modern x86)
index a96ca85..576b2e1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Architecture specific (i386/x86_64) functions for kexec based crash dumps.
  *
index 2879e23..8f32e70 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Low level x86 E820 memory map handling functions.
  *
@@ -73,12 +74,13 @@ EXPORT_SYMBOL(pci_mem_start);
  * This function checks if any part of the range <start,end> is mapped
  * with type.
  */
-bool e820__mapped_any(u64 start, u64 end, enum e820_type type)
+static bool _e820__mapped_any(struct e820_table *table,
+                             u64 start, u64 end, enum e820_type type)
 {
        int i;
 
-       for (i = 0; i < e820_table->nr_entries; i++) {
-               struct e820_entry *entry = &e820_table->entries[i];
+       for (i = 0; i < table->nr_entries; i++) {
+               struct e820_entry *entry = &table->entries[i];
 
                if (type && entry->type != type)
                        continue;
@@ -88,6 +90,17 @@ bool e820__mapped_any(u64 start, u64 end, enum e820_type type)
        }
        return 0;
 }
+
+bool e820__mapped_raw_any(u64 start, u64 end, enum e820_type type)
+{
+       return _e820__mapped_any(e820_table_firmware, start, end, type);
+}
+EXPORT_SYMBOL_GPL(e820__mapped_raw_any);
+
+bool e820__mapped_any(u64 start, u64 end, enum e820_type type)
+{
+       return _e820__mapped_any(e820_table, start, end, type);
+}
 EXPORT_SYMBOL_GPL(e820__mapped_any);
 
 /*
index 68279ef..78c5621 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Build rules for the FPU support code:
 #
index ce243f7..466fca6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1994 Linus Torvalds
  *
index 20d8fa7..ef0030e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * x86 FPU boot time init code:
  */
index 9c459fd..3c36dd1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * xsave/xrstor support.
  *
index 0caf812..0927bb1 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/kprobes.h>
 #include <asm/ftrace.h>
 #include <asm/nops.h>
+#include <asm/text-patching.h>
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 
@@ -231,6 +232,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
 }
 
 static unsigned long ftrace_update_func;
+static unsigned long ftrace_update_func_call;
 
 static int update_ftrace_func(unsigned long ip, void *new)
 {
@@ -259,6 +261,8 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
        unsigned char *new;
        int ret;
 
+       ftrace_update_func_call = (unsigned long)func;
+
        new = ftrace_call_replace(ip, (unsigned long)func);
        ret = update_ftrace_func(ip, new);
 
@@ -294,13 +298,28 @@ int ftrace_int3_handler(struct pt_regs *regs)
        if (WARN_ON_ONCE(!regs))
                return 0;
 
-       ip = regs->ip - 1;
-       if (!ftrace_location(ip) && !is_ftrace_caller(ip))
-               return 0;
+       ip = regs->ip - INT3_INSN_SIZE;
 
-       regs->ip += MCOUNT_INSN_SIZE - 1;
+#ifdef CONFIG_X86_64
+       if (ftrace_location(ip)) {
+               int3_emulate_call(regs, (unsigned long)ftrace_regs_caller);
+               return 1;
+       } else if (is_ftrace_caller(ip)) {
+               if (!ftrace_update_func_call) {
+                       int3_emulate_jmp(regs, ip + CALL_INSN_SIZE);
+                       return 1;
+               }
+               int3_emulate_call(regs, ftrace_update_func_call);
+               return 1;
+       }
+#else
+       if (ftrace_location(ip) || is_ftrace_caller(ip)) {
+               int3_emulate_jmp(regs, ip + CALL_INSN_SIZE);
+               return 1;
+       }
+#endif
 
-       return 1;
+       return 0;
 }
 NOKPROBE_SYMBOL(ftrace_int3_handler);
 
@@ -865,6 +884,8 @@ void arch_ftrace_update_trampoline(struct ftrace_ops *ops)
 
        func = ftrace_ops_get_func(ops);
 
+       ftrace_update_func_call = (unsigned long)func;
+
        /* Do a safe modify in case the trampoline is executing */
        new = ftrace_call_replace(ip, (unsigned long)func);
        ret = update_ftrace_func(ip, new);
@@ -966,6 +987,7 @@ static int ftrace_mod_jmp(unsigned long ip, void *func)
 {
        unsigned char *new;
 
+       ftrace_update_func_call = 0UL;
        new = ftrace_jmp_replace(ip, (unsigned long)func);
 
        return update_ftrace_func(ip, new);
index 4c8440d..2ba914a 100644 (file)
 #include <asm/ftrace.h>
 #include <asm/nospec-branch.h>
 
-#ifdef CC_USING_FENTRY
 # define function_hook __fentry__
 EXPORT_SYMBOL(__fentry__)
-#else
-# define function_hook mcount
-EXPORT_SYMBOL(mcount)
-#endif
-
-#ifdef CONFIG_DYNAMIC_FTRACE
-
-/* mcount uses a frame pointer even if CONFIG_FRAME_POINTER is not set */
-#if !defined(CC_USING_FENTRY) || defined(CONFIG_FRAME_POINTER)
-# define USING_FRAME_POINTER
-#endif
 
-#ifdef USING_FRAME_POINTER
+#ifdef CONFIG_FRAME_POINTER
 # define MCOUNT_FRAME                  1       /* using frame = true  */
 #else
 # define MCOUNT_FRAME                  0       /* using frame = false */
@@ -37,8 +25,7 @@ END(function_hook)
 
 ENTRY(ftrace_caller)
 
-#ifdef USING_FRAME_POINTER
-# ifdef CC_USING_FENTRY
+#ifdef CONFIG_FRAME_POINTER
        /*
         * Frame pointers are of ip followed by bp.
         * Since fentry is an immediate jump, we are left with
@@ -49,7 +36,7 @@ ENTRY(ftrace_caller)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   2*4(%esp)                       /* function ip */
-# endif
+
        /* For mcount, the function ip is directly above */
        pushl   %ebp
        movl    %esp, %ebp
@@ -59,7 +46,7 @@ ENTRY(ftrace_caller)
        pushl   %edx
        pushl   $0                              /* Pass NULL as regs pointer */
 
-#ifdef USING_FRAME_POINTER
+#ifdef CONFIG_FRAME_POINTER
        /* Load parent ebp into edx */
        movl    4*4(%esp), %edx
 #else
@@ -82,13 +69,11 @@ ftrace_call:
        popl    %edx
        popl    %ecx
        popl    %eax
-#ifdef USING_FRAME_POINTER
+#ifdef CONFIG_FRAME_POINTER
        popl    %ebp
-# ifdef CC_USING_FENTRY
        addl    $4,%esp                         /* skip function ip */
        popl    %ebp                            /* this is the orig bp */
        addl    $4, %esp                        /* skip parent ip */
-# endif
 #endif
 .Lftrace_ret:
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -133,11 +118,7 @@ ENTRY(ftrace_regs_caller)
 
        movl    12*4(%esp), %eax                /* Load ip (1st parameter) */
        subl    $MCOUNT_INSN_SIZE, %eax         /* Adjust ip */
-#ifdef CC_USING_FENTRY
        movl    15*4(%esp), %edx                /* Load parent ip (2nd parameter) */
-#else
-       movl    0x4(%ebp), %edx                 /* Load parent ip (2nd parameter) */
-#endif
        movl    function_trace_op, %ecx         /* Save ftrace_pos in 3rd parameter */
        pushl   %esp                            /* Save pt_regs as 4th parameter */
 
@@ -170,43 +151,6 @@ GLOBAL(ftrace_regs_call)
        lea     3*4(%esp), %esp                 /* Skip orig_ax, ip and cs */
 
        jmp     .Lftrace_ret
-#else /* ! CONFIG_DYNAMIC_FTRACE */
-
-ENTRY(function_hook)
-       cmpl    $__PAGE_OFFSET, %esp
-       jb      ftrace_stub                     /* Paging not enabled yet? */
-
-       cmpl    $ftrace_stub, ftrace_trace_function
-       jnz     .Ltrace
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-       cmpl    $ftrace_stub, ftrace_graph_return
-       jnz     ftrace_graph_caller
-
-       cmpl    $ftrace_graph_entry_stub, ftrace_graph_entry
-       jnz     ftrace_graph_caller
-#endif
-.globl ftrace_stub
-ftrace_stub:
-       ret
-
-       /* taken from glibc */
-.Ltrace:
-       pushl   %eax
-       pushl   %ecx
-       pushl   %edx
-       movl    0xc(%esp), %eax
-       movl    0x4(%ebp), %edx
-       subl    $MCOUNT_INSN_SIZE, %eax
-
-       movl    ftrace_trace_function, %ecx
-       CALL_NOSPEC %ecx
-
-       popl    %edx
-       popl    %ecx
-       popl    %eax
-       jmp     ftrace_stub
-END(function_hook)
-#endif /* CONFIG_DYNAMIC_FTRACE */
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 ENTRY(ftrace_graph_caller)
@@ -215,13 +159,8 @@ ENTRY(ftrace_graph_caller)
        pushl   %edx
        movl    3*4(%esp), %eax
        /* Even with frame pointers, fentry doesn't have one here */
-#ifdef CC_USING_FENTRY
        lea     4*4(%esp), %edx
        movl    $0, %ecx
-#else
-       lea     0x4(%ebp), %edx
-       movl    (%ebp), %ecx
-#endif
        subl    $MCOUNT_INSN_SIZE, %eax
        call    prepare_ftrace_return
        popl    %edx
@@ -234,11 +173,7 @@ END(ftrace_graph_caller)
 return_to_handler:
        pushl   %eax
        pushl   %edx
-#ifdef CC_USING_FENTRY
        movl    $0, %eax
-#else
-       movl    %ebp, %eax
-#endif
        call    ftrace_return_to_handler
        movl    %eax, %ecx
        popl    %edx
index 75f2b36..10eb276 100644 (file)
        .code64
        .section .entry.text, "ax"
 
-#ifdef CC_USING_FENTRY
 # define function_hook __fentry__
 EXPORT_SYMBOL(__fentry__)
-#else
-# define function_hook mcount
-EXPORT_SYMBOL(mcount)
-#endif
 
 #ifdef CONFIG_FRAME_POINTER
-# ifdef CC_USING_FENTRY
 /* Save parent and function stack frames (rip and rbp) */
 #  define MCOUNT_FRAME_SIZE    (8+16*2)
-# else
-/* Save just function stack frame (rip and rbp) */
-#  define MCOUNT_FRAME_SIZE    (8+16)
-# endif
 #else
 /* No need to save a stack frame */
 # define MCOUNT_FRAME_SIZE     0
@@ -75,17 +65,13 @@ EXPORT_SYMBOL(mcount)
         * fentry is called before the stack frame is set up, where as mcount
         * is called afterward.
         */
-#ifdef CC_USING_FENTRY
+
        /* Save the parent pointer (skip orig rbp and our return address) */
        pushq \added+8*2(%rsp)
        pushq %rbp
        movq %rsp, %rbp
        /* Save the return address (now skip orig rbp, rbp and parent) */
        pushq \added+8*3(%rsp)
-#else
-       /* Can't assume that rip is before this (unless added was zero) */
-       pushq \added+8(%rsp)
-#endif
        pushq %rbp
        movq %rsp, %rbp
 #endif /* CONFIG_FRAME_POINTER */
@@ -113,12 +99,7 @@ EXPORT_SYMBOL(mcount)
        movq %rdx, RBP(%rsp)
 
        /* Copy the parent address into %rsi (second parameter) */
-#ifdef CC_USING_FENTRY
        movq MCOUNT_REG_SIZE+8+\added(%rsp), %rsi
-#else
-       /* %rdx contains original %rbp */
-       movq 8(%rdx), %rsi
-#endif
 
         /* Move RIP to its proper location */
        movq MCOUNT_REG_SIZE+\added(%rsp), %rdi
@@ -303,15 +284,8 @@ ENTRY(ftrace_graph_caller)
        /* Saves rbp into %rdx and fills first parameter  */
        save_mcount_regs
 
-#ifdef CC_USING_FENTRY
        leaq MCOUNT_REG_SIZE+8(%rsp), %rsi
        movq $0, %rdx   /* No framepointers needed */
-#else
-       /* Save address of the return address of traced function */
-       leaq 8(%rdx), %rsi
-       /* ftrace does sanity checks against frame pointers */
-       movq (%rdx), %rdx
-#endif
        call    prepare_ftrace_return
 
        restore_mcount_regs
index fb32925..a0573f2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
 #include <linux/interrupt.h>
index 59b5f2e..9b68b5b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common interrupt code for 32 and 64 bit
  */
index 0d33169..8a75343 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for kernel probes
 #
index cf52ee0..9e4fa24 100644 (file)
@@ -768,7 +768,7 @@ static struct kprobe kretprobe_kprobe = {
 /*
  * Called from kretprobe_trampoline
  */
-static __used void *trampoline_handler(struct pt_regs *regs)
+__used __visible void *trampoline_handler(struct pt_regs *regs)
 {
        struct kprobe_ctlblk *kcb;
        struct kretprobe_instance *ri = NULL;
index 3f0cc82..5169b8c 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * KVM paravirt_ops implementation
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
  * Copyright (C) 2007, Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  * Copyright IBM Corporation, 2007
  *   Authors: Anthony Liguori <aliguori@us.ibm.com>
index e9d252d..6a68e41 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * livepatch.c - x86-specific Kernel Live Patching Core
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 05b0989..4df7705 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1991, 1992  Linus Torvalds
  *  Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
index f8e1af3..250e4c4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995  Linus Torvalds
  *
index 4b8ee05..a166c96 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* By Ross Biro 1/23/92 */
 /*
  * Pentium III FXSR, SSE support
index 905dae8..08a5f4a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995  Linus Torvalds
  *
index 7de466e..8b6d03e 100644 (file)
@@ -58,7 +58,6 @@
 #include <asm/alternative.h>
 #include <asm/fpu/xstate.h>
 #include <asm/trace/mpx.h>
-#include <asm/nospec-branch.h>
 #include <asm/mpx.h>
 #include <asm/vm86.h>
 #include <asm/umip.h>
@@ -368,13 +367,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
                regs->ip = (unsigned long)general_protection;
                regs->sp = (unsigned long)&gpregs->orig_ax;
 
-               /*
-                * This situation can be triggered by userspace via
-                * modify_ldt(2) and the return does not take the regular
-                * user space exit, so a CPU buffer clear is required when
-                * MDS mitigation is enabled.
-                */
-               mds_user_clear_cpu_buffers();
                return;
        }
 #endif
index 15b5e98..0b29e58 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
@@ -979,7 +980,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
                if (!(freq->flags & CPUFREQ_CONST_LOOPS))
                        mark_tsc_unstable("cpufreq changes");
 
-               set_cyc2ns_scale(tsc_khz, freq->cpu, rdtsc());
+               set_cyc2ns_scale(tsc_khz, freq->policy->cpu, rdtsc());
        }
 
        return 0;
index 9b9fd48..6106760 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/sched.h>
 #include <linux/sched/task.h>
 #include <linux/sched/task_stack.h>
index 4f0e17b..c49f10f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/sched.h>
 #include <linux/ftrace.h>
 #include <asm/ptrace.h>
index 89be1be..33b66b5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/sort.h>
 #include <asm/ptrace.h>
index bbbe611..80a642a 100644 (file)
@@ -963,13 +963,13 @@ int kvm_emulate_cpuid(struct kvm_vcpu *vcpu)
        if (cpuid_fault_enabled(vcpu) && !kvm_require_cpl(vcpu, 0))
                return 1;
 
-       eax = kvm_register_read(vcpu, VCPU_REGS_RAX);
-       ecx = kvm_register_read(vcpu, VCPU_REGS_RCX);
+       eax = kvm_rax_read(vcpu);
+       ecx = kvm_rcx_read(vcpu);
        kvm_cpuid(vcpu, &eax, &ebx, &ecx, &edx, true);
-       kvm_register_write(vcpu, VCPU_REGS_RAX, eax);
-       kvm_register_write(vcpu, VCPU_REGS_RBX, ebx);
-       kvm_register_write(vcpu, VCPU_REGS_RCX, ecx);
-       kvm_register_write(vcpu, VCPU_REGS_RDX, edx);
+       kvm_rax_write(vcpu, eax);
+       kvm_rbx_write(vcpu, ebx);
+       kvm_rcx_write(vcpu, ecx);
+       kvm_rdx_write(vcpu, edx);
        return kvm_skip_emulated_instruction(vcpu);
 }
 EXPORT_SYMBOL_GPL(kvm_emulate_cpuid);
index cc24b3a..8ca4b39 100644 (file)
@@ -1535,10 +1535,10 @@ static void kvm_hv_hypercall_set_result(struct kvm_vcpu *vcpu, u64 result)
 
        longmode = is_64_bit_mode(vcpu);
        if (longmode)
-               kvm_register_write(vcpu, VCPU_REGS_RAX, result);
+               kvm_rax_write(vcpu, result);
        else {
-               kvm_register_write(vcpu, VCPU_REGS_RDX, result >> 32);
-               kvm_register_write(vcpu, VCPU_REGS_RAX, result & 0xffffffff);
+               kvm_rdx_write(vcpu, result >> 32);
+               kvm_rax_write(vcpu, result & 0xffffffff);
        }
 }
 
@@ -1611,18 +1611,18 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
        longmode = is_64_bit_mode(vcpu);
 
        if (!longmode) {
-               param = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDX) << 32) |
-                       (kvm_register_read(vcpu, VCPU_REGS_RAX) & 0xffffffff);
-               ingpa = ((u64)kvm_register_read(vcpu, VCPU_REGS_RBX) << 32) |
-                       (kvm_register_read(vcpu, VCPU_REGS_RCX) & 0xffffffff);
-               outgpa = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDI) << 32) |
-                       (kvm_register_read(vcpu, VCPU_REGS_RSI) & 0xffffffff);
+               param = ((u64)kvm_rdx_read(vcpu) << 32) |
+                       (kvm_rax_read(vcpu) & 0xffffffff);
+               ingpa = ((u64)kvm_rbx_read(vcpu) << 32) |
+                       (kvm_rcx_read(vcpu) & 0xffffffff);
+               outgpa = ((u64)kvm_rdi_read(vcpu) << 32) |
+                       (kvm_rsi_read(vcpu) & 0xffffffff);
        }
 #ifdef CONFIG_X86_64
        else {
-               param = kvm_register_read(vcpu, VCPU_REGS_RCX);
-               ingpa = kvm_register_read(vcpu, VCPU_REGS_RDX);
-               outgpa = kvm_register_read(vcpu, VCPU_REGS_R8);
+               param = kvm_rcx_read(vcpu);
+               ingpa = kvm_rdx_read(vcpu);
+               outgpa = kvm_r8_read(vcpu);
        }
 #endif
 
index f8f56a9..1cc6c47 100644 (file)
@@ -9,6 +9,34 @@
        (X86_CR4_PVI | X86_CR4_DE | X86_CR4_PCE | X86_CR4_OSFXSR  \
         | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_PGE)
 
+#define BUILD_KVM_GPR_ACCESSORS(lname, uname)                                \
+static __always_inline unsigned long kvm_##lname##_read(struct kvm_vcpu *vcpu)\
+{                                                                            \
+       return vcpu->arch.regs[VCPU_REGS_##uname];                            \
+}                                                                            \
+static __always_inline void kvm_##lname##_write(struct kvm_vcpu *vcpu,       \
+                                               unsigned long val)            \
+{                                                                            \
+       vcpu->arch.regs[VCPU_REGS_##uname] = val;                             \
+}
+BUILD_KVM_GPR_ACCESSORS(rax, RAX)
+BUILD_KVM_GPR_ACCESSORS(rbx, RBX)
+BUILD_KVM_GPR_ACCESSORS(rcx, RCX)
+BUILD_KVM_GPR_ACCESSORS(rdx, RDX)
+BUILD_KVM_GPR_ACCESSORS(rbp, RBP)
+BUILD_KVM_GPR_ACCESSORS(rsi, RSI)
+BUILD_KVM_GPR_ACCESSORS(rdi, RDI)
+#ifdef CONFIG_X86_64
+BUILD_KVM_GPR_ACCESSORS(r8,  R8)
+BUILD_KVM_GPR_ACCESSORS(r9,  R9)
+BUILD_KVM_GPR_ACCESSORS(r10, R10)
+BUILD_KVM_GPR_ACCESSORS(r11, R11)
+BUILD_KVM_GPR_ACCESSORS(r12, R12)
+BUILD_KVM_GPR_ACCESSORS(r13, R13)
+BUILD_KVM_GPR_ACCESSORS(r14, R14)
+BUILD_KVM_GPR_ACCESSORS(r15, R15)
+#endif
+
 static inline unsigned long kvm_register_read(struct kvm_vcpu *vcpu,
                                              enum kvm_reg reg)
 {
@@ -37,6 +65,16 @@ static inline void kvm_rip_write(struct kvm_vcpu *vcpu, unsigned long val)
        kvm_register_write(vcpu, VCPU_REGS_RIP, val);
 }
 
+static inline unsigned long kvm_rsp_read(struct kvm_vcpu *vcpu)
+{
+       return kvm_register_read(vcpu, VCPU_REGS_RSP);
+}
+
+static inline void kvm_rsp_write(struct kvm_vcpu *vcpu, unsigned long val)
+{
+       kvm_register_write(vcpu, VCPU_REGS_RSP, val);
+}
+
 static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index)
 {
        might_sleep();  /* on svm */
@@ -83,8 +121,8 @@ static inline ulong kvm_read_cr4(struct kvm_vcpu *vcpu)
 
 static inline u64 kvm_read_edx_eax(struct kvm_vcpu *vcpu)
 {
-       return (kvm_register_read(vcpu, VCPU_REGS_RAX) & -1u)
-               | ((u64)(kvm_register_read(vcpu, VCPU_REGS_RDX) & -1u) << 32);
+       return (kvm_rax_read(vcpu) & -1u)
+               | ((u64)(kvm_rdx_read(vcpu) & -1u) << 32);
 }
 
 static inline void enter_guest_mode(struct kvm_vcpu *vcpu)
index bd13fdd..4924f83 100644 (file)
@@ -1454,7 +1454,7 @@ static void apic_timer_expired(struct kvm_lapic *apic)
        if (swait_active(q))
                swake_up_one(q);
 
-       if (apic_lvtt_tscdeadline(apic))
+       if (apic_lvtt_tscdeadline(apic) || ktimer->hv_timer_in_use)
                ktimer->expired_tscdeadline = ktimer->tscdeadline;
 }
 
@@ -1696,37 +1696,42 @@ static void cancel_hv_timer(struct kvm_lapic *apic)
 static bool start_hv_timer(struct kvm_lapic *apic)
 {
        struct kvm_timer *ktimer = &apic->lapic_timer;
-       int r;
+       struct kvm_vcpu *vcpu = apic->vcpu;
+       bool expired;
 
        WARN_ON(preemptible());
        if (!kvm_x86_ops->set_hv_timer)
                return false;
 
-       if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending))
-               return false;
-
        if (!ktimer->tscdeadline)
                return false;
 
-       r = kvm_x86_ops->set_hv_timer(apic->vcpu, ktimer->tscdeadline);
-       if (r < 0)
+       if (kvm_x86_ops->set_hv_timer(vcpu, ktimer->tscdeadline, &expired))
                return false;
 
        ktimer->hv_timer_in_use = true;
        hrtimer_cancel(&ktimer->timer);
 
        /*
-        * Also recheck ktimer->pending, in case the sw timer triggered in
-        * the window.  For periodic timer, leave the hv timer running for
-        * simplicity, and the deadline will be recomputed on the next vmexit.
+        * To simplify handling the periodic timer, leave the hv timer running
+        * even if the deadline timer has expired, i.e. rely on the resulting
+        * VM-Exit to recompute the periodic timer's target expiration.
         */
-       if (!apic_lvtt_period(apic) && (r || atomic_read(&ktimer->pending))) {
-               if (r)
+       if (!apic_lvtt_period(apic)) {
+               /*
+                * Cancel the hv timer if the sw timer fired while the hv timer
+                * was being programmed, or if the hv timer itself expired.
+                */
+               if (atomic_read(&ktimer->pending)) {
+                       cancel_hv_timer(apic);
+               } else if (expired) {
                        apic_timer_expired(apic);
-               return false;
+                       cancel_hv_timer(apic);
+               }
        }
 
-       trace_kvm_hv_timer_state(apic->vcpu->vcpu_id, true);
+       trace_kvm_hv_timer_state(vcpu->vcpu_id, ktimer->hv_timer_in_use);
+
        return true;
 }
 
@@ -1750,8 +1755,13 @@ static void start_sw_timer(struct kvm_lapic *apic)
 static void restart_apic_timer(struct kvm_lapic *apic)
 {
        preempt_disable();
+
+       if (!apic_lvtt_period(apic) && atomic_read(&apic->lapic_timer.pending))
+               goto out;
+
        if (!start_hv_timer(apic))
                start_sw_timer(apic);
+out:
        preempt_enable();
 }
 
index d9c7b45..1e9ba81 100644 (file)
@@ -44,6 +44,7 @@
 #include <asm/page.h>
 #include <asm/pat.h>
 #include <asm/cmpxchg.h>
+#include <asm/e820/api.h>
 #include <asm/io.h>
 #include <asm/vmx.h>
 #include <asm/kvm_page_track.h>
@@ -487,16 +488,24 @@ static void kvm_mmu_reset_all_pte_masks(void)
         * If the CPU has 46 or less physical address bits, then set an
         * appropriate mask to guard against L1TF attacks. Otherwise, it is
         * assumed that the CPU is not vulnerable to L1TF.
+        *
+        * Some Intel CPUs address the L1 cache using more PA bits than are
+        * reported by CPUID. Use the PA width of the L1 cache when possible
+        * to achieve more effective mitigation, e.g. if system RAM overlaps
+        * the most significant bits of legal physical address space.
         */
-       low_phys_bits = boot_cpu_data.x86_phys_bits;
-       if (boot_cpu_data.x86_phys_bits <
+       shadow_nonpresent_or_rsvd_mask = 0;
+       low_phys_bits = boot_cpu_data.x86_cache_bits;
+       if (boot_cpu_data.x86_cache_bits <
            52 - shadow_nonpresent_or_rsvd_mask_len) {
                shadow_nonpresent_or_rsvd_mask =
-                       rsvd_bits(boot_cpu_data.x86_phys_bits -
+                       rsvd_bits(boot_cpu_data.x86_cache_bits -
                                  shadow_nonpresent_or_rsvd_mask_len,
-                                 boot_cpu_data.x86_phys_bits - 1);
+                                 boot_cpu_data.x86_cache_bits - 1);
                low_phys_bits -= shadow_nonpresent_or_rsvd_mask_len;
-       }
+       } else
+               WARN_ON_ONCE(boot_cpu_has_bug(X86_BUG_L1TF));
+
        shadow_nonpresent_or_rsvd_lower_gfn_mask =
                GENMASK_ULL(low_phys_bits - 1, PAGE_SHIFT);
 }
@@ -2892,7 +2901,9 @@ static bool kvm_is_mmio_pfn(kvm_pfn_t pfn)
                         */
                        (!pat_enabled() || pat_pfn_immune_to_uc_mtrr(pfn));
 
-       return true;
+       return !e820__mapped_raw_any(pfn_to_hpa(pfn),
+                                    pfn_to_hpa(pfn + 1) - 1,
+                                    E820_TYPE_RAM);
 }
 
 /* Bits which may be returned by set_spte() */
index e9ea2d4..9f72cc4 100644 (file)
@@ -48,11 +48,6 @@ static bool msr_mtrr_valid(unsigned msr)
        return false;
 }
 
-static bool valid_pat_type(unsigned t)
-{
-       return t < 8 && (1 << t) & 0xf3; /* 0, 1, 4, 5, 6, 7 */
-}
-
 static bool valid_mtrr_type(unsigned t)
 {
        return t < 8 && (1 << t) & 0x73; /* 0, 1, 4, 5, 6 */
@@ -67,10 +62,7 @@ bool kvm_mtrr_valid(struct kvm_vcpu *vcpu, u32 msr, u64 data)
                return false;
 
        if (msr == MSR_IA32_CR_PAT) {
-               for (i = 0; i < 8; i++)
-                       if (!valid_pat_type((data >> (i * 8)) & 0xff))
-                               return false;
-               return true;
+               return kvm_pat_valid(data);
        } else if (msr == MSR_MTRRdefType) {
                if (data & ~0xcff)
                        return false;
index 0871503..367a47d 100644 (file)
@@ -141,15 +141,35 @@ static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
        struct page *page;
 
        npages = get_user_pages_fast((unsigned long)ptep_user, 1, FOLL_WRITE, &page);
-       /* Check if the user is doing something meaningless. */
-       if (unlikely(npages != 1))
-               return -EFAULT;
-
-       table = kmap_atomic(page);
-       ret = CMPXCHG(&table[index], orig_pte, new_pte);
-       kunmap_atomic(table);
-
-       kvm_release_page_dirty(page);
+       if (likely(npages == 1)) {
+               table = kmap_atomic(page);
+               ret = CMPXCHG(&table[index], orig_pte, new_pte);
+               kunmap_atomic(table);
+
+               kvm_release_page_dirty(page);
+       } else {
+               struct vm_area_struct *vma;
+               unsigned long vaddr = (unsigned long)ptep_user & PAGE_MASK;
+               unsigned long pfn;
+               unsigned long paddr;
+
+               down_read(&current->mm->mmap_sem);
+               vma = find_vma_intersection(current->mm, vaddr, vaddr + PAGE_SIZE);
+               if (!vma || !(vma->vm_flags & VM_PFNMAP)) {
+                       up_read(&current->mm->mmap_sem);
+                       return -EFAULT;
+               }
+               pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
+               paddr = pfn << PAGE_SHIFT;
+               table = memremap(paddr, PAGE_SIZE, MEMREMAP_WB);
+               if (!table) {
+                       up_read(&current->mm->mmap_sem);
+                       return -EFAULT;
+               }
+               ret = CMPXCHG(&table[index], orig_pte, new_pte);
+               memunmap(table);
+               up_read(&current->mm->mmap_sem);
+       }
 
        return (ret != orig_pte);
 }
index 6b92eaf..a849dcb 100644 (file)
@@ -2091,7 +2091,7 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
        init_vmcb(svm);
 
        kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy, true);
-       kvm_register_write(vcpu, VCPU_REGS_RDX, eax);
+       kvm_rdx_write(vcpu, eax);
 
        if (kvm_vcpu_apicv_active(vcpu) && !init_event)
                avic_update_vapic_bar(svm, APIC_DEFAULT_PHYS_BASE);
@@ -3071,32 +3071,6 @@ static inline bool nested_svm_nmi(struct vcpu_svm *svm)
        return false;
 }
 
-static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, struct page **_page)
-{
-       struct page *page;
-
-       might_sleep();
-
-       page = kvm_vcpu_gfn_to_page(&svm->vcpu, gpa >> PAGE_SHIFT);
-       if (is_error_page(page))
-               goto error;
-
-       *_page = page;
-
-       return kmap(page);
-
-error:
-       kvm_inject_gp(&svm->vcpu, 0);
-
-       return NULL;
-}
-
-static void nested_svm_unmap(struct page *page)
-{
-       kunmap(page);
-       kvm_release_page_dirty(page);
-}
-
 static int nested_svm_intercept_ioio(struct vcpu_svm *svm)
 {
        unsigned port, size, iopm_len;
@@ -3299,10 +3273,11 @@ static inline void copy_vmcb_control_area(struct vmcb *dst_vmcb, struct vmcb *fr
 
 static int nested_svm_vmexit(struct vcpu_svm *svm)
 {
+       int rc;
        struct vmcb *nested_vmcb;
        struct vmcb *hsave = svm->nested.hsave;
        struct vmcb *vmcb = svm->vmcb;
-       struct page *page;
+       struct kvm_host_map map;
 
        trace_kvm_nested_vmexit_inject(vmcb->control.exit_code,
                                       vmcb->control.exit_info_1,
@@ -3311,9 +3286,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
                                       vmcb->control.exit_int_info_err,
                                       KVM_ISA_SVM);
 
-       nested_vmcb = nested_svm_map(svm, svm->nested.vmcb, &page);
-       if (!nested_vmcb)
+       rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map);
+       if (rc) {
+               if (rc == -EINVAL)
+                       kvm_inject_gp(&svm->vcpu, 0);
                return 1;
+       }
+
+       nested_vmcb = map.hva;
 
        /* Exit Guest-Mode */
        leave_guest_mode(&svm->vcpu);
@@ -3408,16 +3388,16 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
        } else {
                (void)kvm_set_cr3(&svm->vcpu, hsave->save.cr3);
        }
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, hsave->save.rax);
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, hsave->save.rsp);
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RIP, hsave->save.rip);
+       kvm_rax_write(&svm->vcpu, hsave->save.rax);
+       kvm_rsp_write(&svm->vcpu, hsave->save.rsp);
+       kvm_rip_write(&svm->vcpu, hsave->save.rip);
        svm->vmcb->save.dr7 = 0;
        svm->vmcb->save.cpl = 0;
        svm->vmcb->control.exit_int_info = 0;
 
        mark_all_dirty(svm->vmcb);
 
-       nested_svm_unmap(page);
+       kvm_vcpu_unmap(&svm->vcpu, &map, true);
 
        nested_svm_uninit_mmu_context(&svm->vcpu);
        kvm_mmu_reset_context(&svm->vcpu);
@@ -3483,7 +3463,7 @@ static bool nested_vmcb_checks(struct vmcb *vmcb)
 }
 
 static void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,
-                                struct vmcb *nested_vmcb, struct page *page)
+                                struct vmcb *nested_vmcb, struct kvm_host_map *map)
 {
        if (kvm_get_rflags(&svm->vcpu) & X86_EFLAGS_IF)
                svm->vcpu.arch.hflags |= HF_HIF_MASK;
@@ -3516,9 +3496,9 @@ static void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,
        kvm_mmu_reset_context(&svm->vcpu);
 
        svm->vmcb->save.cr2 = svm->vcpu.arch.cr2 = nested_vmcb->save.cr2;
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, nested_vmcb->save.rax);
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, nested_vmcb->save.rsp);
-       kvm_register_write(&svm->vcpu, VCPU_REGS_RIP, nested_vmcb->save.rip);
+       kvm_rax_write(&svm->vcpu, nested_vmcb->save.rax);
+       kvm_rsp_write(&svm->vcpu, nested_vmcb->save.rsp);
+       kvm_rip_write(&svm->vcpu, nested_vmcb->save.rip);
 
        /* In case we don't even reach vcpu_run, the fields are not updated */
        svm->vmcb->save.rax = nested_vmcb->save.rax;
@@ -3567,7 +3547,7 @@ static void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,
        svm->vmcb->control.pause_filter_thresh =
                nested_vmcb->control.pause_filter_thresh;
 
-       nested_svm_unmap(page);
+       kvm_vcpu_unmap(&svm->vcpu, map, true);
 
        /* Enter Guest-Mode */
        enter_guest_mode(&svm->vcpu);
@@ -3587,17 +3567,23 @@ static void enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb_gpa,
 
 static bool nested_svm_vmrun(struct vcpu_svm *svm)
 {
+       int rc;
        struct vmcb *nested_vmcb;
        struct vmcb *hsave = svm->nested.hsave;
        struct vmcb *vmcb = svm->vmcb;
-       struct page *page;
+       struct kvm_host_map map;
        u64 vmcb_gpa;
 
        vmcb_gpa = svm->vmcb->save.rax;
 
-       nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
-       if (!nested_vmcb)
+       rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map);
+       if (rc) {
+               if (rc == -EINVAL)
+                       kvm_inject_gp(&svm->vcpu, 0);
                return false;
+       }
+
+       nested_vmcb = map.hva;
 
        if (!nested_vmcb_checks(nested_vmcb)) {
                nested_vmcb->control.exit_code    = SVM_EXIT_ERR;
@@ -3605,7 +3591,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
                nested_vmcb->control.exit_info_1  = 0;
                nested_vmcb->control.exit_info_2  = 0;
 
-               nested_svm_unmap(page);
+               kvm_vcpu_unmap(&svm->vcpu, &map, true);
 
                return false;
        }
@@ -3649,7 +3635,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
 
        copy_vmcb_control_area(hsave, vmcb);
 
-       enter_svm_guest_mode(svm, vmcb_gpa, nested_vmcb, page);
+       enter_svm_guest_mode(svm, vmcb_gpa, nested_vmcb, &map);
 
        return true;
 }
@@ -3673,21 +3659,26 @@ static void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
 static int vmload_interception(struct vcpu_svm *svm)
 {
        struct vmcb *nested_vmcb;
-       struct page *page;
+       struct kvm_host_map map;
        int ret;
 
        if (nested_svm_check_permissions(svm))
                return 1;
 
-       nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
-       if (!nested_vmcb)
+       ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->vmcb->save.rax), &map);
+       if (ret) {
+               if (ret == -EINVAL)
+                       kvm_inject_gp(&svm->vcpu, 0);
                return 1;
+       }
+
+       nested_vmcb = map.hva;
 
        svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
        ret = kvm_skip_emulated_instruction(&svm->vcpu);
 
        nested_svm_vmloadsave(nested_vmcb, svm->vmcb);
-       nested_svm_unmap(page);
+       kvm_vcpu_unmap(&svm->vcpu, &map, true);
 
        return ret;
 }
@@ -3695,21 +3686,26 @@ static int vmload_interception(struct vcpu_svm *svm)
 static int vmsave_interception(struct vcpu_svm *svm)
 {
        struct vmcb *nested_vmcb;
-       struct page *page;
+       struct kvm_host_map map;
        int ret;
 
        if (nested_svm_check_permissions(svm))
                return 1;
 
-       nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page);
-       if (!nested_vmcb)
+       ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->vmcb->save.rax), &map);
+       if (ret) {
+               if (ret == -EINVAL)
+                       kvm_inject_gp(&svm->vcpu, 0);
                return 1;
+       }
+
+       nested_vmcb = map.hva;
 
        svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
        ret = kvm_skip_emulated_instruction(&svm->vcpu);
 
        nested_svm_vmloadsave(svm->vmcb, nested_vmcb);
-       nested_svm_unmap(page);
+       kvm_vcpu_unmap(&svm->vcpu, &map, true);
 
        return ret;
 }
@@ -3791,11 +3787,11 @@ static int invlpga_interception(struct vcpu_svm *svm)
 {
        struct kvm_vcpu *vcpu = &svm->vcpu;
 
-       trace_kvm_invlpga(svm->vmcb->save.rip, kvm_register_read(&svm->vcpu, VCPU_REGS_RCX),
-                         kvm_register_read(&svm->vcpu, VCPU_REGS_RAX));
+       trace_kvm_invlpga(svm->vmcb->save.rip, kvm_rcx_read(&svm->vcpu),
+                         kvm_rax_read(&svm->vcpu));
 
        /* Let's treat INVLPGA the same as INVLPG (can be optimized!) */
-       kvm_mmu_invlpg(vcpu, kvm_register_read(&svm->vcpu, VCPU_REGS_RAX));
+       kvm_mmu_invlpg(vcpu, kvm_rax_read(&svm->vcpu));
 
        svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
        return kvm_skip_emulated_instruction(&svm->vcpu);
@@ -3803,7 +3799,7 @@ static int invlpga_interception(struct vcpu_svm *svm)
 
 static int skinit_interception(struct vcpu_svm *svm)
 {
-       trace_kvm_skinit(svm->vmcb->save.rip, kvm_register_read(&svm->vcpu, VCPU_REGS_RAX));
+       trace_kvm_skinit(svm->vmcb->save.rip, kvm_rax_read(&svm->vcpu));
 
        kvm_queue_exception(&svm->vcpu, UD_VECTOR);
        return 1;
@@ -3817,7 +3813,7 @@ static int wbinvd_interception(struct vcpu_svm *svm)
 static int xsetbv_interception(struct vcpu_svm *svm)
 {
        u64 new_bv = kvm_read_edx_eax(&svm->vcpu);
-       u32 index = kvm_register_read(&svm->vcpu, VCPU_REGS_RCX);
+       u32 index = kvm_rcx_read(&svm->vcpu);
 
        if (kvm_set_xcr(&svm->vcpu, index, new_bv) == 0) {
                svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
@@ -4213,7 +4209,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
 static int rdmsr_interception(struct vcpu_svm *svm)
 {
-       u32 ecx = kvm_register_read(&svm->vcpu, VCPU_REGS_RCX);
+       u32 ecx = kvm_rcx_read(&svm->vcpu);
        struct msr_data msr_info;
 
        msr_info.index = ecx;
@@ -4225,10 +4221,8 @@ static int rdmsr_interception(struct vcpu_svm *svm)
        } else {
                trace_kvm_msr_read(ecx, msr_info.data);
 
-               kvm_register_write(&svm->vcpu, VCPU_REGS_RAX,
-                                  msr_info.data & 0xffffffff);
-               kvm_register_write(&svm->vcpu, VCPU_REGS_RDX,
-                                  msr_info.data >> 32);
+               kvm_rax_write(&svm->vcpu, msr_info.data & 0xffffffff);
+               kvm_rdx_write(&svm->vcpu, msr_info.data >> 32);
                svm->next_rip = kvm_rip_read(&svm->vcpu) + 2;
                return kvm_skip_emulated_instruction(&svm->vcpu);
        }
@@ -4422,7 +4416,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
 static int wrmsr_interception(struct vcpu_svm *svm)
 {
        struct msr_data msr;
-       u32 ecx = kvm_register_read(&svm->vcpu, VCPU_REGS_RCX);
+       u32 ecx = kvm_rcx_read(&svm->vcpu);
        u64 data = kvm_read_edx_eax(&svm->vcpu);
 
        msr.data = data;
@@ -6236,7 +6230,7 @@ static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
 {
        struct vcpu_svm *svm = to_svm(vcpu);
        struct vmcb *nested_vmcb;
-       struct page *page;
+       struct kvm_host_map map;
        u64 guest;
        u64 vmcb;
 
@@ -6244,10 +6238,10 @@ static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
        vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
 
        if (guest) {
-               nested_vmcb = nested_svm_map(svm, vmcb, &page);
-               if (!nested_vmcb)
+               if (kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb), &map) == -EINVAL)
                        return 1;
-               enter_svm_guest_mode(svm, vmcb, nested_vmcb, page);
+               nested_vmcb = map.hva;
+               enter_svm_guest_mode(svm, vmcb, nested_vmcb, &map);
        }
        return 0;
 }
index 854e144..d6664ee 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef __KVM_X86_VMX_CAPS_H
 #define __KVM_X86_VMX_CAPS_H
 
+#include <asm/vmx.h>
+
 #include "lapic.h"
 
 extern bool __read_mostly enable_vpid;
index 0c601d0..f1a6911 100644 (file)
@@ -193,10 +193,8 @@ static inline void nested_release_evmcs(struct kvm_vcpu *vcpu)
        if (!vmx->nested.hv_evmcs)
                return;
 
-       kunmap(vmx->nested.hv_evmcs_page);
-       kvm_release_page_dirty(vmx->nested.hv_evmcs_page);
+       kvm_vcpu_unmap(vcpu, &vmx->nested.hv_evmcs_map, true);
        vmx->nested.hv_evmcs_vmptr = -1ull;
-       vmx->nested.hv_evmcs_page = NULL;
        vmx->nested.hv_evmcs = NULL;
 }
 
@@ -229,16 +227,9 @@ static void free_nested(struct kvm_vcpu *vcpu)
                kvm_release_page_dirty(vmx->nested.apic_access_page);
                vmx->nested.apic_access_page = NULL;
        }
-       if (vmx->nested.virtual_apic_page) {
-               kvm_release_page_dirty(vmx->nested.virtual_apic_page);
-               vmx->nested.virtual_apic_page = NULL;
-       }
-       if (vmx->nested.pi_desc_page) {
-               kunmap(vmx->nested.pi_desc_page);
-               kvm_release_page_dirty(vmx->nested.pi_desc_page);
-               vmx->nested.pi_desc_page = NULL;
-               vmx->nested.pi_desc = NULL;
-       }
+       kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true);
+       kvm_vcpu_unmap(vcpu, &vmx->nested.pi_desc_map, true);
+       vmx->nested.pi_desc = NULL;
 
        kvm_mmu_free_roots(vcpu, &vcpu->arch.guest_mmu, KVM_MMU_ROOTS_ALL);
 
@@ -519,39 +510,19 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
                                                 struct vmcs12 *vmcs12)
 {
        int msr;
-       struct page *page;
        unsigned long *msr_bitmap_l1;
        unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.vmcs02.msr_bitmap;
-       /*
-        * pred_cmd & spec_ctrl are trying to verify two things:
-        *
-        * 1. L0 gave a permission to L1 to actually passthrough the MSR. This
-        *    ensures that we do not accidentally generate an L02 MSR bitmap
-        *    from the L12 MSR bitmap that is too permissive.
-        * 2. That L1 or L2s have actually used the MSR. This avoids
-        *    unnecessarily merging of the bitmap if the MSR is unused. This
-        *    works properly because we only update the L01 MSR bitmap lazily.
-        *    So even if L0 should pass L1 these MSRs, the L01 bitmap is only
-        *    updated to reflect this when L1 (or its L2s) actually write to
-        *    the MSR.
-        */
-       bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
-       bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
+       struct kvm_host_map *map = &to_vmx(vcpu)->nested.msr_bitmap_map;
 
        /* Nothing to do if the MSR bitmap is not in use.  */
        if (!cpu_has_vmx_msr_bitmap() ||
            !nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS))
                return false;
 
-       if (!nested_cpu_has_virt_x2apic_mode(vmcs12) &&
-           !pred_cmd && !spec_ctrl)
-               return false;
-
-       page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->msr_bitmap);
-       if (is_error_page(page))
+       if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->msr_bitmap), map))
                return false;
 
-       msr_bitmap_l1 = (unsigned long *)kmap(page);
+       msr_bitmap_l1 = (unsigned long *)map->hva;
 
        /*
         * To keep the control flow simple, pay eight 8-byte writes (sixteen
@@ -592,20 +563,42 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
                }
        }
 
-       if (spec_ctrl)
+       /* KVM unconditionally exposes the FS/GS base MSRs to L1. */
+       nested_vmx_disable_intercept_for_msr(msr_bitmap_l1, msr_bitmap_l0,
+                                            MSR_FS_BASE, MSR_TYPE_RW);
+
+       nested_vmx_disable_intercept_for_msr(msr_bitmap_l1, msr_bitmap_l0,
+                                            MSR_GS_BASE, MSR_TYPE_RW);
+
+       nested_vmx_disable_intercept_for_msr(msr_bitmap_l1, msr_bitmap_l0,
+                                            MSR_KERNEL_GS_BASE, MSR_TYPE_RW);
+
+       /*
+        * Checking the L0->L1 bitmap is trying to verify two things:
+        *
+        * 1. L0 gave a permission to L1 to actually passthrough the MSR. This
+        *    ensures that we do not accidentally generate an L02 MSR bitmap
+        *    from the L12 MSR bitmap that is too permissive.
+        * 2. That L1 or L2s have actually used the MSR. This avoids
+        *    unnecessarily merging of the bitmap if the MSR is unused. This
+        *    works properly because we only update the L01 MSR bitmap lazily.
+        *    So even if L0 should pass L1 these MSRs, the L01 bitmap is only
+        *    updated to reflect this when L1 (or its L2s) actually write to
+        *    the MSR.
+        */
+       if (!msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL))
                nested_vmx_disable_intercept_for_msr(
                                        msr_bitmap_l1, msr_bitmap_l0,
                                        MSR_IA32_SPEC_CTRL,
                                        MSR_TYPE_R | MSR_TYPE_W);
 
-       if (pred_cmd)
+       if (!msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD))
                nested_vmx_disable_intercept_for_msr(
                                        msr_bitmap_l1, msr_bitmap_l0,
                                        MSR_IA32_PRED_CMD,
                                        MSR_TYPE_W);
 
-       kunmap(page);
-       kvm_release_page_clean(page);
+       kvm_vcpu_unmap(vcpu, &to_vmx(vcpu)->nested.msr_bitmap_map, false);
 
        return true;
 }
@@ -613,20 +606,20 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
 static void nested_cache_shadow_vmcs12(struct kvm_vcpu *vcpu,
                                       struct vmcs12 *vmcs12)
 {
+       struct kvm_host_map map;
        struct vmcs12 *shadow;
-       struct page *page;
 
        if (!nested_cpu_has_shadow_vmcs(vmcs12) ||
            vmcs12->vmcs_link_pointer == -1ull)
                return;
 
        shadow = get_shadow_vmcs12(vcpu);
-       page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->vmcs_link_pointer);
 
-       memcpy(shadow, kmap(page), VMCS12_SIZE);
+       if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->vmcs_link_pointer), &map))
+               return;
 
-       kunmap(page);
-       kvm_release_page_clean(page);
+       memcpy(shadow, map.hva, VMCS12_SIZE);
+       kvm_vcpu_unmap(vcpu, &map, false);
 }
 
 static void nested_flush_cached_shadow_vmcs12(struct kvm_vcpu *vcpu,
@@ -930,7 +923,7 @@ static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne
        if (cr3 != kvm_read_cr3(vcpu) || (!nested_ept && pdptrs_changed(vcpu))) {
                if (!nested_cr3_valid(vcpu, cr3)) {
                        *entry_failure_code = ENTRY_FAIL_DEFAULT;
-                       return 1;
+                       return -EINVAL;
                }
 
                /*
@@ -941,7 +934,7 @@ static int nested_vmx_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3, bool ne
                    !nested_ept) {
                        if (!load_pdptrs(vcpu, vcpu->arch.walk_mmu, cr3)) {
                                *entry_failure_code = ENTRY_FAIL_PDPTE;
-                               return 1;
+                               return -EINVAL;
                        }
                }
        }
@@ -1794,13 +1787,11 @@ static int nested_vmx_handle_enlightened_vmptrld(struct kvm_vcpu *vcpu,
 
                nested_release_evmcs(vcpu);
 
-               vmx->nested.hv_evmcs_page = kvm_vcpu_gpa_to_page(
-                       vcpu, assist_page.current_nested_vmcs);
-
-               if (unlikely(is_error_page(vmx->nested.hv_evmcs_page)))
+               if (kvm_vcpu_map(vcpu, gpa_to_gfn(assist_page.current_nested_vmcs),
+                                &vmx->nested.hv_evmcs_map))
                        return 0;
 
-               vmx->nested.hv_evmcs = kmap(vmx->nested.hv_evmcs_page);
+               vmx->nested.hv_evmcs = vmx->nested.hv_evmcs_map.hva;
 
                /*
                 * Currently, KVM only supports eVMCS version 1
@@ -2373,19 +2364,19 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
         */
        if (vmx->emulation_required) {
                *entry_failure_code = ENTRY_FAIL_DEFAULT;
-               return 1;
+               return -EINVAL;
        }
 
        /* Shadow page tables on either EPT or shadow page tables. */
        if (nested_vmx_load_cr3(vcpu, vmcs12->guest_cr3, nested_cpu_has_ept(vmcs12),
                                entry_failure_code))
-               return 1;
+               return -EINVAL;
 
        if (!enable_ept)
                vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested;
 
-       kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp);
-       kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->guest_rip);
+       kvm_rsp_write(vcpu, vmcs12->guest_rsp);
+       kvm_rip_write(vcpu, vmcs12->guest_rip);
        return 0;
 }
 
@@ -2589,11 +2580,19 @@ static int nested_check_vm_entry_controls(struct kvm_vcpu *vcpu,
        return 0;
 }
 
-/*
- * Checks related to Host Control Registers and MSRs
- */
-static int nested_check_host_control_regs(struct kvm_vcpu *vcpu,
-                                          struct vmcs12 *vmcs12)
+static int nested_vmx_check_controls(struct kvm_vcpu *vcpu,
+                                    struct vmcs12 *vmcs12)
+{
+       if (nested_check_vm_execution_controls(vcpu, vmcs12) ||
+           nested_check_vm_exit_controls(vcpu, vmcs12) ||
+           nested_check_vm_entry_controls(vcpu, vmcs12))
+               return -EINVAL;
+
+       return 0;
+}
+
+static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu,
+                                      struct vmcs12 *vmcs12)
 {
        bool ia32e;
 
@@ -2606,6 +2605,10 @@ static int nested_check_host_control_regs(struct kvm_vcpu *vcpu,
            is_noncanonical_address(vmcs12->host_ia32_sysenter_eip, vcpu))
                return -EINVAL;
 
+       if ((vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PAT) &&
+           !kvm_pat_valid(vmcs12->host_ia32_pat))
+               return -EINVAL;
+
        /*
         * If the load IA32_EFER VM-exit control is 1, bits reserved in the
         * IA32_EFER MSR must be 0 in the field for that register. In addition,
@@ -2624,41 +2627,12 @@ static int nested_check_host_control_regs(struct kvm_vcpu *vcpu,
        return 0;
 }
 
-/*
- * Checks related to Guest Non-register State
- */
-static int nested_check_guest_non_reg_state(struct vmcs12 *vmcs12)
-{
-       if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE &&
-           vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT)
-               return -EINVAL;
-
-       return 0;
-}
-
-static int nested_vmx_check_vmentry_prereqs(struct kvm_vcpu *vcpu,
-                                           struct vmcs12 *vmcs12)
-{
-       if (nested_check_vm_execution_controls(vcpu, vmcs12) ||
-           nested_check_vm_exit_controls(vcpu, vmcs12) ||
-           nested_check_vm_entry_controls(vcpu, vmcs12))
-               return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
-
-       if (nested_check_host_control_regs(vcpu, vmcs12))
-               return VMXERR_ENTRY_INVALID_HOST_STATE_FIELD;
-
-       if (nested_check_guest_non_reg_state(vmcs12))
-               return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
-
-       return 0;
-}
-
 static int nested_vmx_check_vmcs_link_ptr(struct kvm_vcpu *vcpu,
                                          struct vmcs12 *vmcs12)
 {
-       int r;
-       struct page *page;
+       int r = 0;
        struct vmcs12 *shadow;
+       struct kvm_host_map map;
 
        if (vmcs12->vmcs_link_pointer == -1ull)
                return 0;
@@ -2666,23 +2640,34 @@ static int nested_vmx_check_vmcs_link_ptr(struct kvm_vcpu *vcpu,
        if (!page_address_valid(vcpu, vmcs12->vmcs_link_pointer))
                return -EINVAL;
 
-       page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->vmcs_link_pointer);
-       if (is_error_page(page))
+       if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->vmcs_link_pointer), &map))
                return -EINVAL;
 
-       r = 0;
-       shadow = kmap(page);
+       shadow = map.hva;
+
        if (shadow->hdr.revision_id != VMCS12_REVISION ||
            shadow->hdr.shadow_vmcs != nested_cpu_has_shadow_vmcs(vmcs12))
                r = -EINVAL;
-       kunmap(page);
-       kvm_release_page_clean(page);
+
+       kvm_vcpu_unmap(vcpu, &map, false);
        return r;
 }
 
-static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
-                                            struct vmcs12 *vmcs12,
-                                            u32 *exit_qual)
+/*
+ * Checks related to Guest Non-register State
+ */
+static int nested_check_guest_non_reg_state(struct vmcs12 *vmcs12)
+{
+       if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE &&
+           vmcs12->guest_activity_state != GUEST_ACTIVITY_HLT)
+               return -EINVAL;
+
+       return 0;
+}
+
+static int nested_vmx_check_guest_state(struct kvm_vcpu *vcpu,
+                                       struct vmcs12 *vmcs12,
+                                       u32 *exit_qual)
 {
        bool ia32e;
 
@@ -2690,11 +2675,15 @@ static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
 
        if (!nested_guest_cr0_valid(vcpu, vmcs12->guest_cr0) ||
            !nested_guest_cr4_valid(vcpu, vmcs12->guest_cr4))
-               return 1;
+               return -EINVAL;
+
+       if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PAT) &&
+           !kvm_pat_valid(vmcs12->guest_ia32_pat))
+               return -EINVAL;
 
        if (nested_vmx_check_vmcs_link_ptr(vcpu, vmcs12)) {
                *exit_qual = ENTRY_FAIL_VMCS_LINK_PTR;
-               return 1;
+               return -EINVAL;
        }
 
        /*
@@ -2713,13 +2702,16 @@ static int nested_vmx_check_vmentry_postreqs(struct kvm_vcpu *vcpu,
                    ia32e != !!(vmcs12->guest_ia32_efer & EFER_LMA) ||
                    ((vmcs12->guest_cr0 & X86_CR0_PG) &&
                     ia32e != !!(vmcs12->guest_ia32_efer & EFER_LME)))
-                       return 1;
+                       return -EINVAL;
        }
 
        if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS) &&
-               (is_noncanonical_address(vmcs12->guest_bndcfgs & PAGE_MASK, vcpu) ||
-               (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD)))
-                       return 1;
+           (is_noncanonical_address(vmcs12->guest_bndcfgs & PAGE_MASK, vcpu) ||
+            (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD)))
+               return -EINVAL;
+
+       if (nested_check_guest_non_reg_state(vmcs12))
+               return -EINVAL;
 
        return 0;
 }
@@ -2832,6 +2824,7 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
 {
        struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
        struct vcpu_vmx *vmx = to_vmx(vcpu);
+       struct kvm_host_map *map;
        struct page *page;
        u64 hpa;
 
@@ -2864,20 +2857,14 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
        }
 
        if (nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW)) {
-               if (vmx->nested.virtual_apic_page) { /* shouldn't happen */
-                       kvm_release_page_dirty(vmx->nested.virtual_apic_page);
-                       vmx->nested.virtual_apic_page = NULL;
-               }
-               page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->virtual_apic_page_addr);
+               map = &vmx->nested.virtual_apic_map;
 
                /*
                 * If translation failed, VM entry will fail because
                 * prepare_vmcs02 set VIRTUAL_APIC_PAGE_ADDR to -1ull.
                 */
-               if (!is_error_page(page)) {
-                       vmx->nested.virtual_apic_page = page;
-                       hpa = page_to_phys(vmx->nested.virtual_apic_page);
-                       vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, hpa);
+               if (!kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->virtual_apic_page_addr), map)) {
+                       vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, pfn_to_hpa(map->pfn));
                } else if (nested_cpu_has(vmcs12, CPU_BASED_CR8_LOAD_EXITING) &&
                           nested_cpu_has(vmcs12, CPU_BASED_CR8_STORE_EXITING) &&
                           !nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) {
@@ -2898,26 +2885,15 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
        }
 
        if (nested_cpu_has_posted_intr(vmcs12)) {
-               if (vmx->nested.pi_desc_page) { /* shouldn't happen */
-                       kunmap(vmx->nested.pi_desc_page);
-                       kvm_release_page_dirty(vmx->nested.pi_desc_page);
-                       vmx->nested.pi_desc_page = NULL;
-                       vmx->nested.pi_desc = NULL;
-                       vmcs_write64(POSTED_INTR_DESC_ADDR, -1ull);
+               map = &vmx->nested.pi_desc_map;
+
+               if (!kvm_vcpu_map(vcpu, gpa_to_gfn(vmcs12->posted_intr_desc_addr), map)) {
+                       vmx->nested.pi_desc =
+                               (struct pi_desc *)(((void *)map->hva) +
+                               offset_in_page(vmcs12->posted_intr_desc_addr));
+                       vmcs_write64(POSTED_INTR_DESC_ADDR,
+                                    pfn_to_hpa(map->pfn) + offset_in_page(vmcs12->posted_intr_desc_addr));
                }
-               page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->posted_intr_desc_addr);
-               if (is_error_page(page))
-                       return;
-               vmx->nested.pi_desc_page = page;
-               vmx->nested.pi_desc = kmap(vmx->nested.pi_desc_page);
-               vmx->nested.pi_desc =
-                       (struct pi_desc *)((void *)vmx->nested.pi_desc +
-                       (unsigned long)(vmcs12->posted_intr_desc_addr &
-                       (PAGE_SIZE - 1)));
-               vmcs_write64(POSTED_INTR_DESC_ADDR,
-                       page_to_phys(vmx->nested.pi_desc_page) +
-                       (unsigned long)(vmcs12->posted_intr_desc_addr &
-                       (PAGE_SIZE - 1)));
        }
        if (nested_vmx_prepare_msr_bitmap(vcpu, vmcs12))
                vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL,
@@ -3000,7 +2976,7 @@ int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry)
                        return -1;
                }
 
-               if (nested_vmx_check_vmentry_postreqs(vcpu, vmcs12, &exit_qual))
+               if (nested_vmx_check_guest_state(vcpu, vmcs12, &exit_qual))
                        goto vmentry_fail_vmexit;
        }
 
@@ -3145,9 +3121,11 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
                        launch ? VMXERR_VMLAUNCH_NONCLEAR_VMCS
                               : VMXERR_VMRESUME_NONLAUNCHED_VMCS);
 
-       ret = nested_vmx_check_vmentry_prereqs(vcpu, vmcs12);
-       if (ret)
-               return nested_vmx_failValid(vcpu, ret);
+       if (nested_vmx_check_controls(vcpu, vmcs12))
+               return nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
+
+       if (nested_vmx_check_host_state(vcpu, vmcs12))
+               return nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_HOST_STATE_FIELD);
 
        /*
         * We're finally done with prerequisite checking, and can start with
@@ -3310,11 +3288,12 @@ static void vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
 
        max_irr = find_last_bit((unsigned long *)vmx->nested.pi_desc->pir, 256);
        if (max_irr != 256) {
-               vapic_page = kmap(vmx->nested.virtual_apic_page);
+               vapic_page = vmx->nested.virtual_apic_map.hva;
+               if (!vapic_page)
+                       return;
+
                __kvm_apic_update_irr(vmx->nested.pi_desc->pir,
                        vapic_page, &max_irr);
-               kunmap(vmx->nested.virtual_apic_page);
-
                status = vmcs_read16(GUEST_INTR_STATUS);
                if ((u8)max_irr > ((u8)status & 0xff)) {
                        status &= ~0xff;
@@ -3425,8 +3404,8 @@ static void sync_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
        vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12);
        vmcs12->guest_cr4 = vmcs12_guest_cr4(vcpu, vmcs12);
 
-       vmcs12->guest_rsp = kvm_register_read(vcpu, VCPU_REGS_RSP);
-       vmcs12->guest_rip = kvm_register_read(vcpu, VCPU_REGS_RIP);
+       vmcs12->guest_rsp = kvm_rsp_read(vcpu);
+       vmcs12->guest_rip = kvm_rip_read(vcpu);
        vmcs12->guest_rflags = vmcs_readl(GUEST_RFLAGS);
 
        vmcs12->guest_es_selector = vmcs_read16(GUEST_ES_SELECTOR);
@@ -3609,8 +3588,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
                vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
        vmx_set_efer(vcpu, vcpu->arch.efer);
 
-       kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
-       kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
+       kvm_rsp_write(vcpu, vmcs12->host_rsp);
+       kvm_rip_write(vcpu, vmcs12->host_rip);
        vmx_set_rflags(vcpu, X86_EFLAGS_FIXED);
        vmx_set_interrupt_shadow(vcpu, 0);
 
@@ -3955,16 +3934,9 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
                kvm_release_page_dirty(vmx->nested.apic_access_page);
                vmx->nested.apic_access_page = NULL;
        }
-       if (vmx->nested.virtual_apic_page) {
-               kvm_release_page_dirty(vmx->nested.virtual_apic_page);
-               vmx->nested.virtual_apic_page = NULL;
-       }
-       if (vmx->nested.pi_desc_page) {
-               kunmap(vmx->nested.pi_desc_page);
-               kvm_release_page_dirty(vmx->nested.pi_desc_page);
-               vmx->nested.pi_desc_page = NULL;
-               vmx->nested.pi_desc = NULL;
-       }
+       kvm_vcpu_unmap(vcpu, &vmx->nested.virtual_apic_map, true);
+       kvm_vcpu_unmap(vcpu, &vmx->nested.pi_desc_map, true);
+       vmx->nested.pi_desc = NULL;
 
        /*
         * We are now running in L2, mmu_notifier will force to reload the
@@ -4260,7 +4232,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
 {
        int ret;
        gpa_t vmptr;
-       struct page *page;
+       uint32_t revision;
        struct vcpu_vmx *vmx = to_vmx(vcpu);
        const u64 VMXON_NEEDED_FEATURES = FEATURE_CONTROL_LOCKED
                | FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
@@ -4306,20 +4278,12 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
         * Note - IA32_VMX_BASIC[48] will never be 1 for the nested case;
         * which replaces physical address width with 32
         */
-       if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
-               return nested_vmx_failInvalid(vcpu);
-
-       page = kvm_vcpu_gpa_to_page(vcpu, vmptr);
-       if (is_error_page(page))
+       if (!page_address_valid(vcpu, vmptr))
                return nested_vmx_failInvalid(vcpu);
 
-       if (*(u32 *)kmap(page) != VMCS12_REVISION) {
-               kunmap(page);
-               kvm_release_page_clean(page);
+       if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) ||
+           revision != VMCS12_REVISION)
                return nested_vmx_failInvalid(vcpu);
-       }
-       kunmap(page);
-       kvm_release_page_clean(page);
 
        vmx->nested.vmxon_ptr = vmptr;
        ret = enter_vmx_operation(vcpu);
@@ -4377,7 +4341,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
        if (nested_vmx_get_vmptr(vcpu, &vmptr))
                return 1;
 
-       if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
+       if (!page_address_valid(vcpu, vmptr))
                return nested_vmx_failValid(vcpu,
                        VMXERR_VMCLEAR_INVALID_ADDRESS);
 
@@ -4385,7 +4349,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
                return nested_vmx_failValid(vcpu,
                        VMXERR_VMCLEAR_VMXON_POINTER);
 
-       if (vmx->nested.hv_evmcs_page) {
+       if (vmx->nested.hv_evmcs_map.hva) {
                if (vmptr == vmx->nested.hv_evmcs_vmptr)
                        nested_release_evmcs(vcpu);
        } else {
@@ -4584,7 +4548,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
        if (nested_vmx_get_vmptr(vcpu, &vmptr))
                return 1;
 
-       if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
+       if (!page_address_valid(vcpu, vmptr))
                return nested_vmx_failValid(vcpu,
                        VMXERR_VMPTRLD_INVALID_ADDRESS);
 
@@ -4597,11 +4561,10 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
                return 1;
 
        if (vmx->nested.current_vmptr != vmptr) {
+               struct kvm_host_map map;
                struct vmcs12 *new_vmcs12;
-               struct page *page;
 
-               page = kvm_vcpu_gpa_to_page(vcpu, vmptr);
-               if (is_error_page(page)) {
+               if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmptr), &map)) {
                        /*
                         * Reads from an unbacked page return all 1s,
                         * which means that the 32 bits located at the
@@ -4611,12 +4574,13 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
                        return nested_vmx_failValid(vcpu,
                                VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID);
                }
-               new_vmcs12 = kmap(page);
+
+               new_vmcs12 = map.hva;
+
                if (new_vmcs12->hdr.revision_id != VMCS12_REVISION ||
                    (new_vmcs12->hdr.shadow_vmcs &&
                     !nested_cpu_has_vmx_shadow_vmcs(vcpu))) {
-                       kunmap(page);
-                       kvm_release_page_clean(page);
+                       kvm_vcpu_unmap(vcpu, &map, false);
                        return nested_vmx_failValid(vcpu,
                                VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID);
                }
@@ -4628,8 +4592,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
                 * cached.
                 */
                memcpy(vmx->nested.cached_vmcs12, new_vmcs12, VMCS12_SIZE);
-               kunmap(page);
-               kvm_release_page_clean(page);
+               kvm_vcpu_unmap(vcpu, &map, false);
 
                set_current_vmptr(vmx, vmptr);
        }
@@ -4804,7 +4767,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
 static int nested_vmx_eptp_switching(struct kvm_vcpu *vcpu,
                                     struct vmcs12 *vmcs12)
 {
-       u32 index = vcpu->arch.regs[VCPU_REGS_RCX];
+       u32 index = kvm_rcx_read(vcpu);
        u64 address;
        bool accessed_dirty;
        struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
@@ -4850,7 +4813,7 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu)
 {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
        struct vmcs12 *vmcs12;
-       u32 function = vcpu->arch.regs[VCPU_REGS_RAX];
+       u32 function = kvm_rax_read(vcpu);
 
        /*
         * VMFUNC is only supported for nested guests, but we always enable the
@@ -4936,7 +4899,7 @@ static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu,
 static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,
        struct vmcs12 *vmcs12, u32 exit_reason)
 {
-       u32 msr_index = vcpu->arch.regs[VCPU_REGS_RCX];
+       u32 msr_index = kvm_rcx_read(vcpu);
        gpa_t bitmap;
 
        if (!nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS))
@@ -5373,9 +5336,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
        if (kvm_state->format != 0)
                return -EINVAL;
 
-       if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
-               nested_enable_evmcs(vcpu, NULL);
-
        if (!nested_vmx_allowed(vcpu))
                return kvm_state->vmx.vmxon_pa == -1ull ? 0 : -EINVAL;
 
@@ -5417,6 +5377,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
        if (kvm_state->vmx.vmxon_pa == -1ull)
                return 0;
 
+       if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
+               nested_enable_evmcs(vcpu, NULL);
+
        vmx->nested.vmxon_ptr = kvm_state->vmx.vmxon_pa;
        ret = enter_vmx_operation(vcpu);
        if (ret)
@@ -5460,9 +5423,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
        if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE))
                return 0;
 
-       vmx->nested.nested_run_pending =
-               !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING);
-
        if (nested_cpu_has_shadow_vmcs(vmcs12) &&
            vmcs12->vmcs_link_pointer != -1ull) {
                struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu);
@@ -5480,14 +5440,20 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
                        return -EINVAL;
        }
 
-       if (nested_vmx_check_vmentry_prereqs(vcpu, vmcs12) ||
-           nested_vmx_check_vmentry_postreqs(vcpu, vmcs12, &exit_qual))
+       if (nested_vmx_check_controls(vcpu, vmcs12) ||
+           nested_vmx_check_host_state(vcpu, vmcs12) ||
+           nested_vmx_check_guest_state(vcpu, vmcs12, &exit_qual))
                return -EINVAL;
 
        vmx->nested.dirty_vmcs12 = true;
+       vmx->nested.nested_run_pending =
+               !!(kvm_state->flags & KVM_STATE_NESTED_RUN_PENDING);
+
        ret = nested_vmx_enter_non_root_mode(vcpu, false);
-       if (ret)
+       if (ret) {
+               vmx->nested.nested_run_pending = 0;
                return -EINVAL;
+       }
 
        return 0;
 }
index 5ab4a36..f8502c3 100644 (file)
@@ -227,7 +227,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                }
                break;
        case MSR_CORE_PERF_GLOBAL_OVF_CTRL:
-               if (!(data & (pmu->global_ctrl_mask & ~(3ull<<62)))) {
+               if (!(data & pmu->global_ovf_ctrl_mask)) {
                        if (!msr_info->host_initiated)
                                pmu->global_status &= ~data;
                        pmu->global_ovf_ctrl = data;
@@ -297,6 +297,12 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
        pmu->global_ctrl = ((1ull << pmu->nr_arch_gp_counters) - 1) |
                (((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED);
        pmu->global_ctrl_mask = ~pmu->global_ctrl;
+       pmu->global_ovf_ctrl_mask = pmu->global_ctrl_mask
+                       & ~(MSR_CORE_PERF_GLOBAL_OVF_CTRL_OVF_BUF |
+                           MSR_CORE_PERF_GLOBAL_OVF_CTRL_COND_CHGD);
+       if (kvm_x86_ops->pt_supported())
+               pmu->global_ovf_ctrl_mask &=
+                               ~MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI;
 
        entry = kvm_find_cpuid_entry(vcpu, 7, 0);
        if (entry &&
index e1fa935..1ac1676 100644 (file)
@@ -1692,6 +1692,9 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_IA32_SYSENTER_ESP:
                msr_info->data = vmcs_readl(GUEST_SYSENTER_ESP);
                break;
+       case MSR_IA32_POWER_CTL:
+               msr_info->data = vmx->msr_ia32_power_ctl;
+               break;
        case MSR_IA32_BNDCFGS:
                if (!kvm_mpx_supported() ||
                    (!msr_info->host_initiated &&
@@ -1822,6 +1825,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_IA32_SYSENTER_ESP:
                vmcs_writel(GUEST_SYSENTER_ESP, data);
                break;
+       case MSR_IA32_POWER_CTL:
+               vmx->msr_ia32_power_ctl = data;
+               break;
        case MSR_IA32_BNDCFGS:
                if (!kvm_mpx_supported() ||
                    (!msr_info->host_initiated &&
@@ -1891,7 +1897,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                break;
        case MSR_IA32_CR_PAT:
                if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
-                       if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
+                       if (!kvm_pat_valid(data))
                                return 1;
                        vmcs_write64(GUEST_IA32_PAT, data);
                        vcpu->arch.pat = data;
@@ -2288,7 +2294,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
        min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
 #endif
        opt = VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL |
-             VM_EXIT_SAVE_IA32_PAT |
              VM_EXIT_LOAD_IA32_PAT |
              VM_EXIT_LOAD_IA32_EFER |
              VM_EXIT_CLEAR_BNDCFGS |
@@ -3619,14 +3624,13 @@ static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)
 
        if (WARN_ON_ONCE(!is_guest_mode(vcpu)) ||
                !nested_cpu_has_vid(get_vmcs12(vcpu)) ||
-               WARN_ON_ONCE(!vmx->nested.virtual_apic_page))
+               WARN_ON_ONCE(!vmx->nested.virtual_apic_map.gfn))
                return false;
 
        rvi = vmx_get_rvi();
 
-       vapic_page = kmap(vmx->nested.virtual_apic_page);
+       vapic_page = vmx->nested.virtual_apic_map.hva;
        vppr = *((u32 *)(vapic_page + APIC_PROCPRI));
-       kunmap(vmx->nested.virtual_apic_page);
 
        return ((rvi & 0xf0) > (vppr & 0xf0));
 }
@@ -4827,7 +4831,7 @@ static int handle_cpuid(struct kvm_vcpu *vcpu)
 
 static int handle_rdmsr(struct kvm_vcpu *vcpu)
 {
-       u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX];
+       u32 ecx = kvm_rcx_read(vcpu);
        struct msr_data msr_info;
 
        msr_info.index = ecx;
@@ -4840,18 +4844,16 @@ static int handle_rdmsr(struct kvm_vcpu *vcpu)
 
        trace_kvm_msr_read(ecx, msr_info.data);
 
-       /* FIXME: handling of bits 32:63 of rax, rdx */
-       vcpu->arch.regs[VCPU_REGS_RAX] = msr_info.data & -1u;
-       vcpu->arch.regs[VCPU_REGS_RDX] = (msr_info.data >> 32) & -1u;
+       kvm_rax_write(vcpu, msr_info.data & -1u);
+       kvm_rdx_write(vcpu, (msr_info.data >> 32) & -1u);
        return kvm_skip_emulated_instruction(vcpu);
 }
 
 static int handle_wrmsr(struct kvm_vcpu *vcpu)
 {
        struct msr_data msr;
-       u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX];
-       u64 data = (vcpu->arch.regs[VCPU_REGS_RAX] & -1u)
-               | ((u64)(vcpu->arch.regs[VCPU_REGS_RDX] & -1u) << 32);
+       u32 ecx = kvm_rcx_read(vcpu);
+       u64 data = kvm_read_edx_eax(vcpu);
 
        msr.data = data;
        msr.index = ecx;
@@ -4922,7 +4924,7 @@ static int handle_wbinvd(struct kvm_vcpu *vcpu)
 static int handle_xsetbv(struct kvm_vcpu *vcpu)
 {
        u64 new_bv = kvm_read_edx_eax(vcpu);
-       u32 index = kvm_register_read(vcpu, VCPU_REGS_RCX);
+       u32 index = kvm_rcx_read(vcpu);
 
        if (kvm_set_xcr(vcpu, index, new_bv) == 0)
                return kvm_skip_emulated_instruction(vcpu);
@@ -5723,8 +5725,16 @@ void dump_vmcs(void)
        if (secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
                pr_err("TSC Multiplier = 0x%016llx\n",
                       vmcs_read64(TSC_MULTIPLIER));
-       if (cpu_based_exec_ctrl & CPU_BASED_TPR_SHADOW)
-               pr_err("TPR Threshold = 0x%02x\n", vmcs_read32(TPR_THRESHOLD));
+       if (cpu_based_exec_ctrl & CPU_BASED_TPR_SHADOW) {
+               if (secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) {
+                       u16 status = vmcs_read16(GUEST_INTR_STATUS);
+                       pr_err("SVI|RVI = %02x|%02x ", status >> 8, status & 0xff);
+               }
+               pr_cont("TPR Threshold = 0x%02x\n", vmcs_read32(TPR_THRESHOLD));
+               if (secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
+                       pr_err("APIC-access addr = 0x%016llx ", vmcs_read64(APIC_ACCESS_ADDR));
+               pr_cont("virt-APIC addr = 0x%016llx\n", vmcs_read64(VIRTUAL_APIC_PAGE_ADDR));
+       }
        if (pin_based_exec_ctrl & PIN_BASED_POSTED_INTR)
                pr_err("PostedIntrVec = 0x%02x\n", vmcs_read16(POSTED_INTR_NV));
        if ((secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT))
@@ -6856,30 +6866,6 @@ static void nested_vmx_entry_exit_ctls_update(struct kvm_vcpu *vcpu)
        }
 }
 
-static bool guest_cpuid_has_pmu(struct kvm_vcpu *vcpu)
-{
-       struct kvm_cpuid_entry2 *entry;
-       union cpuid10_eax eax;
-
-       entry = kvm_find_cpuid_entry(vcpu, 0xa, 0);
-       if (!entry)
-               return false;
-
-       eax.full = entry->eax;
-       return (eax.split.version_id > 0);
-}
-
-static void nested_vmx_procbased_ctls_update(struct kvm_vcpu *vcpu)
-{
-       struct vcpu_vmx *vmx = to_vmx(vcpu);
-       bool pmu_enabled = guest_cpuid_has_pmu(vcpu);
-
-       if (pmu_enabled)
-               vmx->nested.msrs.procbased_ctls_high |= CPU_BASED_RDPMC_EXITING;
-       else
-               vmx->nested.msrs.procbased_ctls_high &= ~CPU_BASED_RDPMC_EXITING;
-}
-
 static void update_intel_pt_cfg(struct kvm_vcpu *vcpu)
 {
        struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -6968,7 +6954,6 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
        if (nested_vmx_allowed(vcpu)) {
                nested_vmx_cr_fixed1_bits_update(vcpu);
                nested_vmx_entry_exit_ctls_update(vcpu);
-               nested_vmx_procbased_ctls_update(vcpu);
        }
 
        if (boot_cpu_has(X86_FEATURE_INTEL_PT) &&
@@ -7028,7 +7013,8 @@ static inline int u64_shl_div_u64(u64 a, unsigned int shift,
        return 0;
 }
 
-static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc)
+static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc,
+                           bool *expired)
 {
        struct vcpu_vmx *vmx;
        u64 tscl, guest_tscl, delta_tsc, lapic_timer_advance_cycles;
@@ -7051,10 +7037,9 @@ static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc)
 
        /* Convert to host delta tsc if tsc scaling is enabled */
        if (vcpu->arch.tsc_scaling_ratio != kvm_default_tsc_scaling_ratio &&
-                       u64_shl_div_u64(delta_tsc,
+           delta_tsc && u64_shl_div_u64(delta_tsc,
                                kvm_tsc_scaling_ratio_frac_bits,
-                               vcpu->arch.tsc_scaling_ratio,
-                               &delta_tsc))
+                               vcpu->arch.tsc_scaling_ratio, &delta_tsc))
                return -ERANGE;
 
        /*
@@ -7067,7 +7052,8 @@ static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc)
                return -ERANGE;
 
        vmx->hv_deadline_tsc = tscl + delta_tsc;
-       return delta_tsc == 0;
+       *expired = !delta_tsc;
+       return 0;
 }
 
 static void vmx_cancel_hv_timer(struct kvm_vcpu *vcpu)
@@ -7104,9 +7090,7 @@ static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu)
 {
        struct vmcs12 *vmcs12;
        struct vcpu_vmx *vmx = to_vmx(vcpu);
-       gpa_t gpa;
-       struct page *page = NULL;
-       u64 *pml_address;
+       gpa_t gpa, dst;
 
        if (is_guest_mode(vcpu)) {
                WARN_ON_ONCE(vmx->nested.pml_full);
@@ -7126,15 +7110,13 @@ static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu)
                }
 
                gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS) & ~0xFFFull;
+               dst = vmcs12->pml_address + sizeof(u64) * vmcs12->guest_pml_index;
 
-               page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->pml_address);
-               if (is_error_page(page))
+               if (kvm_write_guest_page(vcpu->kvm, gpa_to_gfn(dst), &gpa,
+                                        offset_in_page(dst), sizeof(gpa)))
                        return 0;
 
-               pml_address = kmap(page);
-               pml_address[vmcs12->guest_pml_index--] = gpa;
-               kunmap(page);
-               kvm_release_page_clean(page);
+               vmcs12->guest_pml_index--;
        }
 
        return 0;
index f879529..63d37cc 100644 (file)
@@ -142,8 +142,11 @@ struct nested_vmx {
         * pointers, so we must keep them pinned while L2 runs.
         */
        struct page *apic_access_page;
-       struct page *virtual_apic_page;
-       struct page *pi_desc_page;
+       struct kvm_host_map virtual_apic_map;
+       struct kvm_host_map pi_desc_map;
+
+       struct kvm_host_map msr_bitmap_map;
+
        struct pi_desc *pi_desc;
        bool pi_pending;
        u16 posted_intr_nv;
@@ -169,7 +172,7 @@ struct nested_vmx {
        } smm;
 
        gpa_t hv_evmcs_vmptr;
-       struct page *hv_evmcs_page;
+       struct kvm_host_map hv_evmcs_map;
        struct hv_enlightened_vmcs *hv_evmcs;
 };
 
@@ -257,6 +260,8 @@ struct vcpu_vmx {
 
        unsigned long host_debugctlmsr;
 
+       u64 msr_ia32_power_ctl;
+
        /*
         * Only bits masked by msr_ia32_feature_control_valid_bits can be set in
         * msr_ia32_feature_control. FEATURE_CONTROL_LOCKED is always included
index d75bb97..536b78c 100644 (file)
@@ -1100,15 +1100,15 @@ EXPORT_SYMBOL_GPL(kvm_get_dr);
 
 bool kvm_rdpmc(struct kvm_vcpu *vcpu)
 {
-       u32 ecx = kvm_register_read(vcpu, VCPU_REGS_RCX);
+       u32 ecx = kvm_rcx_read(vcpu);
        u64 data;
        int err;
 
        err = kvm_pmu_rdpmc(vcpu, ecx, &data);
        if (err)
                return err;
-       kvm_register_write(vcpu, VCPU_REGS_RAX, (u32)data);
-       kvm_register_write(vcpu, VCPU_REGS_RDX, data >> 32);
+       kvm_rax_write(vcpu, (u32)data);
+       kvm_rdx_write(vcpu, data >> 32);
        return err;
 }
 EXPORT_SYMBOL_GPL(kvm_rdpmc);
@@ -1174,6 +1174,9 @@ static u32 emulated_msrs[] = {
        MSR_PLATFORM_INFO,
        MSR_MISC_FEATURES_ENABLES,
        MSR_AMD64_VIRT_SPEC_CTRL,
+       MSR_IA32_POWER_CTL,
+
+       MSR_K7_HWCR,
 };
 
 static unsigned num_emulated_msrs;
@@ -1262,31 +1265,49 @@ static int do_get_msr_feature(struct kvm_vcpu *vcpu, unsigned index, u64 *data)
        return 0;
 }
 
-bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
+static bool __kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
 {
-       if (efer & efer_reserved_bits)
-               return false;
-
        if (efer & EFER_FFXSR && !guest_cpuid_has(vcpu, X86_FEATURE_FXSR_OPT))
-                       return false;
+               return false;
 
        if (efer & EFER_SVME && !guest_cpuid_has(vcpu, X86_FEATURE_SVM))
-                       return false;
+               return false;
+
+       if (efer & (EFER_LME | EFER_LMA) &&
+           !guest_cpuid_has(vcpu, X86_FEATURE_LM))
+               return false;
+
+       if (efer & EFER_NX && !guest_cpuid_has(vcpu, X86_FEATURE_NX))
+               return false;
 
        return true;
+
+}
+bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
+{
+       if (efer & efer_reserved_bits)
+               return false;
+
+       return __kvm_valid_efer(vcpu, efer);
 }
 EXPORT_SYMBOL_GPL(kvm_valid_efer);
 
-static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
+static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 {
        u64 old_efer = vcpu->arch.efer;
+       u64 efer = msr_info->data;
 
-       if (!kvm_valid_efer(vcpu, efer))
-               return 1;
+       if (efer & efer_reserved_bits)
+               return false;
 
-       if (is_paging(vcpu)
-           && (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME))
-               return 1;
+       if (!msr_info->host_initiated) {
+               if (!__kvm_valid_efer(vcpu, efer))
+                       return 1;
+
+               if (is_paging(vcpu) &&
+                   (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME))
+                       return 1;
+       }
 
        efer &= ~EFER_LMA;
        efer |= vcpu->arch.efer & EFER_LMA;
@@ -2279,6 +2300,18 @@ static void kvmclock_sync_fn(struct work_struct *work)
                                        KVMCLOCK_SYNC_PERIOD);
 }
 
+/*
+ * On AMD, HWCR[McStatusWrEn] controls whether setting MCi_STATUS results in #GP.
+ */
+static bool can_set_mci_status(struct kvm_vcpu *vcpu)
+{
+       /* McStatusWrEn enabled? */
+       if (guest_cpuid_is_amd(vcpu))
+               return !!(vcpu->arch.msr_hwcr & BIT_ULL(18));
+
+       return false;
+}
+
 static int set_msr_mce(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 {
        u64 mcg_cap = vcpu->arch.mcg_cap;
@@ -2310,9 +2343,14 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                        if ((offset & 0x3) == 0 &&
                            data != 0 && (data | (1 << 10)) != ~(u64)0)
                                return -1;
+
+                       /* MCi_STATUS */
                        if (!msr_info->host_initiated &&
-                               (offset & 0x3) == 1 && data != 0)
-                               return -1;
+                           (offset & 0x3) == 1 && data != 0) {
+                               if (!can_set_mci_status(vcpu))
+                                       return -1;
+                       }
+
                        vcpu->arch.mce_banks[offset] = data;
                        break;
                }
@@ -2456,13 +2494,16 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                vcpu->arch.arch_capabilities = data;
                break;
        case MSR_EFER:
-               return set_efer(vcpu, data);
+               return set_efer(vcpu, msr_info);
        case MSR_K7_HWCR:
                data &= ~(u64)0x40;     /* ignore flush filter disable */
                data &= ~(u64)0x100;    /* ignore ignne emulation enable */
                data &= ~(u64)0x8;      /* ignore TLB cache disable */
-               data &= ~(u64)0x40000;  /* ignore Mc status write enable */
-               if (data != 0) {
+
+               /* Handle McStatusWrEn */
+               if (data == BIT_ULL(18)) {
+                       vcpu->arch.msr_hwcr = data;
+               } else if (data != 0) {
                        vcpu_unimpl(vcpu, "unimplemented HWCR wrmsr: 0x%llx\n",
                                    data);
                        return 1;
@@ -2736,7 +2777,6 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_K8_SYSCFG:
        case MSR_K8_TSEG_ADDR:
        case MSR_K8_TSEG_MASK:
-       case MSR_K7_HWCR:
        case MSR_VM_HSAVE_PA:
        case MSR_K8_INT_PENDING_MSG:
        case MSR_AMD64_NB_CFG:
@@ -2900,6 +2940,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_MISC_FEATURES_ENABLES:
                msr_info->data = vcpu->arch.msr_misc_features_enables;
                break;
+       case MSR_K7_HWCR:
+               msr_info->data = vcpu->arch.msr_hwcr;
+               break;
        default:
                if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
                        return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);
@@ -3079,9 +3122,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_MAX_VCPUS:
                r = KVM_MAX_VCPUS;
                break;
-       case KVM_CAP_NR_MEMSLOTS:
-               r = KVM_USER_MEM_SLOTS;
-               break;
        case KVM_CAP_PV_MMU:    /* obsolete */
                r = 0;
                break;
@@ -5521,9 +5561,9 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
                                     unsigned int bytes,
                                     struct x86_exception *exception)
 {
+       struct kvm_host_map map;
        struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
        gpa_t gpa;
-       struct page *page;
        char *kaddr;
        bool exchanged;
 
@@ -5540,12 +5580,11 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
        if (((gpa + bytes - 1) & PAGE_MASK) != (gpa & PAGE_MASK))
                goto emul_write;
 
-       page = kvm_vcpu_gfn_to_page(vcpu, gpa >> PAGE_SHIFT);
-       if (is_error_page(page))
+       if (kvm_vcpu_map(vcpu, gpa_to_gfn(gpa), &map))
                goto emul_write;
 
-       kaddr = kmap_atomic(page);
-       kaddr += offset_in_page(gpa);
+       kaddr = map.hva + offset_in_page(gpa);
+
        switch (bytes) {
        case 1:
                exchanged = CMPXCHG_TYPE(u8, kaddr, old, new);
@@ -5562,13 +5601,12 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt,
        default:
                BUG();
        }
-       kunmap_atomic(kaddr);
-       kvm_release_page_dirty(page);
+
+       kvm_vcpu_unmap(vcpu, &map, true);
 
        if (!exchanged)
                return X86EMUL_CMPXCHG_FAILED;
 
-       kvm_vcpu_mark_page_dirty(vcpu, gpa >> PAGE_SHIFT);
        kvm_page_track_write(vcpu, gpa, new, bytes);
 
        return X86EMUL_CONTINUE;
@@ -6558,7 +6596,7 @@ static int complete_fast_pio_out(struct kvm_vcpu *vcpu)
 static int kvm_fast_pio_out(struct kvm_vcpu *vcpu, int size,
                            unsigned short port)
 {
-       unsigned long val = kvm_register_read(vcpu, VCPU_REGS_RAX);
+       unsigned long val = kvm_rax_read(vcpu);
        int ret = emulator_pio_out_emulated(&vcpu->arch.emulate_ctxt,
                                            size, port, &val, 1);
        if (ret)
@@ -6593,8 +6631,7 @@ static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
        }
 
        /* For size less than 4 we merge, else we zero extend */
-       val = (vcpu->arch.pio.size < 4) ? kvm_register_read(vcpu, VCPU_REGS_RAX)
-                                       : 0;
+       val = (vcpu->arch.pio.size < 4) ? kvm_rax_read(vcpu) : 0;
 
        /*
         * Since vcpu->arch.pio.count == 1 let emulator_pio_in_emulated perform
@@ -6602,7 +6639,7 @@ static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
         */
        emulator_pio_in_emulated(&vcpu->arch.emulate_ctxt, vcpu->arch.pio.size,
                                 vcpu->arch.pio.port, &val, 1);
-       kvm_register_write(vcpu, VCPU_REGS_RAX, val);
+       kvm_rax_write(vcpu, val);
 
        return kvm_skip_emulated_instruction(vcpu);
 }
@@ -6614,12 +6651,12 @@ static int kvm_fast_pio_in(struct kvm_vcpu *vcpu, int size,
        int ret;
 
        /* For size less than 4 we merge, else we zero extend */
-       val = (size < 4) ? kvm_register_read(vcpu, VCPU_REGS_RAX) : 0;
+       val = (size < 4) ? kvm_rax_read(vcpu) : 0;
 
        ret = emulator_pio_in_emulated(&vcpu->arch.emulate_ctxt, size, port,
                                       &val, 1);
        if (ret) {
-               kvm_register_write(vcpu, VCPU_REGS_RAX, val);
+               kvm_rax_write(vcpu, val);
                return ret;
        }
 
@@ -6698,10 +6735,8 @@ static void kvm_hyperv_tsc_notifier(void)
 }
 #endif
 
-static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
-                                    void *data)
+static void __kvmclock_cpufreq_notifier(struct cpufreq_freqs *freq, int cpu)
 {
-       struct cpufreq_freqs *freq = data;
        struct kvm *kvm;
        struct kvm_vcpu *vcpu;
        int i, send_ipi = 0;
@@ -6745,17 +6780,12 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
         *
         */
 
-       if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
-               return 0;
-       if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
-               return 0;
-
-       smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
+       smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
 
        spin_lock(&kvm_lock);
        list_for_each_entry(kvm, &vm_list, vm_list) {
                kvm_for_each_vcpu(i, vcpu, kvm) {
-                       if (vcpu->cpu != freq->cpu)
+                       if (vcpu->cpu != cpu)
                                continue;
                        kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
                        if (vcpu->cpu != smp_processor_id())
@@ -6777,8 +6807,24 @@ static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long va
                 * guest context is entered kvmclock will be updated,
                 * so the guest will not see stale values.
                 */
-               smp_call_function_single(freq->cpu, tsc_khz_changed, freq, 1);
+               smp_call_function_single(cpu, tsc_khz_changed, freq, 1);
        }
+}
+
+static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
+                                    void *data)
+{
+       struct cpufreq_freqs *freq = data;
+       int cpu;
+
+       if (val == CPUFREQ_PRECHANGE && freq->old > freq->new)
+               return 0;
+       if (val == CPUFREQ_POSTCHANGE && freq->old < freq->new)
+               return 0;
+
+       for_each_cpu(cpu, freq->policy->cpus)
+               __kvmclock_cpufreq_notifier(freq, cpu);
+
        return 0;
 }
 
@@ -6845,10 +6891,20 @@ static unsigned long kvm_get_guest_ip(void)
        return ip;
 }
 
+static void kvm_handle_intel_pt_intr(void)
+{
+       struct kvm_vcpu *vcpu = __this_cpu_read(current_vcpu);
+
+       kvm_make_request(KVM_REQ_PMI, vcpu);
+       __set_bit(MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT,
+                       (unsigned long *)&vcpu->arch.pmu.global_status);
+}
+
 static struct perf_guest_info_callbacks kvm_guest_cbs = {
        .is_in_guest            = kvm_is_in_guest,
        .is_user_mode           = kvm_is_user_mode,
        .get_guest_ip           = kvm_get_guest_ip,
+       .handle_intel_pt_intr   = kvm_handle_intel_pt_intr,
 };
 
 static void kvm_set_mmio_spte_mask(void)
@@ -7124,11 +7180,11 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
        if (kvm_hv_hypercall_enabled(vcpu->kvm))
                return kvm_hv_hypercall(vcpu);
 
-       nr = kvm_register_read(vcpu, VCPU_REGS_RAX);
-       a0 = kvm_register_read(vcpu, VCPU_REGS_RBX);
-       a1 = kvm_register_read(vcpu, VCPU_REGS_RCX);
-       a2 = kvm_register_read(vcpu, VCPU_REGS_RDX);
-       a3 = kvm_register_read(vcpu, VCPU_REGS_RSI);
+       nr = kvm_rax_read(vcpu);
+       a0 = kvm_rbx_read(vcpu);
+       a1 = kvm_rcx_read(vcpu);
+       a2 = kvm_rdx_read(vcpu);
+       a3 = kvm_rsi_read(vcpu);
 
        trace_kvm_hypercall(nr, a0, a1, a2, a3);
 
@@ -7169,7 +7225,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
 out:
        if (!op_64_bit)
                ret = (u32)ret;
-       kvm_register_write(vcpu, VCPU_REGS_RAX, ret);
+       kvm_rax_write(vcpu, ret);
 
        ++vcpu->stat.hypercalls;
        return kvm_skip_emulated_instruction(vcpu);
@@ -8271,23 +8327,23 @@ static void __get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
                emulator_writeback_register_cache(&vcpu->arch.emulate_ctxt);
                vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
        }
-       regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX);
-       regs->rbx = kvm_register_read(vcpu, VCPU_REGS_RBX);
-       regs->rcx = kvm_register_read(vcpu, VCPU_REGS_RCX);
-       regs->rdx = kvm_register_read(vcpu, VCPU_REGS_RDX);
-       regs->rsi = kvm_register_read(vcpu, VCPU_REGS_RSI);
-       regs->rdi = kvm_register_read(vcpu, VCPU_REGS_RDI);
-       regs->rsp = kvm_register_read(vcpu, VCPU_REGS_RSP);
-       regs->rbp = kvm_register_read(vcpu, VCPU_REGS_RBP);
+       regs->rax = kvm_rax_read(vcpu);
+       regs->rbx = kvm_rbx_read(vcpu);
+       regs->rcx = kvm_rcx_read(vcpu);
+       regs->rdx = kvm_rdx_read(vcpu);
+       regs->rsi = kvm_rsi_read(vcpu);
+       regs->rdi = kvm_rdi_read(vcpu);
+       regs->rsp = kvm_rsp_read(vcpu);
+       regs->rbp = kvm_rbp_read(vcpu);
 #ifdef CONFIG_X86_64
-       regs->r8 = kvm_register_read(vcpu, VCPU_REGS_R8);
-       regs->r9 = kvm_register_read(vcpu, VCPU_REGS_R9);
-       regs->r10 = kvm_register_read(vcpu, VCPU_REGS_R10);
-       regs->r11 = kvm_register_read(vcpu, VCPU_REGS_R11);
-       regs->r12 = kvm_register_read(vcpu, VCPU_REGS_R12);
-       regs->r13 = kvm_register_read(vcpu, VCPU_REGS_R13);
-       regs->r14 = kvm_register_read(vcpu, VCPU_REGS_R14);
-       regs->r15 = kvm_register_read(vcpu, VCPU_REGS_R15);
+       regs->r8 = kvm_r8_read(vcpu);
+       regs->r9 = kvm_r9_read(vcpu);
+       regs->r10 = kvm_r10_read(vcpu);
+       regs->r11 = kvm_r11_read(vcpu);
+       regs->r12 = kvm_r12_read(vcpu);
+       regs->r13 = kvm_r13_read(vcpu);
+       regs->r14 = kvm_r14_read(vcpu);
+       regs->r15 = kvm_r15_read(vcpu);
 #endif
 
        regs->rip = kvm_rip_read(vcpu);
@@ -8307,23 +8363,23 @@ static void __set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
        vcpu->arch.emulate_regs_need_sync_from_vcpu = true;
        vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
 
-       kvm_register_write(vcpu, VCPU_REGS_RAX, regs->rax);
-       kvm_register_write(vcpu, VCPU_REGS_RBX, regs->rbx);
-       kvm_register_write(vcpu, VCPU_REGS_RCX, regs->rcx);
-       kvm_register_write(vcpu, VCPU_REGS_RDX, regs->rdx);
-       kvm_register_write(vcpu, VCPU_REGS_RSI, regs->rsi);
-       kvm_register_write(vcpu, VCPU_REGS_RDI, regs->rdi);
-       kvm_register_write(vcpu, VCPU_REGS_RSP, regs->rsp);
-       kvm_register_write(vcpu, VCPU_REGS_RBP, regs->rbp);
+       kvm_rax_write(vcpu, regs->rax);
+       kvm_rbx_write(vcpu, regs->rbx);
+       kvm_rcx_write(vcpu, regs->rcx);
+       kvm_rdx_write(vcpu, regs->rdx);
+       kvm_rsi_write(vcpu, regs->rsi);
+       kvm_rdi_write(vcpu, regs->rdi);
+       kvm_rsp_write(vcpu, regs->rsp);
+       kvm_rbp_write(vcpu, regs->rbp);
 #ifdef CONFIG_X86_64
-       kvm_register_write(vcpu, VCPU_REGS_R8, regs->r8);
-       kvm_register_write(vcpu, VCPU_REGS_R9, regs->r9);
-       kvm_register_write(vcpu, VCPU_REGS_R10, regs->r10);
-       kvm_register_write(vcpu, VCPU_REGS_R11, regs->r11);
-       kvm_register_write(vcpu, VCPU_REGS_R12, regs->r12);
-       kvm_register_write(vcpu, VCPU_REGS_R13, regs->r13);
-       kvm_register_write(vcpu, VCPU_REGS_R14, regs->r14);
-       kvm_register_write(vcpu, VCPU_REGS_R15, regs->r15);
+       kvm_r8_write(vcpu, regs->r8);
+       kvm_r9_write(vcpu, regs->r9);
+       kvm_r10_write(vcpu, regs->r10);
+       kvm_r11_write(vcpu, regs->r11);
+       kvm_r12_write(vcpu, regs->r12);
+       kvm_r13_write(vcpu, regs->r13);
+       kvm_r14_write(vcpu, regs->r14);
+       kvm_r15_write(vcpu, regs->r15);
 #endif
 
        kvm_rip_write(vcpu, regs->rip);
index 534d3f2..a470ff0 100644 (file)
@@ -345,6 +345,16 @@ static inline void kvm_after_interrupt(struct kvm_vcpu *vcpu)
        __this_cpu_write(current_vcpu, NULL);
 }
 
+
+static inline bool kvm_pat_valid(u64 data)
+{
+       if (data & 0xF8F8F8F8F8F8F8F8ull)
+               return false;
+       /* 0, 1, 4, 5, 6, 7 are valid values.  */
+       return (data | ((data & 0x0202020202020202ull) << 1)) == data;
+}
+
 void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu);
 void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu);
+
 #endif
index 88acd34..75a5a45 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <linux/linkage.h>
 #include <asm/export.h>
 
index 2dd1fe1..04967cd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/export.h>
 
index 9d05572..9274866 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2002 Andi Kleen */
 
 #include <linux/linkage.h>
index 9952a01..e0e006f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 
  * User address space access functions.
  *
index 4b101dd..84373dc 100644 (file)
@@ -21,7 +21,7 @@ CFLAGS_physaddr.o             := $(nostackp)
 CFLAGS_setup_nx.o              := $(nostackp)
 CFLAGS_mem_encrypt_identity.o  := $(nostackp)
 
-CFLAGS_fault.o := -I$(src)/../include/asm/trace
+CFLAGS_fault.o := -I $(srctree)/$(src)/../include/asm/trace
 
 obj-$(CONFIG_X86_PAT)          += pat_rbtree.o
 
index cd84f06..c6f4982 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/debugfs.h>
 #include <linux/efi.h>
 #include <linux/module.h>
index b0a2de8..4d75bc6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/extable.h>
 #include <linux/uaccess.h>
 #include <linux/sched/debug.h>
index 0d4bdcb..0a1898b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/highmem.h>
 #include <linux/export.h>
 #include <linux/swap.h> /* for totalram_pages */
index 075e568..f265a43 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  *  Copyright (C) 1995  Linus Torvalds
index 20d1425..693aaf2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/arch/x86_64/mm/init.c
  *
 
 #include "ident_map.c"
 
+#define DEFINE_POPULATE(fname, type1, type2, init)             \
+static inline void fname##_init(struct mm_struct *mm,          \
+               type1##_t *arg1, type2##_t *arg2, bool init)    \
+{                                                              \
+       if (init)                                               \
+               fname##_safe(mm, arg1, arg2);                   \
+       else                                                    \
+               fname(mm, arg1, arg2);                          \
+}
+
+DEFINE_POPULATE(p4d_populate, p4d, pud, init)
+DEFINE_POPULATE(pgd_populate, pgd, p4d, init)
+DEFINE_POPULATE(pud_populate, pud, pmd, init)
+DEFINE_POPULATE(pmd_populate_kernel, pmd, pte, init)
+
+#define DEFINE_ENTRY(type1, type2, init)                       \
+static inline void set_##type1##_init(type1##_t *arg1,         \
+                       type2##_t arg2, bool init)              \
+{                                                              \
+       if (init)                                               \
+               set_##type1##_safe(arg1, arg2);                 \
+       else                                                    \
+               set_##type1(arg1, arg2);                        \
+}
+
+DEFINE_ENTRY(p4d, p4d, init)
+DEFINE_ENTRY(pud, pud, init)
+DEFINE_ENTRY(pmd, pmd, init)
+DEFINE_ENTRY(pte, pte, init)
+
+
 /*
  * NOTE: pagetable_init alloc all the fixmap pagetables contiguous on the
  * physical space so we can cache the place of the first one and move
@@ -414,7 +446,7 @@ void __init cleanup_highmap(void)
  */
 static unsigned long __meminit
 phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
-             pgprot_t prot)
+             pgprot_t prot, bool init)
 {
        unsigned long pages = 0, paddr_next;
        unsigned long paddr_last = paddr_end;
@@ -432,7 +464,7 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
                                             E820_TYPE_RAM) &&
                            !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
                                             E820_TYPE_RESERVED_KERN))
-                               set_pte_safe(pte, __pte(0));
+                               set_pte_init(pte, __pte(0), init);
                        continue;
                }
 
@@ -452,7 +484,7 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
                        pr_info("   pte=%p addr=%lx pte=%016lx\n", pte, paddr,
                                pfn_pte(paddr >> PAGE_SHIFT, PAGE_KERNEL).pte);
                pages++;
-               set_pte_safe(pte, pfn_pte(paddr >> PAGE_SHIFT, prot));
+               set_pte_init(pte, pfn_pte(paddr >> PAGE_SHIFT, prot), init);
                paddr_last = (paddr & PAGE_MASK) + PAGE_SIZE;
        }
 
@@ -468,7 +500,7 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
  */
 static unsigned long __meminit
 phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
-             unsigned long page_size_mask, pgprot_t prot)
+             unsigned long page_size_mask, pgprot_t prot, bool init)
 {
        unsigned long pages = 0, paddr_next;
        unsigned long paddr_last = paddr_end;
@@ -487,7 +519,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
                                             E820_TYPE_RAM) &&
                            !e820__mapped_any(paddr & PMD_MASK, paddr_next,
                                             E820_TYPE_RESERVED_KERN))
-                               set_pmd_safe(pmd, __pmd(0));
+                               set_pmd_init(pmd, __pmd(0), init);
                        continue;
                }
 
@@ -496,7 +528,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
                                spin_lock(&init_mm.page_table_lock);
                                pte = (pte_t *)pmd_page_vaddr(*pmd);
                                paddr_last = phys_pte_init(pte, paddr,
-                                                          paddr_end, prot);
+                                                          paddr_end, prot,
+                                                          init);
                                spin_unlock(&init_mm.page_table_lock);
                                continue;
                        }
@@ -524,19 +557,20 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
                if (page_size_mask & (1<<PG_LEVEL_2M)) {
                        pages++;
                        spin_lock(&init_mm.page_table_lock);
-                       set_pte_safe((pte_t *)pmd,
-                               pfn_pte((paddr & PMD_MASK) >> PAGE_SHIFT,
-                                       __pgprot(pgprot_val(prot) | _PAGE_PSE)));
+                       set_pte_init((pte_t *)pmd,
+                                    pfn_pte((paddr & PMD_MASK) >> PAGE_SHIFT,
+                                            __pgprot(pgprot_val(prot) | _PAGE_PSE)),
+                                    init);
                        spin_unlock(&init_mm.page_table_lock);
                        paddr_last = paddr_next;
                        continue;
                }
 
                pte = alloc_low_page();
-               paddr_last = phys_pte_init(pte, paddr, paddr_end, new_prot);
+               paddr_last = phys_pte_init(pte, paddr, paddr_end, new_prot, init);
 
                spin_lock(&init_mm.page_table_lock);
-               pmd_populate_kernel_safe(&init_mm, pmd, pte);
+               pmd_populate_kernel_init(&init_mm, pmd, pte, init);
                spin_unlock(&init_mm.page_table_lock);
        }
        update_page_count(PG_LEVEL_2M, pages);
@@ -551,7 +585,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end,
  */
 static unsigned long __meminit
 phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
-             unsigned long page_size_mask)
+             unsigned long page_size_mask, bool init)
 {
        unsigned long pages = 0, paddr_next;
        unsigned long paddr_last = paddr_end;
@@ -573,7 +607,7 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
                                             E820_TYPE_RAM) &&
                            !e820__mapped_any(paddr & PUD_MASK, paddr_next,
                                             E820_TYPE_RESERVED_KERN))
-                               set_pud_safe(pud, __pud(0));
+                               set_pud_init(pud, __pud(0), init);
                        continue;
                }
 
@@ -583,7 +617,7 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
                                paddr_last = phys_pmd_init(pmd, paddr,
                                                           paddr_end,
                                                           page_size_mask,
-                                                          prot);
+                                                          prot, init);
                                continue;
                        }
                        /*
@@ -610,9 +644,10 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
                if (page_size_mask & (1<<PG_LEVEL_1G)) {
                        pages++;
                        spin_lock(&init_mm.page_table_lock);
-                       set_pte_safe((pte_t *)pud,
-                               pfn_pte((paddr & PUD_MASK) >> PAGE_SHIFT,
-                                       PAGE_KERNEL_LARGE));
+                       set_pte_init((pte_t *)pud,
+                                    pfn_pte((paddr & PUD_MASK) >> PAGE_SHIFT,
+                                            PAGE_KERNEL_LARGE),
+                                    init);
                        spin_unlock(&init_mm.page_table_lock);
                        paddr_last = paddr_next;
                        continue;
@@ -620,10 +655,10 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
 
                pmd = alloc_low_page();
                paddr_last = phys_pmd_init(pmd, paddr, paddr_end,
-                                          page_size_mask, prot);
+                                          page_size_mask, prot, init);
 
                spin_lock(&init_mm.page_table_lock);
-               pud_populate_safe(&init_mm, pud, pmd);
+               pud_populate_init(&init_mm, pud, pmd, init);
                spin_unlock(&init_mm.page_table_lock);
        }
 
@@ -634,14 +669,15 @@ phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end,
 
 static unsigned long __meminit
 phys_p4d_init(p4d_t *p4d_page, unsigned long paddr, unsigned long paddr_end,
-             unsigned long page_size_mask)
+             unsigned long page_size_mask, bool init)
 {
        unsigned long paddr_next, paddr_last = paddr_end;
        unsigned long vaddr = (unsigned long)__va(paddr);
        int i = p4d_index(vaddr);
 
        if (!pgtable_l5_enabled())
-               return phys_pud_init((pud_t *) p4d_page, paddr, paddr_end, page_size_mask);
+               return phys_pud_init((pud_t *) p4d_page, paddr, paddr_end,
+                                    page_size_mask, init);
 
        for (; i < PTRS_PER_P4D; i++, paddr = paddr_next) {
                p4d_t *p4d;
@@ -657,39 +693,34 @@ phys_p4d_init(p4d_t *p4d_page, unsigned long paddr, unsigned long paddr_end,
                                             E820_TYPE_RAM) &&
                            !e820__mapped_any(paddr & P4D_MASK, paddr_next,
                                             E820_TYPE_RESERVED_KERN))
-                               set_p4d_safe(p4d, __p4d(0));
+                               set_p4d_init(p4d, __p4d(0), init);
                        continue;
                }
 
                if (!p4d_none(*p4d)) {
                        pud = pud_offset(p4d, 0);
-                       paddr_last = phys_pud_init(pud, paddr,
-                                       paddr_end,
-                                       page_size_mask);
+                       paddr_last = phys_pud_init(pud, paddr, paddr_end,
+                                                  page_size_mask, init);
                        continue;
                }
 
                pud = alloc_low_page();
                paddr_last = phys_pud_init(pud, paddr, paddr_end,
-                                          page_size_mask);
+                                          page_size_mask, init);
 
                spin_lock(&init_mm.page_table_lock);
-               p4d_populate_safe(&init_mm, p4d, pud);
+               p4d_populate_init(&init_mm, p4d, pud, init);
                spin_unlock(&init_mm.page_table_lock);
        }
 
        return paddr_last;
 }
 
-/*
- * Create page table mapping for the physical memory for specific physical
- * addresses. The virtual and physical addresses have to be aligned on PMD level
- * down. It returns the last physical address mapped.
- */
-unsigned long __meminit
-kernel_physical_mapping_init(unsigned long paddr_start,
-                            unsigned long paddr_end,
-                            unsigned long page_size_mask)
+static unsigned long __meminit
+__kernel_physical_mapping_init(unsigned long paddr_start,
+                              unsigned long paddr_end,
+                              unsigned long page_size_mask,
+                              bool init)
 {
        bool pgd_changed = false;
        unsigned long vaddr, vaddr_start, vaddr_end, vaddr_next, paddr_last;
@@ -709,19 +740,22 @@ kernel_physical_mapping_init(unsigned long paddr_start,
                        p4d = (p4d_t *)pgd_page_vaddr(*pgd);
                        paddr_last = phys_p4d_init(p4d, __pa(vaddr),
                                                   __pa(vaddr_end),
-                                                  page_size_mask);
+                                                  page_size_mask,
+                                                  init);
                        continue;
                }
 
                p4d = alloc_low_page();
                paddr_last = phys_p4d_init(p4d, __pa(vaddr), __pa(vaddr_end),
-                                          page_size_mask);
+                                          page_size_mask, init);
 
                spin_lock(&init_mm.page_table_lock);
                if (pgtable_l5_enabled())
-                       pgd_populate_safe(&init_mm, pgd, p4d);
+                       pgd_populate_init(&init_mm, pgd, p4d, init);
                else
-                       p4d_populate_safe(&init_mm, p4d_offset(pgd, vaddr), (pud_t *) p4d);
+                       p4d_populate_init(&init_mm, p4d_offset(pgd, vaddr),
+                                         (pud_t *) p4d, init);
+
                spin_unlock(&init_mm.page_table_lock);
                pgd_changed = true;
        }
@@ -732,6 +766,37 @@ kernel_physical_mapping_init(unsigned long paddr_start,
        return paddr_last;
 }
 
+
+/*
+ * Create page table mapping for the physical memory for specific physical
+ * addresses. Note that it can only be used to populate non-present entries.
+ * The virtual and physical addresses have to be aligned on PMD level
+ * down. It returns the last physical address mapped.
+ */
+unsigned long __meminit
+kernel_physical_mapping_init(unsigned long paddr_start,
+                            unsigned long paddr_end,
+                            unsigned long page_size_mask)
+{
+       return __kernel_physical_mapping_init(paddr_start, paddr_end,
+                                             page_size_mask, true);
+}
+
+/*
+ * This function is similar to kernel_physical_mapping_init() above with the
+ * exception that it uses set_{pud,pmd}() instead of the set_{pud,pte}_safe()
+ * when updating the mapping. The caller is responsible to flush the TLBs after
+ * the function returns.
+ */
+unsigned long __meminit
+kernel_physical_mapping_change(unsigned long paddr_start,
+                              unsigned long paddr_end,
+                              unsigned long page_size_mask)
+{
+       return __kernel_physical_mapping_init(paddr_start, paddr_end,
+                                             page_size_mask, false);
+}
+
 #ifndef CONFIG_NUMA
 void __init initmem_init(void)
 {
index dd73d5d..4b6423e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Re-map IO memory to kernel address space so that we can access it.
  * This is needed for high PCI addresses that aren't mapped in the
index 385afa2..51f50a7 100644 (file)
@@ -301,9 +301,13 @@ static int __init early_set_memory_enc_dec(unsigned long vaddr,
                else
                        split_page_size_mask = 1 << PG_LEVEL_2M;
 
-               kernel_physical_mapping_init(__pa(vaddr & pmask),
-                                            __pa((vaddr_end & pmask) + psize),
-                                            split_page_size_mask);
+               /*
+                * kernel_physical_mapping_change() does not flush the TLBs, so
+                * a TLB flush is required after we exit from the for loop.
+                */
+               kernel_physical_mapping_change(__pa(vaddr & pmask),
+                                              __pa((vaddr_end & pmask) + psize),
+                                              split_page_size_mask);
        }
 
        ret = 0;
index 319bde3..eeae142 100644 (file)
@@ -13,6 +13,9 @@ void early_ioremap_page_table_range_init(void);
 unsigned long kernel_physical_mapping_init(unsigned long start,
                                             unsigned long end,
                                             unsigned long page_size_mask);
+unsigned long kernel_physical_mapping_change(unsigned long start,
+                                            unsigned long end,
+                                            unsigned long page_size_mask);
 void zone_sizes_init(void);
 
 extern int after_bootmem;
index 59726aa..0d1c47c 100644 (file)
@@ -881,9 +881,10 @@ static int mpx_unmap_tables(struct mm_struct *mm,
  * the virtual address region start...end have already been split if
  * necessary, and the 'vma' is the first vma in this range (start -> end).
  */
-void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
-               unsigned long start, unsigned long end)
+void mpx_notify_unmap(struct mm_struct *mm, unsigned long start,
+                     unsigned long end)
 {
+       struct vm_area_struct *vma;
        int ret;
 
        /*
@@ -902,11 +903,12 @@ void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
         * which should not occur normally. Being strict about it here
         * helps ensure that we do not have an exploitable stack overflow.
         */
-       do {
+       vma = find_vma(mm, start);
+       while (vma && vma->vm_start < end) {
                if (vma->vm_flags & VM_MPX)
                        return;
                vma = vma->vm_next;
-       } while (vma && vma->vm_start < end);
+       }
 
        ret = mpx_unmap_tables(mm, start, end);
        if (ret)
index dfb6c4d..e6dad60 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Common code for 32 and 64-bit NUMA */
 #include <linux/acpi.h>
 #include <linux/kernel.h>
index daf4d64..6a9a77a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 2002 Andi Kleen, SuSE Labs.
  * Thanks to Ben LaHaise for precious feedback.
index 4fe956a..d9fbd4f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Handle caching attributes in page tables (PAT)
  *
index f6ae683..0881e1f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Written by Pekka Paalanen, 2008-2009 <pq@iki.fi>
  */
index 7f61431..91f6db9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/init.h>
 
 #include <linux/mm.h>
index 59e123d..383c873 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Arch-specific network modules
 #
index d4ec117..9acab6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Low-Level PCI Support for PC
  *
index dfbe6ac..467311b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * legacy.c - traditional, old school PCI bus probing
  */
index 9112d1c..91220cc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Xen PCI - handle PCI (INTx) and MSI infrastructure calls for PV, HVM and
  * initial domain support. We also handle the DSDT _PRT callbacks for GSI's
index 57be88f..e06bbec 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
index 91fc929..7b7f37d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_X86_INTEL_CE)     += ce4100.o
index a25a9fd..feb7777 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "efi: " fmt
 
 #include <linux/init.h>
index 5b51194..a8a6b1d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ALIX)             += alix.o
 obj-$(CONFIG_NET5501)          += net5501.o
 obj-$(CONFIG_GEOS)             += geos.o
index f030b53..072c395 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_GOLDFISH) += goldfish.o
index 5cf886c..cc2549f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o pwr.o
 
 # SFI specific code
index 9cc57ed..ed77cb9 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INTEL_IMR) += imr.o
 obj-$(CONFIG_DEBUG_IMR_SELFTEST) += imr_selftest.o
index 49828c2..b542037 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /**
  * imr.c -- Intel Isolated Memory Region driver
  *
index b878032..dbee3b0 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_IOSF_MBI)                 += iosf_mbi.o
index db92198..3543527 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_X86_32_IRIS)              += iris.o
index ac9e7bf..0296c5b 100644 (file)
@@ -220,10 +220,26 @@ static u32 __init olpc_dt_get_board_revision(void)
        return be32_to_cpu(rev);
 }
 
+int olpc_dt_compatible_match(phandle node, const char *compat)
+{
+       char buf[64], *p;
+       int plen, len;
+
+       plen = olpc_dt_getproperty(node, "compatible", buf, sizeof(buf));
+       if (plen <= 0)
+               return 0;
+
+       len = strlen(compat);
+       for (p = buf; p < buf + plen; p += strlen(p) + 1) {
+               if (strcmp(p, compat) == 0)
+                       return 1;
+       }
+
+       return 0;
+}
+
 void __init olpc_dt_fixup(void)
 {
-       int r;
-       char buf[64];
        phandle node;
        u32 board_rev;
 
@@ -231,41 +247,66 @@ void __init olpc_dt_fixup(void)
        if (!node)
                return;
 
-       /*
-        * If the battery node has a compatible property, we are running a new
-        * enough firmware and don't have fixups to make.
-        */
-       r = olpc_dt_getproperty(node, "compatible", buf, sizeof(buf));
-       if (r > 0)
-               return;
-
-       pr_info("PROM DT: Old firmware detected, applying fixes\n");
-
-       /* Add olpc,xo1-battery compatible marker to battery node */
-       olpc_dt_interpret("\" /battery@0\" find-device"
-               " \" olpc,xo1-battery\" +compatible"
-               " device-end");
-
        board_rev = olpc_dt_get_board_revision();
        if (!board_rev)
                return;
 
        if (board_rev >= olpc_board_pre(0xd0)) {
-               /* XO-1.5: add dcon device */
-               olpc_dt_interpret("\" /pci/display@1\" find-device"
-                       " new-device"
-                       " \" dcon\" device-name \" olpc,xo1-dcon\" +compatible"
-                       " finish-device device-end");
+               /* XO-1.5 */
+
+               if (olpc_dt_compatible_match(node, "olpc,xo1.5-battery"))
+                       return;
+
+               /* Add olpc,xo1.5-battery compatible marker to battery node */
+               olpc_dt_interpret("\" /battery@0\" find-device");
+               olpc_dt_interpret("  \" olpc,xo1.5-battery\" +compatible");
+               olpc_dt_interpret("device-end");
+
+               if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) {
+                       /*
+                        * If we have a olpc,xo1-battery compatible, then we're
+                        * running a new enough firmware that already has
+                        * the dcon node.
+                        */
+                       return;
+               }
+
+               /* Add dcon device */
+               olpc_dt_interpret("\" /pci/display@1\" find-device");
+               olpc_dt_interpret("  new-device");
+               olpc_dt_interpret("    \" dcon\" device-name");
+               olpc_dt_interpret("    \" olpc,xo1-dcon\" +compatible");
+               olpc_dt_interpret("  finish-device");
+               olpc_dt_interpret("device-end");
        } else {
-               /* XO-1: add dcon device, mark RTC as olpc,xo1-rtc */
-               olpc_dt_interpret("\" /pci/display@1,1\" find-device"
-                       " new-device"
-                       " \" dcon\" device-name \" olpc,xo1-dcon\" +compatible"
-                       " finish-device device-end"
-                       " \" /rtc\" find-device"
-                       " \" olpc,xo1-rtc\" +compatible"
-                       " device-end");
+               /* XO-1 */
+
+               if (olpc_dt_compatible_match(node, "olpc,xo1-battery")) {
+                       /*
+                        * If we have a olpc,xo1-battery compatible, then we're
+                        * running a new enough firmware that already has
+                        * the dcon and RTC nodes.
+                        */
+                       return;
+               }
+
+               /* Add dcon device, mark RTC as olpc,xo1-rtc */
+               olpc_dt_interpret("\" /pci/display@1,1\" find-device");
+               olpc_dt_interpret("  new-device");
+               olpc_dt_interpret("    \" dcon\" device-name");
+               olpc_dt_interpret("    \" olpc,xo1-dcon\" +compatible");
+               olpc_dt_interpret("  finish-device");
+               olpc_dt_interpret("device-end");
+
+               olpc_dt_interpret("\" /rtc\" find-device");
+               olpc_dt_interpret(" \" olpc,xo1-rtc\" +compatible");
+               olpc_dt_interpret("device-end");
        }
+
+       /* Add olpc,xo1-battery compatible marker to battery node */
+       olpc_dt_interpret("\" /battery@0\" find-device");
+       olpc_dt_interpret("  \" olpc,xo1-battery\" +compatible");
+       olpc_dt_interpret("device-end");
 }
 
 void __init olpc_dt_build_devicetree(void)
index f1aab8c..20a0645 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/export.h>
 #include <linux/spinlock_types.h>
index 62f5c70..1861a2b 100644 (file)
@@ -44,8 +44,6 @@ void __init __weak mem_map_via_hcall(struct boot_params *ptr __maybe_unused)
 
 static void __init init_pvh_bootparams(bool xen_guest)
 {
-       memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
-
        if ((pvh_start_info.version > 0) && (pvh_start_info.memmap_entries)) {
                struct hvm_memmap_table_entry *ep;
                int i;
@@ -103,7 +101,7 @@ static void __init init_pvh_bootparams(bool xen_guest)
  * If we are trying to boot a Xen PVH guest, it is expected that the kernel
  * will have been configured to provide the required override for this routine.
  */
-void __init __weak xen_pvh_init(void)
+void __init __weak xen_pvh_init(struct boot_params *boot_params)
 {
        xen_raw_printk("Error: Missing xen PVH initialization\n");
        BUG();
@@ -112,7 +110,7 @@ void __init __weak xen_pvh_init(void)
 static void hypervisor_specific_init(bool xen_guest)
 {
        if (xen_guest)
-               xen_pvh_init();
+               xen_pvh_init(&pvh_bootparams);
 }
 
 /*
@@ -131,6 +129,8 @@ void __init xen_prepare_pvh(void)
                BUG();
        }
 
+       memset(&pvh_bootparams, 0, sizeof(pvh_bootparams));
+
        hypervisor_specific_init(xen_guest);
 
        init_pvh_bootparams(xen_guest);
index 762b4c7..981b3e4 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCx200)           += scx200.o
 scx200-y                       += scx200_32.o
index 3dc9aee..80662b7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
  *
index cc5db11..4eba24c 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SFI)              += sfi.o
index c54e348..910fe9e 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_TS5500)   += ts5500.o
index 52079be..a3693c8 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_X86_UV)           += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o uv_nmi.o
index 2c447c9..11640c1 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_FB)               += fbdev.o
index 1fbb629..0d3365c 100644 (file)
@@ -158,7 +158,7 @@ static enum efi_secureboot_mode xen_efi_get_secureboot(void)
        return efi_secureboot_mode_unknown;
 }
 
-void __init xen_efi_init(void)
+void __init xen_efi_init(struct boot_params *boot_params)
 {
        efi_system_table_t *efi_systab_xen;
 
@@ -167,12 +167,12 @@ void __init xen_efi_init(void)
        if (efi_systab_xen == NULL)
                return;
 
-       strncpy((char *)&boot_params.efi_info.efi_loader_signature, "Xen",
-                       sizeof(boot_params.efi_info.efi_loader_signature));
-       boot_params.efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
-       boot_params.efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32);
+       strncpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
+                       sizeof(boot_params->efi_info.efi_loader_signature));
+       boot_params->efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
+       boot_params->efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32);
 
-       boot_params.secure_boot = xen_efi_get_secureboot();
+       boot_params->secure_boot = xen_efi_get_secureboot();
 
        set_bit(EFI_BOOT, &efi.flags);
        set_bit(EFI_PARAVIRT, &efi.flags);
index c54a493..4722ba2 100644 (file)
@@ -1403,7 +1403,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
        /* We need this for printk timestamps */
        xen_setup_runstate_info(0);
 
-       xen_efi_init();
+       xen_efi_init(&boot_params);
 
        /* Start the world */
 #ifdef CONFIG_X86_32
index 35b7599..80a79db 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <xen/interface/memory.h>
 
+#include "xen-ops.h"
+
 /*
  * PVH variables.
  *
  */
 bool xen_pvh __attribute__((section(".data"))) = 0;
 
-void __init xen_pvh_init(void)
+void __init xen_pvh_init(struct boot_params *boot_params)
 {
        u32 msr;
        u64 pfn;
 
        xen_pvh = 1;
+       xen_domain_type = XEN_HVM_DOMAIN;
        xen_start_flags = pvh_start_info.flags;
 
        msr = cpuid_ebx(xen_cpuid_base() + 2);
        pfn = __pa(hypercall_page);
        wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
+
+       xen_efi_init(boot_params);
 }
 
 void __init mem_map_via_hcall(struct boot_params *boot_params_p)
index 6e29794..befbdd8 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "xen-ops.h"
 
-/* Xen may fire a timer up to this many ns early */
+/* Minimum amount of time until next clock event fires */
 #define TIMER_SLOP     100000
 
 static u64 xen_sched_clock_offset __read_mostly;
@@ -212,7 +212,7 @@ static int xen_timerop_set_next_event(unsigned long delta,
        return 0;
 }
 
-static const struct clock_event_device xen_timerop_clockevent = {
+static struct clock_event_device xen_timerop_clockevent __ro_after_init = {
        .name                   = "xen",
        .features               = CLOCK_EVT_FEAT_ONESHOT,
 
@@ -273,7 +273,7 @@ static int xen_vcpuop_set_next_event(unsigned long delta,
        return ret;
 }
 
-static const struct clock_event_device xen_vcpuop_clockevent = {
+static struct clock_event_device xen_vcpuop_clockevent __ro_after_init = {
        .name = "xen",
        .features = CLOCK_EVT_FEAT_ONESHOT,
 
@@ -570,3 +570,17 @@ void __init xen_hvm_init_time_ops(void)
        x86_platform.set_wallclock = xen_set_wallclock;
 }
 #endif
+
+/* Kernel parameter to specify Xen timer slop */
+static int __init parse_xen_timer_slop(char *ptr)
+{
+       unsigned long slop = memparse(ptr, NULL);
+
+       xen_timerop_clockevent.min_delta_ns = slop;
+       xen_timerop_clockevent.min_delta_ticks = slop;
+       xen_vcpuop_clockevent.min_delta_ns = slop;
+       xen_vcpuop_clockevent.min_delta_ticks = slop;
+
+       return 0;
+}
+early_param("xen_timer_slop", parse_xen_timer_slop);
index 0e60bd9..2f111f4 100644 (file)
@@ -122,9 +122,9 @@ static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
 void __init xen_init_apic(void);
 
 #ifdef CONFIG_XEN_EFI
-extern void xen_efi_init(void);
+extern void xen_efi_init(struct boot_params *boot_params);
 #else
-static inline void __init xen_efi_init(void)
+static inline void __init xen_efi_init(struct boot_params *boot_params)
 {
 }
 #endif
index 355127f..e3d717c 100644 (file)
@@ -7,7 +7,7 @@ zlib    := inffast.c inflate.c inftrees.c
 
 lib-y  += $(zlib:.c=.o) zmem.o
 
-ccflags-y      := -Ilib/zlib_inflate
+ccflags-y      := -I $(srctree)/lib/zlib_inflate
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_inflate.o = -pg
 CFLAGS_REMOVE_zmem.o = -pg
index 35f83c4..f1686d9 100644 (file)
@@ -27,7 +27,6 @@ generic-y += preempt.h
 generic-y += qrwlock.h
 generic-y += qspinlock.h
 generic-y += sections.h
-generic-y += socket.h
 generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += vga.h
index 9b5e852..1289068 100644 (file)
@@ -27,7 +27,7 @@ static inline unsigned long arch_local_irq_save(void)
 {
        unsigned long flags;
 #if XTENSA_FAKE_NMI
-#if defined(CONFIG_DEBUG_KERNEL) && (LOCKLEVEL | TOPLEVEL) >= XCHAL_DEBUGLEVEL
+#if defined(CONFIG_DEBUG_MISC) && (LOCKLEVEL | TOPLEVEL) >= XCHAL_DEBUGLEVEL
        unsigned long tmp;
 
        asm volatile("rsr       %0, ps\t\n"
diff --git a/arch/xtensa/include/asm/segment.h b/arch/xtensa/include/asm/segment.h
deleted file mode 100644 (file)
index 98964ad..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * include/asm-xtensa/segment.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_SEGMENT_H
-#define _XTENSA_SEGMENT_H
-
-#include <linux/uaccess.h>
-
-#endif /* _XTENSA_SEGEMENT_H */
index 3699d6d..83b244c 100644 (file)
@@ -126,7 +126,7 @@ void secondary_start_kernel(void)
 
        init_mmu();
 
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
        if (boot_secondary_processors == 0) {
                pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n",
                        __func__, boot_secondary_processors, cpu);
index 30084ea..5fa0ee1 100644 (file)
 425    common  io_uring_setup                  sys_io_uring_setup
 426    common  io_uring_enter                  sys_io_uring_enter
 427    common  io_uring_register               sys_io_uring_register
+428    common  open_tree                       sys_open_tree
+429    common  move_mount                      sys_move_mount
+430    common  fsopen                          sys_fsopen
+431    common  fsconfig                        sys_fsconfig
+432    common  fsmount                         sys_fsmount
+433    common  fspick                          sys_fspick
index 6c4fdd8..9437ca5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Xtensa-specific library files.
 #
index 734888a..f7fb08a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux/Xtensa-specific parts of the memory manager.
 #
index b3e8929..f3dd5e7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # $Id: Makefile,v 1.1.1.1 2002/08/28 16:10:14 aroll Exp $
 #
 # Makefile for the Xtensa Instruction Set Simulator (ISS)
index 54d018e..53eaeba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Tensilica XT2000 Emulation Board
 #
index 7839d38..0600371 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the Tensilica xtavnet Emulation Board
 #
 # Note! Dependencies are done automagically by 'make dep', which also
index 820e873..b150637 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/errno.h>
 #include <linux/reboot.h>
 #include <linux/kdev_t.h>
index 4253667..4db6208 100644 (file)
@@ -43,8 +43,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
        unsigned inline_vecs;
 
        if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) {
-               bip = kmalloc(sizeof(struct bio_integrity_payload) +
-                             sizeof(struct bio_vec) * nr_vecs, gfp_mask);
+               bip = kmalloc(struct_size(bip, bip_inline_vecs, nr_vecs), gfp_mask);
                inline_vecs = nr_vecs;
        } else {
                bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask);
index 15ce128..b6a1121 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2006
  * NTT (Nippon Telegraph and Telephone Corporation).
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index a68c126..241b186 100644 (file)
@@ -157,6 +157,8 @@ static int hmac_init_tfm(struct crypto_tfm *tfm)
 
        parent->descsize = sizeof(struct shash_desc) +
                           crypto_shash_descsize(hash);
+       if (WARN_ON(parent->descsize > HASH_MAX_DESCSIZE))
+               return -EINVAL;
 
        ctx->hash = hash;
        return 0;
index 3e3b1d1..4887626 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Shared crypto simd helpers
  *
@@ -8,19 +9,6 @@
  * Based on aesni-intel_glue.c by:
  *  Copyright (C) 2008, Intel Corp.
  *    Author: Huang Ying <ying.huang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index f3a0dd2..222fc76 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Common Twofish algorithm parts shared between the c and assembler
  * implementations
  * code and thus put it in the public domain. The subsequent authors
  * have put this under the GNU General Public License.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
  * This code is a "clean room" implementation, written from the paper
  * _Twofish: A 128-Bit Block Cipher_ by Bruce Schneier, John Kelsey,
  * Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson, available
index dbac6e2..4f7c033 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Twofish for CryptoAPI
  *
  * code and thus put it in the public domain. The subsequent authors 
  * have put this under the GNU General Public License.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *
  * This code is a "clean room" implementation, written from the paper
  * _Twofish: A 128-Bit Block Cipher_ by Bruce Schneier, John Kelsey,
  * Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson, available
index 94ca694..0bb26e8 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2006 USAGI/WIDE Project
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *     Kazunori Miyazawa <miyazawa@linux-ipv6.org>
  */
index 72b01a4..e8c182f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += braille/
index 2e9f16c..fa4b873 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_A11Y_BRAILLE_CONSOLE)             += braille_console.o
index ddf598a..c16f946 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/clkdev.h>
 #include <linux/acpi.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/pm.h>
 
 #include "internal.h"
index 8fe0960..db013dc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2004, 2013 Intel Corporation
  * Author: Naveen B S <naveen.b.s@intel.com>
@@ -5,17 +6,6 @@
  *
  * All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
  * ACPI based HotPlug driver that supports Memory Hotplug
  * This driver fields notifications from firmware for memory add
  * and remove operations and alerts the VM of the affected memory
index 5a6f80f..6dba187 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ACPI Configuration for ARM64
 #
index 1017def..6ff50f4 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ACPI_IORT)        += iort.o
 obj-$(CONFIG_ACPI_GTDT)        += gtdt.o
index aa972dc..b2ef4c2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * custom_method.c - debugfs interface for customizing ACPI control method
  */
index 68bb305..d5ecea3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * debugfs.c - ACPI debugfs interface to userspace.
  */
index 8940054..78c2653 100644 (file)
@@ -428,8 +428,10 @@ static ssize_t acpi_device_adr_show(struct device *dev,
 {
        struct acpi_device *acpi_dev = to_acpi_device(dev);
 
-       return sprintf(buf, "0x%08x\n",
-                      (unsigned int)(acpi_dev->pnp.bus_address));
+       if (acpi_dev->pnp.bus_address > U32_MAX)
+               return sprintf(buf, "0x%016llx\n", acpi_dev->pnp.bus_address);
+       else
+               return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
 }
 static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
 
index e6032e4..1a9b0a2 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ACPI)             += int340x_thermal.o
 obj-$(CONFIG_DPTF_POWER)       += dptf_power.o
index e909051..1c20ef3 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ACPI_HMAT) := hmat.o
index 751081c..07f53c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ACPI_NFIT) := nfit.o
 nfit-y := core.o
 nfit-y += intel.o
index 8c0a54d..f32beb7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2005 Intel Corporation
  * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
index 566270d..0e28270 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * scan.c - support for transforming the ACPI namespace into individual objects
  */
index 403c4ff..e52f123 100644 (file)
@@ -977,6 +977,8 @@ static int acpi_s2idle_prepare(void)
        if (acpi_sci_irq_valid())
                enable_irq_wake(acpi_sci_irq);
 
+       acpi_enable_wakeup_devices(ACPI_STATE_S0);
+
        /* Change the configuration of GPEs to avoid spurious wakeup. */
        acpi_enable_all_wakeup_gpes();
        acpi_os_wait_events_complete();
@@ -1027,6 +1029,8 @@ static void acpi_s2idle_restore(void)
 {
        acpi_enable_all_runtime_gpes();
 
+       acpi_disable_wakeup_devices(ACPI_STATE_S0);
+
        if (acpi_sci_irq_valid())
                disable_irq_wake(acpi_sci_irq);
 
index 66e81c2..cc6b1c9 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARM_AMBA)         += bus.o
 obj-$(CONFIG_TEGRA_AHB)                += tegra-ahb.o
index b0b688c..3751d81 100644 (file)
@@ -170,8 +170,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
 EXPORT_SYMBOL(tegra_ahb_enable_smmu);
 #endif
 
-#ifdef CONFIG_PM
-static int tegra_ahb_suspend(struct device *dev)
+static int __maybe_unused tegra_ahb_suspend(struct device *dev)
 {
        int i;
        struct tegra_ahb *ahb = dev_get_drvdata(dev);
@@ -181,7 +180,7 @@ static int tegra_ahb_suspend(struct device *dev)
        return 0;
 }
 
-static int tegra_ahb_resume(struct device *dev)
+static int __maybe_unused tegra_ahb_resume(struct device *dev)
 {
        int i;
        struct tegra_ahb *ahb = dev_get_drvdata(dev);
@@ -190,7 +189,6 @@ static int tegra_ahb_resume(struct device *dev)
                gizmo_writel(ahb, ahb->ctx[i], tegra_ahb_gizmo[i]);
        return 0;
 }
-#endif
 
 static UNIVERSAL_DEV_PM_OPS(tegra_ahb_pm,
                            tegra_ahb_suspend,
index c7856e3..c9d3d0c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -I$(src)                  # needed for trace events
 
 obj-$(CONFIG_ANDROID_BINDERFS)         += binderfs.o
index 583e366..b1b49db 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  *  acard-ahci.c - ACard AHCI SATA support
@@ -8,29 +9,12 @@
  *
  *  Copyright 2010 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  * libata documentation is available via 'make {ps|pdf}docs',
  * as Documentation/driver-api/libata.rst
  *
  * AHCI hardware documentation:
  * http://www.intel.com/technology/serialata/pdf/rev1_0.pdf
  * http://www.intel.com/technology/serialata/pdf/rev1_1.pdf
- *
  */
 
 #include <linux/kernel.h>
index 021ce46..f7652ba 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  ahci.c - AHCI SATA support
  *
@@ -7,29 +8,12 @@
  *
  *  Copyright 2004-2005 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  * libata documentation is available via 'make {ps|pdf}docs',
  * as Documentation/driver-api/libata.rst
  *
  * AHCI hardware documentation:
  * http://www.intel.com/technology/serialata/pdf/rev1_0.pdf
  * http://www.intel.com/technology/serialata/pdf/rev1_1.pdf
- *
  */
 
 #include <linux/kernel.h>
index 8810475..0570629 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  ahci.h - Common AHCI SATA definitions and declarations
  *
@@ -7,29 +8,12 @@
  *
  *  Copyright 2004-2005 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  * libata documentation is available via 'make {ps|pdf}docs',
  * as Documentation/driver-api/libata.rst
  *
  * AHCI hardware documentation:
  * http://www.intel.com/technology/serialata/pdf/rev1_0.pdf
  * http://www.intel.com/technology/serialata/pdf/rev1_1.pdf
- *
  */
 
 #ifndef _AHCI_H
index 7e157e1..16246c8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * AppliedMicro X-Gene SoC SATA Host Controller Driver
  *
@@ -6,21 +7,7 @@
  *         Tuan Phan <tphan@apm.com>
  *         Suman Tripathi <stripathi@apm.com>
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * NOTE: PM support is not currently available.
- *
  */
 #include <linux/acpi.h>
 #include <linux/module.h>
index 7ecb132..e4da725 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *    ata_piix.c - Intel PATA/SATA controllers
  *
@@ -5,33 +6,15 @@
  *                 Please ALWAYS copy linux-ide@vger.kernel.org
  *                 on emails.
  *
- *
  *     Copyright 2003-2005 Red Hat Inc
  *     Copyright 2003-2005 Jeff Garzik
  *
- *
  *     Copyright header from piix.c:
  *
  *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
  *  Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2003 Red Hat Inc
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
index 692782d..0984c4b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  libahci.c - Common AHCI SATA low-level routines
  *
@@ -7,29 +8,12 @@
  *
  *  Copyright 2004-2005 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  * libata documentation is available via 'make {ps|pdf}docs',
  * as Documentation/driver-api/libata.rst
  *
  * AHCI hardware documentation:
  * http://www.intel.com/technology/serialata/pdf/rev1_0.pdf
  * http://www.intel.com/technology/serialata/pdf/rev1_1.pdf
- *
  */
 
 #include <linux/kernel.h>
index 97a14fe..224e348 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * libata-acpi.c
  * Provides ACPI support for PATA/SATA.
index adf2878..aaa57e0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  libata-core.c - helper library for ATA
  *
@@ -8,22 +9,6 @@
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
@@ -37,7 +22,6 @@
  *     http://www.compactflash.org (CF)
  *     http://www.qic.org (QIC157 - Tape and DSC)
  *     http://www.ce-ata.org (CE-ATA: not supported)
- *
  */
 
 #include <linux/kernel.h>
index 938ed51..9d687e1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  libata-eh.c - libata error handling
  *
@@ -7,29 +8,11 @@
  *
  *  Copyright 2006 Tejun Heo <htejun@gmail.com>
  *
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2, or
- *  (at your option) any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
- *  USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available from http://www.t13.org/ and
  *  http://www.sata-io.org/
- *
  */
 
 #include <linux/kernel.h>
index c10ee23..391ac05 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  libata-scsi.c - helper library for ATA
  *
@@ -8,29 +9,12 @@
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available from
  *  - http://www.t10.org/
  *  - http://www.t13.org/
- *
  */
 
 #include <linux/slab.h>
index c5ea0fc..10aa278 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  libata-sff.c - helper library for PCI IDE BMDMA
  *
@@ -8,28 +9,11 @@
  *  Copyright 2003-2006 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2006 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available from http://www.t13.org/ and
  *  http://www.sata-io.org/
- *
  */
 
 #include <linux/kernel.h>
index f8c550d..08e0013 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * libata-trace.c - trace functions for libata
  *
  * Copyright 2015 Hannes Reinecke
  * Copyright 2015 SUSE Linux GmbH
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/kernel.h>
index f953cb4..cd8090a 100644 (file)
@@ -1,28 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  libata.h - helper library for ATA
  *
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
- *
  */
 
 #ifndef __LIBATA_H__
index b70fce2..fa2bfc3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     ACPI PATA driver
  *
index 8706533..987967f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_amd.c  - AMD PATA for new ATA layer
  *                       (C) 2005-2006 Red Hat Inc
index 6b33553..3aa006c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_artop.c - ARTOP ATA controller driver
  *
index 843bb20..c68aa3f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_atiixp.c       - ATI PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index e3532ed..d0bcabb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_cmd640.c       - CMD640 PCI PATA for new ATA layer
  *                       (C) 2007 Red Hat Inc
index 13ca588..3134eae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_cmd64x.c       - CMD64x PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index 7930184..e1486fe 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_cypress.c      - Cypress PATA for new ATA layer
  *                       (C) 2006 Red Hat Inc
index 4a57a6f..21da59f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_efar.c - EFAR PIIX clone controller driver
  *
index cc6d06c..badab67 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * EP93XX PATA controller driver.
  *
@@ -44,7 +45,7 @@
 #include <linux/ktime.h>
 
 #include <linux/platform_data/dma-ep93xx.h>
-#include <mach/platform.h>
+#include <linux/soc/cirrus/ep93xx.h>
 
 #define DRV_NAME       "ep93xx-ide"
 #define DRV_VERSION    "1.0"
index 569a4a6..34cb104 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Faraday Technology FTIDE010 driver
  * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
index a219a50..2574d6f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Libata driver for the highpoint 366 and 368 UDMA66 ATA controllers.
  *
index ef8aaeb..fad6c6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Libata driver for the highpoint 37x and 30x UDMA66 ATA controllers.
  *
index b93c0f0..9cb2d50 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Libata driver for the HighPoint 371N, 372N, and 302N UDMA66 ATA controllers.
  *
index c272f2c..08543ae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 994f168..43bb224 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 /*
  *   pata-isapnp.c - ISA PnP PATA controller driver.
index 4f97d1e..8a3e877 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_it8213.c - iTE Tech. Inc.  IT8213 PATA driver
  *
index 4d1a5d2..c3dedd3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_jmicron.c - JMicron ATA driver for non AHCI mode. This drives the
  *                     PATA port of the controller. The SATA ports are
index 8ea4b84..4fd12b2 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   pata-legacy.c - Legacy port PATA/SATA controller driver.
  *   Copyright 2005/2006 Red Hat, all rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  *   An ATA driver for the legacy ATA ports.
  *
  *   Data Sources:
@@ -55,7 +42,6 @@
  *
  *  For now use autospeed and pio_mask as above with the W83759A. This may
  *  change.
- *
  */
 
 #include <linux/async.h>
index 456ae71..57f2ec7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Libata based driver for Apple "macio" family of PATA controllers
  *
index ff468a6..b066809 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Marvell PATA driver.
  *
index 202b4d6..8fda0e3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_mpiix.c        - Intel MPIIX PATA for new ATA layer
  *                       (C) 2005-2006 Red Hat Inc
index 0ea1833..a7ecc1a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_netcell.c - Netcell PATA driver
  *
index 44f97ad..607db1f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_ninja32.c      - Ninja32 PATA for new ATA layer
  *                       (C) 2007 Red Hat Inc
index 200e1eb..ca3ab27 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pata_ns87410.c      - National Semiconductor 87410 PATA for new ATA layer
  *                       (C) 2006 Red Hat Inc
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/kernel.h>
index 84c6b22..4b2ba81 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_ns87415.c - NS87415 (non PARISC) PATA
  *
index b9bf78b..22a0203 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_oldpiix.c - Intel PATA/SATA controllers
  *
index 3a944a0..06a800a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_opti.c         - ATI PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index bdec7ef..fbcf0af 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_optidma.c      - Opti DMA PATA for new ATA layer
  *                       (C) 2006 Red Hat Inc
index 9b0e6c7..3fe0754 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   pata_pcmcia.c - PCMCIA PATA controller driver.
  *   Copyright 2005-2006 Red Hat Inc, all rights reserved.
  *   PCMCIA ident update Copyright 2006 Marcin Juszkiewicz
  *                                             <openembedded@hrw.one.pl>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  *   Heavily based upon ide-cs.c
  *   The initial developer of the original code is David A. Hinds
  *   <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
index 9001991..378ed9e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_pdc202xx_old.c         - Promise PDC202xx PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index 4b9b9e1..4afcb8e 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Generic PXA PATA driver
  *
  * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/kernel.h>
index a3f1123..8fde4a8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_radisys.c - Intel PATA/SATA controllers
  *
index 959bb54..ecb229c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  pata_rdc           -       Driver for later RDC PATA controllers
  *
@@ -5,20 +6,6 @@
  *  INCITS 370-2004 (1510D): ATA Host Adapter Standards
  *
  *  Based on ata_piix.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/kernel.h>
index b3ec18c..3722a67 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  RZ1000/1001 driver based upon
  *
index 57de021..916bf02 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_serverworks.c  - Serverworks PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index 626f989..d7cd39a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    pata_sis.c - SiS ATA driver
  *
index 4935f61..ac7ddd8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_sl82c105.c     - SL82C105 PATA for new ATA layer
  *                       (C) 2005 Red Hat Inc
index fd19f1c..38044e6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * pata_via.c  - VIA PATA for new ATA layer
  *                       (C) 2005-2006 Red Hat Inc
index f1e873a..52fa860 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  pdc_adma.c - Pacific Digital Corporation ADMA
  *
@@ -5,31 +6,14 @@
  *
  *  Copyright 2005 Mark Lord
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
- *
  *  Supports ATA disks in single-packet ADMA mode.
  *  Uses PIO for everything else.
  *
  *  TODO:  Use ADMA transfers for ATAPI devices, when possible.
  *  This requires careful attention to a number of quirks of the chip.
- *
  */
 
 #include <linux/kernel.h>
index 46950e0..f793564 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Cortina Systems Gemini SATA bridge add-on to Faraday FTIDE010
  * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
index 72c9b92..54bfab1 100644 (file)
@@ -1,25 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_nv.c - NVIDIA nForce SATA
  *
  *  Copyright 2004 NVIDIA Corp.  All rights reserved.
  *  Copyright 2004 Andrew Chew
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
@@ -33,7 +18,6 @@
  *  similar to the ADMA specification (with some modifications).
  *  This allows the use of NCQ. Non-DMA-mapped ATA commands are still
  *  sent through the legacy interface.
- *
  */
 
 #include <linux/kernel.h>
index d032bf6..f4dfec3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_promise.c - Promise SATA
  *
@@ -8,27 +9,10 @@
  *
  *  Copyright 2003-2004 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware information only available under NDA.
- *
  */
 
 #include <linux/kernel.h>
index 61633ef..c81db14 100644 (file)
@@ -1,27 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  sata_promise.h - Promise SATA common definitions and inline funcs
  *
  *  Copyright 2003-2004 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
- *
  */
 
 #ifndef __SATA_PROMISE_H__
index 59b2317..3495e17 100644 (file)
@@ -909,7 +909,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
 
        host = ata_host_alloc(dev, 1);
        if (!host) {
-               dev_err(dev, "ata_host_alloc failed\n");
                ret = -ENOMEM;
                goto err_pm_put;
        }
index ed76f07..25b6a52 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_sil.c - Silicon Image SATA
  *
@@ -8,22 +9,6 @@
  *  Copyright 2003-2005 Red Hat, Inc.
  *  Copyright 2003 Benjamin Herrenschmidt
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
@@ -31,7 +16,6 @@
  *  http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2
  *
  *  Other errata and documentation available under NDA.
- *
  */
 
 #include <linux/kernel.h>
index 30f4f35..3162373 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_sis.c - Silicon Integrated Systems SATA
  *
@@ -7,27 +8,10 @@
  *
  *  Copyright 2004 Uwe Koziolek
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available under NDA.
- *
  */
 
 #include <linux/kernel.h>
index a9d692c..b903d55 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_svw.c - ServerWorks / Apple K2 SATA
  *
  *  This driver probably works with non-Apple versions of the
  *  Broadcom chipset...
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available under NDA.
- *
  */
 
 #include <linux/kernel.h>
index 405e606..ae8e374 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_sx4.c - Promise SATA
  *
@@ -7,27 +8,10 @@
  *
  *  Copyright 2003-2004 Red Hat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available under NDA.
- *
  */
 
 /*
index 4f6e8d8..815e6af 100644 (file)
@@ -1,27 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_uli.c - ULi Electronics SATA
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available under NDA.
- *
  */
 
 #include <linux/kernel.h>
index 93b8d78..fcb9245 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_via.c - VIA Serial ATA controllers
  *
@@ -8,29 +9,10 @@
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available under NDA.
- *
- *
- *
  */
 
 #include <linux/kernel.h>
index 9648127..fd401e9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  sata_vsc.c - Vitesse VSC7174 4 port DPA SATA
  *
  *
  *  Bits from Jeff Garzik, Copyright RedHat, Inc.
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Vitesse hardware documentation presumably available under NDA.
  *  Intel 31244 (same hardware interface) documentation presumably
  *  available from http://developer.intel.com/
- *
  */
 
 #include <linux/kernel.h>
index 8d98130..8157925 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * adummy.c: a dummy ATM driver
  */
index afebeb1..d9fd702 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* drivers/atm/atmtcp.c - ATM over TCP "device" driver */
 
 /* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */
index f8c7034..79b7184 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* drivers/atm/eni.c - Efficient Networks ENI155P device driver */
  
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
index 0a67487..6387185 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* drivers/atm/idt77105.c - IDT77105 (PHY) driver */
  
 /* Written 1999 by Greg Banks, NEC Australia <gnb@linuxfan.com>. Based on suni.c */
index ae4aa02..8db8c0f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * nicstar.c
  *
index 4b04471..c920a8c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * drivers/atm/suni.c - S/UNI PHY driver
  *
index 4fa13a8..7850758 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* drivers/atm/uPD98402.c - NEC uPD98402 (PHY) declarations */
  
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
index d5c76b5..57f97b9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* drivers/atm/zatm.c - ZeitNet ZN122x device driver */
  
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
index 7a6aa23..33c30c1 100644 (file)
@@ -128,6 +128,7 @@ static const struct genpd_lock_ops genpd_spin_ops = {
 #define genpd_is_always_on(genpd)      (genpd->flags & GENPD_FLAG_ALWAYS_ON)
 #define genpd_is_active_wakeup(genpd)  (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP)
 #define genpd_is_cpu_domain(genpd)     (genpd->flags & GENPD_FLAG_CPU_DOMAIN)
+#define genpd_is_rpm_always_on(genpd)  (genpd->flags & GENPD_FLAG_RPM_ALWAYS_ON)
 
 static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev,
                const struct generic_pm_domain *genpd)
@@ -515,7 +516,9 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
         * (1) The domain is configured as always on.
         * (2) When the domain has a subdomain being powered on.
         */
-       if (genpd_is_always_on(genpd) || atomic_read(&genpd->sd_count) > 0)
+       if (genpd_is_always_on(genpd) ||
+                       genpd_is_rpm_always_on(genpd) ||
+                       atomic_read(&genpd->sd_count) > 0)
                return -EBUSY;
 
        list_for_each_entry(pdd, &genpd->dev_list, list_node) {
@@ -1812,7 +1815,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
        }
 
        /* Always-on domains must be powered on at initialization. */
-       if (genpd_is_always_on(genpd) && !genpd_status_on(genpd))
+       if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) &&
+                       !genpd_status_on(genpd))
                return -EINVAL;
 
        if (genpd_is_cpu_domain(genpd) &&
index 92b930c..226219d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/amiga/amiflop.c
  *
index 06ea82c..b7545ce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ATA over Ethernet
 #
index c7b5c46..85f20e3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  drivers/block/ataflop.c
  *
index 17defbf..c548a5a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Ram backed block device driver.
  *
@@ -153,6 +154,12 @@ static void brd_free_pages(struct brd_device *brd)
                pos++;
 
                /*
+                * It takes 3.4 seconds to remove 80GiB ramdisk.
+                * So, we need cond_resched to avoid stalling the CPU.
+                */
+               cond_resched();
+
+               /*
                 * This assumes radix_tree_gang_lookup always returns as
                 * many pages as possible. If the radix-tree code changes,
                 * so will this have to.
index b8998ab..9fb9b31 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/drivers/block/floppy.c
  *
index 4fbef8c..bff32b5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for  Block device driver for Micron PCIe SSD
 #
index d7ac09c..447d635 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Add configfs and memory store: Kyungchan Koh <kkc6196@fb.com> and
  * Shaohua Li <shli@fb.com>
index c0c5081..4c7f51b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ps3vram - Use extra PS3 video ram as block device.
  *
index 2210c1b..e5009a3 100644 (file)
@@ -934,7 +934,7 @@ static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
        struct rbd_client *rbdc;
        int ret;
 
-       mutex_lock_nested(&client_mutex, SINGLE_DEPTH_NESTING);
+       mutex_lock(&client_mutex);
        rbdc = rbd_client_find(ceph_opts);
        if (rbdc) {
                ceph_destroy_options(ceph_opts);
@@ -1326,7 +1326,7 @@ static void rbd_obj_zero_range(struct rbd_obj_request *obj_req, u32 off,
                zero_bvecs(&obj_req->bvec_pos, off, bytes);
                break;
        default:
-               rbd_assert(0);
+               BUG();
        }
 }
 
@@ -1581,7 +1581,7 @@ static void rbd_obj_request_destroy(struct kref *kref)
                kfree(obj_request->bvec_pos.bvecs);
                break;
        default:
-               rbd_assert(0);
+               BUG();
        }
 
        kfree(obj_request->img_extents);
@@ -1781,7 +1781,7 @@ static void rbd_osd_req_setup_data(struct rbd_obj_request *obj_req, u32 which)
                                                    &obj_req->bvec_pos);
                break;
        default:
-               rbd_assert(0);
+               BUG();
        }
 }
 
@@ -2036,7 +2036,7 @@ static int __rbd_img_fill_request(struct rbd_img_request *img_req)
                        ret = rbd_obj_setup_zeroout(obj_req);
                        break;
                default:
-                       rbd_assert(0);
+                       BUG();
                }
                if (ret < 0)
                        return ret;
@@ -2383,7 +2383,7 @@ static int rbd_obj_read_from_parent(struct rbd_obj_request *obj_req)
                                                      &obj_req->bvec_pos);
                        break;
                default:
-                       rbd_assert(0);
+                       BUG();
                }
        } else {
                ret = rbd_img_fill_from_bvecs(child_img_req,
@@ -2515,7 +2515,7 @@ static int rbd_obj_issue_copyup_ops(struct rbd_obj_request *obj_req, u32 bytes)
                num_osd_ops += count_zeroout_ops(obj_req);
                break;
        default:
-               rbd_assert(0);
+               BUG();
        }
 
        obj_req->osd_req = rbd_osd_req_create(obj_req, num_osd_ops);
@@ -2542,7 +2542,7 @@ static int rbd_obj_issue_copyup_ops(struct rbd_obj_request *obj_req, u32 bytes)
                __rbd_obj_setup_zeroout(obj_req, which);
                break;
        default:
-               rbd_assert(0);
+               BUG();
        }
 
        ret = ceph_osdc_alloc_messages(obj_req->osd_req, GFP_NOIO);
@@ -3842,8 +3842,12 @@ static void rbd_queue_workfn(struct work_struct *work)
                goto err_rq;
        }
 
-       rbd_assert(op_type == OBJ_OP_READ ||
-                  rbd_dev->spec->snap_id == CEPH_NOSNAP);
+       if (op_type != OBJ_OP_READ && rbd_dev->spec->snap_id != CEPH_NOSNAP) {
+               rbd_warn(rbd_dev, "%s on read-only snapshot",
+                        obj_op_name(op_type));
+               result = -EIO;
+               goto err;
+       }
 
        /*
         * Quit early if the mapped snapshot no longer exists.  It's
index b1c53c0..7ef1580 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BLK_DEV_RSXX) += rsxx.o
 rsxx-objs := config.o core.o cregs.o dev.o dma.o
index 26937ba..6b2fd63 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* sunvdc.c: Sun LDOM Virtual Disk Client.
  *
  * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
index f1d90cd..7ffd719 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 //#define DEBUG
 #include <linux/spinlock.h>
 #include <linux/slab.h>
index e491c1b..b0ea5ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XEN_BLKDEV_BACKEND) := xen-blkback.o
 
 xen-blkback-y  := blkback.o xenbus.o
index 9e2b79e..de9e457 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 zram-y :=      zcomp.o zram_drv.o
 
 obj-$(CONFIG_ZRAM)     +=      zram.o
index 084ae28..ac58142 100644 (file)
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
-#include <linux/pm_clock.h>
 #include <linux/pm_runtime.h>
 
+struct tegra_aconnect {
+       struct clk      *ape_clk;
+       struct clk      *apb2ape_clk;
+};
+
 static int tegra_aconnect_probe(struct platform_device *pdev)
 {
-       int ret;
+       struct tegra_aconnect *aconnect;
 
        if (!pdev->dev.of_node)
                return -EINVAL;
 
-       ret = pm_clk_create(&pdev->dev);
-       if (ret)
-               return ret;
+       aconnect = devm_kzalloc(&pdev->dev, sizeof(struct tegra_aconnect),
+                               GFP_KERNEL);
+       if (!aconnect)
+               return -ENOMEM;
 
-       ret = of_pm_clk_add_clk(&pdev->dev, "ape");
-       if (ret)
-               goto clk_destroy;
+       aconnect->ape_clk = devm_clk_get(&pdev->dev, "ape");
+       if (IS_ERR(aconnect->ape_clk)) {
+               dev_err(&pdev->dev, "Can't retrieve ape clock\n");
+               return PTR_ERR(aconnect->ape_clk);
+       }
 
-       ret = of_pm_clk_add_clk(&pdev->dev, "apb2ape");
-       if (ret)
-               goto clk_destroy;
+       aconnect->apb2ape_clk = devm_clk_get(&pdev->dev, "apb2ape");
+       if (IS_ERR(aconnect->apb2ape_clk)) {
+               dev_err(&pdev->dev, "Can't retrieve apb2ape clock\n");
+               return PTR_ERR(aconnect->apb2ape_clk);
+       }
 
+       dev_set_drvdata(&pdev->dev, aconnect);
        pm_runtime_enable(&pdev->dev);
 
        of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
@@ -41,35 +51,51 @@ static int tegra_aconnect_probe(struct platform_device *pdev)
        dev_info(&pdev->dev, "Tegra ACONNECT bus registered\n");
 
        return 0;
-
-clk_destroy:
-       pm_clk_destroy(&pdev->dev);
-
-       return ret;
 }
 
 static int tegra_aconnect_remove(struct platform_device *pdev)
 {
        pm_runtime_disable(&pdev->dev);
 
-       pm_clk_destroy(&pdev->dev);
-
        return 0;
 }
 
 static int tegra_aconnect_runtime_resume(struct device *dev)
 {
-       return pm_clk_resume(dev);
+       struct tegra_aconnect *aconnect = dev_get_drvdata(dev);
+       int ret;
+
+       ret = clk_prepare_enable(aconnect->ape_clk);
+       if (ret) {
+               dev_err(dev, "ape clk_enable failed: %d\n", ret);
+               return ret;
+       }
+
+       ret = clk_prepare_enable(aconnect->apb2ape_clk);
+       if (ret) {
+               clk_disable_unprepare(aconnect->ape_clk);
+               dev_err(dev, "apb2ape clk_enable failed: %d\n", ret);
+               return ret;
+       }
+
+       return 0;
 }
 
 static int tegra_aconnect_runtime_suspend(struct device *dev)
 {
-       return pm_clk_suspend(dev);
+       struct tegra_aconnect *aconnect = dev_get_drvdata(dev);
+
+       clk_disable_unprepare(aconnect->ape_clk);
+       clk_disable_unprepare(aconnect->apb2ape_clk);
+
+       return 0;
 }
 
 static const struct dev_pm_ops tegra_aconnect_pm_ops = {
        SET_RUNTIME_PM_OPS(tegra_aconnect_runtime_suspend,
                           tegra_aconnect_runtime_resume, NULL)
+       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+                                     pm_runtime_force_resume)
 };
 
 static const struct of_device_id tegra_aconnect_of_match[] = {
index d299ec7..308475e 100644 (file)
@@ -47,7 +47,10 @@ enum sysc_clocks {
        SYSC_MAX_CLOCKS,
 };
 
-static const char * const clock_names[SYSC_ICK + 1] = { "fck", "ick", };
+static const char * const clock_names[SYSC_MAX_CLOCKS] = {
+       "fck", "ick", "opt0", "opt1", "opt2", "opt3", "opt4",
+       "opt5", "opt6", "opt7",
+};
 
 #define SYSC_IDLEMODE_MASK             3
 #define SYSC_CLOCKACTIVITY_MASK                3
@@ -75,6 +78,7 @@ struct sysc {
        u32 module_size;
        void __iomem *module_va;
        int offsets[SYSC_MAX_REGS];
+       struct ti_sysc_module_data *mdata;
        struct clk **clocks;
        const char **clock_roles;
        int nr_clocks;
@@ -94,7 +98,7 @@ struct sysc {
 static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np,
                                  bool is_child);
 
-void sysc_write(struct sysc *ddata, int offset, u32 value)
+static void sysc_write(struct sysc *ddata, int offset, u32 value)
 {
        writel_relaxed(value, ddata->module_va + offset);
 }
@@ -128,6 +132,81 @@ static u32 sysc_read_revision(struct sysc *ddata)
        return sysc_read(ddata, offset);
 }
 
+static int sysc_add_named_clock_from_child(struct sysc *ddata,
+                                          const char *name,
+                                          const char *optfck_name)
+{
+       struct device_node *np = ddata->dev->of_node;
+       struct device_node *child;
+       struct clk_lookup *cl;
+       struct clk *clock;
+       const char *n;
+
+       if (name)
+               n = name;
+       else
+               n = optfck_name;
+
+       /* Does the clock alias already exist? */
+       clock = of_clk_get_by_name(np, n);
+       if (!IS_ERR(clock)) {
+               clk_put(clock);
+
+               return 0;
+       }
+
+       child = of_get_next_available_child(np, NULL);
+       if (!child)
+               return -ENODEV;
+
+       clock = devm_get_clk_from_child(ddata->dev, child, name);
+       if (IS_ERR(clock))
+               return PTR_ERR(clock);
+
+       /*
+        * Use clkdev_add() instead of clkdev_alloc() to avoid the MAX_DEV_ID
+        * limit for clk_get(). If cl ever needs to be freed, it should be done
+        * with clkdev_drop().
+        */
+       cl = kcalloc(1, sizeof(*cl), GFP_KERNEL);
+       if (!cl)
+               return -ENOMEM;
+
+       cl->con_id = n;
+       cl->dev_id = dev_name(ddata->dev);
+       cl->clk = clock;
+       clkdev_add(cl);
+
+       clk_put(clock);
+
+       return 0;
+}
+
+static int sysc_init_ext_opt_clock(struct sysc *ddata, const char *name)
+{
+       const char *optfck_name;
+       int error, index;
+
+       if (ddata->nr_clocks < SYSC_OPTFCK0)
+               index = SYSC_OPTFCK0;
+       else
+               index = ddata->nr_clocks;
+
+       if (name)
+               optfck_name = name;
+       else
+               optfck_name = clock_names[index];
+
+       error = sysc_add_named_clock_from_child(ddata, name, optfck_name);
+       if (error)
+               return error;
+
+       ddata->clock_roles[index] = optfck_name;
+       ddata->nr_clocks++;
+
+       return 0;
+}
+
 static int sysc_get_one_clock(struct sysc *ddata, const char *name)
 {
        int error, i, index = -ENODEV;
@@ -199,6 +278,12 @@ static int sysc_get_clocks(struct sysc *ddata)
        if (ddata->nr_clocks < 1)
                return 0;
 
+       if ((ddata->cfg.quirks & SYSC_QUIRK_EXT_OPT_CLOCK)) {
+               error = sysc_init_ext_opt_clock(ddata, NULL);
+               if (error)
+                       return error;
+       }
+
        if (ddata->nr_clocks > SYSC_MAX_CLOCKS) {
                dev_err(ddata->dev, "too many clocks for %pOF\n", np);
 
@@ -231,39 +316,125 @@ static int sysc_get_clocks(struct sysc *ddata)
        return 0;
 }
 
+static int sysc_enable_main_clocks(struct sysc *ddata)
+{
+       struct clk *clock;
+       int i, error;
+
+       if (!ddata->clocks)
+               return 0;
+
+       for (i = 0; i < SYSC_OPTFCK0; i++) {
+               clock = ddata->clocks[i];
+
+               /* Main clocks may not have ick */
+               if (IS_ERR_OR_NULL(clock))
+                       continue;
+
+               error = clk_enable(clock);
+               if (error)
+                       goto err_disable;
+       }
+
+       return 0;
+
+err_disable:
+       for (i--; i >= 0; i--) {
+               clock = ddata->clocks[i];
+
+               /* Main clocks may not have ick */
+               if (IS_ERR_OR_NULL(clock))
+                       continue;
+
+               clk_disable(clock);
+       }
+
+       return error;
+}
+
+static void sysc_disable_main_clocks(struct sysc *ddata)
+{
+       struct clk *clock;
+       int i;
+
+       if (!ddata->clocks)
+               return;
+
+       for (i = 0; i < SYSC_OPTFCK0; i++) {
+               clock = ddata->clocks[i];
+               if (IS_ERR_OR_NULL(clock))
+                       continue;
+
+               clk_disable(clock);
+       }
+}
+
+static int sysc_enable_opt_clocks(struct sysc *ddata)
+{
+       struct clk *clock;
+       int i, error;
+
+       if (!ddata->clocks)
+               return 0;
+
+       for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
+               clock = ddata->clocks[i];
+
+               /* Assume no holes for opt clocks */
+               if (IS_ERR_OR_NULL(clock))
+                       return 0;
+
+               error = clk_enable(clock);
+               if (error)
+                       goto err_disable;
+       }
+
+       return 0;
+
+err_disable:
+       for (i--; i >= 0; i--) {
+               clock = ddata->clocks[i];
+               if (IS_ERR_OR_NULL(clock))
+                       continue;
+
+               clk_disable(clock);
+       }
+
+       return error;
+}
+
+static void sysc_disable_opt_clocks(struct sysc *ddata)
+{
+       struct clk *clock;
+       int i;
+
+       if (!ddata->clocks)
+               return;
+
+       for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
+               clock = ddata->clocks[i];
+
+               /* Assume no holes for opt clocks */
+               if (IS_ERR_OR_NULL(clock))
+                       return;
+
+               clk_disable(clock);
+       }
+}
+
 /**
- * sysc_init_resets - reset module on init
+ * sysc_init_resets - init rstctrl reset line if configured
  * @ddata: device driver data
  *
- * A module can have both OCP softreset control and external rstctrl.
- * If more complicated rstctrl resets are needed, please handle these
- * directly from the child device driver and map only the module reset
- * for the parent interconnect target module device.
- *
- * Automatic reset of the module on init can be skipped with the
- * "ti,no-reset-on-init" device tree property.
+ * See sysc_rstctrl_reset_deassert().
  */
 static int sysc_init_resets(struct sysc *ddata)
 {
-       int error;
-
        ddata->rsts =
                devm_reset_control_array_get_optional_exclusive(ddata->dev);
        if (IS_ERR(ddata->rsts))
                return PTR_ERR(ddata->rsts);
 
-       if (ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
-               goto deassert;
-
-       error = reset_control_assert(ddata->rsts);
-       if (error)
-               return error;
-
-deassert:
-       error = reset_control_deassert(ddata->rsts);
-       if (error)
-               return error;
-
        return 0;
 }
 
@@ -622,91 +793,239 @@ static void sysc_show_registers(struct sysc *ddata)
                buf);
 }
 
-static int __maybe_unused sysc_runtime_suspend(struct device *dev)
+#define SYSC_IDLE_MASK (SYSC_NR_IDLEMODES - 1)
+
+static int sysc_enable_module(struct device *dev)
 {
-       struct ti_sysc_platform_data *pdata;
        struct sysc *ddata;
-       int error = 0, i;
+       const struct sysc_regbits *regbits;
+       u32 reg, idlemodes, best_mode;
 
        ddata = dev_get_drvdata(dev);
+       if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
+               return 0;
 
-       if (!ddata->enabled)
+       /*
+        * TODO: Need to prevent clockdomain autoidle?
+        * See clkdm_deny_idle() in arch/mach-omap2/omap_hwmod.c
+        */
+
+       regbits = ddata->cap->regbits;
+       reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
+
+       /* Set SIDLE mode */
+       idlemodes = ddata->cfg.sidlemodes;
+       if (!idlemodes || regbits->sidle_shift < 0)
+               goto set_midle;
+
+       best_mode = fls(ddata->cfg.sidlemodes) - 1;
+       if (best_mode > SYSC_IDLE_MASK) {
+               dev_err(dev, "%s: invalid sidlemode\n", __func__);
+               return -EINVAL;
+       }
+
+       reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift);
+       reg |= best_mode << regbits->sidle_shift;
+       sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
+
+set_midle:
+       /* Set MIDLE mode */
+       idlemodes = ddata->cfg.midlemodes;
+       if (!idlemodes || regbits->midle_shift < 0)
                return 0;
 
-       if (ddata->legacy_mode) {
-               pdata = dev_get_platdata(ddata->dev);
-               if (!pdata)
-                       return 0;
+       best_mode = fls(ddata->cfg.midlemodes) - 1;
+       if (best_mode > SYSC_IDLE_MASK) {
+               dev_err(dev, "%s: invalid midlemode\n", __func__);
+               return -EINVAL;
+       }
 
-               if (!pdata->idle_module)
-                       return -ENODEV;
+       reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift);
+       reg |= best_mode << regbits->midle_shift;
+       sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
 
-               error = pdata->idle_module(dev, &ddata->cookie);
-               if (error)
-                       dev_err(dev, "%s: could not idle: %i\n",
-                               __func__, error);
+       return 0;
+}
+
+static int sysc_best_idle_mode(u32 idlemodes, u32 *best_mode)
+{
+       if (idlemodes & BIT(SYSC_IDLE_SMART_WKUP))
+               *best_mode = SYSC_IDLE_SMART_WKUP;
+       else if (idlemodes & BIT(SYSC_IDLE_SMART))
+               *best_mode = SYSC_IDLE_SMART;
+       else if (idlemodes & SYSC_IDLE_FORCE)
+               *best_mode = SYSC_IDLE_FORCE;
+       else
+               return -EINVAL;
+
+       return 0;
+}
+
+static int sysc_disable_module(struct device *dev)
+{
+       struct sysc *ddata;
+       const struct sysc_regbits *regbits;
+       u32 reg, idlemodes, best_mode;
+       int ret;
 
-               goto idled;
+       ddata = dev_get_drvdata(dev);
+       if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
+               return 0;
+
+       /*
+        * TODO: Need to prevent clockdomain autoidle?
+        * See clkdm_deny_idle() in arch/mach-omap2/omap_hwmod.c
+        */
+
+       regbits = ddata->cap->regbits;
+       reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
+
+       /* Set MIDLE mode */
+       idlemodes = ddata->cfg.midlemodes;
+       if (!idlemodes || regbits->midle_shift < 0)
+               goto set_sidle;
+
+       ret = sysc_best_idle_mode(idlemodes, &best_mode);
+       if (ret) {
+               dev_err(dev, "%s: invalid midlemode\n", __func__);
+               return ret;
        }
 
-       for (i = 0; i < ddata->nr_clocks; i++) {
-               if (IS_ERR_OR_NULL(ddata->clocks[i]))
-                       continue;
+       reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift);
+       reg |= best_mode << regbits->midle_shift;
+       sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
 
-               if (i >= SYSC_OPTFCK0 && !sysc_opt_clks_needed(ddata))
-                       break;
+set_sidle:
+       /* Set SIDLE mode */
+       idlemodes = ddata->cfg.sidlemodes;
+       if (!idlemodes || regbits->sidle_shift < 0)
+               return 0;
 
-               clk_disable(ddata->clocks[i]);
+       ret = sysc_best_idle_mode(idlemodes, &best_mode);
+       if (ret) {
+               dev_err(dev, "%s: invalid sidlemode\n", __func__);
+               return ret;
        }
 
-idled:
-       ddata->enabled = false;
+       reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift);
+       reg |= best_mode << regbits->sidle_shift;
+       sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg);
 
-       return error;
+       return 0;
 }
 
-static int __maybe_unused sysc_runtime_resume(struct device *dev)
+static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
+                                                     struct sysc *ddata)
 {
        struct ti_sysc_platform_data *pdata;
+       int error;
+
+       pdata = dev_get_platdata(ddata->dev);
+       if (!pdata)
+               return 0;
+
+       if (!pdata->idle_module)
+               return -ENODEV;
+
+       error = pdata->idle_module(dev, &ddata->cookie);
+       if (error)
+               dev_err(dev, "%s: could not idle: %i\n",
+                       __func__, error);
+
+       return 0;
+}
+
+static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
+                                                    struct sysc *ddata)
+{
+       struct ti_sysc_platform_data *pdata;
+       int error;
+
+       pdata = dev_get_platdata(ddata->dev);
+       if (!pdata)
+               return 0;
+
+       if (!pdata->enable_module)
+               return -ENODEV;
+
+       error = pdata->enable_module(dev, &ddata->cookie);
+       if (error)
+               dev_err(dev, "%s: could not enable: %i\n",
+                       __func__, error);
+
+       return 0;
+}
+
+static int __maybe_unused sysc_runtime_suspend(struct device *dev)
+{
        struct sysc *ddata;
-       int error = 0, i;
+       int error = 0;
 
        ddata = dev_get_drvdata(dev);
 
-       if (ddata->enabled)
+       if (!ddata->enabled)
                return 0;
 
        if (ddata->legacy_mode) {
-               pdata = dev_get_platdata(ddata->dev);
-               if (!pdata)
-                       return 0;
+               error = sysc_runtime_suspend_legacy(dev, ddata);
+               if (error)
+                       return error;
+       } else {
+               error = sysc_disable_module(dev);
+               if (error)
+                       return error;
+       }
 
-               if (!pdata->enable_module)
-                       return -ENODEV;
+       sysc_disable_main_clocks(ddata);
 
-               error = pdata->enable_module(dev, &ddata->cookie);
-               if (error)
-                       dev_err(dev, "%s: could not enable: %i\n",
-                               __func__, error);
+       if (sysc_opt_clks_needed(ddata))
+               sysc_disable_opt_clocks(ddata);
 
-               goto awake;
-       }
+       ddata->enabled = false;
 
-       for (i = 0; i < ddata->nr_clocks; i++) {
-               if (IS_ERR_OR_NULL(ddata->clocks[i]))
-                       continue;
+       return error;
+}
 
-               if (i >= SYSC_OPTFCK0 && !sysc_opt_clks_needed(ddata))
-                       break;
+static int __maybe_unused sysc_runtime_resume(struct device *dev)
+{
+       struct sysc *ddata;
+       int error = 0;
+
+       ddata = dev_get_drvdata(dev);
 
-               error = clk_enable(ddata->clocks[i]);
+       if (ddata->enabled)
+               return 0;
+
+       if (sysc_opt_clks_needed(ddata)) {
+               error = sysc_enable_opt_clocks(ddata);
                if (error)
                        return error;
        }
 
-awake:
+       error = sysc_enable_main_clocks(ddata);
+       if (error)
+               goto err_opt_clocks;
+
+       if (ddata->legacy_mode) {
+               error = sysc_runtime_resume_legacy(dev, ddata);
+               if (error)
+                       goto err_main_clocks;
+       } else {
+               error = sysc_enable_module(dev);
+               if (error)
+                       goto err_main_clocks;
+       }
+
        ddata->enabled = true;
 
+       return 0;
+
+err_main_clocks:
+       sysc_disable_main_clocks(ddata);
+err_opt_clocks:
+       if (sysc_opt_clks_needed(ddata))
+               sysc_disable_opt_clocks(ddata);
+
        return error;
 }
 
@@ -788,12 +1107,17 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
        SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffff00ff,
                   0),
        SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
-                  SYSC_QUIRK_LEGACY_IDLE),
+                  SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
        /* Uarts on omap4 and later */
        SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
-                  SYSC_QUIRK_LEGACY_IDLE),
+                  SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
        SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
-                  SYSC_QUIRK_LEGACY_IDLE),
+                  SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
+
+       /* Quirks that need to be set based on the module address */
+       SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -1, 0x50000800, 0xffffffff,
+                  SYSC_QUIRK_EXT_OPT_CLOCK | SYSC_QUIRK_NO_RESET_ON_INIT |
+                  SYSC_QUIRK_SWSUP_SIDLE),
 
 #ifdef DEBUG
        SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0),
@@ -805,6 +1129,7 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
                   0xffff00f0, 0),
        SYSC_QUIRK("dcan", 0, 0, -1, -1, 0xffffffff, 0xffffffff, 0),
        SYSC_QUIRK("dcan", 0, 0, -1, -1, 0x00001401, 0xffffffff, 0),
+       SYSC_QUIRK("dmic", 0, 0, 0x10, -1, 0x50010000, 0xffffffff, 0),
        SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0),
        SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0),
        SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0),
@@ -853,6 +1178,42 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
 #endif
 };
 
+/*
+ * Early quirks based on module base and register offsets only that are
+ * needed before the module revision can be read
+ */
+static void sysc_init_early_quirks(struct sysc *ddata)
+{
+       const struct sysc_revision_quirk *q;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(sysc_revision_quirks); i++) {
+               q = &sysc_revision_quirks[i];
+
+               if (!q->base)
+                       continue;
+
+               if (q->base != ddata->module_pa)
+                       continue;
+
+               if (q->rev_offset >= 0 &&
+                   q->rev_offset != ddata->offsets[SYSC_REVISION])
+                       continue;
+
+               if (q->sysc_offset >= 0 &&
+                   q->sysc_offset != ddata->offsets[SYSC_SYSCONFIG])
+                       continue;
+
+               if (q->syss_offset >= 0 &&
+                   q->syss_offset != ddata->offsets[SYSC_SYSSTATUS])
+                       continue;
+
+               ddata->name = q->name;
+               ddata->cfg.quirks |= q->quirks;
+       }
+}
+
+/* Quirks that also consider the revision register value */
 static void sysc_init_revision_quirks(struct sysc *ddata)
 {
        const struct sysc_revision_quirk *q;
@@ -885,6 +1246,55 @@ static void sysc_init_revision_quirks(struct sysc *ddata)
        }
 }
 
+/*
+ * Note that pdata->init_module() typically does a reset first. After
+ * pdata->init_module() is done, PM runtime can be used for the interconnect
+ * target module.
+ */
+static int sysc_legacy_init(struct sysc *ddata)
+{
+       struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
+       int error;
+
+       if (!ddata->legacy_mode || !pdata || !pdata->init_module)
+               return 0;
+
+       error = pdata->init_module(ddata->dev, ddata->mdata, &ddata->cookie);
+       if (error == -EEXIST)
+               error = 0;
+
+       return error;
+}
+
+/**
+ * sysc_rstctrl_reset_deassert - deassert rstctrl reset
+ * @ddata: device driver data
+ * @reset: reset before deassert
+ *
+ * A module can have both OCP softreset control and external rstctrl.
+ * If more complicated rstctrl resets are needed, please handle these
+ * directly from the child device driver and map only the module reset
+ * for the parent interconnect target module device.
+ *
+ * Automatic reset of the module on init can be skipped with the
+ * "ti,no-reset-on-init" device tree property.
+ */
+static int sysc_rstctrl_reset_deassert(struct sysc *ddata, bool reset)
+{
+       int error;
+
+       if (!ddata->rsts)
+               return 0;
+
+       if (reset) {
+               error = reset_control_assert(ddata->rsts);
+               if (error)
+                       return error;
+       }
+
+       return reset_control_deassert(ddata->rsts);
+}
+
 static int sysc_reset(struct sysc *ddata)
 {
        int offset = ddata->offsets[SYSC_SYSCONFIG];
@@ -915,38 +1325,58 @@ static int sysc_reset(struct sysc *ddata)
                                  100, MAX_MODULE_SOFTRESET_WAIT);
 }
 
-/* At this point the module is configured enough to read the revision */
+/*
+ * At this point the module is configured enough to read the revision but
+ * module may not be completely configured yet to use PM runtime. Enable
+ * all clocks directly during init to configure the quirks needed for PM
+ * runtime based on the revision register.
+ */
 static int sysc_init_module(struct sysc *ddata)
 {
-       int error;
+       int error = 0;
+       bool manage_clocks = true;
+       bool reset = true;
 
-       if (ddata->cfg.quirks & SYSC_QUIRK_NO_IDLE_ON_INIT) {
-               ddata->revision = sysc_read_revision(ddata);
-               goto rev_quirks;
-       }
+       if (ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
+               reset = false;
 
-       error = pm_runtime_get_sync(ddata->dev);
-       if (error < 0) {
-               pm_runtime_put_noidle(ddata->dev);
+       error = sysc_rstctrl_reset_deassert(ddata, reset);
+       if (error)
+               return error;
 
-               return 0;
-       }
+       if (ddata->cfg.quirks &
+           (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))
+               manage_clocks = false;
 
-       error = sysc_reset(ddata);
-       if (error) {
-               dev_err(ddata->dev, "Reset failed with %d\n", error);
-               pm_runtime_put_sync(ddata->dev);
+       if (manage_clocks) {
+               error = sysc_enable_opt_clocks(ddata);
+               if (error)
+                       return error;
 
-               return error;
+               error = sysc_enable_main_clocks(ddata);
+               if (error)
+                       goto err_opt_clocks;
        }
 
        ddata->revision = sysc_read_revision(ddata);
-       pm_runtime_put_sync(ddata->dev);
-
-rev_quirks:
        sysc_init_revision_quirks(ddata);
 
-       return 0;
+       error = sysc_legacy_init(ddata);
+       if (error)
+               goto err_main_clocks;
+
+       error = sysc_reset(ddata);
+       if (error)
+               dev_err(ddata->dev, "Reset failed with %d\n", error);
+
+err_main_clocks:
+       if (manage_clocks)
+               sysc_disable_main_clocks(ddata);
+err_opt_clocks:
+       if (manage_clocks)
+               sysc_disable_opt_clocks(ddata);
+
+       return error;
 }
 
 static int sysc_init_sysc_mask(struct sysc *ddata)
@@ -1208,7 +1638,7 @@ static int sysc_child_resume_noirq(struct device *dev)
 }
 #endif
 
-struct dev_pm_domain sysc_child_pm_domain = {
+static struct dev_pm_domain sysc_child_pm_domain = {
        .ops = {
                SET_RUNTIME_PM_OPS(sysc_child_runtime_suspend,
                                   sysc_child_runtime_resume,
@@ -1281,6 +1711,8 @@ static const struct sysc_dts_quirk sysc_dts_quirks[] = {
          .mask = SYSC_QUIRK_NO_IDLE_ON_INIT, },
        { .name = "ti,no-reset-on-init",
          .mask = SYSC_QUIRK_NO_RESET_ON_INIT, },
+       { .name = "ti,no-idle",
+         .mask = SYSC_QUIRK_NO_IDLE, },
 };
 
 static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np,
@@ -1331,6 +1763,9 @@ static void sysc_unprepare(struct sysc *ddata)
 {
        int i;
 
+       if (!ddata->clocks)
+               return;
+
        for (i = 0; i < SYSC_MAX_CLOCKS; i++) {
                if (!IS_ERR_OR_NULL(ddata->clocks[i]))
                        clk_unprepare(ddata->clocks[i]);
@@ -1576,28 +2011,26 @@ static const struct sysc_capabilities sysc_dra7_mcan = {
 static int sysc_init_pdata(struct sysc *ddata)
 {
        struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
-       struct ti_sysc_module_data mdata;
-       int error = 0;
+       struct ti_sysc_module_data *mdata;
 
        if (!pdata || !ddata->legacy_mode)
                return 0;
 
-       mdata.name = ddata->legacy_mode;
-       mdata.module_pa = ddata->module_pa;
-       mdata.module_size = ddata->module_size;
-       mdata.offsets = ddata->offsets;
-       mdata.nr_offsets = SYSC_MAX_REGS;
-       mdata.cap = ddata->cap;
-       mdata.cfg = &ddata->cfg;
+       mdata = devm_kzalloc(ddata->dev, sizeof(*mdata), GFP_KERNEL);
+       if (!mdata)
+               return -ENOMEM;
 
-       if (!pdata->init_module)
-               return -ENODEV;
+       mdata->name = ddata->legacy_mode;
+       mdata->module_pa = ddata->module_pa;
+       mdata->module_size = ddata->module_size;
+       mdata->offsets = ddata->offsets;
+       mdata->nr_offsets = SYSC_MAX_REGS;
+       mdata->cap = ddata->cap;
+       mdata->cfg = &ddata->cfg;
 
-       error = pdata->init_module(ddata->dev, &mdata, &ddata->cookie);
-       if (error == -EEXIST)
-               error = 0;
+       ddata->mdata = mdata;
 
-       return error;
+       return 0;
 }
 
 static int sysc_init_match(struct sysc *ddata)
@@ -1651,10 +2084,6 @@ static int sysc_probe(struct platform_device *pdev)
        if (error)
                goto unprepare;
 
-       error = sysc_get_clocks(ddata);
-       if (error)
-               return error;
-
        error = sysc_map_and_check_registers(ddata);
        if (error)
                goto unprepare;
@@ -1675,15 +2104,21 @@ static int sysc_probe(struct platform_device *pdev)
        if (error)
                goto unprepare;
 
+       sysc_init_early_quirks(ddata);
+
+       error = sysc_get_clocks(ddata);
+       if (error)
+               return error;
+
        error = sysc_init_resets(ddata);
        if (error)
                return error;
 
-       pm_runtime_enable(ddata->dev);
        error = sysc_init_module(ddata);
        if (error)
                goto unprepare;
 
+       pm_runtime_enable(ddata->dev);
        error = pm_runtime_get_sync(ddata->dev);
        if (error < 0) {
                pm_runtime_put_noidle(ddata->dev);
index 5cf3bad..6626c84 100644 (file)
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* GD ROM driver for the SEGA Dreamcast
  * copyright Adrian McMenamin, 2007
  * With thanks to Marcus Comstedt and Nathan Keynes
  * for work in reversing PIO and DMA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index c69e39f..594aee2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 2001-2003 SuSE Labs.
  * Distributed under the GNU public license, v2.
index 31fcd04..62de7f4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * UniNorth AGPGART routines.
  */
index a4961d3..87a92a0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * VIA AGPGART routines.
  */
index 53436c0..230cf85 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * bios-less APM driver for ARM Linux
  *  Jamey Hicks <jamey@crl.dec.com>
index 4ccc39e..eb108b3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Derived from Applicom driver ac.c for SCO Unix                            */
 /* Ported by David Woodhouse, Axiom (Cambridge) Ltd.                         */
 /* dwmw2@infradead.org 30/8/98                                               */
index 373f549..cf89a96 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/drivers/char/ds1620.c: Dallas Semiconductors DS1620
  *   thermometer driver (as used in the Rebel.com NetWinder)
index 4fed8fa..6946c1c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*                                              -*- linux-c -*-
  * dtlk.c - DoubleTalk PC driver for Linux
  *
index 11781eb..4f73064 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * EFI Time Services Driver for Linux
  *
index 25a7d8f..59f2528 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Hardware Random Number Generator (RNG) configuration
 #
index f841151..d4cab10 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* n2-drv.c: Niagara-2 RNG driver.
  *
  * Copyright (C) 2008, 2011 David S. Miller <davem@davemloft.net>
index 7175579..8c6f9f6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * APM X-Gene SoC RNG Driver
  *
@@ -5,20 +6,6 @@
  * Author: Rameshwar Prasad Sahu <rsahu@apm.com>
  *        Shamal Winchurkar <swinchurkar@apm.com>
  *        Feng Kan <fkan@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/acpi.h>
index 94719fc..caac5d2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IPMI device configuration
 #
index 3406852..7c9269e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic parallel printer driver
  *
index efa6a82..a24fe96 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ACP Modem (Mwave).
 #
index 2a91bf0..da930c7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* linux/drivers/char/nsc_gpio.c
 
    National Semiconductor common GPIO device-file/VFS methods.
index eff1e3f..4667844 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * CMOS/NV-RAM driver for Linux
  *
index a7113b7..ea378c0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     NetWinder Button Driver-
  *     Copyright (C) Alex Holden <alex@linuxhacker.org> 1998, 1999.
index 76fb434..a4a0797 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Flash memory interface rev.5 driver for the Intel
  * Flash chips used on the NetWinder.
index 5f4be88..c39a836 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* linux/drivers/char/pc8736x_gpio.c
 
    National Semiconductor PC8736x GPIO driver.  Allows a user space
index 1d1e7da..f5d589b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PCMCIA character device configuration
 #
index 5b836bc..024eed1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # drivers/char/pcmcia/Makefile
 #
index 04b39c3..47feb39 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SCR24x PCMCIA Smart Card Reader Driver
  *
@@ -5,20 +6,6 @@
  * Copyright (C) 2016 Lubomir Rintel
  *
  * Derived from "scr24x_v4.2.6_Release.tar.gz" driver by TL Sudheendran.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/device.h>
index a45dabc..027484e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * OPAL Operator Panel Display Driver
  *
index fd6eec8..3484e91 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/drivers/char/raw.c
  *
index 903761b..9f701dc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* linux/drivers/char/scx200_gpio.c
 
    National Semiconductor SCx200 GPIO driver.  Allows a user space
index f3e4bc4..88a3c06 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TPM device configuration
 #
index e74c6f2..e582145 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TCG_TIS_ST33ZP24
        tristate
        ---help---
index 8390c5b..35333b6 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * STMicroelectronics TPM I2C Linux driver for TPM ST33ZP24
  * Copyright (C) 2009 - 2016 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index ff019a1..26e09de 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * STMicroelectronics TPM SPI Linux driver for TPM ST33ZP24
  * Copyright (C) 2009 - 2016 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 13dc614..37bb13f 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * STMicroelectronics TPM Linux driver for TPM ST33ZP24
  * Copyright (C) 2009 - 2016 STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 8a7e809..d5ac855 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ATMEL I2C TPM AT97SC3204T
  *
  *
  * TGC status/locality/etc functions seen in the LPC implementation do not
  * seem to be present.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see http://www.gnu.org/licenses/>.
  */
 #include <linux/init.h>
 #include <linux/module.h>
index 315a3b4..b77c18e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /******************************************************************************
  * Nuvoton TPM I2C Device Driver Interface for WPCT301/NPCT501/NPCT6XX,
  * based on the TCG TPM Interface Spec version 1.2.
@@ -8,19 +9,6 @@
  * Copyright (C) 2013, Obsidian Research Corp.
  *  Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see http://www.gnu.org/licenses/>.
- *
  * Nuvoton contact information: APC.Support@nuvoton.com
  *****************************************************************************/
 
index 5491cbc..cc45138 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Xilinx OPB hwicap driver
 #
index a1f16df..130dbdc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Xillybus devices
 #
index b68b7eb..099e9a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Xillybus driver
 #
index 5b45ca3..0686391 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CLK_ACTIONS
        bool "Clock driver for Actions Semi SoCs"
        depends on ARCH_ACTIONS || COMPILE_TEST
index a2588e5..db1c458 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CLK_ACTIONS)      += clk-owl.o
 
 clk-owl-y                      += owl-common.o
index b5fd60c..1e291b1 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CLK_ANALOGBITS_WRPLL_CLN28HPC
        bool
index 628c9d3..a6a9bbe 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MACH_ARTPEC6)     += clk-artpec6.o
index d747dea..5e81109 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += i2s_pll_clock.o
 obj-y += pll_clock.o
index 02d3bcd..71c2e95 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
 #include <linux/of.h>
index c68dada..aba787b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
index 4c4bd85..29ee7b7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CLK_BCM_63XX
        bool "Broadcom BCM63xx clock support"
        depends on ARCH_BCM_63XX || COMPILE_TEST
index 2a2c756..b6d07ca 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <dt-bindings/clock/bcm2835-aux.h>
index 9fcae93..770bb01 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/clk.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
index eee64b9..cc3b1e1 100644 (file)
@@ -15,8 +15,9 @@
 #include "clk-kona.h"
 
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
-#include <linux/clk.h>
+#include <linux/clk-provider.h>
 
 /*
  * "Policies" affect the frequencies of bus clocks provided by a
index 2a36ab7..3733733 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += berlin2-avpll.o berlin2-pll.o berlin2-div.o
 obj-$(CONFIG_MACH_BERLIN_BG2)  += bg2.o
 obj-$(CONFIG_MACH_BERLIN_BG2CD)        += bg2.o
index 4d0be66..eb14a5b 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <linux/bitops.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index 0b4b44a..bccdfa0 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index 9b9db74..e9518d3 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index d1a97d9..51f2661 100644 (file)
@@ -10,8 +10,9 @@
  */
 
 #include <linux/clk-provider.h>
-#include <linux/of_address.h>
+#include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of_address.h>
 #include <linux/platform_device.h>
 
 static struct clk_hw *fixed_mmio_clk_setup(struct device_node *node)
index d81f1d2..b1e556f 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/slab.h>
index a47c2b6..97d1e8c 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
index 94470b4..e507aa9 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/export.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/slab.h>
index 0f71981..bf120be 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/clkdev.h>
 #include <linux/device.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/mfd/da8xx-cfgchip.h>
 #include <linux/mfd/syscon.h>
index b86427c..8078a0b 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += clk-div.o
 obj-$(CONFIG_H8S2678) += clk-h8s2678.o
index d413ade..376be03 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index c7ae653..67c495b 100644 (file)
@@ -6,8 +6,9 @@
  */
 
 #include <linux/clk-provider.h>
-#include <linux/err.h>
 #include <linux/device.h>
+#include <linux/io.h>
+#include <linux/err.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
 
index 30fad7a..6a9e93a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_CLK_HI3516CV300
        tristate "HI3516CV300 Clock Driver"
        depends on ARCH_HISI || COMPILE_TEST
index 51b173e..ad0c7f3 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hi3519 Clock Driver
  *
  * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <dt-bindings/clock/hi3519-clock.h>
index 2eda9bd..a3d04c7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon Hi3620 clock driver
  *
@@ -6,21 +7,6 @@
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  *        Xin Li <li.xin@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #include <linux/kernel.h>
index e8b2c43..89934be 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/mailbox_client.h>
 #include <linux/module.h>
 #include <linux/of.h>
index b38e03d..785b9fa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon HiP04 clock driver
  *
@@ -5,21 +6,6 @@
  * Copyright (c) 2013-2014 Linaro Limited.
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #include <linux/kernel.h>
index 953c8da..54d9fdc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon clock driver
  *
@@ -6,21 +7,6 @@
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  *        Xin Li <li.xin@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #include <linux/kernel.h>
index 8d7ee5c..61cbd90 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Hisilicon Hi3620 clock gate driver
  *
@@ -6,21 +7,6 @@
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  *        Xin Li <li.xin@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #ifndef        __HISI_CLK_H
index ae84884..90d8585 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon clock separated gate driver
  *
@@ -6,21 +7,6 @@
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  *        Xin Li <li.xin@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #include <linux/kernel.h>
index 53450b6..5d4e61c 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hi3516CV300 Clock and Reset Generator Driver
  *
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <dt-bindings/clock/hi3516cv300-clock.h>
index 4fe0b2a..08a19ba 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hi3798CV200 Clock and Reset Generator Driver
  *
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <dt-bindings/clock/histb-clock.h>
index 43e82fa..2e22fea 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon Reset Controller Driver
  *
  * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/io.h>
index 9a69374..81ff9e9 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2015 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef        __HISI_RESET_H
index f6dcb74..30f5265 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_CLK_BOSTON
        bool "Clock driver for MIPS Boston boards"
        depends on MIPS || COMPILE_TEST
index ac779b8..d2e8142 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_COMMON_CLK_BOSTON)                += clk-boston.o
index 574fac1..388bdb9 100644 (file)
@@ -3,9 +3,10 @@
  * Copyright 2018 NXP
  */
 
+#include <linux/clk-provider.h>
 #include <linux/errno.h>
+#include <linux/io.h>
 #include <linux/slab.h>
-#include <linux/clk-provider.h>
 
 #include "clk.h"
 
index 76b9eb1..fece503 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
 #include <linux/bitfield.h>
index e63188e..6e93284 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <dt-bindings/clock/imx21-clock.h>
index 23686f7..a66cabf 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2009 by Sascha Hauer, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/kernel.h>
index 0a0ab95..a375306 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <dt-bindings/clock/imx27-clock.h>
index cbce308..4bb05e4 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012 Sascha Hauer <kernel@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation.
  */
 
 #include <linux/module.h>
index fb567dc..a03bbed 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
 
index d7e62c3..8155b12 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
 
index 991bbe6..5d65f65 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
 #include <linux/bitfield.h>
index 34dc0da..fe8db93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Ingenic JZ47xx CGU drivers"
        depends on MIPS
 
index 00a79b2..ab58a6a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INGENIC_CGU_COMMON)       += cgu.o
 obj-$(CONFIG_INGENIC_CGU_JZ4740)       += jz4740-cgu.o
 obj-$(CONFIG_INGENIC_CGU_JZ4725B)      += jz4725b-cgu.o
index 510b685..b80af61 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/math64.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index b86edd3..25f7df0 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <dt-bindings/clock/jz4740-cgu.h>
 #include <asm/mach-jz4740/clock.h>
index bf46a0d..dfce740 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/syscore_ops.h>
 #include <dt-bindings/clock/jz4770-cgu.h>
index 6427be1..d03b7fc 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <dt-bindings/clock/jz4780-cgu.h>
 #include "cgu.h"
index b04927d..0ca6301 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_CLK_KEYSTONE
        tristate "Clock drivers for Keystone based SOCs"
        depends on (ARCH_KEYSTONE || COMPILE_TEST) && OF
index c125939..d044de6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)      += pll.o gate.o
 obj-$(CONFIG_TI_SCI_CLK)               += sci-clk.o
index b7f6a16..251d0fe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += clk.o
 obj-$(CONFIG_LOONGSON1_LS1B)   += clk-loongson1b.o
 obj-$(CONFIG_LOONGSON1_LS1C)   += clk-loongson1c.o
index 3466f73..22a165e 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include <loongson1.h>
 #include "clk.h"
index 4d8a9ae..f797f09 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MediaTek Clock Drivers
 #
index 3858747..a6b20e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_CLK_MESON_INPUT
        tristate
 
index 021fc29..bc35a4e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Amlogic clock drivers
 
 obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-aoclk.o
index 2152f41..f34b247 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_COMMON_CLK_PIC32) += clk-core.o
 obj-$(CONFIG_PIC32MZDA) += clk-pic32mzda.o
index c3b3014..4680064 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <asm/mach-pic32/pic32.h>
 #include <asm/traps.h>
index 9f73477..e6c05df 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
index fddc8ac..b09f6de 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MVEBU_CLK_COMMON
        bool
 
index 1f1cff4..5fc6d48 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
index ee272d4..585a02e 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/clk.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
index 1fc84b0..818b175 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/kernel.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
index a6a2223..15a112f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for mxs specific clk
 #
index d456ee6..2cf6317 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARCH_LPC18XX)     += clk-lpc18xx-cgu.o
 obj-$(CONFIG_ARCH_LPC18XX)     += clk-lpc18xx-ccu.o
 obj-$(CONFIG_ARCH_LPC18XX)     += clk-lpc18xx-creg.o
index 5969f62..f2e171a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index f5bc8bd..8b686da 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index 7524d19..7f67c10 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/regmap.h>
 
index f1e151f..7035567 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += clk.o
 obj-y  += clk-pll.o
 obj-y  += clk-pistachio.o
index 38e37bf..da663c2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += clk-pxa.o
 obj-$(CONFIG_PXA25x)           += clk-pxa25x.o
 obj-$(CONFIG_PXA27x)           += clk-pxa27x.o
index 42627bf..5326f77 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
+#include <linux/io.h>
 #include <linux/of.h>
 
 #include <dt-bindings/clock/pxa-clock.h>
index 18bdf34..e1ff83c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config KRAIT_CLOCKS
        bool
        select KRAIT_L2_ACCESSORS
index 2719c24..cfed11c 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clk/renesas.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/of.h>
index 5967656..d8190f0 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clk/renesas.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/of.h>
index 2913b41..da9fe3f 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clk/renesas.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/math64.h>
 #include <linux/of.h>
index 3cda53a..fbc34be 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clk/renesas.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index dc8ffc7..5f25a70 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clk/renesas.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index 97c7247..7d04218 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/math64.h>
 #include <linux/of.h>
index b241f9c..cc90b11 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/clk-provider.h>
 #include <linux/device.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
index 30df0dc..0201809 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
index 784b81e..ba9f00d 100644 (file)
@@ -3,8 +3,9 @@
  * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
  */
 
-#include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
+#include <linux/slab.h>
 #include "clk.h"
 
 #define div_mask(width)        ((1 << (width)) - 1)
index 601a77f..68d23be 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index c300198..3bf919b 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 5970a50..8278a54 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 5ecf288..378420b 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <dt-bindings/clock/rk3188-cru-common.h>
index 7af4818..7176003 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 24baeb5..85907f3 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index f12142d..9b03c1a 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 7c4d242..d239bbc 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
index 5a62814..2322d71 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
index 089cb17..6c051aa 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 0ea8e80..d5fac5a 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 #include <linux/reboot.h>
index addc652..57d4b3f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Recent Exynos platforms should just select COMMON_CLK_SAMSUNG:
 config COMMON_CLK_SAMSUNG
        bool "Samsung Exynos clock controller support" if COMPILE_TEST
index a5fddeb..3f80bcd 100644 (file)
@@ -33,6 +33,7 @@
 */
 
 #include <linux/errno.h>
+#include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
index 9c95390..ce41f36 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
index 0e9a41a..facaad3 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
index 54066e6..d2a68a7 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index 8ae44b5..91db789 100644 (file)
@@ -4,6 +4,7 @@
 // Author: Marek Szyprowski <m.szyprowski@samsung.com>
 // Common Clock Framework support for Exynos5 power-domain dependent clocks
 
+#include <linux/io.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
index f14139b..c8265c4 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <dt-bindings/clock/exynos5250.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index 1c4c7a3..0c6782c 100644 (file)
@@ -13,7 +13,8 @@
 #include <linux/hrtimer.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/io.h>
 #include "clk.h"
 #include "clk-pll.h"
 
index 82f8ae2..0117e40 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include "clk.h"
index dd11590..ce21b89 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/reboot.h>
index f38f0e2..b2ea4df 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/reboot.h>
index 1f6e47c..9ad546a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/clkdev.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
 
index 74d58a4..0797f14 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI)    += fu540-prci.o
index 0ec8bf7..6282ee2 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/clk/analogbits-wrpll-cln28hpc.h>
 #include <linux/delay.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_clk.h>
index 09b4210..0ff61f8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for sirf specific clk
 #
index 0cd11e6..c84d5ba 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Clock tree for CSR SiRFatlasVI
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index be012b4..3f57fef 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Clock tree for CSR SiRFAtlas7
  *
  * Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/bitops.h>
index d8f9efa..ad7951b 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * common clks module for all SiRF SoCs
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/clk.h>
index 2f82432..45dcbc9 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Clock tree for CSR SiRFprimaII
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index eee2d48..54a464f 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2017, Intel Corporation
  */
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/slab.h>
 #include "stratix10-clk.h"
 #include "clk.h"
index 568f59b..5c50e72 100644 (file)
@@ -4,6 +4,7 @@
  */
 #include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "stratix10-clk.h"
 #include "clk.h"
index c4d0b6f..4705eb5 100644 (file)
@@ -4,6 +4,7 @@
  */
 #include <linux/slab.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "stratix10-clk.h"
 #include "clk.h"
index 7564d2e..0bd7d0e 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright 2011-2012 Calxeda, Inc.
  *  Copyright (C) 2012-2013 Altera Corporation <www.altera.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
  * Based from clk-highbank.c
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/of.h>
 
index 8789247..91d3d72 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SPRD_COMMON_CLK
        tristate "Clock support for Spreadtrum SoCs"
        depends on ARCH_SPRD || COMPILE_TEST
index b0d81e5..d4c0078 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SPRD_COMMON_CLK)  += clk-sprd.o
 
 clk-sprd-y     += common.o
index ede7b2f..caf7789 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += clkgen-mux.o clkgen-pll.o clkgen-fsyn.o clk-flexgen.o
index c514d39..23497f0 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/slab.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
index ecd1b6b..cdf3330 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SUNXI_CCU
        bool "Clock support for Allwinner SoCs"
        depends on ARCH_SUNXI || COMPILE_TEST
index 129ebd2..2bbfb33 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index be0deee..d3fc1f5 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 
index 3c32d77..9d3f989 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 
index fa2c2dd..813e9bf 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index 609970c..b494c4f 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index 4b5f8f4..a9c0c54 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index c7bf814..25bcf3f 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index 5f714b4..be5920e 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 
index e71e245..0f3df56 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index a22d11a..f9625f7 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
index eada0e2..ec64eb6 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index 8936ef8..0e23583 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 
index dc9f0a3..e748b8a 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 
 #include "ccu_common.h"
index 302a18e..6d407a8 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_div.h"
index d1d168d..1842603 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/spinlock.h>
 
 #include "ccu_frac.h"
index cd069d5..9c81644 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 
index f9869f7..b234106 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/clk/sunxi-ng.h>
+#include <linux/io.h>
 
 #include "ccu_common.h"
 
index 0357349..e17fb4c 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_mp.h"
index 12e0783..c2a6727 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_mult.h"
index 3126641..f9b409c 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_mux.h"
index 2485bda..50c7e6b 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_nk.h"
index 841840e..aa5beaa 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_nkm.h"
index cbcdf66..53ec4fb 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_gate.h"
 #include "ccu_nkmp.h"
index 424d863..e154131 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "ccu_frac.h"
 #include "ccu_gate.h"
index 400c58a..0a4a6fd 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/spinlock.h>
 
 #include "ccu_phase.h"
index 3b3dc9b..e510467 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/spinlock.h>
 
 #include "ccu_sdm.h"
index 2b6207c..3fba3d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig CLK_SUNXI
        bool "Legacy clock support for Allwinner SoCs"
        depends on ARCH_SUNXI || COMPILE_TEST
index e2819fa..9e6796a 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index d8eab90..a709b6a 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index d9ea22e..d119b45 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/reset-controller.h>
index 3437f73..e6d639d 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index fc0278a..9159545 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
index a085c3b..8130467 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index 9780fac..bb2dc83 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/of_address.h>
 #include <linux/reset-controller.h>
index f66267e..c879d7e 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index b6d29d1..af8ca50 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index d5c3180..5a7d4dd 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
index bee305b..bfbcd71 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/slab.h>
index 56db89b..0e924c9 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/of_address.h>
index 4d5e141..01255d8 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/of.h>
index f00d875..da264d0 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/reset.h>
index 892c290..f5b1c00 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/reset-controller.h>
index 917fc27..7d15e04 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/reset-controller.h>
index 1adcccf..4d99a87 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TEGRA_CLK_EMC
        def_bool y
        depends on TEGRA124_EMC
index 93ecb53..b7f763f 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
index c57dfb0..956f221 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "clk.h"
 
index 473d418..a5cd3e3 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/types.h>
 
 #include "clk.h"
index ffaf17f..6f2862e 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/clk/tegra.h>
 #include <linux/reset-controller.h>
index 2713417..d913d86 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_CLK_TI_ADPLL
        tristate "Clock driver for dm814x ADPLL"
        depends on ARCH_OMAP2PLUS || COMPILE_TEST
index 0c21098..fdfb900 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/math64.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
index ba17cc5..e0b8ed3 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/clk/ti.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/list.h>
index ed24f20..95e36ba 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/math64.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
index 5512377..af37b21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CLK_UNIPHIER
        bool "Clock driver for UniPhier SoCs"
        depends on ARCH_UNIPHIER || COMPILE_TEST
index 8aa875f..ac76685 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ICST
        bool
 
index 58b54b8..4ff563e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for Versatile-specific clocks
 obj-$(CONFIG_ICST)             += icst.o clk-icst.o clk-versatile.o
 obj-$(CONFIG_INTEGRATOR_IMPD1) += clk-impd1.o
index c2b6bb8..4fa0cd9 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
index 00303bc..e3ec81e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PMC_ATOM)         += clk-pmc-atom.o
 obj-$(CONFIG_X86_AMD_PLATFORM_DEVICE)  += clk-st.o
 clk-x86-lpss-objs              := clk-lpt.o
index 1917483..5970edb 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 #include <linux/err.h>
+#include <linux/io.h>
 #include <linux/platform_data/x86/clk-pmc-atom.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
index 83374bf..f130643 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := clk.o
 obj-$(CONFIG_SOC_ZX296702) += clk-zx296702.o
 obj-$(CONFIG_ARCH_ZX) += clk-zx296718.o
index 0afc2e7..a5bb696 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Zynq clock specific Makefile
 
 obj-y  += clkc.o pll.o
index 8febd24..a11f93e 100644 (file)
@@ -739,8 +739,8 @@ static int zynqmp_clock_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
 
        eemi_ops = zynqmp_pm_get_eemi_ops();
-       if (!eemi_ops)
-               return -ENXIO;
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
 
        ret = zynqmp_clk_setup(dev->of_node);
 
index 4b3d143..3300739 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Clock Source drivers"
        depends on GENERIC_CLOCKEVENTS
 
@@ -69,6 +70,13 @@ config FTTMR010_TIMER
          Enables support for the Faraday Technology timer block
          FTTMR010.
 
+config IXP4XX_TIMER
+       bool "Intel XScale IXP4xx timer driver" if COMPILE_TEST
+       depends on HAS_IOMEM
+       select CLKSRC_MMIO
+       help
+         Enables support for the Intel XScale IXP4xx SoC timer.
+
 config ROCKCHIP_TIMER
        bool "Rockchip timer driver" if COMPILE_TEST
        depends on ARM || ARM64
@@ -380,7 +388,7 @@ config ARM_GLOBAL_TIMER
          This options enables support for the ARM global timer unit
 
 config ARM_TIMER_SP804
-       bool "Support for Dual Timer SP804 module"
+       bool "Support for Dual Timer SP804 module" if COMPILE_TEST
        depends on GENERIC_SCHED_CLOCK && CLKDEV_LOOKUP
        select CLKSRC_MMIO
        select TIMER_OF if OF
@@ -400,8 +408,11 @@ config ARMV7M_SYSTICK
          This options enables support for the ARMv7M system timer unit
 
 config ATMEL_PIT
+       bool "Atmel PIT support" if COMPILE_TEST
+       depends on HAS_IOMEM
        select TIMER_OF if OF
-       def_bool SOC_AT91SAM9 || SOC_SAMA5
+       help
+         Support for the Periodic Interval Timer found on Atmel SoCs.
 
 config ATMEL_ST
        bool "Atmel ST timer support" if COMPILE_TEST
@@ -411,6 +422,13 @@ config ATMEL_ST
        help
          Support for the Atmel ST timer.
 
+config ATMEL_TCB_CLKSRC
+       bool "Atmel TC Block timer driver" if COMPILE_TEST
+       depends on HAS_IOMEM
+       select TIMER_OF if OF
+       help
+         Support for Timer Counter Blocks on Atmel SoCs.
+
 config CLKSRC_EXYNOS_MCT
        bool "Exynos multi core timer driver" if COMPILE_TEST
        depends on ARM || ARM64
index be6e0fb..236858f 100644 (file)
@@ -3,7 +3,7 @@ obj-$(CONFIG_TIMER_OF)          += timer-of.o
 obj-$(CONFIG_TIMER_PROBE)      += timer-probe.o
 obj-$(CONFIG_ATMEL_PIT)                += timer-atmel-pit.o
 obj-$(CONFIG_ATMEL_ST)         += timer-atmel-st.o
-obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o
+obj-$(CONFIG_ATMEL_TCB_CLKSRC) += timer-atmel-tcb.o
 obj-$(CONFIG_X86_PM_TIMER)     += acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)   += scx200_hrt.o
 obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)   += timer-cs5535.o
@@ -20,6 +20,7 @@ obj-$(CONFIG_OMAP_DM_TIMER)   += timer-ti-dm.o
 obj-$(CONFIG_DW_APB_TIMER)     += dw_apb_timer.o
 obj-$(CONFIG_DW_APB_TIMER_OF)  += dw_apb_timer_of.o
 obj-$(CONFIG_FTTMR010_TIMER)   += timer-fttmr010.o
+obj-$(CONFIG_IXP4XX_TIMER)     += timer-ixp4xx.o
 obj-$(CONFIG_ROCKCHIP_TIMER)      += timer-rockchip.o
 obj-$(CONFIG_CLKSRC_NOMADIK_MTU)       += nomadik-mtu.o
 obj-$(CONFIG_CLKSRC_DBX500_PRCMU)      += clksrc-dbx500-prcmu.o
index 62c4bbc..93c3ac6 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * System timer for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
similarity index 80%
rename from drivers/clocksource/tcb_clksrc.c
rename to drivers/clocksource/timer-atmel-tcb.c
index f987027..6ed31f9 100644 (file)
@@ -9,9 +9,11 @@
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
-#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/sched_clock.h>
 #include <linux/syscore_ops.h>
-#include <linux/atmel_tc.h>
+#include <soc/at91/atmel_tcb.h>
 
 
 /*
  *     source, used in either periodic or oneshot mode.  This runs
  *     at 32 KiHZ, and can handle delays of up to two seconds.
  *
- * A boot clocksource and clockevent source are also currently needed,
- * unless the relevant platforms (ARM/AT91, AVR32/AT32) are changed so
- * this code can be used when init_timers() is called, well before most
- * devices are set up.  (Some low end AT91 parts, which can run uClinux,
- * have only the timers in one TC block... they currently don't support
- * the tclib code, because of that initialization issue.)
- *
  * REVISIT behavior during system suspend states... we should disable
  * all clocks and save the power.  Easily done for clockevent devices,
  * but clocksources won't necessarily get the needed notifications.
@@ -112,7 +107,6 @@ static void tc_clksrc_resume(struct clocksource *cs)
 }
 
 static struct clocksource clksrc = {
-       .name           = "tcb_clksrc",
        .rating         = 200,
        .read           = tc_get_cycles,
        .mask           = CLOCKSOURCE_MASK(32),
@@ -121,6 +115,16 @@ static struct clocksource clksrc = {
        .resume         = tc_clksrc_resume,
 };
 
+static u64 notrace tc_sched_clock_read(void)
+{
+       return tc_get_cycles(&clksrc);
+}
+
+static u64 notrace tc_sched_clock_read32(void)
+{
+       return tc_get_cycles32(&clksrc);
+}
+
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
 
 struct tc_clkevt_device {
@@ -214,7 +218,6 @@ static int tc_next_event(unsigned long delta, struct clock_event_device *d)
 
 static struct tc_clkevt_device clkevt = {
        .clkevt = {
-               .name                   = "tc_clkevt",
                .features               = CLOCK_EVT_FEAT_PERIODIC |
                                          CLOCK_EVT_FEAT_ONESHOT,
                /* Should be lower than at91rm9200's system timer */
@@ -330,39 +333,74 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id
        writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
 }
 
-static int __init tcb_clksrc_init(void)
-{
-       static char bootinfo[] __initdata
-               = KERN_DEBUG "%s: tc%d at %d.%03d MHz\n";
+static const u8 atmel_tcb_divisors[5] = { 2, 8, 32, 128, 0, };
+
+static const struct of_device_id atmel_tcb_of_match[] = {
+       { .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, },
+       { .compatible = "atmel,at91sam9x5-tcb", .data = (void *)32, },
+       { /* sentinel */ }
+};
 
-       struct platform_device *pdev;
-       struct atmel_tc *tc;
+static int __init tcb_clksrc_init(struct device_node *node)
+{
+       struct atmel_tc tc;
        struct clk *t0_clk;
+       const struct of_device_id *match;
+       u64 (*tc_sched_clock)(void);
        u32 rate, divided_rate = 0;
        int best_divisor_idx = -1;
        int clk32k_divisor_idx = -1;
+       int bits;
        int i;
        int ret;
 
-       tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK);
-       if (!tc) {
-               pr_debug("can't alloc TC for clocksource\n");
-               return -ENODEV;
+       /* Protect against multiple calls */
+       if (tcaddr)
+               return 0;
+
+       tc.regs = of_iomap(node->parent, 0);
+       if (!tc.regs)
+               return -ENXIO;
+
+       t0_clk = of_clk_get_by_name(node->parent, "t0_clk");
+       if (IS_ERR(t0_clk))
+               return PTR_ERR(t0_clk);
+
+       tc.slow_clk = of_clk_get_by_name(node->parent, "slow_clk");
+       if (IS_ERR(tc.slow_clk))
+               return PTR_ERR(tc.slow_clk);
+
+       tc.clk[0] = t0_clk;
+       tc.clk[1] = of_clk_get_by_name(node->parent, "t1_clk");
+       if (IS_ERR(tc.clk[1]))
+               tc.clk[1] = t0_clk;
+       tc.clk[2] = of_clk_get_by_name(node->parent, "t2_clk");
+       if (IS_ERR(tc.clk[2]))
+               tc.clk[2] = t0_clk;
+
+       tc.irq[2] = of_irq_get(node->parent, 2);
+       if (tc.irq[2] <= 0) {
+               tc.irq[2] = of_irq_get(node->parent, 0);
+               if (tc.irq[2] <= 0)
+                       return -EINVAL;
        }
-       tcaddr = tc->regs;
-       pdev = tc->pdev;
 
-       t0_clk = tc->clk[0];
+       match = of_match_node(atmel_tcb_of_match, node->parent);
+       bits = (uintptr_t)match->data;
+
+       for (i = 0; i < ARRAY_SIZE(tc.irq); i++)
+               writel(ATMEL_TC_ALL_IRQ, tc.regs + ATMEL_TC_REG(i, IDR));
+
        ret = clk_prepare_enable(t0_clk);
        if (ret) {
                pr_debug("can't enable T0 clk\n");
-               goto err_free_tc;
+               return ret;
        }
 
        /* How fast will we be counting?  Pick something over 5 MHz.  */
        rate = (u32) clk_get_rate(t0_clk);
-       for (i = 0; i < 5; i++) {
-               unsigned divisor = atmel_tc_divisors[i];
+       for (i = 0; i < ARRAY_SIZE(atmel_tcb_divisors); i++) {
+               unsigned divisor = atmel_tcb_divisors[i];
                unsigned tmp;
 
                /* remember 32 KiHz clock for later */
@@ -381,27 +419,31 @@ static int __init tcb_clksrc_init(void)
                best_divisor_idx = i;
        }
 
-
-       printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK,
-                       divided_rate / 1000000,
+       clksrc.name = kbasename(node->parent->full_name);
+       clkevt.clkevt.name = kbasename(node->parent->full_name);
+       pr_debug("%s at %d.%03d MHz\n", clksrc.name, divided_rate / 1000000,
                        ((divided_rate % 1000000) + 500) / 1000);
 
-       if (tc->tcb_config && tc->tcb_config->counter_width == 32) {
+       tcaddr = tc.regs;
+
+       if (bits == 32) {
                /* use apropriate function to read 32 bit counter */
                clksrc.read = tc_get_cycles32;
                /* setup ony channel 0 */
-               tcb_setup_single_chan(tc, best_divisor_idx);
+               tcb_setup_single_chan(&tc, best_divisor_idx);
+               tc_sched_clock = tc_sched_clock_read32;
        } else {
-               /* tclib will give us three clocks no matter what the
+               /* we have three clocks no matter what the
                 * underlying platform supports.
                 */
-               ret = clk_prepare_enable(tc->clk[1]);
+               ret = clk_prepare_enable(tc.clk[1]);
                if (ret) {
                        pr_debug("can't enable T1 clk\n");
                        goto err_disable_t0;
                }
                /* setup both channel 0 & 1 */
-               tcb_setup_dual_chan(tc, best_divisor_idx);
+               tcb_setup_dual_chan(&tc, best_divisor_idx);
+               tc_sched_clock = tc_sched_clock_read;
        }
 
        /* and away we go! */
@@ -410,24 +452,26 @@ static int __init tcb_clksrc_init(void)
                goto err_disable_t1;
 
        /* channel 2:  periodic and oneshot timer support */
-       ret = setup_clkevents(tc, clk32k_divisor_idx);
+       ret = setup_clkevents(&tc, clk32k_divisor_idx);
        if (ret)
                goto err_unregister_clksrc;
 
+       sched_clock_register(tc_sched_clock, 32, divided_rate);
+
        return 0;
 
 err_unregister_clksrc:
        clocksource_unregister(&clksrc);
 
 err_disable_t1:
-       if (!tc->tcb_config || tc->tcb_config->counter_width != 32)
-               clk_disable_unprepare(tc->clk[1]);
+       if (bits != 32)
+               clk_disable_unprepare(tc.clk[1]);
 
 err_disable_t0:
        clk_disable_unprepare(t0_clk);
 
-err_free_tc:
-       atmel_tc_free(tc);
+       tcaddr = NULL;
+
        return ret;
 }
-arch_initcall(tcb_clksrc_init);
+TIMER_OF_DECLARE(atmel_tcb_clksrc, "atmel,tcb-timer", tcb_clksrc_init);
diff --git a/drivers/clocksource/timer-ixp4xx.c b/drivers/clocksource/timer-ixp4xx.c
new file mode 100644 (file)
index 0000000..5c2190b
--- /dev/null
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * IXP4 timer driver
+ * Copyright (C) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Based on arch/arm/mach-ixp4xx/common.c
+ * Copyright 2002 (C) Intel Corporation
+ * Copyright 2003-2004 (C) MontaVista, Software, Inc.
+ * Copyright (C) Deepak Saxena <dsaxena@plexity.net>
+ */
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/clockchips.h>
+#include <linux/clocksource.h>
+#include <linux/sched_clock.h>
+#include <linux/slab.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+/* Goes away with OF conversion */
+#include <linux/platform_data/timer-ixp4xx.h>
+
+/*
+ * Constants to make it easy to access Timer Control/Status registers
+ */
+#define IXP4XX_OSTS_OFFSET     0x00  /* Continuous Timestamp */
+#define IXP4XX_OST1_OFFSET     0x04  /* Timer 1 Timestamp */
+#define IXP4XX_OSRT1_OFFSET    0x08  /* Timer 1 Reload */
+#define IXP4XX_OST2_OFFSET     0x0C  /* Timer 2 Timestamp */
+#define IXP4XX_OSRT2_OFFSET    0x10  /* Timer 2 Reload */
+#define IXP4XX_OSWT_OFFSET     0x14  /* Watchdog Timer */
+#define IXP4XX_OSWE_OFFSET     0x18  /* Watchdog Enable */
+#define IXP4XX_OSWK_OFFSET     0x1C  /* Watchdog Key */
+#define IXP4XX_OSST_OFFSET     0x20  /* Timer Status */
+
+/*
+ * Timer register values and bit definitions
+ */
+#define IXP4XX_OST_ENABLE              0x00000001
+#define IXP4XX_OST_ONE_SHOT            0x00000002
+/* Low order bits of reload value ignored */
+#define IXP4XX_OST_RELOAD_MASK         0x00000003
+#define IXP4XX_OST_DISABLED            0x00000000
+#define IXP4XX_OSST_TIMER_1_PEND       0x00000001
+#define IXP4XX_OSST_TIMER_2_PEND       0x00000002
+#define IXP4XX_OSST_TIMER_TS_PEND      0x00000004
+#define IXP4XX_OSST_TIMER_WDOG_PEND    0x00000008
+#define IXP4XX_OSST_TIMER_WARM_RESET   0x00000010
+
+#define        IXP4XX_WDT_KEY                  0x0000482E
+#define        IXP4XX_WDT_RESET_ENABLE         0x00000001
+#define        IXP4XX_WDT_IRQ_ENABLE           0x00000002
+#define        IXP4XX_WDT_COUNT_ENABLE         0x00000004
+
+struct ixp4xx_timer {
+       void __iomem *base;
+       unsigned int tick_rate;
+       u32 latch;
+       struct clock_event_device clkevt;
+#ifdef CONFIG_ARM
+       struct delay_timer delay_timer;
+#endif
+};
+
+/*
+ * A local singleton used by sched_clock and delay timer reads, which are
+ * fast and stateless
+ */
+static struct ixp4xx_timer *local_ixp4xx_timer;
+
+static inline struct ixp4xx_timer *
+to_ixp4xx_timer(struct clock_event_device *evt)
+{
+       return container_of(evt, struct ixp4xx_timer, clkevt);
+}
+
+static u64 notrace ixp4xx_read_sched_clock(void)
+{
+       return __raw_readl(local_ixp4xx_timer->base + IXP4XX_OSTS_OFFSET);
+}
+
+static u64 ixp4xx_clocksource_read(struct clocksource *c)
+{
+       return __raw_readl(local_ixp4xx_timer->base + IXP4XX_OSTS_OFFSET);
+}
+
+static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
+{
+       struct ixp4xx_timer *tmr = dev_id;
+       struct clock_event_device *evt = &tmr->clkevt;
+
+       /* Clear Pending Interrupt */
+       __raw_writel(IXP4XX_OSST_TIMER_1_PEND,
+                    tmr->base + IXP4XX_OSST_OFFSET);
+
+       evt->event_handler(evt);
+
+       return IRQ_HANDLED;
+}
+
+static int ixp4xx_set_next_event(unsigned long cycles,
+                                struct clock_event_device *evt)
+{
+       struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt);
+       u32 val;
+
+       val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET);
+       /* Keep enable/oneshot bits */
+       val &= IXP4XX_OST_RELOAD_MASK;
+       __raw_writel((cycles & ~IXP4XX_OST_RELOAD_MASK) | val,
+                    tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       return 0;
+}
+
+static int ixp4xx_shutdown(struct clock_event_device *evt)
+{
+       struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt);
+       u32 val;
+
+       val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET);
+       val &= ~IXP4XX_OST_ENABLE;
+       __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       return 0;
+}
+
+static int ixp4xx_set_oneshot(struct clock_event_device *evt)
+{
+       struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt);
+
+       __raw_writel(IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT,
+                    tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       return 0;
+}
+
+static int ixp4xx_set_periodic(struct clock_event_device *evt)
+{
+       struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt);
+       u32 val;
+
+       val = tmr->latch & ~IXP4XX_OST_RELOAD_MASK;
+       val |= IXP4XX_OST_ENABLE;
+       __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       return 0;
+}
+
+static int ixp4xx_resume(struct clock_event_device *evt)
+{
+       struct ixp4xx_timer *tmr = to_ixp4xx_timer(evt);
+       u32 val;
+
+       val = __raw_readl(tmr->base + IXP4XX_OSRT1_OFFSET);
+       val |= IXP4XX_OST_ENABLE;
+       __raw_writel(val, tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       return 0;
+}
+
+/*
+ * IXP4xx timer tick
+ * We use OS timer1 on the CPU for the timer tick and the timestamp
+ * counter as a source of real clock ticks to account for missed jiffies.
+ */
+static __init int ixp4xx_timer_register(void __iomem *base,
+                                       int timer_irq,
+                                       unsigned int timer_freq)
+{
+       struct ixp4xx_timer *tmr;
+       int ret;
+
+       tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
+       if (!tmr)
+               return -ENOMEM;
+       tmr->base = base;
+       tmr->tick_rate = timer_freq;
+
+       /*
+        * The timer register doesn't allow to specify the two least
+        * significant bits of the timeout value and assumes them being zero.
+        * So make sure the latch is the best value with the two least
+        * significant bits unset.
+        */
+       tmr->latch = DIV_ROUND_CLOSEST(timer_freq,
+                                      (IXP4XX_OST_RELOAD_MASK + 1) * HZ)
+               * (IXP4XX_OST_RELOAD_MASK + 1);
+
+       local_ixp4xx_timer = tmr;
+
+       /* Reset/disable counter */
+       __raw_writel(0, tmr->base + IXP4XX_OSRT1_OFFSET);
+
+       /* Clear any pending interrupt on timer 1 */
+       __raw_writel(IXP4XX_OSST_TIMER_1_PEND,
+                    tmr->base + IXP4XX_OSST_OFFSET);
+
+       /* Reset time-stamp counter */
+       __raw_writel(0, tmr->base + IXP4XX_OSTS_OFFSET);
+
+       clocksource_mmio_init(NULL, "OSTS", timer_freq, 200, 32,
+                             ixp4xx_clocksource_read);
+
+       tmr->clkevt.name = "ixp4xx timer1";
+       tmr->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
+       tmr->clkevt.rating = 200;
+       tmr->clkevt.set_state_shutdown = ixp4xx_shutdown;
+       tmr->clkevt.set_state_periodic = ixp4xx_set_periodic;
+       tmr->clkevt.set_state_oneshot = ixp4xx_set_oneshot;
+       tmr->clkevt.tick_resume = ixp4xx_resume;
+       tmr->clkevt.set_next_event = ixp4xx_set_next_event;
+       tmr->clkevt.cpumask = cpumask_of(0);
+       tmr->clkevt.irq = timer_irq;
+       ret = request_irq(timer_irq, ixp4xx_timer_interrupt,
+                         IRQF_TIMER, "IXP4XX-TIMER1", tmr);
+       if (ret) {
+               pr_crit("no timer IRQ\n");
+               return -ENODEV;
+       }
+       clockevents_config_and_register(&tmr->clkevt, timer_freq,
+                                       0xf, 0xfffffffe);
+
+       sched_clock_register(ixp4xx_read_sched_clock, 32, timer_freq);
+
+       return 0;
+}
+
+/**
+ * ixp4xx_timer_setup() - Timer setup function to be called from boardfiles
+ * @timerbase: physical base of timer block
+ * @timer_irq: Linux IRQ number for the timer
+ * @timer_freq: Fixed frequency of the timer
+ */
+void __init ixp4xx_timer_setup(resource_size_t timerbase,
+                              int timer_irq,
+                              unsigned int timer_freq)
+{
+       void __iomem *base;
+
+       base = ioremap(timerbase, 0x100);
+       if (!base) {
+               pr_crit("IXP4xx: can't remap timer\n");
+               return;
+       }
+       ixp4xx_timer_register(base, timer_irq, timer_freq);
+}
+EXPORT_SYMBOL_GPL(ixp4xx_timer_setup);
+
+#ifdef CONFIG_OF
+static __init int ixp4xx_of_timer_init(struct device_node *np)
+{
+       void __iomem *base;
+       int irq;
+       int ret;
+
+       base = of_iomap(np, 0);
+       if (!base) {
+               pr_crit("IXP4xx: can't remap timer\n");
+               return -ENODEV;
+       }
+
+       irq = irq_of_parse_and_map(np, 0);
+       if (irq <= 0) {
+               pr_err("Can't parse IRQ\n");
+               ret = -EINVAL;
+               goto out_unmap;
+       }
+
+       /* TODO: get some fixed clocks into the device tree */
+       ret = ixp4xx_timer_register(base, irq, 66666000);
+       if (ret)
+               goto out_unmap;
+       return 0;
+
+out_unmap:
+       iounmap(base);
+       return ret;
+}
+TIMER_OF_DECLARE(ixp4xx, "intel,ixp4xx-timer", ixp4xx_of_timer_init);
+#endif
index f2019a8..fa9fb4e 100644 (file)
@@ -26,8 +26,8 @@
 #define MLB_TMR_TMCSR_CSL_DIV2 0
 #define MLB_TMR_DIV_CNT                2
 
-#define MLB_TMR_SRC_CH  (1)
-#define MLB_TMR_EVT_CH  (0)
+#define MLB_TMR_SRC_CH         1
+#define MLB_TMR_EVT_CH         0
 
 #define MLB_TMR_SRC_CH_OFS     (MLB_TMR_REGSZPCH * MLB_TMR_SRC_CH)
 #define MLB_TMR_EVT_CH_OFS     (MLB_TMR_REGSZPCH * MLB_TMR_EVT_CH)
@@ -43,6 +43,8 @@
 #define MLB_TMR_EVT_TMRLR2_OFS (MLB_TMR_EVT_CH_OFS + MLB_TMR_TMRLR2_OFS)
 
 #define MLB_TIMER_RATING       500
+#define MLB_TIMER_ONESHOT      0
+#define MLB_TIMER_PERIODIC     1
 
 static irqreturn_t mlb_timer_interrupt(int irq, void *dev_id)
 {
@@ -59,27 +61,53 @@ static irqreturn_t mlb_timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int mlb_set_state_periodic(struct clock_event_device *clk)
+static void mlb_evt_timer_start(struct timer_of *to, bool periodic)
 {
-       struct timer_of *to = to_timer_of(clk);
        u32 val = MLB_TMR_TMCSR_CSL_DIV2;
 
+       val |= MLB_TMR_TMCSR_CNTE | MLB_TMR_TMCSR_TRG | MLB_TMR_TMCSR_INTE;
+       if (periodic)
+               val |= MLB_TMR_TMCSR_RELD;
        writel_relaxed(val, timer_of_base(to) + MLB_TMR_EVT_TMCSR_OFS);
+}
 
-       writel_relaxed(to->of_clk.period, timer_of_base(to) +
-                               MLB_TMR_EVT_TMRLR1_OFS);
-       val |= MLB_TMR_TMCSR_RELD | MLB_TMR_TMCSR_CNTE |
-               MLB_TMR_TMCSR_TRG | MLB_TMR_TMCSR_INTE;
+static void mlb_evt_timer_stop(struct timer_of *to)
+{
+       u32 val = readl_relaxed(timer_of_base(to) + MLB_TMR_EVT_TMCSR_OFS);
+
+       val &= ~MLB_TMR_TMCSR_CNTE;
        writel_relaxed(val, timer_of_base(to) + MLB_TMR_EVT_TMCSR_OFS);
+}
+
+static void mlb_evt_timer_register_count(struct timer_of *to, unsigned long cnt)
+{
+       writel_relaxed(cnt, timer_of_base(to) + MLB_TMR_EVT_TMRLR1_OFS);
+}
+
+static int mlb_set_state_periodic(struct clock_event_device *clk)
+{
+       struct timer_of *to = to_timer_of(clk);
+
+       mlb_evt_timer_stop(to);
+       mlb_evt_timer_register_count(to, to->of_clk.period);
+       mlb_evt_timer_start(to, MLB_TIMER_PERIODIC);
        return 0;
 }
 
 static int mlb_set_state_oneshot(struct clock_event_device *clk)
 {
        struct timer_of *to = to_timer_of(clk);
-       u32 val = MLB_TMR_TMCSR_CSL_DIV2;
 
-       writel_relaxed(val, timer_of_base(to) + MLB_TMR_EVT_TMCSR_OFS);
+       mlb_evt_timer_stop(to);
+       mlb_evt_timer_start(to, MLB_TIMER_ONESHOT);
+       return 0;
+}
+
+static int mlb_set_state_shutdown(struct clock_event_device *clk)
+{
+       struct timer_of *to = to_timer_of(clk);
+
+       mlb_evt_timer_stop(to);
        return 0;
 }
 
@@ -88,22 +116,21 @@ static int mlb_clkevt_next_event(unsigned long event,
 {
        struct timer_of *to = to_timer_of(clk);
 
-       writel_relaxed(event, timer_of_base(to) + MLB_TMR_EVT_TMRLR1_OFS);
-       writel_relaxed(MLB_TMR_TMCSR_CSL_DIV2 |
-                       MLB_TMR_TMCSR_CNTE | MLB_TMR_TMCSR_INTE |
-                       MLB_TMR_TMCSR_TRG, timer_of_base(to) +
-                       MLB_TMR_EVT_TMCSR_OFS);
+       mlb_evt_timer_stop(to);
+       mlb_evt_timer_register_count(to, event);
+       mlb_evt_timer_start(to, MLB_TIMER_ONESHOT);
        return 0;
 }
 
 static int mlb_config_clock_source(struct timer_of *to)
 {
-       writel_relaxed(0, timer_of_base(to) + MLB_TMR_SRC_TMCSR_OFS);
-       writel_relaxed(~0, timer_of_base(to) + MLB_TMR_SRC_TMR_OFS);
+       u32 val = MLB_TMR_TMCSR_CSL_DIV2;
+
+       writel_relaxed(val, timer_of_base(to) + MLB_TMR_SRC_TMCSR_OFS);
        writel_relaxed(~0, timer_of_base(to) + MLB_TMR_SRC_TMRLR1_OFS);
        writel_relaxed(~0, timer_of_base(to) + MLB_TMR_SRC_TMRLR2_OFS);
-       writel_relaxed(BIT(4) | BIT(1) | BIT(0), timer_of_base(to) +
-               MLB_TMR_SRC_TMCSR_OFS);
+       val |= MLB_TMR_TMCSR_RELD | MLB_TMR_TMCSR_CNTE | MLB_TMR_TMCSR_TRG;
+       writel_relaxed(val, timer_of_base(to) + MLB_TMR_SRC_TMCSR_OFS);
        return 0;
 }
 
@@ -123,6 +150,7 @@ static struct timer_of to = {
                .features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT,
                .set_state_oneshot = mlb_set_state_oneshot,
                .set_state_periodic = mlb_set_state_periodic,
+               .set_state_shutdown = mlb_set_state_shutdown,
                .set_next_event = mlb_clkevt_next_event,
        },
 
index 20ff33b..d4a9dcf 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * System timer for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/kernel.h>
index 6e0180a..65f38f6 100644 (file)
@@ -186,7 +186,8 @@ static int __init sun4i_timer_init(struct device_node *node)
         */
        if (of_machine_is_compatible("allwinner,sun4i-a10") ||
            of_machine_is_compatible("allwinner,sun5i-a13") ||
-           of_machine_is_compatible("allwinner,sun5i-a10s"))
+           of_machine_is_compatible("allwinner,sun5i-a10s") ||
+           of_machine_is_compatible("allwinner,suniv-f1c100s"))
                sched_clock_register(sun4i_timer_sched_read, 32,
                                     timer_of_rate(&to));
 
@@ -218,3 +219,5 @@ static int __init sun4i_timer_init(struct device_node *node)
 }
 TIMER_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer",
                       sun4i_timer_init);
+TIMER_OF_DECLARE(suniv, "allwinner,suniv-f1c100s-timer",
+                      sun4i_timer_init);
index fdb3d79..919b356 100644 (file)
@@ -60,9 +60,6 @@
 static u32 usec_config;
 static void __iomem *timer_reg_base;
 #ifdef CONFIG_ARM
-static void __iomem *rtc_base;
-static struct timespec64 persistent_ts;
-static u64 persistent_ms, last_persistent_ms;
 static struct delay_timer tegra_delay_timer;
 #endif
 
@@ -199,40 +196,30 @@ static unsigned long tegra_delay_timer_read_counter_long(void)
        return readl(timer_reg_base + TIMERUS_CNTR_1US);
 }
 
+static struct timer_of suspend_rtc_to = {
+       .flags = TIMER_OF_BASE | TIMER_OF_CLOCK,
+};
+
 /*
  * tegra_rtc_read - Reads the Tegra RTC registers
  * Care must be taken that this funciton is not called while the
  * tegra_rtc driver could be executing to avoid race conditions
  * on the RTC shadow register
  */
-static u64 tegra_rtc_read_ms(void)
+static u64 tegra_rtc_read_ms(struct clocksource *cs)
 {
-       u32 ms = readl(rtc_base + RTC_MILLISECONDS);
-       u32 s = readl(rtc_base + RTC_SHADOW_SECONDS);
+       u32 ms = readl(timer_of_base(&suspend_rtc_to) + RTC_MILLISECONDS);
+       u32 s = readl(timer_of_base(&suspend_rtc_to) + RTC_SHADOW_SECONDS);
        return (u64)s * MSEC_PER_SEC + ms;
 }
 
-/*
- * tegra_read_persistent_clock64 -  Return time from a persistent clock.
- *
- * Reads the time from a source which isn't disabled during PM, the
- * 32k sync timer.  Convert the cycles elapsed since last read into
- * nsecs and adds to a monotonically increasing timespec64.
- * Care must be taken that this funciton is not called while the
- * tegra_rtc driver could be executing to avoid race conditions
- * on the RTC shadow register
- */
-static void tegra_read_persistent_clock64(struct timespec64 *ts)
-{
-       u64 delta;
-
-       last_persistent_ms = persistent_ms;
-       persistent_ms = tegra_rtc_read_ms();
-       delta = persistent_ms - last_persistent_ms;
-
-       timespec64_add_ns(&persistent_ts, delta * NSEC_PER_MSEC);
-       *ts = persistent_ts;
-}
+static struct clocksource suspend_rtc_clocksource = {
+       .name   = "tegra_suspend_timer",
+       .rating = 200,
+       .read   = tegra_rtc_read_ms,
+       .mask   = CLOCKSOURCE_MASK(32),
+       .flags  = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP,
+};
 #endif
 
 static int tegra_timer_common_init(struct device_node *np, struct timer_of *to)
@@ -385,25 +372,15 @@ out:
 
 static int __init tegra20_init_rtc(struct device_node *np)
 {
-       struct clk *clk;
+       int ret;
 
-       rtc_base = of_iomap(np, 0);
-       if (!rtc_base) {
-               pr_err("Can't map RTC registers\n");
-               return -ENXIO;
-       }
+       ret = timer_of_init(np, &suspend_rtc_to);
+       if (ret)
+               return ret;
 
-       /*
-        * rtc registers are used by read_persistent_clock, keep the rtc clock
-        * enabled
-        */
-       clk = of_clk_get(np, 0);
-       if (IS_ERR(clk))
-               pr_warn("Unable to get rtc-tegra clock\n");
-       else
-               clk_prepare_enable(clk);
+       clocksource_register_hz(&suspend_rtc_clocksource, 1000);
 
-       return register_persistent_clock(tegra_read_persistent_clock64);
+       return 0;
 }
 TIMER_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
 #endif
index 3de5f3a..ba1f3f4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig CONNECTOR
        tristate "Connector - unified userspace <-> kernelspace linker"
index 1f255e4..1bf67d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CONNECTOR)                += cn.o
 obj-$(CONFIG_PROC_EVENTS)      += cn_proc.o
 
index 233ac30..138ecd8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Counter devices
 #
index 0c9e622..40d3552 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Counter devices
 #
index 4d2b33a..bff5295 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "CPU Frequency scaling"
 
 config CPU_FREQ
index 179a1d3..f8129ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ARM CPU Frequency scaling drivers
 #
index 3a0595b..35b4f70 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CPU_FREQ_CBE
        tristate "CBE frequency scaling"
        depends on CBE_RAS && PPC_CELL
index 35f7182..dfa6457 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # x86 CPU Frequency scaling drivers
 #
index db779b6..85ff958 100644 (file)
@@ -340,11 +340,14 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
                                      struct cpufreq_freqs *freqs,
                                      unsigned int state)
 {
+       int cpu;
+
        BUG_ON(irqs_disabled());
 
        if (cpufreq_disabled())
                return;
 
+       freqs->policy = policy;
        freqs->flags = cpufreq_driver->flags;
        pr_debug("notification %u of frequency transition to %u kHz\n",
                 state, freqs->new);
@@ -364,10 +367,8 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
                        }
                }
 
-               for_each_cpu(freqs->cpu, policy->cpus) {
-                       srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
-                                                CPUFREQ_PRECHANGE, freqs);
-               }
+               srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
+                                        CPUFREQ_PRECHANGE, freqs);
 
                adjust_jiffies(CPUFREQ_PRECHANGE, freqs);
                break;
@@ -377,11 +378,11 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy,
                pr_debug("FREQ: %u - CPUs: %*pbl\n", freqs->new,
                         cpumask_pr_args(policy->cpus));
 
-               for_each_cpu(freqs->cpu, policy->cpus) {
-                       trace_cpu_frequency(freqs->new, freqs->cpu);
-                       srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
-                                                CPUFREQ_POSTCHANGE, freqs);
-               }
+               for_each_cpu(cpu, policy->cpus)
+                       trace_cpu_frequency(freqs->new, cpu);
+
+               srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
+                                        CPUFREQ_POSTCHANGE, freqs);
 
                cpufreq_stats_record_transition(policy, freqs->new);
                policy->cur = freqs->new;
@@ -618,50 +619,52 @@ static struct cpufreq_governor *find_governor(const char *str_governor)
        return NULL;
 }
 
+static int cpufreq_parse_policy(char *str_governor,
+                               struct cpufreq_policy *policy)
+{
+       if (!strncasecmp(str_governor, "performance", CPUFREQ_NAME_LEN)) {
+               policy->policy = CPUFREQ_POLICY_PERFORMANCE;
+               return 0;
+       }
+       if (!strncasecmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) {
+               policy->policy = CPUFREQ_POLICY_POWERSAVE;
+               return 0;
+       }
+       return -EINVAL;
+}
+
 /**
- * cpufreq_parse_governor - parse a governor string
+ * cpufreq_parse_governor - parse a governor string only for !setpolicy
  */
 static int cpufreq_parse_governor(char *str_governor,
                                  struct cpufreq_policy *policy)
 {
-       if (cpufreq_driver->setpolicy) {
-               if (!strncasecmp(str_governor, "performance", CPUFREQ_NAME_LEN)) {
-                       policy->policy = CPUFREQ_POLICY_PERFORMANCE;
-                       return 0;
-               }
+       struct cpufreq_governor *t;
 
-               if (!strncasecmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) {
-                       policy->policy = CPUFREQ_POLICY_POWERSAVE;
-                       return 0;
-               }
-       } else {
-               struct cpufreq_governor *t;
+       mutex_lock(&cpufreq_governor_mutex);
 
-               mutex_lock(&cpufreq_governor_mutex);
+       t = find_governor(str_governor);
+       if (!t) {
+               int ret;
 
-               t = find_governor(str_governor);
-               if (!t) {
-                       int ret;
-
-                       mutex_unlock(&cpufreq_governor_mutex);
+               mutex_unlock(&cpufreq_governor_mutex);
 
-                       ret = request_module("cpufreq_%s", str_governor);
-                       if (ret)
-                               return -EINVAL;
+               ret = request_module("cpufreq_%s", str_governor);
+               if (ret)
+                       return -EINVAL;
 
-                       mutex_lock(&cpufreq_governor_mutex);
+               mutex_lock(&cpufreq_governor_mutex);
 
-                       t = find_governor(str_governor);
-               }
-               if (t && !try_module_get(t->owner))
-                       t = NULL;
+               t = find_governor(str_governor);
+       }
+       if (t && !try_module_get(t->owner))
+               t = NULL;
 
-               mutex_unlock(&cpufreq_governor_mutex);
+       mutex_unlock(&cpufreq_governor_mutex);
 
-               if (t) {
-                       policy->governor = t;
-                       return 0;
-               }
+       if (t) {
+               policy->governor = t;
+               return 0;
        }
 
        return -EINVAL;
@@ -783,8 +786,13 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
        if (ret != 1)
                return -EINVAL;
 
-       if (cpufreq_parse_governor(str_governor, &new_policy))
-               return -EINVAL;
+       if (cpufreq_driver->setpolicy) {
+               if (cpufreq_parse_policy(str_governor, &new_policy))
+                       return -EINVAL;
+       } else {
+               if (cpufreq_parse_governor(str_governor, &new_policy))
+                       return -EINVAL;
+       }
 
        ret = cpufreq_set_policy(policy, &new_policy);
 
@@ -1050,32 +1058,39 @@ __weak struct cpufreq_governor *cpufreq_default_governor(void)
 
 static int cpufreq_init_policy(struct cpufreq_policy *policy)
 {
-       struct cpufreq_governor *gov = NULL;
+       struct cpufreq_governor *gov = NULL, *def_gov = NULL;
        struct cpufreq_policy new_policy;
 
        memcpy(&new_policy, policy, sizeof(*policy));
 
-       /* Update governor of new_policy to the governor used before hotplug */
-       gov = find_governor(policy->last_governor);
-       if (gov) {
-               pr_debug("Restoring governor %s for cpu %d\n",
+       def_gov = cpufreq_default_governor();
+
+       if (has_target()) {
+               /*
+                * Update governor of new_policy to the governor used before
+                * hotplug
+                */
+               gov = find_governor(policy->last_governor);
+               if (gov) {
+                       pr_debug("Restoring governor %s for cpu %d\n",
                                policy->governor->name, policy->cpu);
+               } else {
+                       if (!def_gov)
+                               return -ENODATA;
+                       gov = def_gov;
+               }
+               new_policy.governor = gov;
        } else {
-               gov = cpufreq_default_governor();
-               if (!gov)
-                       return -ENODATA;
-       }
-
-       new_policy.governor = gov;
-
-       /* Use the default policy if there is no last_policy. */
-       if (cpufreq_driver->setpolicy) {
-               if (policy->last_policy)
+               /* Use the default policy if there is no last_policy. */
+               if (policy->last_policy) {
                        new_policy.policy = policy->last_policy;
-               else
-                       cpufreq_parse_governor(gov->name, &new_policy);
+               } else {
+                       if (!def_gov)
+                               return -ENODATA;
+                       cpufreq_parse_policy(def_gov->name, &new_policy);
+               }
        }
-       /* set default policy */
+
        return cpufreq_set_policy(policy, &new_policy);
 }
 
@@ -1133,6 +1148,11 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
                                   cpufreq_global_kobject, "policy%u", cpu);
        if (ret) {
                pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret);
+               /*
+                * The entire policy object will be freed below, but the extra
+                * memory allocated for the kobject name needs to be freed by
+                * releasing the kobject.
+                */
                kobject_put(&policy->kobj);
                goto err_free_real_cpus;
        }
index 80c5bf5..2efe718 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file provides the ACPI based P-state support. This
  * module works with generic cpufreq infrastructure. Most of
index be89416..21c9ce8 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/cpu.h>
 #include <linux/cpufreq.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
index bbd1d1e..92acbb2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* us2e_cpufreq.c: UltraSPARC-IIe cpu frequency support
  *
  * Copyright (C) 2003 David S. Miller (davem@redhat.com)
index 51e3c60..e41b35b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* us3_cpufreq.c: UltraSPARC-III cpu frequency support
  *
  * Copyright (C) 2003 David S. Miller (davem@redhat.com)
index e086b2d..b49f494 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * cpufreq driver for Enhanced SpeedStep, as found in Intel's Pentium
  * M (part of the Centrino chipset).
index 8caccbb..a4ac31e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "CPU Idle"
 
 config CPU_IDLE
index f521448..48cb3d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ARM CPU Idle drivers
 #
index 512ee37..c3c011a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MIPS CPU Idle Drivers
 #
index 66c3a09..a797a02 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # POWERPC CPU Idle Drivers
 #
index 4d8aff5..42f44cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for cpuidle governors.
 #
index 177b771..0af0808 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig CRYPTO_HW
        bool "Hardware crypto devices"
index e33c185..d662399 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o
 crypto4xx-y :=  crypto4xx_core.o crypto4xx_alg.o
 crypto4xx-$(CONFIG_HW_RANDOM_PPC4XX) += crypto4xx_trng.o
index be9a84a..146e09e 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) := artpec6_crypto.o
index d2fb728..80fa04e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *   Driver for ARTPEC-6 crypto block using the kernel asynchronous crypto api.
  *
index 7469e19..8a2110b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # File: drivers/crypto/bcm/Makefile
 #
 # Makefile for crypto acceleration files for Broadcom SPU driver
index 3e23d4b..c0ece44 100644 (file)
@@ -89,6 +89,7 @@ struct caam_alg_entry {
        int class2_alg_type;
        bool rfc3686;
        bool geniv;
+       bool nodkp;
 };
 
 struct caam_aead_alg {
@@ -2052,6 +2053,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        {
@@ -2070,6 +2072,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        /* Galois Counter Mode */
@@ -2089,6 +2092,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        /* single-pass ipsec_esp descriptor */
@@ -3334,6 +3338,7 @@ static struct caam_aead_alg driver_aeads[] = {
                                           OP_ALG_AAI_AEAD,
                        .class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
                                           OP_ALG_AAI_AEAD,
+                       .nodkp = true,
                },
        },
        {
@@ -3356,6 +3361,7 @@ static struct caam_aead_alg driver_aeads[] = {
                                           OP_ALG_AAI_AEAD,
                        .class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
                                           OP_ALG_AAI_AEAD,
+                       .nodkp = true,
                },
        },
 };
@@ -3417,8 +3423,7 @@ static int caam_aead_init(struct crypto_aead *tfm)
                 container_of(alg, struct caam_aead_alg, aead);
        struct caam_ctx *ctx = crypto_aead_ctx(tfm);
 
-       return caam_init_common(ctx, &caam_alg->caam,
-                               alg->setkey == aead_setkey);
+       return caam_init_common(ctx, &caam_alg->caam, !caam_alg->caam.nodkp);
 }
 
 static void caam_exit_common(struct caam_ctx *ctx)
index 70af211..d290d6b 100644 (file)
@@ -36,6 +36,7 @@ struct caam_alg_entry {
        int class2_alg_type;
        bool rfc3686;
        bool geniv;
+       bool nodkp;
 };
 
 struct caam_aead_alg {
@@ -1523,6 +1524,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        {
@@ -1541,6 +1543,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        /* Galois Counter Mode */
@@ -1560,6 +1563,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                }
        },
        /* single-pass ipsec_esp descriptor */
@@ -2433,8 +2437,7 @@ static int caam_aead_init(struct crypto_aead *tfm)
                                                      aead);
        struct caam_ctx *ctx = crypto_aead_ctx(tfm);
 
-       return caam_init_common(ctx, &caam_alg->caam,
-                               alg->setkey == aead_setkey);
+       return caam_init_common(ctx, &caam_alg->caam, !caam_alg->caam.nodkp);
 }
 
 static void caam_exit_common(struct caam_ctx *ctx)
index 33a4df6..2b2980a 100644 (file)
@@ -42,6 +42,7 @@ struct caam_alg_entry {
        int class2_alg_type;
        bool rfc3686;
        bool geniv;
+       bool nodkp;
 };
 
 struct caam_aead_alg {
@@ -1480,7 +1481,7 @@ static int caam_cra_init_aead(struct crypto_aead *tfm)
 
        crypto_aead_set_reqsize(tfm, sizeof(struct caam_request));
        return caam_cra_init(crypto_aead_ctx(tfm), &caam_alg->caam,
-                            alg->setkey == aead_setkey);
+                            !caam_alg->caam.nodkp);
 }
 
 static void caam_exit_common(struct caam_ctx *ctx)
@@ -1641,6 +1642,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        {
@@ -1659,6 +1661,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                },
        },
        /* Galois Counter Mode */
@@ -1678,6 +1681,7 @@ static struct caam_aead_alg driver_aeads[] = {
                },
                .caam = {
                        .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_GCM,
+                       .nodkp = true,
                }
        },
        /* single-pass ipsec_esp descriptor */
@@ -2755,6 +2759,7 @@ static struct caam_aead_alg driver_aeads[] = {
                                           OP_ALG_AAI_AEAD,
                        .class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
                                           OP_ALG_AAI_AEAD,
+                       .nodkp = true,
                },
        },
        {
@@ -2777,6 +2782,7 @@ static struct caam_aead_alg driver_aeads[] = {
                                           OP_ALG_AAI_AEAD,
                        .class2_alg_type = OP_ALG_ALGSEL_POLY1305 |
                                           OP_ALG_AAI_AEAD,
+                       .nodkp = true,
                },
        },
        {
index e2ba3d2..fec39c3 100644 (file)
@@ -469,7 +469,7 @@ static int caam_get_era(struct caam_ctrl __iomem *ctrl)
 }
 
 /*
- * ERRATA: imx6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ)
+ * ERRATA: imx6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6QP)
  * have an issue wherein AXI bus transactions may not occur in the correct
  * order. This isn't a problem running single descriptors, but can be if
  * running multiple concurrent descriptors. Reworking the driver to throttle
index a4129a3..4da844e 100644 (file)
@@ -22,7 +22,7 @@ void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type,
        size_t len;
        void *buf;
 
-       for (it = sg; it && tlen > 0 ; it = sg_next(sg)) {
+       for (it = sg; it && tlen > 0 ; it = sg_next(it)) {
                /*
                 * make sure the scatterlist's page
                 * has a valid virtual memory mapping
index 044a69b..1de2562 100644 (file)
@@ -213,7 +213,7 @@ static void caam_jr_dequeue(unsigned long devarg)
                mb();
 
                /* set done */
-               wr_reg32_relaxed(&jrp->rregs->outring_rmvd, 1);
+               wr_reg32(&jrp->rregs->outring_rmvd, 1);
 
                jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) &
                                           (JOBR_DEPTH - 1);
index c1fa1ec..8591914 100644 (file)
@@ -96,14 +96,6 @@ cpu_to_caam(16)
 cpu_to_caam(32)
 cpu_to_caam(64)
 
-static inline void wr_reg32_relaxed(void __iomem *reg, u32 data)
-{
-       if (caam_little_end)
-               writel_relaxed(data, reg);
-       else
-               writel_relaxed(cpu_to_be32(data), reg);
-}
-
 static inline void wr_reg32(void __iomem *reg, u32 data)
 {
        if (caam_little_end)
index 641268b..4679c06 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Cavium crypto device drivers
 #
index cbd51b1..b987405 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cavium crypto device configuration
 #
index dbf055e..0f04f1b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CAVIUM_CPT) += cptpf.o cptvf.o
 cptpf-objs := cptpf_main.o cptpf_mbox.o
 cptvf-objs := cptvf_main.o cptvf_reqmanager.o cptvf_mbox.o cptvf_algs.o
index 181a1df..dab162a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cavium NITROX Crypto Device configuration
 #
index faa78f6..fe825d0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/aer.h>
 #include <linux/delay.h>
 #include <linux/firmware.h>
index b9dfae4..48f3edc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_CCP_DD
        tristate "Secure Processor device driver"
        depends on CPU_SUP_AMD || ARM64
index 930d82d..4b9b37a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_CHELSIO
        tristate "Chelsio Crypto Co-processor Driver"
        depends on CHELSIO_T4
index b7bd980..a3c05e2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4
 
 obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chcr.o
index 8a76fce..177f572 100644 (file)
@@ -200,17 +200,10 @@ void chcr_verify_tag(struct aead_request *req, u8 *input, int *err)
 
 static int chcr_inc_wrcount(struct chcr_dev *dev)
 {
-       int err = 0;
-
-       spin_lock_bh(&dev->lock_chcr_dev);
        if (dev->state == CHCR_DETACH)
-               err = 1;
-       else
-               atomic_inc(&dev->inflight);
-
-       spin_unlock_bh(&dev->lock_chcr_dev);
-
-       return err;
+               return 1;
+       atomic_inc(&dev->inflight);
+       return 0;
 }
 
 static inline void chcr_dec_wrcount(struct chcr_dev *dev)
@@ -1101,8 +1094,8 @@ static int chcr_final_cipher_iv(struct ablkcipher_request *req,
        int ret = 0;
 
        if (subtype == CRYPTO_ALG_SUB_TYPE_CTR)
-               ctr_add_iv(iv, req->info, (reqctx->processed /
-                          AES_BLOCK_SIZE));
+               ctr_add_iv(iv, req->info, DIV_ROUND_UP(reqctx->processed,
+                                                      AES_BLOCK_SIZE));
        else if (subtype == CRYPTO_ALG_SUB_TYPE_XTS)
                ret = chcr_update_tweak(req, iv, 1);
        else if (subtype == CRYPTO_ALG_SUB_TYPE_CBC) {
index 239b933..029a735 100644 (file)
@@ -243,15 +243,11 @@ static void chcr_detach_device(struct uld_ctx *u_ctx)
 {
        struct chcr_dev *dev = &u_ctx->dev;
 
-       spin_lock_bh(&dev->lock_chcr_dev);
        if (dev->state == CHCR_DETACH) {
-               spin_unlock_bh(&dev->lock_chcr_dev);
                pr_debug("Detached Event received for already detach device\n");
                return;
        }
        dev->state = CHCR_DETACH;
-       spin_unlock_bh(&dev->lock_chcr_dev);
-
        if (atomic_read(&dev->inflight) != 0) {
                schedule_delayed_work(&dev->detach_work, WQ_DETACH_TM);
                wait_for_completion(&dev->detach_comp);
index 2f60049..f429aae 100644 (file)
@@ -575,7 +575,8 @@ inline void *chcr_crypto_wreq(struct sk_buff *skb,
        if (unlikely(credits < ETHTXQ_STOP_THRES)) {
                netif_tx_stop_queue(q->txq);
                q->q.stops++;
-               wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
+               if (!q->dbqt)
+                       wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
        }
        wr_mid |= FW_ULPTX_WR_DATA_F;
        wr->wreq.flowid_len16 = htonl(wr_mid);
index b958f1b..bc11495 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 \
             -I $(srctree)/drivers/crypto/chelsio
 
index 302f07d..13f64f9 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += crypto_safexcel.o
 crypto_safexcel-objs := safexcel.o safexcel_ring.o safexcel_cipher.o safexcel_hash.o
index 9bbde2f..f5414b6 100644 (file)
@@ -30,8 +30,8 @@
 #include <crypto/authenc.h>
 #include <crypto/scatterwalk.h>
 
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define MAX_KEYLEN 32
 
index 0c12b13..b27cab6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_MARVELL_CESA) += marvell-cesa.o
 marvell-cesa-objs := cesa.o cipher.o hash.o tdma.o
index 187be79..196a465 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_MEDIATEK) += mtk-crypto.o
 mtk-crypto-objs:= mtk-platform.o mtk-aes.o mtk-sha.o
index 0d5d3d8..760e72a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* n2_core.c: Niagara2 Stream Processing Unit (SPU) crypto support.
  *
  * Copyright (C) 2010, 2011 David S. Miller <davem@davemloft.net>
index cd5dda9..23e3d01 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config CRYPTO_DEV_NX_ENCRYPT
        tristate "Encryption acceleration support on pSeries platform"
index 5793284..5c4aa60 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for IBM Power 842 compression accelerator
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
  * Copyright (C) IBM Corporation, 2012
  *
  * Authors: Robert Jennings <rcj@linux.vnet.ibm.com>
index 09d823d..ad02013 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 
  * Cryptographic API.
  *
index ce3cae4..6ab7e5a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_QAT
        tristate
        select CRYPTO_AEAD
index 822b5de..92ef416 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXX) += qat_c3xxx.o
 qat_c3xxx-objs := adf_drv.o adf_c3xxx_hw_data.o
index 8f56d27..b6d7682 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXXVF) += qat_c3xxxvf.o
 qat_c3xxxvf-objs := adf_drv.o adf_c3xxxvf_hw_data.o
index 6dcd404..d581f7c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_C62X) += qat_c62x.o
 qat_c62x-objs := adf_drv.o adf_c62x_hw_data.o
index 1e5d51d..446c3d6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_C62XVF) += qat_c62xvf.o
 qat_c62xvf-objs := adf_drv.o adf_c62xvf_hw_data.o
index 0fc06b1..38d6f8e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc.o
 qat_dh895xcc-objs := adf_drv.o adf_dh895xcc_hw_data.o
index 9ce906a..0153c85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/$(src)/../qat_common
 obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCCVF) += qat_dh895xccvf.o
 qat_dh895xccvf-objs := adf_drv.o adf_dh895xccvf_hw_data.o
index 30f9129..6e23764 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o
 rk_crypto-objs := rk3288_crypto.o \
                  rk3288_crypto_ablkcipher.o \
index 4491e21..d657628 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_STM32_CRC
        tristate "Support for STM32 crc accelerators"
        depends on ARCH_STM32
index 53d1bb9..ce77e38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_STM32_CRC) += stm32_crc32.o
 obj-$(CONFIG_CRYPTO_DEV_STM32_HASH) += stm32-hash.o
 obj-$(CONFIG_CRYPTO_DEV_STM32_CRYP) += stm32-cryp.o
index ccb8932..c0a2797 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o
 sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o
 sun4i-ss-$(CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG) += sun4i-ss-prng.o
index a4324b1..01b625e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_VIRTIO
        tristate "VirtIO crypto driver"
        depends on VIRTIO
index 0704833..10f266d 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /* Algorithms supported by virtio crypto device
   *
   * Authors: Gonglei <arei.gonglei@huawei.com>
   *
   * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD.
-  *
-  * This program is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published by
-  * the Free Software Foundation; either version 2 of the License, or
-  * (at your option) any later version.
-  *
-  * This 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.
-  *
-  * You should have received a copy of the GNU General Public License
-  * along with this program; if not, see <http://www.gnu.org/licenses/>.
   */
 
 #include <linux/scatterlist.h>
index 63ef7f7..1c6e00d 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Common header for Virtio crypto device.
  *
  * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _VIRTIO_CRYPTO_COMMON_H
index 3c9e120..c8a962c 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /* Driver for Virtio crypto device.
   *
   * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD.
-  *
-  * This program is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published by
-  * the Free Software Foundation; either version 2 of the License, or
-  * (at your option) any later version.
-  *
-  * This 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.
-  *
-  * You should have received a copy of the GNU General Public License
-  * along with this program; if not, see <http://www.gnu.org/licenses/>.
   */
 
 #include <linux/err.h>
index d70de3a..6860f81 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /* Management for virtio crypto devices (refer to adf_dev_mgr.c)
   *
   * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD.
-  *
-  * This program is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published by
-  * the Free Software Foundation; either version 2 of the License, or
-  * (at your option) any later version.
-  *
-  * This 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.
-  *
-  * You should have received a copy of the GNU General Public License
-  * along with this program; if not, see <http://www.gnu.org/licenses/>.
   */
 
 #include <linux/mutex.h>
index c3d524e..c85fab7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRYPTO_DEV_VMX_ENCRYPT
        tristate "Encryption acceleration support on P8 CPU"
        depends on CRYPTO_DEV_VMX
index de78282..9c6b5c1 100644 (file)
@@ -1357,7 +1357,7 @@ Loop_ctr32_enc:
        addi            $idx,$idx,16
        bdnz            Loop_ctr32_enc
 
-       vadduwm         $ivec,$ivec,$one
+       vadduqm         $ivec,$ivec,$one
         vmr            $dat,$inptail
         lvx            $inptail,0,$inp
         addi           $inp,$inp,16
index b5a6883..14807ac 100644 (file)
@@ -1,22 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
 /**
  * GHASH routines supporting VMX instructions on the Power 8
  *
- * Copyright (C) 2015 International Business Machines Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 only.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Copyright (C) 2015, 2019 International Business Machines Inc.
  *
  * Author: Marcelo Henrique Cerri <mhcerri@br.ibm.com>
+ *
+ * Extended by Daniel Axtens <dja@axtens.net> to replace the fallback
+ * mechanism. The new approach is based on arm64 code, which is:
+ *   Copyright (C) 2014 - 2018 Linaro Ltd. <ard.biesheuvel@linaro.org>
  */
 
 #include <linux/types.h>
@@ -38,70 +30,25 @@ void gcm_ghash_p8(u64 Xi[2], const u128 htable[16],
                  const u8 *in, size_t len);
 
 struct p8_ghash_ctx {
+       /* key used by vector asm */
        u128 htable[16];
-       struct crypto_shash *fallback;
+       /* key used by software fallback */
+       be128 key;
 };
 
 struct p8_ghash_desc_ctx {
        u64 shash[2];
        u8 buffer[GHASH_DIGEST_SIZE];
        int bytes;
-       struct shash_desc fallback_desc;
 };
 
-static int p8_ghash_init_tfm(struct crypto_tfm *tfm)
-{
-       const char *alg = "ghash-generic";
-       struct crypto_shash *fallback;
-       struct crypto_shash *shash_tfm = __crypto_shash_cast(tfm);
-       struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm);
-
-       fallback = crypto_alloc_shash(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
-       if (IS_ERR(fallback)) {
-               printk(KERN_ERR
-                      "Failed to allocate transformation for '%s': %ld\n",
-                      alg, PTR_ERR(fallback));
-               return PTR_ERR(fallback);
-       }
-
-       crypto_shash_set_flags(fallback,
-                              crypto_shash_get_flags((struct crypto_shash
-                                                      *) tfm));
-
-       /* Check if the descsize defined in the algorithm is still enough. */
-       if (shash_tfm->descsize < sizeof(struct p8_ghash_desc_ctx)
-           + crypto_shash_descsize(fallback)) {
-               printk(KERN_ERR
-                      "Desc size of the fallback implementation (%s) does not match the expected value: %lu vs %u\n",
-                      alg,
-                      shash_tfm->descsize - sizeof(struct p8_ghash_desc_ctx),
-                      crypto_shash_descsize(fallback));
-               return -EINVAL;
-       }
-       ctx->fallback = fallback;
-
-       return 0;
-}
-
-static void p8_ghash_exit_tfm(struct crypto_tfm *tfm)
-{
-       struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm);
-
-       if (ctx->fallback) {
-               crypto_free_shash(ctx->fallback);
-               ctx->fallback = NULL;
-       }
-}
-
 static int p8_ghash_init(struct shash_desc *desc)
 {
-       struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm));
        struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc);
 
        dctx->bytes = 0;
        memset(dctx->shash, 0, GHASH_DIGEST_SIZE);
-       dctx->fallback_desc.tfm = ctx->fallback;
-       return crypto_shash_init(&dctx->fallback_desc);
+       return 0;
 }
 
 static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key,
@@ -119,7 +66,51 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key,
        disable_kernel_vsx();
        pagefault_enable();
        preempt_enable();
-       return crypto_shash_setkey(ctx->fallback, key, keylen);
+
+       memcpy(&ctx->key, key, GHASH_BLOCK_SIZE);
+
+       return 0;
+}
+
+static inline void __ghash_block(struct p8_ghash_ctx *ctx,
+                                struct p8_ghash_desc_ctx *dctx)
+{
+       if (crypto_simd_usable()) {
+               preempt_disable();
+               pagefault_disable();
+               enable_kernel_vsx();
+               gcm_ghash_p8(dctx->shash, ctx->htable,
+                               dctx->buffer, GHASH_DIGEST_SIZE);
+               disable_kernel_vsx();
+               pagefault_enable();
+               preempt_enable();
+       } else {
+               crypto_xor((u8 *)dctx->shash, dctx->buffer, GHASH_BLOCK_SIZE);
+               gf128mul_lle((be128 *)dctx->shash, &ctx->key);
+       }
+}
+
+static inline void __ghash_blocks(struct p8_ghash_ctx *ctx,
+                                 struct p8_ghash_desc_ctx *dctx,
+                                 const u8 *src, unsigned int srclen)
+{
+       if (crypto_simd_usable()) {
+               preempt_disable();
+               pagefault_disable();
+               enable_kernel_vsx();
+               gcm_ghash_p8(dctx->shash, ctx->htable,
+                               src, srclen);
+               disable_kernel_vsx();
+               pagefault_enable();
+               preempt_enable();
+       } else {
+               while (srclen >= GHASH_BLOCK_SIZE) {
+                       crypto_xor((u8 *)dctx->shash, src, GHASH_BLOCK_SIZE);
+                       gf128mul_lle((be128 *)dctx->shash, &ctx->key);
+                       srclen -= GHASH_BLOCK_SIZE;
+                       src += GHASH_BLOCK_SIZE;
+               }
+       }
 }
 
 static int p8_ghash_update(struct shash_desc *desc,
@@ -129,49 +120,33 @@ static int p8_ghash_update(struct shash_desc *desc,
        struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm));
        struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc);
 
-       if (!crypto_simd_usable()) {
-               return crypto_shash_update(&dctx->fallback_desc, src,
-                                          srclen);
-       } else {
-               if (dctx->bytes) {
-                       if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) {
-                               memcpy(dctx->buffer + dctx->bytes, src,
-                                      srclen);
-                               dctx->bytes += srclen;
-                               return 0;
-                       }
+       if (dctx->bytes) {
+               if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) {
                        memcpy(dctx->buffer + dctx->bytes, src,
-                              GHASH_DIGEST_SIZE - dctx->bytes);
-                       preempt_disable();
-                       pagefault_disable();
-                       enable_kernel_vsx();
-                       gcm_ghash_p8(dctx->shash, ctx->htable,
-                                    dctx->buffer, GHASH_DIGEST_SIZE);
-                       disable_kernel_vsx();
-                       pagefault_enable();
-                       preempt_enable();
-                       src += GHASH_DIGEST_SIZE - dctx->bytes;
-                       srclen -= GHASH_DIGEST_SIZE - dctx->bytes;
-                       dctx->bytes = 0;
-               }
-               len = srclen & ~(GHASH_DIGEST_SIZE - 1);
-               if (len) {
-                       preempt_disable();
-                       pagefault_disable();
-                       enable_kernel_vsx();
-                       gcm_ghash_p8(dctx->shash, ctx->htable, src, len);
-                       disable_kernel_vsx();
-                       pagefault_enable();
-                       preempt_enable();
-                       src += len;
-                       srclen -= len;
-               }
-               if (srclen) {
-                       memcpy(dctx->buffer, src, srclen);
-                       dctx->bytes = srclen;
+                               srclen);
+                       dctx->bytes += srclen;
+                       return 0;
                }
-               return 0;
+               memcpy(dctx->buffer + dctx->bytes, src,
+                       GHASH_DIGEST_SIZE - dctx->bytes);
+
+               __ghash_block(ctx, dctx);
+
+               src += GHASH_DIGEST_SIZE - dctx->bytes;
+               srclen -= GHASH_DIGEST_SIZE - dctx->bytes;
+               dctx->bytes = 0;
+       }
+       len = srclen & ~(GHASH_DIGEST_SIZE - 1);
+       if (len) {
+               __ghash_blocks(ctx, dctx, src, len);
+               src += len;
+               srclen -= len;
        }
+       if (srclen) {
+               memcpy(dctx->buffer, src, srclen);
+               dctx->bytes = srclen;
+       }
+       return 0;
 }
 
 static int p8_ghash_final(struct shash_desc *desc, u8 *out)
@@ -180,25 +155,14 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out)
        struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm));
        struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc);
 
-       if (!crypto_simd_usable()) {
-               return crypto_shash_final(&dctx->fallback_desc, out);
-       } else {
-               if (dctx->bytes) {
-                       for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++)
-                               dctx->buffer[i] = 0;
-                       preempt_disable();
-                       pagefault_disable();
-                       enable_kernel_vsx();
-                       gcm_ghash_p8(dctx->shash, ctx->htable,
-                                    dctx->buffer, GHASH_DIGEST_SIZE);
-                       disable_kernel_vsx();
-                       pagefault_enable();
-                       preempt_enable();
-                       dctx->bytes = 0;
-               }
-               memcpy(out, dctx->shash, GHASH_DIGEST_SIZE);
-               return 0;
+       if (dctx->bytes) {
+               for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++)
+                       dctx->buffer[i] = 0;
+               __ghash_block(ctx, dctx);
+               dctx->bytes = 0;
        }
+       memcpy(out, dctx->shash, GHASH_DIGEST_SIZE);
+       return 0;
 }
 
 struct shash_alg p8_ghash_alg = {
@@ -213,11 +177,8 @@ struct shash_alg p8_ghash_alg = {
                 .cra_name = "ghash",
                 .cra_driver_name = "p8_ghash",
                 .cra_priority = 1000,
-                .cra_flags = CRYPTO_ALG_NEED_FALLBACK,
                 .cra_blocksize = GHASH_BLOCK_SIZE,
                 .cra_ctxsize = sizeof(struct p8_ghash_ctx),
                 .cra_module = THIS_MODULE,
-                .cra_init = p8_ghash_init_tfm,
-                .cra_exit = p8_ghash_exit_tfm,
        },
 };
index 5ef624f..f33c73e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DAX_DRIVER
        select DAX
        bool
@@ -23,7 +24,6 @@ config DEV_DAX
 config DEV_DAX_PMEM
        tristate "PMEM DAX: direct access to persistent memory"
        depends on LIBNVDIMM && NVDIMM_DAX && DEV_DAX
-       depends on m # until we can kill DEV_DAX_PMEM_COMPAT
        default DEV_DAX
        help
          Support raw access to persistent memory.  Note that this
@@ -50,7 +50,7 @@ config DEV_DAX_KMEM
 
 config DEV_DAX_PMEM_COMPAT
        tristate "PMEM DAX: support the deprecated /sys/class/dax interface"
-       depends on DEV_DAX_PMEM
+       depends on m && DEV_DAX_PMEM=m
        default DEV_DAX_PMEM
        help
          Older versions of the libdaxctl library expect to find all
index e2e79bd..010269f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
 obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem_core.o
 obj-$(CONFIG_DEV_DAX_PMEM_COMPAT) += dax_pmem_compat.o
index f71019c..f9f5178 100644 (file)
@@ -37,13 +37,13 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
        devm_nsio_disable(dev, nsio);
 
        /* reserve the metadata area, device-dax will reserve the data */
-        pfn_sb = nd_pfn->pfn_sb;
+       pfn_sb = nd_pfn->pfn_sb;
        offset = le64_to_cpu(pfn_sb->dataoff);
        if (!devm_request_mem_region(dev, nsio->res.start, offset,
                                dev_name(&ndns->dev))) {
-                dev_warn(dev, "could not reserve metadata\n");
+               dev_warn(dev, "could not reserve metadata\n");
                return ERR_PTR(-EBUSY);
-        }
+       }
 
        rc = sscanf(dev_name(&ndns->dev), "namespace%d.%d", &region_id, &id);
        if (rc != 2)
index 94f0364..fd33481 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DCA server configuration
 #
index b2db56b..f3f0f02 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DCA) += dca.o
 dca-objs := dca-core.o dca-sysfs.o
index 6a172d3..ba98a4e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig PM_DEVFREQ
        bool "Generic Dynamic Voltage and Frequency Scaling (DVFS) support"
        select SRCU
index cd94980..cef2cf5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig PM_DEVFREQ_EVENT
        bool "DEVFREQ-Event device Support"
        help
index dda7090..3c847e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Exynos DEVFREQ Event Drivers
 
 obj-$(CONFIG_DEVFREQ_EVENT_EXYNOS_NOCP) += exynos-nocp.o
index ae92d17..11202f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 3fc9c2e..d5f9158 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "DMABUF options"
 
 config SYNC_FILE
index 1f006e0..e8c7310 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
         reservation.o seqno-fence.o
 obj-$(CONFIG_SYNC_FILE)                += sync_file.o
index 3aa8733..9bf0604 100644 (file)
@@ -29,6 +29,7 @@
 
 EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
 EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
+EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled);
 
 static DEFINE_SPINLOCK(dma_fence_stub_lock);
 static struct dma_fence dma_fence_stub;
index eaf78f4..703275c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DMA engine configuration
 #
index 29e4270..5dd4372 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Kconfig options for Bestcomm
 #
index 3a11b10..58cbf9f 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 
 /*
index 4bfa462..4eb2f16 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DW_AXI_DMAC) += dw-axi-dmac-platform.o
index c708417..af102ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # DMA engine configuration for hsu
 config HSU_DMA
        tristate
index b8f9af0..61829b1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HSU_DMA)          += hsu_dma.o
 hsu_dma-objs           := hsu.o
 
index cf5fedb..86638a6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o
 ioatdma-y := init.o dma.o prep.o dca.o sysfs.o
index aaafd0e..b8e8e0b 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 #ifndef IOATDMA_H
 #define IOATDMA_H
index 781c94d..79e4e4c 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 #ifndef _IOAT_HW_H_
 #define _IOAT_HW_H_
index 99c1c24..f55a5f9 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 #ifndef _IOAT_REGISTERS_H_
 #define _IOAT_REGISTERS_H_
index 6704cf4..c79ff11 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += ipu_irq.o ipu_idmac.o
index 680fc05..7411eb3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config MTK_HSDMA
        tristate "MediaTek High-Speed DMA controller support"
index 41bb381..13b1445 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
 obj-$(CONFIG_MTK_CQDMA) += mtk-cqdma.o
index 0c56faa..bb3ccbf 100644 (file)
@@ -1,12 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver For Marvell Two-channel DMA Engine
  *
  * Copyright: Marvell International Ltd.
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
  */
 
 #include <linux/err.h>
index dde7134..dc2cae7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) Freescale Semicondutor, Inc. 2007, 2008.
  * Copyright (C) Semihalf 2009
  *
  * Approved as OSADL project by a majority of OSADL members and funded
  * by OSADL membership fees in 2009;  for details see www.osadl.org.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 
 /*
index 8dc0aa4..fa5dab4 100644 (file)
@@ -1,15 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015-2016 Marvell International Ltd.
 
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 2 of the
- * License, or any later version.
- *
- * 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.
  */
 
 #include <linux/clk.h>
index b3d259b..69c2cfa 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += adma.o
index 2561028..fbabd2e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2006-2009 DENX Software Engineering.
  *
@@ -5,19 +6,6 @@
  *
  * Further porting to arch/powerpc by
  *     Anatolij Gustschin <agust@denx.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 
 /*
index a7761c4..1d18943 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QCOM_BAM_DMA
        tristate "QCOM BAM DMA support"
        depends on ARCH_QCOM || (COMPILE_TEST && OF && ARM)
index a0733ac..3006468 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DMA controller driver for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index e5e74e1..d507c24 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Texas Instruments DMA drivers
 #
index e507ec3..2f946f5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
index 8d174dc..957c269 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC DMA engine Driver
  *
@@ -5,19 +6,6 @@
  * Authors: Rameshwar Prasad Sahu <rsahu@apm.com>
  *         Loc Ho <lho@apm.com>
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * NOTE: PM support is currently not available.
  */
 
index 9e91f8f..e921de5 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XILINX_DMA) += xilinx_dma.o
 obj-$(CONFIG_XILINX_ZYNQMP_DMA) += zynqmp_dma.o
index 47eb4d1..5e2e034 100644 (file)
@@ -263,8 +263,8 @@ config EDAC_PND2
          micro-server but may appear on others in the future.
 
 config EDAC_MPC85XX
-       tristate "Freescale MPC83xx / MPC85xx"
-       depends on FSL_SOC
+       bool "Freescale MPC83xx / MPC85xx"
+       depends on FSL_SOC && EDAC=y
        help
          Support for error detection and correction on the Freescale
          MPC8349, MPC8560, MPC8540, MPC8548, T4240
index e2a9946..873437b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "amd64_edac.h"
 #include <asm/amd_nb.h>
 
index 0a92772..6b8e484 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "edac_module.h"
 
 static struct dentry *edac_debugfs;
index 13594ff..64922c8 100644 (file)
@@ -679,22 +679,18 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)
 
 struct mem_ctl_info *edac_mc_find(int idx)
 {
-       struct mem_ctl_info *mci = NULL;
+       struct mem_ctl_info *mci;
        struct list_head *item;
 
        mutex_lock(&mem_ctls_mutex);
 
        list_for_each(item, &mc_devices) {
                mci = list_entry(item, struct mem_ctl_info, link);
-
-               if (mci->mc_idx >= idx) {
-                       if (mci->mc_idx == idx) {
-                               goto unlock;
-                       }
-                       break;
-               }
+               if (mci->mc_idx == idx)
+                       goto unlock;
        }
 
+       mci = NULL;
 unlock:
        mutex_unlock(&mem_ctls_mutex);
        return mci;
index aac9b9b..adf60eb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Intel E3-1200
  * Copyright (C) 2014 Jason Baron <jbaron@akamai.com>
index bb0202a..ea622c6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/slab.h>
 
index 2a9a11a..d021d28 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "edac_module.h"
 
 static struct workqueue_struct *wq;
index e8b81d7..e4a1032 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * APM X-Gene SoC EDAC (error detection and correction)
  *
  * Copyright (c) 2015, Applied Micro Circuits Corporation
  * Author: Feng Kan <fkan@apm.com>
  *         Loc Ho <lho@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/ctype.h>
index 4570e3b..ffc894b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # EISA configuration
 #
index de06faf..6f5af41 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig EXTCON
        tristate "External Connector Class (extcon) support"
        help
index 4199849..ec00a6f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "IEEE 1394 (FireWire) support"
        depends on PCI || COMPILE_TEST
        # firewire-core does not depend on PCI but is
index 82ba110..b132ab9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IPv4 over IEEE 1394, per RFC 2734
  * IPv6 over IEEE 1394, per RFC 3146
index 7b655f6..9026df9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
@@ -253,6 +254,22 @@ config TI_SCI_PROTOCOL
          This protocol library is used by client drivers to use the features
          provided by the system controller.
 
+config TRUSTED_FOUNDATIONS
+       bool "Trusted Foundations secure monitor support"
+       depends on ARM
+       help
+         Some devices (including most early Tegra-based consumer devices on
+         the market) are booted with the Trusted Foundations secure monitor
+         active, requiring some core operations to be performed by the secure
+         monitor instead of the kernel.
+
+         This option allows the kernel to invoke the secure monitor whenever
+         required on devices using Trusted Foundations. See the functions and
+         comments in linux/firmware/trusted_foundations.h or the device tree
+         bindings for "tlm,trusted-foundations" for details on how to use it.
+
+         Choose N if you don't know what this is about.
+
 config HAVE_ARM_SMCCC
        bool
 
index 9a3909a..3fa0b34 100644 (file)
@@ -21,6 +21,7 @@ obj-$(CONFIG_QCOM_SCM_64)     += qcom_scm-64.o
 obj-$(CONFIG_QCOM_SCM_32)      += qcom_scm-32.o
 CFLAGS_qcom_scm-32.o :=$(call as-instr,.arch armv7-a\n.arch_extension sec,-DREQUIRES_SEC=1) -march=armv7-a
 obj-$(CONFIG_TI_SCI_PROTOCOL)  += ti_sci.o
+obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o
 
 obj-$(CONFIG_ARM_SCMI_PROTOCOL)        += arm_scmi/
 obj-y                          += psci/
index 99e36c5..c47d28d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  = scmi-bus.o scmi-driver.o scmi-protocols.o
 scmi-bus-y = bus.o
 scmi-driver-y = driver.o
index 8f952f2..b5bc4c7 100644 (file)
@@ -654,9 +654,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo)
 
 static int scmi_mailbox_check(struct device_node *np)
 {
-       struct of_phandle_args arg;
-
-       return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", 0, &arg);
+       return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", 0, NULL);
 }
 
 static int scmi_mbox_free_channel(int id, void *p, void *data)
@@ -798,7 +796,9 @@ static int scmi_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       desc = of_match_device(scmi_of_match, dev)->data;
+       desc = of_device_get_match_data(dev);
+       if (!desc)
+               return -EINVAL;
 
        info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
        if (!info)
index f77cdb3..6468082 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BCM47XX_NVRAM
        bool "Broadcom NVRAM driver"
        depends on BCM47XX || ARCH_BCM_5301X
index f93efc4..72c7fdc 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM47XX_NVRAM)            += bcm47xx_nvram.o
 obj-$(CONFIG_BCM47XX_SPROM)            += bcm47xx_sprom.o
index ecf2eeb..b618002 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * dmi-sysfs.c
  *
index fae2d5c..35ed56b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/init.h>
index 190be0b..d4ea929 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "EFI (Extensible Firmware Interface) Support"
        depends on EFI
 
index bcd4577..4197088 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_EFI_TEST)                 += efi_test.o
index 91a0404..a3a6ca6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig GOOGLE_FIRMWARE
        bool "Google Firmware Drivers"
        default n
index 82ce1e6..edaa4e5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 2010 Google Inc. All Rights Reserved.
  * Author: dlaurie@google.com (Duncan Laurie)
index 6a7a7c2..42b566f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IMX_SCU
        bool "IMX SCU Protocol driver"
        depends on IMX_MBOX
index 1b2e15b..802c4ad 100644 (file)
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_IMX_SCU)          += imx-scu.o misc.o
+obj-$(CONFIG_IMX_SCU)          += imx-scu.o misc.o imx-scu-irq.o
 obj-$(CONFIG_IMX_SCU_PD)       += scu-pd.o
diff --git a/drivers/firmware/imx/imx-scu-irq.c b/drivers/firmware/imx/imx-scu-irq.c
new file mode 100644 (file)
index 0000000..043833a
--- /dev/null
@@ -0,0 +1,168 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ *
+ * Implementation of the SCU IRQ functions using MU.
+ *
+ */
+
+#include <dt-bindings/firmware/imx/rsrc.h>
+#include <linux/firmware/imx/ipc.h>
+#include <linux/mailbox_client.h>
+
+#define IMX_SC_IRQ_FUNC_ENABLE 1
+#define IMX_SC_IRQ_FUNC_STATUS 2
+#define IMX_SC_IRQ_NUM_GROUP   4
+
+static u32 mu_resource_id;
+
+struct imx_sc_msg_irq_get_status {
+       struct imx_sc_rpc_msg hdr;
+       union {
+               struct {
+                       u16 resource;
+                       u8 group;
+                       u8 reserved;
+               } __packed req;
+               struct {
+                       u32 status;
+               } resp;
+       } data;
+};
+
+struct imx_sc_msg_irq_enable {
+       struct imx_sc_rpc_msg hdr;
+       u32 mask;
+       u16 resource;
+       u8 group;
+       u8 enable;
+} __packed;
+
+static struct imx_sc_ipc *imx_sc_irq_ipc_handle;
+static struct work_struct imx_sc_irq_work;
+static ATOMIC_NOTIFIER_HEAD(imx_scu_irq_notifier_chain);
+
+int imx_scu_irq_register_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_register(
+               &imx_scu_irq_notifier_chain, nb);
+}
+EXPORT_SYMBOL(imx_scu_irq_register_notifier);
+
+int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_unregister(
+               &imx_scu_irq_notifier_chain, nb);
+}
+EXPORT_SYMBOL(imx_scu_irq_unregister_notifier);
+
+static int imx_scu_irq_notifier_call_chain(unsigned long status, u8 *group)
+{
+       return atomic_notifier_call_chain(&imx_scu_irq_notifier_chain,
+               status, (void *)group);
+}
+
+static void imx_scu_irq_work_handler(struct work_struct *work)
+{
+       struct imx_sc_msg_irq_get_status msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u32 irq_status;
+       int ret;
+       u8 i;
+
+       for (i = 0; i < IMX_SC_IRQ_NUM_GROUP; i++) {
+               hdr->ver = IMX_SC_RPC_VERSION;
+               hdr->svc = IMX_SC_RPC_SVC_IRQ;
+               hdr->func = IMX_SC_IRQ_FUNC_STATUS;
+               hdr->size = 2;
+
+               msg.data.req.resource = mu_resource_id;
+               msg.data.req.group = i;
+
+               ret = imx_scu_call_rpc(imx_sc_irq_ipc_handle, &msg, true);
+               if (ret) {
+                       pr_err("get irq group %d status failed, ret %d\n",
+                              i, ret);
+                       return;
+               }
+
+               irq_status = msg.data.resp.status;
+               if (!irq_status)
+                       continue;
+
+               imx_scu_irq_notifier_call_chain(irq_status, &i);
+       }
+}
+
+int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
+{
+       struct imx_sc_msg_irq_enable msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       int ret;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
+       hdr->svc = IMX_SC_RPC_SVC_IRQ;
+       hdr->func = IMX_SC_IRQ_FUNC_ENABLE;
+       hdr->size = 3;
+
+       msg.resource = mu_resource_id;
+       msg.group = group;
+       msg.mask = mask;
+       msg.enable = enable;
+
+       ret = imx_scu_call_rpc(imx_sc_irq_ipc_handle, &msg, true);
+       if (ret)
+               pr_err("enable irq failed, group %d, mask %d, ret %d\n",
+                       group, mask, ret);
+
+       return ret;
+}
+EXPORT_SYMBOL(imx_scu_irq_group_enable);
+
+static void imx_scu_irq_callback(struct mbox_client *c, void *msg)
+{
+       schedule_work(&imx_sc_irq_work);
+}
+
+int imx_scu_enable_general_irq_channel(struct device *dev)
+{
+       struct of_phandle_args spec;
+       struct mbox_client *cl;
+       struct mbox_chan *ch;
+       int ret = 0, i = 0;
+
+       ret = imx_scu_get_handle(&imx_sc_irq_ipc_handle);
+       if (ret)
+               return ret;
+
+       cl = devm_kzalloc(dev, sizeof(*cl), GFP_KERNEL);
+       if (!cl)
+               return -ENOMEM;
+
+       cl->dev = dev;
+       cl->rx_callback = imx_scu_irq_callback;
+
+       /* SCU general IRQ uses general interrupt channel 3 */
+       ch = mbox_request_channel_byname(cl, "gip3");
+       if (IS_ERR(ch)) {
+               ret = PTR_ERR(ch);
+               dev_err(dev, "failed to request mbox chan gip3, ret %d\n", ret);
+               devm_kfree(dev, cl);
+               return ret;
+       }
+
+       INIT_WORK(&imx_sc_irq_work, imx_scu_irq_work_handler);
+
+       if (!of_parse_phandle_with_args(dev->of_node, "mboxes",
+                                      "#mbox-cells", 0, &spec))
+               i = of_alias_get_id(spec.np, "mu");
+
+       /* use mu1 as general mu irq channel if failed */
+       if (i < 0)
+               i = 1;
+
+       mu_resource_id = IMX_SC_R_MU_0A + i;
+
+       return ret;
+}
+EXPORT_SYMBOL(imx_scu_enable_general_irq_channel);
index 2bb1a19..04a24a8 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/firmware/imx/types.h>
 #include <linux/firmware/imx/ipc.h>
+#include <linux/firmware/imx/sci.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
@@ -246,6 +247,11 @@ static int imx_scu_probe(struct platform_device *pdev)
 
        imx_sc_ipc_handle = sc_ipc;
 
+       ret = imx_scu_enable_general_irq_channel(dev);
+       if (ret)
+               dev_warn(dev,
+                       "failed to enable general irq channel: %d\n", ret);
+
        dev_info(dev, "NXP i.MX SCU Initialized\n");
 
        return devm_of_platform_populate(dev);
index 39a94c7..480cec6 100644 (file)
@@ -74,7 +74,10 @@ struct imx_sc_pd_range {
        char *name;
        u32 rsrc;
        u8 num;
+
+       /* add domain index */
        bool postfix;
+       u8 start_from;
 };
 
 struct imx_sc_pd_soc {
@@ -84,71 +87,75 @@ struct imx_sc_pd_soc {
 
 static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {
        /* LSIO SS */
-       { "lsio-pwm", IMX_SC_R_PWM_0, 8, 1 },
-       { "lsio-gpio", IMX_SC_R_GPIO_0, 8, 1 },
-       { "lsio-gpt", IMX_SC_R_GPT_0, 5, 1 },
-       { "lsio-kpp", IMX_SC_R_KPP, 1, 0 },
-       { "lsio-fspi", IMX_SC_R_FSPI_0, 2, 1 },
-       { "lsio-mu", IMX_SC_R_MU_0A, 14, 1 },
+       { "pwm", IMX_SC_R_PWM_0, 8, true, 0 },
+       { "gpio", IMX_SC_R_GPIO_0, 8, true, 0 },
+       { "gpt", IMX_SC_R_GPT_0, 5, true, 0 },
+       { "kpp", IMX_SC_R_KPP, 1, false, 0 },
+       { "fspi", IMX_SC_R_FSPI_0, 2, true, 0 },
+       { "mu", IMX_SC_R_MU_0A, 14, true, 0 },
 
        /* CONN SS */
-       { "con-usb", IMX_SC_R_USB_0, 2, 1 },
-       { "con-usb0phy", IMX_SC_R_USB_0_PHY, 1, 0 },
-       { "con-usb2", IMX_SC_R_USB_2, 1, 0 },
-       { "con-usb2phy", IMX_SC_R_USB_2_PHY, 1, 0 },
-       { "con-sdhc", IMX_SC_R_SDHC_0, 3, 1 },
-       { "con-enet", IMX_SC_R_ENET_0, 2, 1 },
-       { "con-nand", IMX_SC_R_NAND, 1, 0 },
-       { "con-mlb", IMX_SC_R_MLB_0, 1, 1 },
-
-       /* Audio DMA SS */
-       { "adma-audio-pll0", IMX_SC_R_AUDIO_PLL_0, 1, 0 },
-       { "adma-audio-pll1", IMX_SC_R_AUDIO_PLL_1, 1, 0 },
-       { "adma-audio-clk-0", IMX_SC_R_AUDIO_CLK_0, 1, 0 },
-       { "adma-dma0-ch", IMX_SC_R_DMA_0_CH0, 16, 1 },
-       { "adma-dma1-ch", IMX_SC_R_DMA_1_CH0, 16, 1 },
-       { "adma-dma2-ch", IMX_SC_R_DMA_2_CH0, 5, 1 },
-       { "adma-asrc0", IMX_SC_R_ASRC_0, 1, 0 },
-       { "adma-asrc1", IMX_SC_R_ASRC_1, 1, 0 },
-       { "adma-esai0", IMX_SC_R_ESAI_0, 1, 0 },
-       { "adma-spdif0", IMX_SC_R_SPDIF_0, 1, 0 },
-       { "adma-sai", IMX_SC_R_SAI_0, 3, 1 },
-       { "adma-amix", IMX_SC_R_AMIX, 1, 0 },
-       { "adma-mqs0", IMX_SC_R_MQS_0, 1, 0 },
-       { "adma-dsp", IMX_SC_R_DSP, 1, 0 },
-       { "adma-dsp-ram", IMX_SC_R_DSP_RAM, 1, 0 },
-       { "adma-can", IMX_SC_R_CAN_0, 3, 1 },
-       { "adma-ftm", IMX_SC_R_FTM_0, 2, 1 },
-       { "adma-lpi2c", IMX_SC_R_I2C_0, 4, 1 },
-       { "adma-adc", IMX_SC_R_ADC_0, 1, 1 },
-       { "adma-lcd", IMX_SC_R_LCD_0, 1, 1 },
-       { "adma-lcd0-pwm", IMX_SC_R_LCD_0_PWM_0, 1, 1 },
-       { "adma-lpuart", IMX_SC_R_UART_0, 4, 1 },
-       { "adma-lpspi", IMX_SC_R_SPI_0, 4, 1 },
-
-       /* VPU SS  */
-       { "vpu", IMX_SC_R_VPU, 1, 0 },
-       { "vpu-pid", IMX_SC_R_VPU_PID0, 8, 1 },
-       { "vpu-dec0", IMX_SC_R_VPU_DEC_0, 1, 0 },
-       { "vpu-enc0", IMX_SC_R_VPU_ENC_0, 1, 0 },
+       { "usb", IMX_SC_R_USB_0, 2, true, 0 },
+       { "usb0phy", IMX_SC_R_USB_0_PHY, 1, false, 0 },
+       { "usb2", IMX_SC_R_USB_2, 1, false, 0 },
+       { "usb2phy", IMX_SC_R_USB_2_PHY, 1, false, 0 },
+       { "sdhc", IMX_SC_R_SDHC_0, 3, true, 0 },
+       { "enet", IMX_SC_R_ENET_0, 2, true, 0 },
+       { "nand", IMX_SC_R_NAND, 1, false, 0 },
+       { "mlb", IMX_SC_R_MLB_0, 1, true, 0 },
+
+       /* AUDIO SS */
+       { "audio-pll0", IMX_SC_R_AUDIO_PLL_0, 1, false, 0 },
+       { "audio-pll1", IMX_SC_R_AUDIO_PLL_1, 1, false, 0 },
+       { "audio-clk-0", IMX_SC_R_AUDIO_CLK_0, 1, false, 0 },
+       { "dma0-ch", IMX_SC_R_DMA_0_CH0, 16, true, 0 },
+       { "dma1-ch", IMX_SC_R_DMA_1_CH0, 16, true, 0 },
+       { "dma2-ch", IMX_SC_R_DMA_2_CH0, 5, true, 0 },
+       { "asrc0", IMX_SC_R_ASRC_0, 1, false, 0 },
+       { "asrc1", IMX_SC_R_ASRC_1, 1, false, 0 },
+       { "esai0", IMX_SC_R_ESAI_0, 1, false, 0 },
+       { "spdif0", IMX_SC_R_SPDIF_0, 1, false, 0 },
+       { "sai", IMX_SC_R_SAI_0, 3, true, 0 },
+       { "amix", IMX_SC_R_AMIX, 1, false, 0 },
+       { "mqs0", IMX_SC_R_MQS_0, 1, false, 0 },
+       { "dsp", IMX_SC_R_DSP, 1, false, 0 },
+       { "dsp-ram", IMX_SC_R_DSP_RAM, 1, false, 0 },
+
+       /* DMA SS */
+       { "can", IMX_SC_R_CAN_0, 3, true, 0 },
+       { "ftm", IMX_SC_R_FTM_0, 2, true, 0 },
+       { "lpi2c", IMX_SC_R_I2C_0, 4, true, 0 },
+       { "adc", IMX_SC_R_ADC_0, 1, true, 0 },
+       { "lcd", IMX_SC_R_LCD_0, 1, true, 0 },
+       { "lcd0-pwm", IMX_SC_R_LCD_0_PWM_0, 1, true, 0 },
+       { "lpuart", IMX_SC_R_UART_0, 4, true, 0 },
+       { "lpspi", IMX_SC_R_SPI_0, 4, true, 0 },
+
+       /* VPU SS */
+       { "vpu", IMX_SC_R_VPU, 1, false, 0 },
+       { "vpu-pid", IMX_SC_R_VPU_PID0, 8, true, 0 },
+       { "vpu-dec0", IMX_SC_R_VPU_DEC_0, 1, false, 0 },
+       { "vpu-enc0", IMX_SC_R_VPU_ENC_0, 1, false, 0 },
 
        /* GPU SS */
-       { "gpu0-pid", IMX_SC_R_GPU_0_PID0, 4, 1 },
+       { "gpu0-pid", IMX_SC_R_GPU_0_PID0, 4, true, 0 },
 
        /* HSIO SS */
-       { "hsio-pcie-b", IMX_SC_R_PCIE_B, 1, 0 },
-       { "hsio-serdes-1", IMX_SC_R_SERDES_1, 1, 0 },
-       { "hsio-gpio", IMX_SC_R_HSIO_GPIO, 1, 0 },
+       { "pcie-b", IMX_SC_R_PCIE_B, 1, false, 0 },
+       { "serdes-1", IMX_SC_R_SERDES_1, 1, false, 0 },
+       { "hsio-gpio", IMX_SC_R_HSIO_GPIO, 1, false, 0 },
+
+       /* MIPI SS */
+       { "mipi0", IMX_SC_R_MIPI_0, 1, false, 0 },
+       { "mipi0-pwm0", IMX_SC_R_MIPI_0_PWM_0, 1, false, 0 },
+       { "mipi0-i2c", IMX_SC_R_MIPI_0_I2C_0, 2, true, 0 },
 
-       /* MIPI/LVDS SS */
-       { "mipi0", IMX_SC_R_MIPI_0, 1, 0 },
-       { "mipi0-pwm0", IMX_SC_R_MIPI_0_PWM_0, 1, 0 },
-       { "mipi0-i2c", IMX_SC_R_MIPI_0_I2C_0, 2, 1 },
-       { "lvds0", IMX_SC_R_LVDS_0, 1, 0 },
+       /* LVDS SS */
+       { "lvds0", IMX_SC_R_LVDS_0, 1, false, 0 },
 
        /* DC SS */
-       { "dc0", IMX_SC_R_DC_0, 1, 0 },
-       { "dc0-pll", IMX_SC_R_DC_0_PLL_0, 2, 1 },
+       { "dc0", IMX_SC_R_DC_0, 1, false, 0 },
+       { "dc0-pll", IMX_SC_R_DC_0_PLL_0, 2, true, 0 },
 };
 
 static const struct imx_sc_pd_soc imx8qxp_scu_pd = {
@@ -236,7 +243,7 @@ imx_scu_add_pm_domain(struct device *dev, int idx,
 
        if (pd_ranges->postfix)
                snprintf(sc_pd->name, sizeof(sc_pd->name),
-                        "%s%i", pd_ranges->name, idx);
+                        "%s%i", pd_ranges->name, pd_ranges->start_from + idx);
        else
                snprintf(sc_pd->name, sizeof(sc_pd->name),
                         "%s", pd_ranges->name);
index 170d7e8..2671dcd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Amlogic Secure Monitor driver
 #
index 9ab3884..c6c0948 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MESON_SM) +=      meson_sm.o
index 26a3b32..9794416 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARM_PSCI_FW
        bool
 
index ff2730d..a887731 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Tegra firmware driver"
 
 config TEGRA_IVC
index 676b01c..49c87e0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tegra-bpmp-y                   = bpmp.o
 tegra-bpmp-$(CONFIG_ARCH_TEGRA_210_SOC)        += bpmp-tegra210.o
 tegra-bpmp-$(CONFIG_ARCH_TEGRA_186_SOC)        += bpmp-tegra186.o
index 3fbbb61..ef93406 100644 (file)
@@ -65,18 +65,36 @@ struct ti_sci_xfers_info {
 };
 
 /**
+ * struct ti_sci_rm_type_map - Structure representing TISCI Resource
+ *                             management representation of dev_ids.
+ * @dev_id:    TISCI device ID
+ * @type:      Corresponding id as identified by TISCI RM.
+ *
+ * Note: This is used only as a work around for using RM range apis
+ *     for AM654 SoC. For future SoCs dev_id will be used as type
+ *     for RM range APIs. In order to maintain ABI backward compatibility
+ *     type is not being changed for AM654 SoC.
+ */
+struct ti_sci_rm_type_map {
+       u32 dev_id;
+       u16 type;
+};
+
+/**
  * struct ti_sci_desc - Description of SoC integration
  * @default_host_id:   Host identifier representing the compute entity
  * @max_rx_timeout_ms: Timeout for communication with SoC (in Milliseconds)
  * @max_msgs: Maximum number of messages that can be pending
  *               simultaneously in the system
  * @max_msg_size: Maximum size of data per message that can be handled.
+ * @rm_type_map: RM resource type mapping structure.
  */
 struct ti_sci_desc {
        u8 default_host_id;
        int max_rx_timeout_ms;
        int max_msgs;
        int max_msg_size;
+       struct ti_sci_rm_type_map *rm_type_map;
 };
 
 /**
@@ -1600,6 +1618,392 @@ fail:
        return ret;
 }
 
+static int ti_sci_get_resource_type(struct ti_sci_info *info, u16 dev_id,
+                                   u16 *type)
+{
+       struct ti_sci_rm_type_map *rm_type_map = info->desc->rm_type_map;
+       bool found = false;
+       int i;
+
+       /* If map is not provided then assume dev_id is used as type */
+       if (!rm_type_map) {
+               *type = dev_id;
+               return 0;
+       }
+
+       for (i = 0; rm_type_map[i].dev_id; i++) {
+               if (rm_type_map[i].dev_id == dev_id) {
+                       *type = rm_type_map[i].type;
+                       found = true;
+                       break;
+               }
+       }
+
+       if (!found)
+               return -EINVAL;
+
+       return 0;
+}
+
+/**
+ * ti_sci_get_resource_range - Helper to get a range of resources assigned
+ *                            to a host. Resource is uniquely identified by
+ *                            type and subtype.
+ * @handle:            Pointer to TISCI handle.
+ * @dev_id:            TISCI device ID.
+ * @subtype:           Resource assignment subtype that is being requested
+ *                     from the given device.
+ * @s_host:            Host processor ID to which the resources are allocated
+ * @range_start:       Start index of the resource range
+ * @range_num:         Number of resources in the range
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
+                                    u32 dev_id, u8 subtype, u8 s_host,
+                                    u16 *range_start, u16 *range_num)
+{
+       struct ti_sci_msg_resp_get_resource_range *resp;
+       struct ti_sci_msg_req_get_resource_range *req;
+       struct ti_sci_xfer *xfer;
+       struct ti_sci_info *info;
+       struct device *dev;
+       u16 type;
+       int ret = 0;
+
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+       if (!handle)
+               return -EINVAL;
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_GET_RESOURCE_RANGE,
+                                  TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+
+       ret = ti_sci_get_resource_type(info, dev_id, &type);
+       if (ret) {
+               dev_err(dev, "rm type lookup failed for %u\n", dev_id);
+               goto fail;
+       }
+
+       req = (struct ti_sci_msg_req_get_resource_range *)xfer->xfer_buf;
+       req->secondary_host = s_host;
+       req->type = type & MSG_RM_RESOURCE_TYPE_MASK;
+       req->subtype = subtype & MSG_RM_RESOURCE_SUBTYPE_MASK;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_resp_get_resource_range *)xfer->xfer_buf;
+
+       if (!ti_sci_is_response_ack(resp)) {
+               ret = -ENODEV;
+       } else if (!resp->range_start && !resp->range_num) {
+               ret = -ENODEV;
+       } else {
+               *range_start = resp->range_start;
+               *range_num = resp->range_num;
+       };
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host
+ *                                that is same as ti sci interface host.
+ * @handle:            Pointer to TISCI handle.
+ * @dev_id:            TISCI device ID.
+ * @subtype:           Resource assignment subtype that is being requested
+ *                     from the given device.
+ * @range_start:       Start index of the resource range
+ * @range_num:         Number of resources in the range
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
+                                        u32 dev_id, u8 subtype,
+                                        u16 *range_start, u16 *range_num)
+{
+       return ti_sci_get_resource_range(handle, dev_id, subtype,
+                                        TI_SCI_IRQ_SECONDARY_HOST_INVALID,
+                                        range_start, range_num);
+}
+
+/**
+ * ti_sci_cmd_get_resource_range_from_shost - Get a range of resources
+ *                                           assigned to a specified host.
+ * @handle:            Pointer to TISCI handle.
+ * @dev_id:            TISCI device ID.
+ * @subtype:           Resource assignment subtype that is being requested
+ *                     from the given device.
+ * @s_host:            Host processor ID to which the resources are allocated
+ * @range_start:       Start index of the resource range
+ * @range_num:         Number of resources in the range
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static
+int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
+                                            u32 dev_id, u8 subtype, u8 s_host,
+                                            u16 *range_start, u16 *range_num)
+{
+       return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
+                                        range_start, range_num);
+}
+
+/**
+ * ti_sci_manage_irq() - Helper api to configure/release the irq route between
+ *                      the requested source and destination
+ * @handle:            Pointer to TISCI handle.
+ * @valid_params:      Bit fields defining the validity of certain params
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @dst_id:            Device ID of the IRQ destination
+ * @dst_host_irq:      IRQ number of the destination device
+ * @ia_id:             Device ID of the IA, if the IRQ flows through this IA
+ * @vint:              Virtual interrupt to be used within the IA
+ * @global_event:      Global event number to be used for the requesting event
+ * @vint_status_bit:   Virtual interrupt status bit to be used for the event
+ * @s_host:            Secondary host ID to which the irq/event is being
+ *                     requested for.
+ * @type:              Request type irq set or release.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_manage_irq(const struct ti_sci_handle *handle,
+                            u32 valid_params, u16 src_id, u16 src_index,
+                            u16 dst_id, u16 dst_host_irq, u16 ia_id, u16 vint,
+                            u16 global_event, u8 vint_status_bit, u8 s_host,
+                            u16 type)
+{
+       struct ti_sci_msg_req_manage_irq *req;
+       struct ti_sci_msg_hdr *resp;
+       struct ti_sci_xfer *xfer;
+       struct ti_sci_info *info;
+       struct device *dev;
+       int ret = 0;
+
+       if (IS_ERR(handle))
+               return PTR_ERR(handle);
+       if (!handle)
+               return -EINVAL;
+
+       info = handle_to_ti_sci_info(handle);
+       dev = info->dev;
+
+       xfer = ti_sci_get_one_xfer(info, type, TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+                                  sizeof(*req), sizeof(*resp));
+       if (IS_ERR(xfer)) {
+               ret = PTR_ERR(xfer);
+               dev_err(dev, "Message alloc failed(%d)\n", ret);
+               return ret;
+       }
+       req = (struct ti_sci_msg_req_manage_irq *)xfer->xfer_buf;
+       req->valid_params = valid_params;
+       req->src_id = src_id;
+       req->src_index = src_index;
+       req->dst_id = dst_id;
+       req->dst_host_irq = dst_host_irq;
+       req->ia_id = ia_id;
+       req->vint = vint;
+       req->global_event = global_event;
+       req->vint_status_bit = vint_status_bit;
+       req->secondary_host = s_host;
+
+       ret = ti_sci_do_xfer(info, xfer);
+       if (ret) {
+               dev_err(dev, "Mbox send fail %d\n", ret);
+               goto fail;
+       }
+
+       resp = (struct ti_sci_msg_hdr *)xfer->xfer_buf;
+
+       ret = ti_sci_is_response_ack(resp) ? 0 : -ENODEV;
+
+fail:
+       ti_sci_put_one_xfer(&info->minfo, xfer);
+
+       return ret;
+}
+
+/**
+ * ti_sci_set_irq() - Helper api to configure the irq route between the
+ *                   requested source and destination
+ * @handle:            Pointer to TISCI handle.
+ * @valid_params:      Bit fields defining the validity of certain params
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @dst_id:            Device ID of the IRQ destination
+ * @dst_host_irq:      IRQ number of the destination device
+ * @ia_id:             Device ID of the IA, if the IRQ flows through this IA
+ * @vint:              Virtual interrupt to be used within the IA
+ * @global_event:      Global event number to be used for the requesting event
+ * @vint_status_bit:   Virtual interrupt status bit to be used for the event
+ * @s_host:            Secondary host ID to which the irq/event is being
+ *                     requested for.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params,
+                         u16 src_id, u16 src_index, u16 dst_id,
+                         u16 dst_host_irq, u16 ia_id, u16 vint,
+                         u16 global_event, u8 vint_status_bit, u8 s_host)
+{
+       pr_debug("%s: IRQ set with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d,via ia_id = %d, vint = %d, global event = %d,status_bit = %d\n",
+                __func__, valid_params, src_id, src_index,
+                dst_id, dst_host_irq, ia_id, vint, global_event,
+                vint_status_bit);
+
+       return ti_sci_manage_irq(handle, valid_params, src_id, src_index,
+                                dst_id, dst_host_irq, ia_id, vint,
+                                global_event, vint_status_bit, s_host,
+                                TI_SCI_MSG_SET_IRQ);
+}
+
+/**
+ * ti_sci_free_irq() - Helper api to free the irq route between the
+ *                        requested source and destination
+ * @handle:            Pointer to TISCI handle.
+ * @valid_params:      Bit fields defining the validity of certain params
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @dst_id:            Device ID of the IRQ destination
+ * @dst_host_irq:      IRQ number of the destination device
+ * @ia_id:             Device ID of the IA, if the IRQ flows through this IA
+ * @vint:              Virtual interrupt to be used within the IA
+ * @global_event:      Global event number to be used for the requesting event
+ * @vint_status_bit:   Virtual interrupt status bit to be used for the event
+ * @s_host:            Secondary host ID to which the irq/event is being
+ *                     requested for.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_free_irq(const struct ti_sci_handle *handle, u32 valid_params,
+                          u16 src_id, u16 src_index, u16 dst_id,
+                          u16 dst_host_irq, u16 ia_id, u16 vint,
+                          u16 global_event, u8 vint_status_bit, u8 s_host)
+{
+       pr_debug("%s: IRQ release with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d,via ia_id = %d, vint = %d, global event = %d,status_bit = %d\n",
+                __func__, valid_params, src_id, src_index,
+                dst_id, dst_host_irq, ia_id, vint, global_event,
+                vint_status_bit);
+
+       return ti_sci_manage_irq(handle, valid_params, src_id, src_index,
+                                dst_id, dst_host_irq, ia_id, vint,
+                                global_event, vint_status_bit, s_host,
+                                TI_SCI_MSG_FREE_IRQ);
+}
+
+/**
+ * ti_sci_cmd_set_irq() - Configure a host irq route between the requested
+ *                       source and destination.
+ * @handle:            Pointer to TISCI handle.
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @dst_id:            Device ID of the IRQ destination
+ * @dst_host_irq:      IRQ number of the destination device
+ * @vint_irq:          Boolean specifying if this interrupt belongs to
+ *                     Interrupt Aggregator.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_set_irq(const struct ti_sci_handle *handle, u16 src_id,
+                             u16 src_index, u16 dst_id, u16 dst_host_irq)
+{
+       u32 valid_params = MSG_FLAG_DST_ID_VALID | MSG_FLAG_DST_HOST_IRQ_VALID;
+
+       return ti_sci_set_irq(handle, valid_params, src_id, src_index, dst_id,
+                             dst_host_irq, 0, 0, 0, 0, 0);
+}
+
+/**
+ * ti_sci_cmd_set_event_map() - Configure an event based irq route between the
+ *                             requested source and Interrupt Aggregator.
+ * @handle:            Pointer to TISCI handle.
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @ia_id:             Device ID of the IA, if the IRQ flows through this IA
+ * @vint:              Virtual interrupt to be used within the IA
+ * @global_event:      Global event number to be used for the requesting event
+ * @vint_status_bit:   Virtual interrupt status bit to be used for the event
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_set_event_map(const struct ti_sci_handle *handle,
+                                   u16 src_id, u16 src_index, u16 ia_id,
+                                   u16 vint, u16 global_event,
+                                   u8 vint_status_bit)
+{
+       u32 valid_params = MSG_FLAG_IA_ID_VALID | MSG_FLAG_VINT_VALID |
+                          MSG_FLAG_GLB_EVNT_VALID |
+                          MSG_FLAG_VINT_STS_BIT_VALID;
+
+       return ti_sci_set_irq(handle, valid_params, src_id, src_index, 0, 0,
+                             ia_id, vint, global_event, vint_status_bit, 0);
+}
+
+/**
+ * ti_sci_cmd_free_irq() - Free a host irq route between the between the
+ *                        requested source and destination.
+ * @handle:            Pointer to TISCI handle.
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @dst_id:            Device ID of the IRQ destination
+ * @dst_host_irq:      IRQ number of the destination device
+ * @vint_irq:          Boolean specifying if this interrupt belongs to
+ *                     Interrupt Aggregator.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_free_irq(const struct ti_sci_handle *handle, u16 src_id,
+                              u16 src_index, u16 dst_id, u16 dst_host_irq)
+{
+       u32 valid_params = MSG_FLAG_DST_ID_VALID | MSG_FLAG_DST_HOST_IRQ_VALID;
+
+       return ti_sci_free_irq(handle, valid_params, src_id, src_index, dst_id,
+                              dst_host_irq, 0, 0, 0, 0, 0);
+}
+
+/**
+ * ti_sci_cmd_free_event_map() - Free an event map between the requested source
+ *                              and Interrupt Aggregator.
+ * @handle:            Pointer to TISCI handle.
+ * @src_id:            Device ID of the IRQ source
+ * @src_index:         IRQ source index within the source device
+ * @ia_id:             Device ID of the IA, if the IRQ flows through this IA
+ * @vint:              Virtual interrupt to be used within the IA
+ * @global_event:      Global event number to be used for the requesting event
+ * @vint_status_bit:   Virtual interrupt status bit to be used for the event
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_free_event_map(const struct ti_sci_handle *handle,
+                                    u16 src_id, u16 src_index, u16 ia_id,
+                                    u16 vint, u16 global_event,
+                                    u8 vint_status_bit)
+{
+       u32 valid_params = MSG_FLAG_IA_ID_VALID |
+                          MSG_FLAG_VINT_VALID | MSG_FLAG_GLB_EVNT_VALID |
+                          MSG_FLAG_VINT_STS_BIT_VALID;
+
+       return ti_sci_free_irq(handle, valid_params, src_id, src_index, 0, 0,
+                              ia_id, vint, global_event, vint_status_bit, 0);
+}
+
 /*
  * ti_sci_setup_ops() - Setup the operations structures
  * @info:      pointer to TISCI pointer
@@ -1610,6 +2014,8 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
        struct ti_sci_core_ops *core_ops = &ops->core_ops;
        struct ti_sci_dev_ops *dops = &ops->dev_ops;
        struct ti_sci_clk_ops *cops = &ops->clk_ops;
+       struct ti_sci_rm_core_ops *rm_core_ops = &ops->rm_core_ops;
+       struct ti_sci_rm_irq_ops *iops = &ops->rm_irq_ops;
 
        core_ops->reboot_device = ti_sci_cmd_core_reboot;
 
@@ -1640,6 +2046,15 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
        cops->get_best_match_freq = ti_sci_cmd_clk_get_match_freq;
        cops->set_freq = ti_sci_cmd_clk_set_freq;
        cops->get_freq = ti_sci_cmd_clk_get_freq;
+
+       rm_core_ops->get_range = ti_sci_cmd_get_resource_range;
+       rm_core_ops->get_range_from_shost =
+                               ti_sci_cmd_get_resource_range_from_shost;
+
+       iops->set_irq = ti_sci_cmd_set_irq;
+       iops->set_event_map = ti_sci_cmd_set_event_map;
+       iops->free_irq = ti_sci_cmd_free_irq;
+       iops->free_event_map = ti_sci_cmd_free_event_map;
 }
 
 /**
@@ -1764,6 +2179,219 @@ const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(devm_ti_sci_get_handle);
 
+/**
+ * ti_sci_get_by_phandle() - Get the TI SCI handle using DT phandle
+ * @np:                device node
+ * @property:  property name containing phandle on TISCI node
+ *
+ * NOTE: The function does not track individual clients of the framework
+ * and is expected to be maintained by caller of TI SCI protocol library.
+ * ti_sci_put_handle must be balanced with successful ti_sci_get_by_phandle
+ * Return: pointer to handle if successful, else:
+ * -EPROBE_DEFER if the instance is not ready
+ * -ENODEV if the required node handler is missing
+ * -EINVAL if invalid conditions are encountered.
+ */
+const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
+                                                 const char *property)
+{
+       struct ti_sci_handle *handle = NULL;
+       struct device_node *ti_sci_np;
+       struct ti_sci_info *info;
+       struct list_head *p;
+
+       if (!np) {
+               pr_err("I need a device pointer\n");
+               return ERR_PTR(-EINVAL);
+       }
+
+       ti_sci_np = of_parse_phandle(np, property, 0);
+       if (!ti_sci_np)
+               return ERR_PTR(-ENODEV);
+
+       mutex_lock(&ti_sci_list_mutex);
+       list_for_each(p, &ti_sci_list) {
+               info = list_entry(p, struct ti_sci_info, node);
+               if (ti_sci_np == info->dev->of_node) {
+                       handle = &info->handle;
+                       info->users++;
+                       break;
+               }
+       }
+       mutex_unlock(&ti_sci_list_mutex);
+       of_node_put(ti_sci_np);
+
+       if (!handle)
+               return ERR_PTR(-EPROBE_DEFER);
+
+       return handle;
+}
+EXPORT_SYMBOL_GPL(ti_sci_get_by_phandle);
+
+/**
+ * devm_ti_sci_get_by_phandle() - Managed get handle using phandle
+ * @dev:       Device pointer requesting TISCI handle
+ * @property:  property name containing phandle on TISCI node
+ *
+ * NOTE: This releases the handle once the device resources are
+ * no longer needed. MUST NOT BE released with ti_sci_put_handle.
+ * The function does not track individual clients of the framework
+ * and is expected to be maintained by caller of TI SCI protocol library.
+ *
+ * Return: 0 if all went fine, else corresponding error.
+ */
+const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev,
+                                                      const char *property)
+{
+       const struct ti_sci_handle *handle;
+       const struct ti_sci_handle **ptr;
+
+       ptr = devres_alloc(devm_ti_sci_release, sizeof(*ptr), GFP_KERNEL);
+       if (!ptr)
+               return ERR_PTR(-ENOMEM);
+       handle = ti_sci_get_by_phandle(dev_of_node(dev), property);
+
+       if (!IS_ERR(handle)) {
+               *ptr = handle;
+               devres_add(dev, ptr);
+       } else {
+               devres_free(ptr);
+       }
+
+       return handle;
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_by_phandle);
+
+/**
+ * ti_sci_get_free_resource() - Get a free resource from TISCI resource.
+ * @res:       Pointer to the TISCI resource
+ *
+ * Return: resource num if all went ok else TI_SCI_RESOURCE_NULL.
+ */
+u16 ti_sci_get_free_resource(struct ti_sci_resource *res)
+{
+       unsigned long flags;
+       u16 set, free_bit;
+
+       raw_spin_lock_irqsave(&res->lock, flags);
+       for (set = 0; set < res->sets; set++) {
+               free_bit = find_first_zero_bit(res->desc[set].res_map,
+                                              res->desc[set].num);
+               if (free_bit != res->desc[set].num) {
+                       set_bit(free_bit, res->desc[set].res_map);
+                       raw_spin_unlock_irqrestore(&res->lock, flags);
+                       return res->desc[set].start + free_bit;
+               }
+       }
+       raw_spin_unlock_irqrestore(&res->lock, flags);
+
+       return TI_SCI_RESOURCE_NULL;
+}
+EXPORT_SYMBOL_GPL(ti_sci_get_free_resource);
+
+/**
+ * ti_sci_release_resource() - Release a resource from TISCI resource.
+ * @res:       Pointer to the TISCI resource
+ * @id:                Resource id to be released.
+ */
+void ti_sci_release_resource(struct ti_sci_resource *res, u16 id)
+{
+       unsigned long flags;
+       u16 set;
+
+       raw_spin_lock_irqsave(&res->lock, flags);
+       for (set = 0; set < res->sets; set++) {
+               if (res->desc[set].start <= id &&
+                   (res->desc[set].num + res->desc[set].start) > id)
+                       clear_bit(id - res->desc[set].start,
+                                 res->desc[set].res_map);
+       }
+       raw_spin_unlock_irqrestore(&res->lock, flags);
+}
+EXPORT_SYMBOL_GPL(ti_sci_release_resource);
+
+/**
+ * ti_sci_get_num_resources() - Get the number of resources in TISCI resource
+ * @res:       Pointer to the TISCI resource
+ *
+ * Return: Total number of available resources.
+ */
+u32 ti_sci_get_num_resources(struct ti_sci_resource *res)
+{
+       u32 set, count = 0;
+
+       for (set = 0; set < res->sets; set++)
+               count += res->desc[set].num;
+
+       return count;
+}
+EXPORT_SYMBOL_GPL(ti_sci_get_num_resources);
+
+/**
+ * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * @handle:    TISCI handle
+ * @dev:       Device pointer to which the resource is assigned
+ * @dev_id:    TISCI device id to which the resource is assigned
+ * @of_prop:   property name by which the resource are represented
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *        error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+                           struct device *dev, u32 dev_id, char *of_prop)
+{
+       struct ti_sci_resource *res;
+       u32 resource_subtype;
+       int i, ret;
+
+       res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
+       if (!res)
+               return ERR_PTR(-ENOMEM);
+
+       res->sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
+                                                   sizeof(u32));
+       if (res->sets < 0) {
+               dev_err(dev, "%s resource type ids not available\n", of_prop);
+               return ERR_PTR(res->sets);
+       }
+
+       res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
+                                GFP_KERNEL);
+       if (!res->desc)
+               return ERR_PTR(-ENOMEM);
+
+       for (i = 0; i < res->sets; i++) {
+               ret = of_property_read_u32_index(dev_of_node(dev), of_prop, i,
+                                                &resource_subtype);
+               if (ret)
+                       return ERR_PTR(-EINVAL);
+
+               ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
+                                                       resource_subtype,
+                                                       &res->desc[i].start,
+                                                       &res->desc[i].num);
+               if (ret) {
+                       dev_err(dev, "dev = %d subtype %d not allocated for this host\n",
+                               dev_id, resource_subtype);
+                       return ERR_PTR(ret);
+               }
+
+               dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
+                       dev_id, resource_subtype, res->desc[i].start,
+                       res->desc[i].num);
+
+               res->desc[i].res_map =
+                       devm_kzalloc(dev, BITS_TO_LONGS(res->desc[i].num) *
+                                    sizeof(*res->desc[i].res_map), GFP_KERNEL);
+               if (!res->desc[i].res_map)
+                       return ERR_PTR(-ENOMEM);
+       }
+       raw_spin_lock_init(&res->lock);
+
+       return res;
+}
+
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
                                void *cmd)
 {
@@ -1784,10 +2412,33 @@ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
        /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
        .max_msgs = 20,
        .max_msg_size = 64,
+       .rm_type_map = NULL,
+};
+
+static struct ti_sci_rm_type_map ti_sci_am654_rm_type_map[] = {
+       {.dev_id = 56, .type = 0x00b}, /* GIC_IRQ */
+       {.dev_id = 179, .type = 0x000}, /* MAIN_NAV_UDMASS_IA0 */
+       {.dev_id = 187, .type = 0x009}, /* MAIN_NAV_RA */
+       {.dev_id = 188, .type = 0x006}, /* MAIN_NAV_UDMAP */
+       {.dev_id = 194, .type = 0x007}, /* MCU_NAV_UDMAP */
+       {.dev_id = 195, .type = 0x00a}, /* MCU_NAV_RA */
+       {.dev_id = 0, .type = 0x000}, /* end of table */
+};
+
+/* Description for AM654 */
+static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
+       .default_host_id = 12,
+       /* Conservative duration */
+       .max_rx_timeout_ms = 10000,
+       /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
+       .max_msgs = 20,
+       .max_msg_size = 60,
+       .rm_type_map = ti_sci_am654_rm_type_map,
 };
 
 static const struct of_device_id ti_sci_of_match[] = {
        {.compatible = "ti,k2g-sci", .data = &ti_sci_pmmc_k2g_desc},
+       {.compatible = "ti,am654-sci", .data = &ti_sci_pmmc_am654_desc},
        { /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, ti_sci_of_match);
index 12bf316..4983827 100644 (file)
 #define TI_SCI_MSG_QUERY_CLOCK_FREQ    0x010d
 #define TI_SCI_MSG_GET_CLOCK_FREQ      0x010e
 
+/* Resource Management Requests */
+#define TI_SCI_MSG_GET_RESOURCE_RANGE  0x1500
+
+/* IRQ requests */
+#define TI_SCI_MSG_SET_IRQ             0x1000
+#define TI_SCI_MSG_FREE_IRQ            0x1001
+
 /**
  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
  * @type:      Type of messages: One of TI_SCI_MSG* values
@@ -461,4 +468,99 @@ struct ti_sci_msg_resp_get_clock_freq {
        u64 freq_hz;
 } __packed;
 
+#define TI_SCI_IRQ_SECONDARY_HOST_INVALID      0xff
+
+/**
+ * struct ti_sci_msg_req_get_resource_range - Request to get a host's assigned
+ *                                           range of resources.
+ * @hdr:               Generic Header
+ * @type:              Unique resource assignment type
+ * @subtype:           Resource assignment subtype within the resource type.
+ * @secondary_host:    Host processing entity to which the resources are
+ *                     allocated. This is required only when the destination
+ *                     host id id different from ti sci interface host id,
+ *                     else TI_SCI_IRQ_SECONDARY_HOST_INVALID can be passed.
+ *
+ * Request type is TI_SCI_MSG_GET_RESOURCE_RANGE. Responded with requested
+ * resource range which is of type TI_SCI_MSG_GET_RESOURCE_RANGE.
+ */
+struct ti_sci_msg_req_get_resource_range {
+       struct ti_sci_msg_hdr hdr;
+#define MSG_RM_RESOURCE_TYPE_MASK      GENMASK(9, 0)
+#define MSG_RM_RESOURCE_SUBTYPE_MASK   GENMASK(5, 0)
+       u16 type;
+       u8 subtype;
+       u8 secondary_host;
+} __packed;
+
+/**
+ * struct ti_sci_msg_resp_get_resource_range - Response to resource get range.
+ * @hdr:               Generic Header
+ * @range_start:       Start index of the resource range.
+ * @range_num:         Number of resources in the range.
+ *
+ * Response to request TI_SCI_MSG_GET_RESOURCE_RANGE.
+ */
+struct ti_sci_msg_resp_get_resource_range {
+       struct ti_sci_msg_hdr hdr;
+       u16 range_start;
+       u16 range_num;
+} __packed;
+
+/**
+ * struct ti_sci_msg_req_manage_irq - Request to configure/release the route
+ *                                     between the dev and the host.
+ * @hdr:               Generic Header
+ * @valid_params:      Bit fields defining the validity of interrupt source
+ *                     parameters. If a bit is not set, then corresponding
+ *                     field is not valid and will not be used for route set.
+ *                     Bit field definitions:
+ *                     0 - Valid bit for @dst_id
+ *                     1 - Valid bit for @dst_host_irq
+ *                     2 - Valid bit for @ia_id
+ *                     3 - Valid bit for @vint
+ *                     4 - Valid bit for @global_event
+ *                     5 - Valid bit for @vint_status_bit_index
+ *                     31 - Valid bit for @secondary_host
+ * @src_id:            IRQ source peripheral ID.
+ * @src_index:         IRQ source index within the peripheral
+ * @dst_id:            IRQ Destination ID. Based on the architecture it can be
+ *                     IRQ controller or host processor ID.
+ * @dst_host_irq:      IRQ number of the destination host IRQ controller
+ * @ia_id:             Device ID of the interrupt aggregator in which the
+ *                     vint resides.
+ * @vint:              Virtual interrupt number if the interrupt route
+ *                     is through an interrupt aggregator.
+ * @global_event:      Global event that is to be mapped to interrupt
+ *                     aggregator virtual interrupt status bit.
+ * @vint_status_bit:   Virtual interrupt status bit if the interrupt route
+ *                     utilizes an interrupt aggregator status bit.
+ * @secondary_host:    Host ID of the IRQ destination computing entity. This is
+ *                     required only when destination host id is different
+ *                     from ti sci interface host id.
+ *
+ * Request type is TI_SCI_MSG_SET/RELEASE_IRQ.
+ * Response is generic ACK / NACK message.
+ */
+struct ti_sci_msg_req_manage_irq {
+       struct ti_sci_msg_hdr hdr;
+#define MSG_FLAG_DST_ID_VALID                  TI_SCI_MSG_FLAG(0)
+#define MSG_FLAG_DST_HOST_IRQ_VALID            TI_SCI_MSG_FLAG(1)
+#define MSG_FLAG_IA_ID_VALID                   TI_SCI_MSG_FLAG(2)
+#define MSG_FLAG_VINT_VALID                    TI_SCI_MSG_FLAG(3)
+#define MSG_FLAG_GLB_EVNT_VALID                        TI_SCI_MSG_FLAG(4)
+#define MSG_FLAG_VINT_STS_BIT_VALID            TI_SCI_MSG_FLAG(5)
+#define MSG_FLAG_SHOST_VALID                   TI_SCI_MSG_FLAG(31)
+       u32 valid_params;
+       u16 src_id;
+       u16 src_index;
+       u16 dst_id;
+       u16 dst_host_irq;
+       u16 ia_id;
+       u16 vint;
+       u16 global_event;
+       u8 vint_status_bit;
+       u8 secondary_host;
+} __packed;
+
 #endif /* __TI_SCI_H */
similarity index 62%
rename from arch/arm/firmware/trusted_foundations.c
rename to drivers/firmware/trusted_foundations.c
index 689e656..fd49993 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/of.h>
+
+#include <linux/firmware/trusted_foundations.h>
+
 #include <asm/firmware.h>
-#include <asm/trusted_foundations.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/outercache.h>
+
+#define TF_CACHE_MAINT         0xfffff100
+
+#define TF_CACHE_ENABLE                1
+#define TF_CACHE_DISABLE       2
 
 #define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200
 
@@ -60,16 +69,75 @@ static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
        return 0;
 }
 
-static int tf_prepare_idle(void)
+static int tf_prepare_idle(unsigned long mode)
 {
-       tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1_NOFLUSH_L2, cpu_boot_addr);
+       switch (mode) {
+       case TF_PM_MODE_LP0:
+               tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S3, cpu_boot_addr);
+               break;
+
+       case TF_PM_MODE_LP1:
+               tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S2, cpu_boot_addr);
+               break;
+
+       case TF_PM_MODE_LP1_NO_MC_CLK:
+               tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S2_NO_MC_CLK,
+                              cpu_boot_addr);
+               break;
+
+       case TF_PM_MODE_LP2:
+               tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1, cpu_boot_addr);
+               break;
+
+       case TF_PM_MODE_LP2_NOFLUSH_L2:
+               tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1_NOFLUSH_L2,
+                              cpu_boot_addr);
+               break;
+
+       default:
+               return -EINVAL;
+       }
 
        return 0;
 }
 
+#ifdef CONFIG_CACHE_L2X0
+static void tf_cache_write_sec(unsigned long val, unsigned int reg)
+{
+       u32 l2x0_way_mask = 0xff;
+
+       switch (reg) {
+       case L2X0_CTRL:
+               if (l2x0_saved_regs.aux_ctrl & L310_AUX_CTRL_ASSOCIATIVITY_16)
+                       l2x0_way_mask = 0xffff;
+
+               if (val == L2X0_CTRL_EN)
+                       tf_generic_smc(TF_CACHE_MAINT, TF_CACHE_ENABLE,
+                                      l2x0_saved_regs.aux_ctrl);
+               else
+                       tf_generic_smc(TF_CACHE_MAINT, TF_CACHE_DISABLE,
+                                      l2x0_way_mask);
+               break;
+
+       default:
+               break;
+       }
+}
+
+static int tf_init_cache(void)
+{
+       outer_cache.write_sec = tf_cache_write_sec;
+
+       return 0;
+}
+#endif /* CONFIG_CACHE_L2X0 */
+
 static const struct firmware_ops trusted_foundations_ops = {
        .set_cpu_boot_addr = tf_set_cpu_boot_addr,
        .prepare_idle = tf_prepare_idle,
+#ifdef CONFIG_CACHE_L2X0
+       .l2x0_init = tf_init_cache,
+#endif
 };
 
 void register_trusted_foundations(struct trusted_foundations_platform_data *pd)
@@ -101,3 +169,8 @@ void of_register_trusted_foundations(void)
                panic("Trusted Foundation: missing version-minor property\n");
        register_trusted_foundations(&pdata);
 }
+
+bool trusted_foundations_registered(void)
+{
+       return firmware_ops == &trusted_foundations_ops;
+}
index 2771df6..c6d0724 100644 (file)
@@ -90,9 +90,6 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
        int ret;
        struct zynqmp_pm_query_data qdata = {0};
 
-       if (!eemi_ops)
-               return -ENXIO;
-
        switch (pm_id) {
        case PM_GET_API_VERSION:
                ret = eemi_ops->get_api_version(&pm_api_version);
@@ -163,21 +160,14 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
 
        strcpy(debugfs_buf, "");
 
-       if (*off != 0 || len == 0)
+       if (*off != 0 || len <= 1 || len > PAGE_SIZE - 1)
                return -EINVAL;
 
-       kern_buff = kzalloc(len, GFP_KERNEL);
-       if (!kern_buff)
-               return -ENOMEM;
-
+       kern_buff = memdup_user_nul(ptr, len);
+       if (IS_ERR(kern_buff))
+               return PTR_ERR(kern_buff);
        tmp_buff = kern_buff;
 
-       ret = strncpy_from_user(kern_buff, ptr, len);
-       if (ret < 0) {
-               ret = -EFAULT;
-               goto err;
-       }
-
        /* Read the API name from a user request */
        pm_api_req = strsep(&kern_buff, " ");
 
index 98f9361..fd3d837 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/firmware/xlnx-zynqmp.h>
 #include "zynqmp-debug.h"
 
+static const struct zynqmp_eemi_ops *eemi_ops_tbl;
+
 static const struct mfd_cell firmware_devs[] = {
        {
                .name = "zynqmp_power_controller",
@@ -538,6 +540,49 @@ static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
 }
 
 /**
+ * zynqmp_pm_fpga_load - Perform the fpga load
+ * @address:   Address to write to
+ * @size:      pl bitstream size
+ * @flags:     Bitstream type
+ *     -XILINX_ZYNQMP_PM_FPGA_FULL:  FPGA full reconfiguration
+ *     -XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
+ *
+ * This function provides access to pmufw. To transfer
+ * the required bitstream into PL.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_fpga_load(const u64 address, const u32 size,
+                              const u32 flags)
+{
+       return zynqmp_pm_invoke_fn(PM_FPGA_LOAD, lower_32_bits(address),
+                                  upper_32_bits(address), size, flags, NULL);
+}
+
+/**
+ * zynqmp_pm_fpga_get_status - Read value from PCAP status register
+ * @value: Value to read
+ *
+ * This function provides access to the pmufw to get the PCAP
+ * status
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_fpga_get_status(u32 *value)
+{
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       int ret;
+
+       if (!value)
+               return -EINVAL;
+
+       ret = zynqmp_pm_invoke_fn(PM_FPGA_GET_STATUS, 0, 0, 0, 0, ret_payload);
+       *value = ret_payload[1];
+
+       return ret;
+}
+
+/**
  * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
  *                            master has initialized its own power management
  *
@@ -640,6 +685,8 @@ static const struct zynqmp_eemi_ops eemi_ops = {
        .request_node = zynqmp_pm_request_node,
        .release_node = zynqmp_pm_release_node,
        .set_requirement = zynqmp_pm_set_requirement,
+       .fpga_load = zynqmp_pm_fpga_load,
+       .fpga_get_status = zynqmp_pm_fpga_get_status,
 };
 
 /**
@@ -649,7 +696,11 @@ static const struct zynqmp_eemi_ops eemi_ops = {
  */
 const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
 {
-       return &eemi_ops;
+       if (eemi_ops_tbl)
+               return eemi_ops_tbl;
+       else
+               return ERR_PTR(-EPROBE_DEFER);
+
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_get_eemi_ops);
 
@@ -694,6 +745,9 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
        pr_info("%s Trustzone version v%d.%d\n", __func__,
                pm_tz_version >> 16, pm_tz_version & 0xFFFF);
 
+       /* Assign eemi_ops_table */
+       eemi_ops_tbl = &eemi_ops;
+
        zynqmp_pm_api_debugfs_init();
 
        ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs,
index 3a75f42..ae3d7f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # FMC (ANSI-VITA 57.1) bus support
 #
index c20445b..8072c19 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # FPGA framework configuration
 #
@@ -204,4 +205,13 @@ config FPGA_DFL_PCI
 
          To compile this as a module, choose M here.
 
+config FPGA_MGR_ZYNQMP_FPGA
+       tristate "Xilinx ZynqMP FPGA"
+       depends on ARCH_ZYNQMP || COMPILE_TEST
+       help
+         FPGA manager driver support for Xilinx ZynqMP FPGAs.
+         This driver uses the processor configuration port(PCAP)
+         to configure the programmable logic(PL) through PS
+         on ZynqMP SoC.
+
 endif # FPGA
index c0dd4c8..312b937 100644 (file)
@@ -17,6 +17,7 @@ obj-$(CONFIG_FPGA_MGR_STRATIX10_SOC)  += stratix10-soc.o
 obj-$(CONFIG_FPGA_MGR_TS73XX)          += ts73xx-fpga.o
 obj-$(CONFIG_FPGA_MGR_XILINX_SPI)      += xilinx-spi.o
 obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA)       += zynq-fpga.o
+obj-$(CONFIG_FPGA_MGR_ZYNQMP_FPGA)     += zynqmp-fpga.o
 obj-$(CONFIG_ALTERA_PR_IP_CORE)         += altera-pr-ip-core.o
 obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT)    += altera-pr-ip-core-plat.o
 
diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
new file mode 100644 (file)
index 0000000..f7cbaad
--- /dev/null
@@ -0,0 +1,159 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Xilinx, Inc.
+ */
+
+#include <linux/dma-mapping.h>
+#include <linux/fpga/fpga-mgr.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/string.h>
+#include <linux/firmware/xlnx-zynqmp.h>
+
+/* Constant Definitions */
+#define IXR_FPGA_DONE_MASK     BIT(3)
+
+/**
+ * struct zynqmp_fpga_priv - Private data structure
+ * @dev:       Device data structure
+ * @flags:     flags which is used to identify the bitfile type
+ */
+struct zynqmp_fpga_priv {
+       struct device *dev;
+       u32 flags;
+};
+
+static int zynqmp_fpga_ops_write_init(struct fpga_manager *mgr,
+                                     struct fpga_image_info *info,
+                                     const char *buf, size_t size)
+{
+       struct zynqmp_fpga_priv *priv;
+
+       priv = mgr->priv;
+       priv->flags = info->flags;
+
+       return 0;
+}
+
+static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
+                                const char *buf, size_t size)
+{
+       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
+       struct zynqmp_fpga_priv *priv;
+       dma_addr_t dma_addr;
+       u32 eemi_flags = 0;
+       char *kbuf;
+       int ret;
+
+       if (!eemi_ops || !eemi_ops->fpga_load)
+               return -ENXIO;
+
+       priv = mgr->priv;
+
+       kbuf = dma_alloc_coherent(priv->dev, size, &dma_addr, GFP_KERNEL);
+       if (!kbuf)
+               return -ENOMEM;
+
+       memcpy(kbuf, buf, size);
+
+       wmb(); /* ensure all writes are done before initiate FW call */
+
+       if (priv->flags & FPGA_MGR_PARTIAL_RECONFIG)
+               eemi_flags |= XILINX_ZYNQMP_PM_FPGA_PARTIAL;
+
+       ret = eemi_ops->fpga_load(dma_addr, size, eemi_flags);
+
+       dma_free_coherent(priv->dev, size, kbuf, dma_addr);
+
+       return ret;
+}
+
+static int zynqmp_fpga_ops_write_complete(struct fpga_manager *mgr,
+                                         struct fpga_image_info *info)
+{
+       return 0;
+}
+
+static enum fpga_mgr_states zynqmp_fpga_ops_state(struct fpga_manager *mgr)
+{
+       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
+       u32 status;
+
+       if (!eemi_ops || !eemi_ops->fpga_get_status)
+               return FPGA_MGR_STATE_UNKNOWN;
+
+       eemi_ops->fpga_get_status(&status);
+       if (status & IXR_FPGA_DONE_MASK)
+               return FPGA_MGR_STATE_OPERATING;
+
+       return FPGA_MGR_STATE_UNKNOWN;
+}
+
+static const struct fpga_manager_ops zynqmp_fpga_ops = {
+       .state = zynqmp_fpga_ops_state,
+       .write_init = zynqmp_fpga_ops_write_init,
+       .write = zynqmp_fpga_ops_write,
+       .write_complete = zynqmp_fpga_ops_write_complete,
+};
+
+static int zynqmp_fpga_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct zynqmp_fpga_priv *priv;
+       struct fpga_manager *mgr;
+       int ret;
+
+       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       priv->dev = dev;
+
+       mgr = devm_fpga_mgr_create(dev, "Xilinx ZynqMP FPGA Manager",
+                                  &zynqmp_fpga_ops, priv);
+       if (!mgr)
+               return -ENOMEM;
+
+       platform_set_drvdata(pdev, mgr);
+
+       ret = fpga_mgr_register(mgr);
+       if (ret) {
+               dev_err(dev, "unable to register FPGA manager");
+               return ret;
+       }
+
+       return 0;
+}
+
+static int zynqmp_fpga_remove(struct platform_device *pdev)
+{
+       struct fpga_manager *mgr = platform_get_drvdata(pdev);
+
+       fpga_mgr_unregister(mgr);
+
+       return 0;
+}
+
+static const struct of_device_id zynqmp_fpga_of_match[] = {
+       { .compatible = "xlnx,zynqmp-pcap-fpga", },
+       {},
+};
+
+MODULE_DEVICE_TABLE(of, zynqmp_fpga_of_match);
+
+static struct platform_driver zynqmp_fpga_driver = {
+       .probe = zynqmp_fpga_probe,
+       .remove = zynqmp_fpga_remove,
+       .driver = {
+               .name = "zynqmp_fpga_manager",
+               .of_match_table = of_match_ptr(zynqmp_fpga_of_match),
+       },
+};
+
+module_platform_driver(zynqmp_fpga_driver);
+
+MODULE_AUTHOR("Nava kishore Manne <navam@xilinx.com>");
+MODULE_DESCRIPTION("Xilinx ZynqMp FPGA Manager");
+MODULE_LICENSE("GPL");
index 5cc20f3..c612db7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # FSI subsystem
 #
index 62687ec..e4a2ff0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_FSI) += fsi-core.o
 obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o
index 4eb3a76..4dcce17 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * A FSI master controller, using a simple GPIO bit-banging interface
  */
index 6d8c802..a0404ce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # GNSS receiver configuration
 #
index 41f0836..be832eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # GPIO infrastructure and drivers
 #
@@ -286,6 +287,19 @@ config GPIO_IOP
 
          If unsure, say N.
 
+config GPIO_IXP4XX
+       bool "Intel IXP4xx GPIO"
+       depends on ARM # For <asm/mach-types.h>
+       depends on ARCH_IXP4XX
+       select GPIO_GENERIC
+       select IRQ_DOMAIN
+       select IRQ_DOMAIN_HIERARCHY
+       help
+         Say yes here to support the GPIO functionality of a number of Intel
+         IXP4xx series of chips.
+
+         If unsure, say N.
+
 config GPIO_LOONGSON
        bool "Loongson-2/3 GPIO support"
        depends on CPU_LOONGSON2 || CPU_LOONGSON3
index e19be76..6700eee 100644 (file)
@@ -61,6 +61,7 @@ obj-$(CONFIG_GPIO_HLWD)               += gpio-hlwd.o
 obj-$(CONFIG_HTC_EGPIO)                += gpio-htc-egpio.o
 obj-$(CONFIG_GPIO_ICH)         += gpio-ich.o
 obj-$(CONFIG_GPIO_IOP)         += gpio-iop.o
+obj-$(CONFIG_GPIO_IXP4XX)      += gpio-ixp4xx.o
 obj-$(CONFIG_GPIO_IT87)                += gpio-it87.o
 obj-$(CONFIG_GPIO_JANZ_TTL)    += gpio-janz-ttl.o
 obj-$(CONFIG_GPIO_KEMPLD)      += gpio-kempld.o
index 748fdd4..e088b90 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2013 Altera Corporation
  * Based on gpio-mpc8xxx.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/io.h>
diff --git a/drivers/gpio/gpio-ixp4xx.c b/drivers/gpio/gpio-ixp4xx.c
new file mode 100644 (file)
index 0000000..4b1cf7e
--- /dev/null
@@ -0,0 +1,474 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// IXP4 GPIO driver
+// Copyright (C) 2019 Linus Walleij <linus.walleij@linaro.org>
+//
+// based on previous work and know-how from:
+// Deepak Saxena <dsaxena@plexity.net>
+
+#include <linux/gpio/driver.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/irqchip.h>
+#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include <linux/bitops.h>
+/* Include that go away with DT transition */
+#include <linux/irqchip/irq-ixp4xx.h>
+
+#include <asm/mach-types.h>
+
+#define IXP4XX_REG_GPOUT       0x00
+#define IXP4XX_REG_GPOE                0x04
+#define IXP4XX_REG_GPIN                0x08
+#define IXP4XX_REG_GPIS                0x0C
+#define IXP4XX_REG_GPIT1       0x10
+#define IXP4XX_REG_GPIT2       0x14
+#define IXP4XX_REG_GPCLK       0x18
+#define IXP4XX_REG_GPDBSEL     0x1C
+
+/*
+ * The hardware uses 3 bits to indicate interrupt "style".
+ * we clear and set these three bits accordingly. The lower 24
+ * bits in two registers (GPIT1 and GPIT2) are used to set up
+ * the style for 8 lines each for a total of 16 GPIO lines.
+ */
+#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH  0x0
+#define IXP4XX_GPIO_STYLE_ACTIVE_LOW   0x1
+#define IXP4XX_GPIO_STYLE_RISING_EDGE  0x2
+#define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3
+#define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4
+#define IXP4XX_GPIO_STYLE_MASK         GENMASK(2, 0)
+#define IXP4XX_GPIO_STYLE_SIZE         3
+
+/**
+ * struct ixp4xx_gpio - IXP4 GPIO state container
+ * @dev: containing device for this instance
+ * @fwnode: the fwnode for this GPIO chip
+ * @gc: gpiochip for this instance
+ * @domain: irqdomain for this chip instance
+ * @base: remapped I/O-memory base
+ * @irq_edge: Each bit represents an IRQ: 1: edge-triggered,
+ * 0: level triggered
+ */
+struct ixp4xx_gpio {
+       struct device *dev;
+       struct fwnode_handle *fwnode;
+       struct gpio_chip gc;
+       struct irq_domain *domain;
+       void __iomem *base;
+       unsigned long long irq_edge;
+};
+
+/**
+ * struct ixp4xx_gpio_map - IXP4 GPIO to parent IRQ map
+ * @gpio_offset: offset of the IXP4 GPIO line
+ * @parent_hwirq: hwirq on the parent IRQ controller
+ */
+struct ixp4xx_gpio_map {
+       int gpio_offset;
+       int parent_hwirq;
+};
+
+/* GPIO lines 0..12 have corresponding IRQs, GPIOs 13..15 have no IRQs */
+const struct ixp4xx_gpio_map ixp4xx_gpiomap[] = {
+       { .gpio_offset = 0, .parent_hwirq = 6 },
+       { .gpio_offset = 1, .parent_hwirq = 7 },
+       { .gpio_offset = 2, .parent_hwirq = 19 },
+       { .gpio_offset = 3, .parent_hwirq = 20 },
+       { .gpio_offset = 4, .parent_hwirq = 21 },
+       { .gpio_offset = 5, .parent_hwirq = 22 },
+       { .gpio_offset = 6, .parent_hwirq = 23 },
+       { .gpio_offset = 7, .parent_hwirq = 24 },
+       { .gpio_offset = 8, .parent_hwirq = 25 },
+       { .gpio_offset = 9, .parent_hwirq = 26 },
+       { .gpio_offset = 10, .parent_hwirq = 27 },
+       { .gpio_offset = 11, .parent_hwirq = 28 },
+       { .gpio_offset = 12, .parent_hwirq = 29 },
+};
+
+static void ixp4xx_gpio_irq_ack(struct irq_data *d)
+{
+       struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d);
+
+       __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS);
+}
+
+static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
+{
+       struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d);
+
+       /* ACK when unmasking if not edge-triggered */
+       if (!(g->irq_edge & BIT(d->hwirq)))
+               ixp4xx_gpio_irq_ack(d);
+
+       irq_chip_unmask_parent(d);
+}
+
+static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
+{
+       struct ixp4xx_gpio *g = irq_data_get_irq_chip_data(d);
+       int line = d->hwirq;
+       unsigned long flags;
+       u32 int_style;
+       u32 int_reg;
+       u32 val;
+
+       switch (type) {
+       case IRQ_TYPE_EDGE_BOTH:
+               irq_set_handler_locked(d, handle_edge_irq);
+               int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL;
+               g->irq_edge |= BIT(d->hwirq);
+               break;
+       case IRQ_TYPE_EDGE_RISING:
+               irq_set_handler_locked(d, handle_edge_irq);
+               int_style = IXP4XX_GPIO_STYLE_RISING_EDGE;
+               g->irq_edge |= BIT(d->hwirq);
+               break;
+       case IRQ_TYPE_EDGE_FALLING:
+               irq_set_handler_locked(d, handle_edge_irq);
+               int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE;
+               g->irq_edge |= BIT(d->hwirq);
+               break;
+       case IRQ_TYPE_LEVEL_HIGH:
+               irq_set_handler_locked(d, handle_level_irq);
+               int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
+               g->irq_edge &= ~BIT(d->hwirq);
+               break;
+       case IRQ_TYPE_LEVEL_LOW:
+               irq_set_handler_locked(d, handle_level_irq);
+               int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW;
+               g->irq_edge &= ~BIT(d->hwirq);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (line >= 8) {
+               /* pins 8-15 */
+               line -= 8;
+               int_reg = IXP4XX_REG_GPIT2;
+       } else {
+               /* pins 0-7 */
+               int_reg = IXP4XX_REG_GPIT1;
+       }
+
+       spin_lock_irqsave(&g->gc.bgpio_lock, flags);
+
+       /* Clear the style for the appropriate pin */
+       val = __raw_readl(g->base + int_reg);
+       val &= ~(IXP4XX_GPIO_STYLE_MASK << (line * IXP4XX_GPIO_STYLE_SIZE));
+       __raw_writel(val, g->base + int_reg);
+
+       __raw_writel(BIT(line), g->base + IXP4XX_REG_GPIS);
+
+       /* Set the new style */
+       val = __raw_readl(g->base + int_reg);
+       val |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
+       __raw_writel(val, g->base + int_reg);
+
+       /* Force-configure this line as an input */
+       val = __raw_readl(g->base + IXP4XX_REG_GPOE);
+       val |= BIT(d->hwirq);
+       __raw_writel(val, g->base + IXP4XX_REG_GPOE);
+
+       spin_unlock_irqrestore(&g->gc.bgpio_lock, flags);
+
+       /* This parent only accept level high (asserted) */
+       return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
+}
+
+static struct irq_chip ixp4xx_gpio_irqchip = {
+       .name = "IXP4GPIO",
+       .irq_ack = ixp4xx_gpio_irq_ack,
+       .irq_mask = irq_chip_mask_parent,
+       .irq_unmask = ixp4xx_gpio_irq_unmask,
+       .irq_set_type = ixp4xx_gpio_irq_set_type,
+};
+
+static int ixp4xx_gpio_to_irq(struct gpio_chip *gc, unsigned int offset)
+{
+       struct ixp4xx_gpio *g = gpiochip_get_data(gc);
+       struct irq_fwspec fwspec;
+
+       fwspec.fwnode = g->fwnode;
+       fwspec.param_count = 2;
+       fwspec.param[0] = offset;
+       fwspec.param[1] = IRQ_TYPE_NONE;
+
+       return irq_create_fwspec_mapping(&fwspec);
+}
+
+static int ixp4xx_gpio_irq_domain_translate(struct irq_domain *domain,
+                                           struct irq_fwspec *fwspec,
+                                           unsigned long *hwirq,
+                                           unsigned int *type)
+{
+
+       /* We support standard DT translation */
+       if (is_of_node(fwspec->fwnode) && fwspec->param_count == 2) {
+               *hwirq = fwspec->param[0];
+               *type = fwspec->param[1];
+               return 0;
+       }
+
+       /* This goes away when we transition to DT */
+       if (is_fwnode_irqchip(fwspec->fwnode)) {
+               if (fwspec->param_count != 2)
+                       return -EINVAL;
+               *hwirq = fwspec->param[0];
+               *type = fwspec->param[1];
+               WARN_ON(*type == IRQ_TYPE_NONE);
+               return 0;
+       }
+       return -EINVAL;
+}
+
+static int ixp4xx_gpio_irq_domain_alloc(struct irq_domain *d,
+                                       unsigned int irq, unsigned int nr_irqs,
+                                       void *data)
+{
+       struct ixp4xx_gpio *g = d->host_data;
+       irq_hw_number_t hwirq;
+       unsigned int type = IRQ_TYPE_NONE;
+       struct irq_fwspec *fwspec = data;
+       int ret;
+       int i;
+
+       ret = ixp4xx_gpio_irq_domain_translate(d, fwspec, &hwirq, &type);
+       if (ret)
+               return ret;
+
+       dev_dbg(g->dev, "allocate IRQ %d..%d, hwirq %lu..%lu\n",
+               irq, irq + nr_irqs - 1,
+               hwirq, hwirq + nr_irqs - 1);
+
+       for (i = 0; i < nr_irqs; i++) {
+               struct irq_fwspec parent_fwspec;
+               const struct ixp4xx_gpio_map *map;
+               int j;
+
+               /* Not all lines support IRQs */
+               for (j = 0; j < ARRAY_SIZE(ixp4xx_gpiomap); j++) {
+                       map = &ixp4xx_gpiomap[j];
+                       if (map->gpio_offset == hwirq)
+                               break;
+               }
+               if (j == ARRAY_SIZE(ixp4xx_gpiomap)) {
+                       dev_err(g->dev, "can't look up hwirq %lu\n", hwirq);
+                       return -EINVAL;
+               }
+               dev_dbg(g->dev, "found parent hwirq %u\n", map->parent_hwirq);
+
+               /*
+                * We set handle_bad_irq because the .set_type() should
+                * always be invoked and set the right type of handler.
+                */
+               irq_domain_set_info(d,
+                                   irq + i,
+                                   hwirq + i,
+                                   &ixp4xx_gpio_irqchip,
+                                   g,
+                                   handle_bad_irq,
+                                   NULL, NULL);
+               irq_set_probe(irq + i);
+
+               /*
+                * Create a IRQ fwspec to send up to the parent irqdomain:
+                * specify the hwirq we address on the parent and tie it
+                * all together up the chain.
+                */
+               parent_fwspec.fwnode = d->parent->fwnode;
+               parent_fwspec.param_count = 2;
+               parent_fwspec.param[0] = map->parent_hwirq;
+               /* This parent only handles asserted level IRQs */
+               parent_fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH;
+               dev_dbg(g->dev, "alloc_irqs_parent for %d parent hwirq %d\n",
+                       irq + i, map->parent_hwirq);
+               ret = irq_domain_alloc_irqs_parent(d, irq + i, 1,
+                                                  &parent_fwspec);
+               if (ret)
+                       dev_err(g->dev,
+                               "failed to allocate parent hwirq %d for hwirq %lu\n",
+                               map->parent_hwirq, hwirq);
+       }
+
+       return 0;
+}
+
+static const struct irq_domain_ops ixp4xx_gpio_irqdomain_ops = {
+       .translate = ixp4xx_gpio_irq_domain_translate,
+       .alloc = ixp4xx_gpio_irq_domain_alloc,
+       .free = irq_domain_free_irqs_common,
+};
+
+static int ixp4xx_gpio_probe(struct platform_device *pdev)
+{
+       unsigned long flags;
+       struct device *dev = &pdev->dev;
+       struct device_node *np = dev->of_node;
+       struct irq_domain *parent;
+       struct resource *res;
+       struct ixp4xx_gpio *g;
+       int ret;
+       int i;
+
+       g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL);
+       if (!g)
+               return -ENOMEM;
+       g->dev = dev;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       g->base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(g->base)) {
+               dev_err(dev, "ioremap error\n");
+               return PTR_ERR(g->base);
+       }
+
+       /*
+        * Make sure GPIO 14 and 15 are NOT used as clocks but GPIO on
+        * specific machines.
+        */
+       if (machine_is_dsmg600() || machine_is_nas100d())
+               __raw_writel(0x0, g->base + IXP4XX_REG_GPCLK);
+
+       /*
+        * This is a very special big-endian ARM issue: when the IXP4xx is
+        * run in big endian mode, all registers in the machine are switched
+        * around to the CPU-native endianness. As you see mostly in the
+        * driver we use __raw_readl()/__raw_writel() to access the registers
+        * in the appropriate order. With the GPIO library we need to specify
+        * byte order explicitly, so this flag needs to be set when compiling
+        * for big endian.
+        */
+#if defined(CONFIG_CPU_BIG_ENDIAN)
+       flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER;
+#else
+       flags = 0;
+#endif
+
+       /* Populate and register gpio chip */
+       ret = bgpio_init(&g->gc, dev, 4,
+                        g->base + IXP4XX_REG_GPIN,
+                        g->base + IXP4XX_REG_GPOUT,
+                        NULL,
+                        NULL,
+                        g->base + IXP4XX_REG_GPOE,
+                        flags);
+       if (ret) {
+               dev_err(dev, "unable to init generic GPIO\n");
+               return ret;
+       }
+       g->gc.to_irq = ixp4xx_gpio_to_irq;
+       g->gc.ngpio = 16;
+       g->gc.label = "IXP4XX_GPIO_CHIP";
+       /*
+        * TODO: when we have migrated to device tree and all GPIOs
+        * are fetched using phandles, set this to -1 to get rid of
+        * the fixed gpiochip base.
+        */
+       g->gc.base = 0;
+       g->gc.parent = &pdev->dev;
+       g->gc.owner = THIS_MODULE;
+
+       ret = devm_gpiochip_add_data(dev, &g->gc, g);
+       if (ret) {
+               dev_err(dev, "failed to add SoC gpiochip\n");
+               return ret;
+       }
+
+       /*
+        * When we convert to device tree we will simply look up the
+        * parent irqdomain using irq_find_host(parent) as parent comes
+        * from IRQCHIP_DECLARE(), then use of_node_to_fwnode() to get
+        * the fwnode. For now we need this boardfile style code.
+        */
+       if (np) {
+               struct device_node *irq_parent;
+
+               irq_parent = of_irq_find_parent(np);
+               if (!irq_parent) {
+                       dev_err(dev, "no IRQ parent node\n");
+                       return -ENODEV;
+               }
+               parent = irq_find_host(irq_parent);
+               if (!parent) {
+                       dev_err(dev, "no IRQ parent domain\n");
+                       return -ENODEV;
+               }
+               g->fwnode = of_node_to_fwnode(np);
+       } else {
+               parent = ixp4xx_get_irq_domain();
+               g->fwnode = irq_domain_alloc_fwnode(g->base);
+               if (!g->fwnode) {
+                       dev_err(dev, "no domain base\n");
+                       return -ENODEV;
+               }
+       }
+       g->domain = irq_domain_create_hierarchy(parent,
+                                               IRQ_DOMAIN_FLAG_HIERARCHY,
+                                               ARRAY_SIZE(ixp4xx_gpiomap),
+                                               g->fwnode,
+                                               &ixp4xx_gpio_irqdomain_ops,
+                                               g);
+       if (!g->domain) {
+               irq_domain_free_fwnode(g->fwnode);
+               dev_err(dev, "no hierarchical irq domain\n");
+               return ret;
+       }
+
+       /*
+        * After adding OF support, this is no longer needed: irqs
+        * will be allocated for the respective fwnodes.
+        */
+       if (!np) {
+               for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) {
+                       const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i];
+                       struct irq_fwspec fwspec;
+
+                       fwspec.fwnode = g->fwnode;
+                       /* This is the hwirq for the GPIO line side of things */
+                       fwspec.param[0] = map->gpio_offset;
+                       fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
+                       fwspec.param_count = 2;
+                       ret = __irq_domain_alloc_irqs(g->domain,
+                                                     -1, /* just pick something */
+                                                     1,
+                                                     NUMA_NO_NODE,
+                                                     &fwspec,
+                                                     false,
+                                                     NULL);
+                       if (ret < 0) {
+                               irq_domain_free_fwnode(g->fwnode);
+                               dev_err(dev,
+                                       "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
+                                       map->gpio_offset, map->parent_hwirq,
+                                       ret);
+                               return ret;
+                       }
+               }
+       }
+
+       platform_set_drvdata(pdev, g);
+       dev_info(dev, "IXP4 GPIO @%p registered\n", g->base);
+
+       return 0;
+}
+
+static const struct of_device_id ixp4xx_gpio_of_match[] = {
+       {
+               .compatible = "intel,ixp4xx-gpio",
+       },
+       {},
+};
+
+
+static struct platform_driver ixp4xx_gpio_driver = {
+       .driver = {
+               .name           = "ixp4xx-gpio",
+               .of_match_table = of_match_ptr(ixp4xx_gpio_of_match),
+       },
+       .probe = ixp4xx_gpio_probe,
+};
+builtin_platform_driver(ixp4xx_gpio_driver);
index 1306722..715371b 100644 (file)
@@ -363,22 +363,16 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data)
 {
        struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
        struct thunderx_gpio *txgpio = txline->txgpio;
-       struct irq_data *parent_data = data->parent_data;
        int r;
 
        r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
        if (r)
                return r;
 
-       if (parent_data && parent_data->chip->irq_request_resources) {
-               r = parent_data->chip->irq_request_resources(parent_data);
-               if (r)
-                       goto error;
-       }
+       r = irq_chip_request_resources_parent(data);
+       if (r)
+               gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
 
-       return 0;
-error:
-       gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
        return r;
 }
 
@@ -386,10 +380,8 @@ static void thunderx_gpio_irq_release_resources(struct irq_data *data)
 {
        struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
        struct thunderx_gpio *txgpio = txline->txgpio;
-       struct irq_data *parent_data = data->parent_data;
 
-       if (parent_data && parent_data->chip->irq_release_resources)
-               parent_data->chip->irq_release_resources(parent_data);
+       irq_chip_release_resources_parent(data);
 
        gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
 }
index 641a051..38c0191 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * AppliedMicro X-Gene SoC GPIO-Standby Driver
  *
@@ -5,19 +6,6 @@
  * Author:     Tin Huynh <tnhuynh@apm.com>.
  *             Y Vo <yvo@apm.com>.
  *             Quan Nguyen <qnguyen@apm.com>.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index e9ed439..f17d01f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # drm/tegra depends on host1x, so if both drivers are built-in care must be
 # taken to initialize them in the correct order. Link order is the only way
 # to ensure this currently.
index e360a4a..36f900d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Drm device configuration
 #
index e503e3d..d968c24 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "ACP (Audio CoProcessor) Configuration"
 
 config DRM_AMD_ACP
index 9221e54..844f0a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_AMDGPU_SI
        bool "Enable amdgpu support for SI parts"
        depends on DRM_AMDGPU
index 4376b17..56f8ca2 100644 (file)
@@ -464,8 +464,7 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
                        }
                }
                if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
-                       if ((adev->flags & AMD_IS_PX) &&
-                           amdgpu_atpx_dgpu_req_power_for_displays()) {
+                       if (adev->flags & AMD_IS_PX) {
                                pm_runtime_get_sync(adev->ddev->dev);
                                /* Just fire off a uevent and let userspace tell us what to do */
                                drm_helper_hpd_irq_event(adev->ddev);
index 95144e4..34471db 100644 (file)
@@ -342,6 +342,16 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
        if (current_level == level)
                return count;
 
+       /* profile_exit setting is valid only when current mode is in profile mode */
+       if (!(current_level & (AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |
+           AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
+           AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
+           AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)) &&
+           (level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)) {
+               pr_err("Currently not in any profile mode!\n");
+               return -EINVAL;
+       }
+
        if (is_support_sw_smu(adev)) {
                mutex_lock(&adev->pm.mutex);
                if (adev->pm.dpm.thermal_active) {
index 905cce1..05897b0 100644 (file)
@@ -38,18 +38,10 @@ static void psp_set_funcs(struct amdgpu_device *adev);
 static int psp_early_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       struct psp_context *psp = &adev->psp;
 
        psp_set_funcs(adev);
 
-       return 0;
-}
-
-static int psp_sw_init(void *handle)
-{
-       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-       struct psp_context *psp = &adev->psp;
-       int ret;
-
        switch (adev->asic_type) {
        case CHIP_VEGA10:
        case CHIP_VEGA12:
@@ -67,6 +59,15 @@ static int psp_sw_init(void *handle)
 
        psp->adev = adev;
 
+       return 0;
+}
+
+static int psp_sw_init(void *handle)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       struct psp_context *psp = &adev->psp;
+       int ret;
+
        ret = psp_init_microcode(psp);
        if (ret) {
                DRM_ERROR("Failed to load psp firmware!\n");
index a07c858..4f10f5a 100644 (file)
@@ -2757,6 +2757,37 @@ error_free_sched_entity:
 }
 
 /**
+ * amdgpu_vm_check_clean_reserved - check if a VM is clean
+ *
+ * @adev: amdgpu_device pointer
+ * @vm: the VM to check
+ *
+ * check all entries of the root PD, if any subsequent PDs are allocated,
+ * it means there are page table creating and filling, and is no a clean
+ * VM
+ *
+ * Returns:
+ *     0 if this VM is clean
+ */
+static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev,
+       struct amdgpu_vm *vm)
+{
+       enum amdgpu_vm_level root = adev->vm_manager.root_level;
+       unsigned int entries = amdgpu_vm_num_entries(adev, root);
+       unsigned int i = 0;
+
+       if (!(vm->root.entries))
+               return 0;
+
+       for (i = 0; i < entries; i++) {
+               if (vm->root.entries[i].base.bo)
+                       return -EINVAL;
+       }
+
+       return 0;
+}
+
+/**
  * amdgpu_vm_make_compute - Turn a GFX VM into a compute VM
  *
  * @adev: amdgpu_device pointer
@@ -2786,10 +2817,9 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
                return r;
 
        /* Sanity checks */
-       if (!RB_EMPTY_ROOT(&vm->va.rb_root) || vm->root.entries) {
-               r = -EINVAL;
+       r = amdgpu_vm_check_clean_reserved(adev, vm);
+       if (r)
                goto unreserve_bo;
-       }
 
        if (pasid) {
                unsigned long flags;
index 8dbad49..2471e7c 100644 (file)
@@ -372,6 +372,9 @@ static int xgpu_ai_mailbox_rcv_irq(struct amdgpu_device *adev,
                if (amdgpu_sriov_runtime(adev))
                        schedule_work(&adev->virt.flr_work);
                break;
+               case IDH_QUERY_ALIVE:
+                       xgpu_ai_mailbox_send_ack(adev);
+                       break;
                /* READY_TO_ACCESS_GPU is fetched by kernel polling, IRQ can ignore
                 * it byfar since that polling thread will handle it,
                 * other msg like flr complete is not handled here.
index 39d151b..077e91a 100644 (file)
@@ -49,6 +49,7 @@ enum idh_event {
        IDH_FLR_NOTIFICATION_CMPL,
        IDH_SUCCESS,
        IDH_FAIL,
+       IDH_QUERY_ALIVE,
        IDH_EVENT_MAX
 };
 
index dc461df..2191d3d 100644 (file)
@@ -787,10 +787,13 @@ static int uvd_v7_0_sriov_start(struct amdgpu_device *adev)
                                                           0xFFFFFFFF, 0x00000004);
                        /* mc resume*/
                        if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
-                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),
-                                                           lower_32_bits(adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].mc_addr));
-                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),
-                                                           upper_32_bits(adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].mc_addr));
+                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i,
+                                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),
+                                                       adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].tmr_mc_addr_lo);
+                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i,
+                                                       mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),
+                                                       adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].tmr_mc_addr_hi);
+                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0), 0);
                                offset = 0;
                        } else {
                                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),
@@ -798,10 +801,11 @@ static int uvd_v7_0_sriov_start(struct amdgpu_device *adev)
                                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),
                                                            upper_32_bits(adev->uvd.inst[i].gpu_addr));
                                offset = size;
+                               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0),
+                                                       AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
+
                        }
 
-                       MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_OFFSET0),
-                                                   AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE0), size);
 
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW),
index f3f5938..c0ec279 100644 (file)
@@ -244,13 +244,18 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_SWAP_CNTL1), 0);
                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_VM_CTRL), 0);
 
+               offset = AMDGPU_VCE_FIRMWARE_OFFSET;
                if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
+                       uint32_t low = adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].tmr_mc_addr_lo;
+                       uint32_t hi = adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].tmr_mc_addr_hi;
+                       uint64_t tmr_mc_addr = (uint64_t)(hi) << 32 | low;
+
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
-                                               mmVCE_LMI_VCPU_CACHE_40BIT_BAR0),
-                                               adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].mc_addr >> 8);
+                                               mmVCE_LMI_VCPU_CACHE_40BIT_BAR0), tmr_mc_addr >> 8);
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
                                                mmVCE_LMI_VCPU_CACHE_64BIT_BAR0),
-                                               (adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].mc_addr >> 40) & 0xff);
+                                               (tmr_mc_addr >> 40) & 0xff);
+                       MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0), 0);
                } else {
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
                                                mmVCE_LMI_VCPU_CACHE_40BIT_BAR0),
@@ -258,6 +263,9 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
                        MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
                                                mmVCE_LMI_VCPU_CACHE_64BIT_BAR0),
                                                (adev->vce.gpu_addr >> 40) & 0xff);
+                       MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0),
+                                               offset & ~0x0f000000);
+
                }
                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
                                                mmVCE_LMI_VCPU_CACHE_40BIT_BAR1),
@@ -272,10 +280,7 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
                                                mmVCE_LMI_VCPU_CACHE_64BIT_BAR2),
                                                (adev->vce.gpu_addr >> 40) & 0xff);
 
-               offset = AMDGPU_VCE_FIRMWARE_OFFSET;
                size = VCE_V4_0_FW_SIZE;
-               MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0),
-                                       offset & ~0x0f000000);
                MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_SIZE0), size);
 
                offset = (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) ? offset + size : 0;
index 1b2f69a..8d89ab7 100644 (file)
@@ -31,7 +31,7 @@
 #include "soc15_common.h"
 #include "vega10_ih.h"
 
-
+#define MAX_REARM_RETRY 10
 
 static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev);
 
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
 }
 
 /**
+ * vega10_ih_irq_rearm - rearm IRQ if lost
+ *
+ * @adev: amdgpu_device pointer
+ *
+ */
+static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
+                              struct amdgpu_ih_ring *ih)
+{
+       uint32_t reg_rptr = 0;
+       uint32_t v = 0;
+       uint32_t i = 0;
+
+       if (ih == &adev->irq.ih)
+               reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
+       else if (ih == &adev->irq.ih1)
+               reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
+       else if (ih == &adev->irq.ih2)
+               reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
+       else
+               return;
+
+       /* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
+       for (i = 0; i < MAX_REARM_RETRY; i++) {
+               v = RREG32_NO_KIQ(reg_rptr);
+               if ((v < ih->ring_size) && (v != ih->rptr))
+                       WDOORBELL32(ih->doorbell_index, ih->rptr);
+               else
+                       break;
+       }
+}
+
+/**
  * vega10_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
                /* XXX check if swapping is necessary on BE */
                *ih->rptr_cpu = ih->rptr;
                WDOORBELL32(ih->doorbell_index, ih->rptr);
+
+               if (amdgpu_sriov_vf(adev))
+                       vega10_ih_irq_rearm(adev, ih);
        } else if (ih == &adev->irq.ih) {
                WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
        } else if (ih == &adev->irq.ih1) {
index c361360..a1a35d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Heterogenous system architecture configuration
 #
index 13a6ce9..0c25bad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Display Engine Configuration"
        depends on DRM && DRM_AMDGPU
 
index 1854506..995f9df 100644 (file)
@@ -5242,7 +5242,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                                    struct drm_crtc *pcrtc,
                                    bool wait_for_vblank)
 {
-       uint32_t i, r;
+       uint32_t i;
        uint64_t timestamp_ns;
        struct drm_plane *plane;
        struct drm_plane_state *old_plane_state, *new_plane_state;
@@ -5253,6 +5253,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
        struct dm_crtc_state *dm_old_crtc_state =
                        to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc));
        int planes_count = 0, vpos, hpos;
+       long r;
        unsigned long flags;
        struct amdgpu_bo *abo;
        uint64_t tiling_flags;
index f47d88b..e8f3d63 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ARCPGU
        tristate "ARC PGU"
        depends on DRM && OF
index 73de56a..c7028b7 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
index 120bef8..3ced6fc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 hdlcd-y := hdlcd_drv.o hdlcd_crtc.o
 obj-$(CONFIG_DRM_HDLCD)        += hdlcd.o
 mali-dp-y := malidp_drv.o malidp_hw.o malidp_planes.o malidp_crtc.o
index eafaeeb..f5c66d8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ARMADA
        tristate "DRM support for Marvell Armada SoCs"
        depends on DRM && HAVE_CLK && ARM && MMU
index cccab52..018383c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ASPEED_GFX
        tristate "ASPEED BMC Display Controller"
        depends on DRM && OF
index 6e194cd..a681ba3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 aspeed_gfx-y := aspeed_gfx_drv.o aspeed_gfx_crtc.o aspeed_gfx_out.o
 
 obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed_gfx.o
index 9647e1f..ac47ecf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_AST
        tristate "AST server chips"
        depends on DRM && PCI && MMU
index 617fdd3..b086dae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 32bcc4b..5f67f00 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ATMEL_HLCDC
        tristate "DRM Support for ATMEL HLCDC Display Controller"
        depends on DRM && OF && COMMON_CLK && MFD_ATMEL_HLCDC && ARM
index bd27180..17885fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_BOCHS
        tristate "DRM Support for bochs dispi vga interface (qemu stdvga)"
        depends on DRM && PCI && MMU
index e9e0f8f..5547337 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 bochs-drm-y := bochs_drv.o bochs_mm.o bochs_kms.o bochs_hw.o
 
 obj-$(CONFIG_DRM_BOCHS)        += bochs-drm.o
index 3dff999..ee77746 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_BRIDGE
        def_bool y
        depends on DRM
index 944e440..8a56ff8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_I2C_ADV7511
        tristate "ADV7511 encoder"
        depends on OF
index 5bb3849..b46ebeb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 adv7511-y := adv7511_drv.o
 adv7511-$(CONFIG_DRM_I2C_ADV7511_AUDIO) += adv7511_audio.o
 adv7511-$(CONFIG_DRM_I2C_ADV7511_CEC) += adv7511_cec.o
index ec2ca71..c532e9c 100644 (file)
@@ -748,11 +748,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511,
                        vsync_polarity = 1;
        }
 
-       if (mode->vrefresh <= 24000)
+       if (drm_mode_vrefresh(mode) <= 24)
                low_refresh_rate = ADV7511_LOW_REFRESH_RATE_24HZ;
-       else if (mode->vrefresh <= 25000)
+       else if (drm_mode_vrefresh(mode) <= 25)
                low_refresh_rate = ADV7511_LOW_REFRESH_RATE_25HZ;
-       else if (mode->vrefresh <= 30000)
+       else if (drm_mode_vrefresh(mode) <= 30)
                low_refresh_rate = ADV7511_LOW_REFRESH_RATE_30HZ;
        else
                low_refresh_rate = ADV7511_LOW_REFRESH_RATE_NONE;
index 80f286f..e930ff9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ANALOGIX_DP
        tristate
        depends on DRM
index cd4010b..fdbf3fd 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
index 3cc53b4..21a1be3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_DW_HDMI
        tristate
        select DRM_KMS_HELPER
index 3e1b1e3..91d746a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
 obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o
index dd4f52a..c6bbd98 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_CIRRUS_QEMU
        tristate "Cirrus driver for QEMU emulated device"
        depends on DRM && PCI && MMU
index acf8971..0c1ed3f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o
index f2f71d7..6becf63 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/component.h>
 #include <linux/export.h>
 #include <linux/list.h>
index 21df44b..faa7fc6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config DRM_ETNAVIV
        tristate "ETNAVIV (DRM support for Vivante GPU IP cores)"
index 3691a14..cbe58d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_EXYNOS
        tristate "DRM Support for Samsung SoC EXYNOS Series"
        depends on OF && DRM && (ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || ARCH_MULTIPLATFORM)
index dc82588..d7dd8ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_FSL_DCU
        tristate "DRM Support for Freescale DCU"
        depends on DRM && OF && ARM && COMMON_CLK
index df11582..0e23c93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_GMA500
        tristate "Intel GMA5/600 KMS Framebuffer"
        depends on DRM && PCI && X86 && MMU
index 2fd2724..cc5a244 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # hisilicon drm device configuration.
 # Please keep this list sorted alphabetically
index c8155bf..69dec60 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for hisilicon drm drivers.
 # Please keep this list sorted alphabetically
index c7129dc..7cf8d38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_HISI_HIBMC
        tristate "DRM Support for Hisilicon Hibmc"
        depends on DRM && PCI && MMU
index 3df7266..0c2d429 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_de.o hibmc_drm_vdac.o hibmc_drm_fbdev.o hibmc_ttm.o
 
 obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc-drm.o
index 499f644..0fa29af 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_HISI_KIRIN
        tristate "DRM Support for Hisilicon Kirin series SoCs Platform"
        depends on DRM && OF && ARM64
index cdf6158..c0501fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 kirin-drm-y := kirin_drm_drv.o \
               kirin_drm_ade.o
 
index 65d3acb..6f19e1c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "I2C encoder or helper chips"
      depends on DRM && DRM_KMS_HELPER && I2C
 
index 639f859..c181f85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 3d5f1cb..255f224 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_I915
        tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics"
        depends on DRM
index ad4d711..04b686d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_I915_WERROR
         bool "Force GCC to throw an error instead of a warning when compiling"
         # As this may inadvertently break the build, only allow the user
index 2ec89bc..8a9606f 100644 (file)
@@ -196,9 +196,9 @@ DEFINE_SIMPLE_ATTRIBUTE(vgpu_scan_nonprivbb_fops,
 int intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu)
 {
        struct dentry *ent;
-       char name[10] = "";
+       char name[16] = "";
 
-       sprintf(name, "vgpu%d", vgpu->id);
+       snprintf(name, 16, "vgpu%d", vgpu->id);
        vgpu->debugfs = debugfs_create_dir(name, vgpu->gvt->debugfs_root);
        if (!vgpu->debugfs)
                return -ENOMEM;
index 4e1e425..41c8ebc 100644 (file)
@@ -45,6 +45,7 @@ static int vgpu_gem_get_pages(
        int i, ret;
        gen8_pte_t __iomem *gtt_entries;
        struct intel_vgpu_fb_info *fb_info;
+       u32 page_num;
 
        fb_info = (struct intel_vgpu_fb_info *)obj->gvt_info;
        if (WARN_ON(!fb_info))
@@ -54,14 +55,15 @@ static int vgpu_gem_get_pages(
        if (unlikely(!st))
                return -ENOMEM;
 
-       ret = sg_alloc_table(st, fb_info->size, GFP_KERNEL);
+       page_num = obj->base.size >> PAGE_SHIFT;
+       ret = sg_alloc_table(st, page_num, GFP_KERNEL);
        if (ret) {
                kfree(st);
                return ret;
        }
        gtt_entries = (gen8_pte_t __iomem *)dev_priv->ggtt.gsm +
                (fb_info->start >> PAGE_SHIFT);
-       for_each_sg(st->sgl, sg, fb_info->size, i) {
+       for_each_sg(st->sgl, sg, page_num, i) {
                sg->offset = 0;
                sg->length = PAGE_SIZE;
                sg_dma_address(sg) =
@@ -158,7 +160,7 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev,
                return NULL;
 
        drm_gem_private_object_init(dev, &obj->base,
-               info->size << PAGE_SHIFT);
+               roundup(info->size, PAGE_SIZE));
        i915_gem_object_init(obj, &intel_vgpu_gem_ops);
 
        obj->read_domains = I915_GEM_DOMAIN_GTT;
@@ -206,11 +208,12 @@ static int vgpu_get_plane_info(struct drm_device *dev,
                struct intel_vgpu_fb_info *info,
                int plane_id)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        struct intel_vgpu_primary_plane_format p;
        struct intel_vgpu_cursor_plane_format c;
        int ret, tile_height = 1;
 
+       memset(info, 0, sizeof(*info));
+
        if (plane_id == DRM_PLANE_TYPE_PRIMARY) {
                ret = intel_vgpu_decode_primary_plane(vgpu, &p);
                if (ret)
@@ -267,8 +270,7 @@ static int vgpu_get_plane_info(struct drm_device *dev,
                return -EINVAL;
        }
 
-       info->size = (info->stride * roundup(info->height, tile_height)
-                     + PAGE_SIZE - 1) >> PAGE_SHIFT;
+       info->size = info->stride * roundup(info->height, tile_height);
        if (info->size == 0) {
                gvt_vgpu_err("fb size is zero\n");
                return -EINVAL;
@@ -278,11 +280,6 @@ static int vgpu_get_plane_info(struct drm_device *dev,
                gvt_vgpu_err("Not aligned fb address:0x%llx\n", info->start);
                return -EFAULT;
        }
-       if (((info->start >> PAGE_SHIFT) + info->size) >
-               ggtt_total_entries(&dev_priv->ggtt)) {
-               gvt_vgpu_err("Invalid GTT offset or size\n");
-               return -EFAULT;
-       }
 
        if (!intel_gvt_ggtt_validate_range(vgpu, info->start, info->size)) {
                gvt_vgpu_err("invalid gma addr\n");
index c2f7d20..08c74e6 100644 (file)
@@ -811,7 +811,7 @@ static int reclaim_one_ppgtt_mm(struct intel_gvt *gvt);
 
 /* Allocate shadow page table without guest page. */
 static struct intel_vgpu_ppgtt_spt *ppgtt_alloc_spt(
-               struct intel_vgpu *vgpu, intel_gvt_gtt_type_t type)
+               struct intel_vgpu *vgpu, enum intel_gvt_gtt_type type)
 {
        struct device *kdev = &vgpu->gvt->dev_priv->drm.pdev->dev;
        struct intel_vgpu_ppgtt_spt *spt = NULL;
@@ -861,7 +861,7 @@ err_free_spt:
 
 /* Allocate shadow page table associated with specific gfn. */
 static struct intel_vgpu_ppgtt_spt *ppgtt_alloc_spt_gfn(
-               struct intel_vgpu *vgpu, intel_gvt_gtt_type_t type,
+               struct intel_vgpu *vgpu, enum intel_gvt_gtt_type type,
                unsigned long gfn, bool guest_pde_ips)
 {
        struct intel_vgpu_ppgtt_spt *spt;
@@ -936,7 +936,7 @@ static int ppgtt_invalidate_spt_by_shadow_entry(struct intel_vgpu *vgpu,
 {
        struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
        struct intel_vgpu_ppgtt_spt *s;
-       intel_gvt_gtt_type_t cur_pt_type;
+       enum intel_gvt_gtt_type cur_pt_type;
 
        GEM_BUG_ON(!gtt_type_is_pt(get_next_pt_type(e->type)));
 
@@ -1076,6 +1076,9 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_spt_by_guest_entry(
        } else {
                int type = get_next_pt_type(we->type);
 
+               if (!gtt_type_is_pt(type))
+                       goto err;
+
                spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
                if (IS_ERR(spt)) {
                        ret = PTR_ERR(spt);
@@ -1855,7 +1858,7 @@ static void vgpu_free_mm(struct intel_vgpu_mm *mm)
  * Zero on success, negative error code in pointer if failed.
  */
 struct intel_vgpu_mm *intel_vgpu_create_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[])
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[])
 {
        struct intel_gvt *gvt = vgpu->gvt;
        struct intel_vgpu_mm *mm;
@@ -2309,7 +2312,7 @@ int intel_vgpu_emulate_ggtt_mmio_write(struct intel_vgpu *vgpu,
 }
 
 static int alloc_scratch_pages(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t type)
+               enum intel_gvt_gtt_type type)
 {
        struct intel_vgpu_gtt *gtt = &vgpu->gtt;
        struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
@@ -2594,7 +2597,7 @@ struct intel_vgpu_mm *intel_vgpu_find_ppgtt_mm(struct intel_vgpu *vgpu,
  * Zero on success, negative error code if failed.
  */
 struct intel_vgpu_mm *intel_vgpu_get_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[])
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[])
 {
        struct intel_vgpu_mm *mm;
 
index 32c573a..42d0394 100644 (file)
@@ -95,8 +95,8 @@ struct intel_gvt_gtt {
        unsigned long scratch_mfn;
 };
 
-typedef enum {
-       GTT_TYPE_INVALID = -1,
+enum intel_gvt_gtt_type {
+       GTT_TYPE_INVALID = 0,
 
        GTT_TYPE_GGTT_PTE,
 
@@ -124,7 +124,7 @@ typedef enum {
        GTT_TYPE_PPGTT_PML4_PT,
 
        GTT_TYPE_MAX,
-} intel_gvt_gtt_type_t;
+};
 
 enum intel_gvt_mm_type {
        INTEL_GVT_MM_GGTT,
@@ -148,7 +148,7 @@ struct intel_vgpu_mm {
 
        union {
                struct {
-                       intel_gvt_gtt_type_t root_entry_type;
+                       enum intel_gvt_gtt_type root_entry_type;
                        /*
                         * The 4 PDPs in ring context. For 48bit addressing,
                         * only PDP0 is valid and point to PML4. For 32it
@@ -169,7 +169,7 @@ struct intel_vgpu_mm {
 };
 
 struct intel_vgpu_mm *intel_vgpu_create_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[]);
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[]);
 
 static inline void intel_vgpu_mm_get(struct intel_vgpu_mm *mm)
 {
@@ -233,7 +233,7 @@ struct intel_vgpu_ppgtt_spt {
        struct intel_vgpu *vgpu;
 
        struct {
-               intel_gvt_gtt_type_t type;
+               enum intel_gvt_gtt_type type;
                bool pde_ips; /* for 64KB PTEs */
                void *vaddr;
                struct page *page;
@@ -241,7 +241,7 @@ struct intel_vgpu_ppgtt_spt {
        } shadow_page;
 
        struct {
-               intel_gvt_gtt_type_t type;
+               enum intel_gvt_gtt_type type;
                bool pde_ips; /* for 64KB PTEs */
                unsigned long gfn;
                unsigned long write_cnt;
@@ -267,7 +267,7 @@ struct intel_vgpu_mm *intel_vgpu_find_ppgtt_mm(struct intel_vgpu *vgpu,
                u64 pdps[]);
 
 struct intel_vgpu_mm *intel_vgpu_get_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[]);
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[]);
 
 int intel_vgpu_put_ppgtt_mm(struct intel_vgpu *vgpu, u64 pdps[]);
 
index 18f01ee..90673fc 100644 (file)
@@ -1206,7 +1206,7 @@ static int pvinfo_mmio_read(struct intel_vgpu *vgpu, unsigned int offset,
 
 static int handle_g2v_notification(struct intel_vgpu *vgpu, int notification)
 {
-       intel_gvt_gtt_type_t root_entry_type = GTT_TYPE_PPGTT_ROOT_L4_ENTRY;
+       enum intel_gvt_gtt_type root_entry_type = GTT_TYPE_PPGTT_ROOT_L4_ENTRY;
        struct intel_vgpu_mm *mm;
        u64 *pdps;
 
@@ -3303,7 +3303,7 @@ void intel_gvt_clean_mmio_info(struct intel_gvt *gvt)
 /* Special MMIO blocks. */
 static struct gvt_mmio_block mmio_blocks[] = {
        {D_SKL_PLUS, _MMIO(CSR_MMIO_START_RANGE), 0x3000, NULL, NULL},
-       {D_ALL, MCHBAR_MIRROR_REG_BASE, 0x4000, NULL, NULL},
+       {D_ALL, _MMIO(MCHBAR_MIRROR_BASE_SNB), 0x40000, NULL, NULL},
        {D_ALL, _MMIO(VGT_PVINFO_PAGE), VGT_PVINFO_SIZE,
                pvinfo_mmio_read, pvinfo_mmio_write},
        {D_ALL, LGC_PALETTE(PIPE_A, 0), 1024, NULL, NULL},
index e7e14c8..edf6d64 100644 (file)
@@ -132,6 +132,7 @@ static struct engine_mmio gen9_engine_mmio_list[] __cacheline_aligned = {
 
        {RCS0, GEN9_GAMT_ECO_REG_RW_IA, 0x0, false}, /* 0x4ab0 */
        {RCS0, GEN9_CSFE_CHICKEN1_RCS, 0xffff, false}, /* 0x20d4 */
+       {RCS0, _MMIO(0x20D8), 0xffff, true}, /* 0x20d8 */
 
        {RCS0, GEN8_GARBCNTL, 0x0, false}, /* 0xb004 */
        {RCS0, GEN7_FF_THREAD_MODE, 0x0, false}, /* 0x20a0 */
index 3de5b64..33aaa14 100644 (file)
 #define RING_GFX_MODE(base)    _MMIO((base) + 0x29c)
 #define VF_GUARDBAND           _MMIO(0x83a4)
 
-/* define the effective range of MCHBAR register on Sandybridge+ */
-#define MCHBAR_MIRROR_REG_BASE _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x4000)
-
 #endif
index 8998fa5..7c99bbc 100644 (file)
@@ -1343,7 +1343,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload)
        struct execlist_ctx_descriptor_format *desc = &workload->ctx_desc;
        struct intel_vgpu_mm *mm;
        struct intel_vgpu *vgpu = workload->vgpu;
-       intel_gvt_gtt_type_t root_entry_type;
+       enum intel_gvt_gtt_type root_entry_type;
        u64 pdps[GVT_RING_CTX_NR_PDPS];
 
        switch (desc->addressing_mode) {
index b836721..f6c78c0 100644 (file)
@@ -425,6 +425,26 @@ void __i915_request_submit(struct i915_request *request)
        if (i915_gem_context_is_banned(request->gem_context))
                i915_request_skip(request, -EIO);
 
+       /*
+        * Are we using semaphores when the gpu is already saturated?
+        *
+        * Using semaphores incurs a cost in having the GPU poll a
+        * memory location, busywaiting for it to change. The continual
+        * memory reads can have a noticeable impact on the rest of the
+        * system with the extra bus traffic, stalling the cpu as it too
+        * tries to access memory across the bus (perf stat -e bus-cycles).
+        *
+        * If we installed a semaphore on this request and we only submit
+        * the request after the signaler completed, that indicates the
+        * system is overloaded and using semaphores at this time only
+        * increases the amount of work we are doing. If so, we disable
+        * further use of semaphores until we are idle again, whence we
+        * optimistically try again.
+        */
+       if (request->sched.semaphores &&
+           i915_sw_fence_signaled(&request->semaphore))
+               request->hw_context->saturated |= request->sched.semaphores;
+
        /* We may be recursing from the signal callback of another i915 fence */
        spin_lock_nested(&request->lock, SINGLE_DEPTH_NESTING);
 
@@ -432,6 +452,7 @@ void __i915_request_submit(struct i915_request *request)
        set_bit(I915_FENCE_FLAG_ACTIVE, &request->fence.flags);
 
        if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &request->fence.flags) &&
+           !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &request->fence.flags) &&
            !i915_request_enable_breadcrumb(request))
                intel_engine_queue_breadcrumbs(engine);
 
@@ -799,6 +820,39 @@ err_unreserve:
 }
 
 static int
+i915_request_await_start(struct i915_request *rq, struct i915_request *signal)
+{
+       if (list_is_first(&signal->ring_link, &signal->ring->request_list))
+               return 0;
+
+       signal = list_prev_entry(signal, ring_link);
+       if (i915_timeline_sync_is_later(rq->timeline, &signal->fence))
+               return 0;
+
+       return i915_sw_fence_await_dma_fence(&rq->submit,
+                                            &signal->fence, 0,
+                                            I915_FENCE_GFP);
+}
+
+static intel_engine_mask_t
+already_busywaiting(struct i915_request *rq)
+{
+       /*
+        * Polling a semaphore causes bus traffic, delaying other users of
+        * both the GPU and CPU. We want to limit the impact on others,
+        * while taking advantage of early submission to reduce GPU
+        * latency. Therefore we restrict ourselves to not using more
+        * than one semaphore from each source, and not using a semaphore
+        * if we have detected the engine is saturated (i.e. would not be
+        * submitted early and cause bus traffic reading an already passed
+        * semaphore).
+        *
+        * See the are-we-too-late? check in __i915_request_submit().
+        */
+       return rq->sched.semaphores | rq->hw_context->saturated;
+}
+
+static int
 emit_semaphore_wait(struct i915_request *to,
                    struct i915_request *from,
                    gfp_t gfp)
@@ -811,11 +865,15 @@ emit_semaphore_wait(struct i915_request *to,
        GEM_BUG_ON(INTEL_GEN(to->i915) < 8);
 
        /* Just emit the first semaphore we see as request space is limited. */
-       if (to->sched.semaphores & from->engine->mask)
+       if (already_busywaiting(to) & from->engine->mask)
                return i915_sw_fence_await_dma_fence(&to->submit,
                                                     &from->fence, 0,
                                                     I915_FENCE_GFP);
 
+       err = i915_request_await_start(to, from);
+       if (err < 0)
+               return err;
+
        err = i915_sw_fence_await_dma_fence(&to->semaphore,
                                            &from->fence, 0,
                                            I915_FENCE_GFP);
index 3cbffd4..832cb6b 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/kthread.h>
+#include <trace/events/dma_fence.h>
 #include <uapi/linux/sched/types.h>
 
 #include "i915_drv.h"
@@ -80,9 +81,39 @@ static inline bool __request_completed(const struct i915_request *rq)
        return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno);
 }
 
+static bool
+__dma_fence_signal(struct dma_fence *fence)
+{
+       return !test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags);
+}
+
+static void
+__dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
+{
+       fence->timestamp = timestamp;
+       set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
+       trace_dma_fence_signaled(fence);
+}
+
+static void
+__dma_fence_signal__notify(struct dma_fence *fence)
+{
+       struct dma_fence_cb *cur, *tmp;
+
+       lockdep_assert_held(fence->lock);
+       lockdep_assert_irqs_disabled();
+
+       list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
+               INIT_LIST_HEAD(&cur->node);
+               cur->func(fence, cur);
+       }
+       INIT_LIST_HEAD(&fence->cb_list);
+}
+
 void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
 {
        struct intel_breadcrumbs *b = &engine->breadcrumbs;
+       const ktime_t timestamp = ktime_get();
        struct intel_context *ce, *cn;
        struct list_head *pos, *next;
        LIST_HEAD(signal);
@@ -104,6 +135,10 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
 
                        GEM_BUG_ON(!test_bit(I915_FENCE_FLAG_SIGNAL,
                                             &rq->fence.flags));
+                       clear_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags);
+
+                       if (!__dma_fence_signal(&rq->fence))
+                               continue;
 
                        /*
                         * Queue for execution after dropping the signaling
@@ -111,14 +146,6 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
                         * more signalers to the same context or engine.
                         */
                        i915_request_get(rq);
-
-                       /*
-                        * We may race with direct invocation of
-                        * dma_fence_signal(), e.g. i915_request_retire(),
-                        * so we need to acquire our reference to the request
-                        * before we cancel the breadcrumb.
-                        */
-                       clear_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags);
                        list_add_tail(&rq->signal_link, &signal);
                }
 
@@ -141,7 +168,12 @@ void intel_engine_breadcrumbs_irq(struct intel_engine_cs *engine)
                struct i915_request *rq =
                        list_entry(pos, typeof(*rq), signal_link);
 
-               dma_fence_signal(&rq->fence);
+               __dma_fence_signal__timestamp(&rq->fence, timestamp);
+
+               spin_lock(&rq->lock);
+               __dma_fence_signal__notify(&rq->fence);
+               spin_unlock(&rq->lock);
+
                i915_request_put(rq);
        }
 }
@@ -243,19 +275,17 @@ void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine)
 
 bool i915_request_enable_breadcrumb(struct i915_request *rq)
 {
-       struct intel_breadcrumbs *b = &rq->engine->breadcrumbs;
-
-       GEM_BUG_ON(test_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags));
+       lockdep_assert_held(&rq->lock);
+       lockdep_assert_irqs_disabled();
 
-       if (!test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags))
-               return true;
-
-       spin_lock(&b->irq_lock);
-       if (test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags) &&
-           !__request_completed(rq)) {
+       if (test_bit(I915_FENCE_FLAG_ACTIVE, &rq->fence.flags)) {
+               struct intel_breadcrumbs *b = &rq->engine->breadcrumbs;
                struct intel_context *ce = rq->hw_context;
                struct list_head *pos;
 
+               spin_lock(&b->irq_lock);
+               GEM_BUG_ON(test_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags));
+
                __intel_breadcrumbs_arm_irq(b);
 
                /*
@@ -284,8 +314,8 @@ bool i915_request_enable_breadcrumb(struct i915_request *rq)
                        list_move_tail(&ce->signal_link, &b->signalers);
 
                set_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags);
+               spin_unlock(&b->irq_lock);
        }
-       spin_unlock(&b->irq_lock);
 
        return !__request_completed(rq);
 }
@@ -294,9 +324,15 @@ void i915_request_cancel_breadcrumb(struct i915_request *rq)
 {
        struct intel_breadcrumbs *b = &rq->engine->breadcrumbs;
 
-       if (!test_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags))
-               return;
+       lockdep_assert_held(&rq->lock);
+       lockdep_assert_irqs_disabled();
 
+       /*
+        * We must wait for b->irq_lock so that we know the interrupt handler
+        * has released its reference to the intel_context and has completed
+        * the DMA_FENCE_FLAG_SIGNALED_BIT/I915_FENCE_FLAG_SIGNAL dance (if
+        * required).
+        */
        spin_lock(&b->irq_lock);
        if (test_bit(I915_FENCE_FLAG_SIGNAL, &rq->fence.flags)) {
                struct intel_context *ce = rq->hw_context;
index 8931e0f..924cc55 100644 (file)
@@ -230,6 +230,7 @@ intel_context_init(struct intel_context *ce,
        ce->gem_context = ctx;
        ce->engine = engine;
        ce->ops = engine->cops;
+       ce->saturated = 0;
 
        INIT_LIST_HEAD(&ce->signal_link);
        INIT_LIST_HEAD(&ce->signals);
index 68b4ca1..339c743 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 
 #include "i915_active_types.h"
+#include "intel_engine_types.h"
 
 struct i915_gem_context;
 struct i915_vma;
@@ -58,6 +59,8 @@ struct intel_context {
        atomic_t pin_count;
        struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
 
+       intel_engine_mask_t saturated; /* submitting semaphores too late? */
+
        /**
         * active_tracker: Active tracker for the external rq activity
         * on this intel_context object.
index 3bd40a4..5098228 100644 (file)
@@ -12082,6 +12082,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
                          struct intel_crtc_state *pipe_config,
                          bool adjust)
 {
+       struct intel_crtc *crtc = to_intel_crtc(current_config->base.crtc);
        bool ret = true;
        bool fixup_inherited = adjust &&
                (current_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED) &&
@@ -12303,6 +12304,14 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv,
                PIPE_CONF_CHECK_X(gmch_pfit.pgm_ratios);
        PIPE_CONF_CHECK_X(gmch_pfit.lvds_border_bits);
 
+       /*
+        * Changing the EDP transcoder input mux
+        * (A_ONOFF vs. A_ON) requires a full modeset.
+        */
+       if (IS_HASWELL(dev_priv) && crtc->pipe == PIPE_A &&
+           current_config->cpu_transcoder == TRANSCODER_EDP)
+               PIPE_CONF_CHECK_BOOL(pch_pfit.enabled);
+
        if (!adjust) {
                PIPE_CONF_CHECK_I(pipe_src_w);
                PIPE_CONF_CHECK_I(pipe_src_h);
index c805a09..5679f2f 100644 (file)
@@ -1280,6 +1280,10 @@ static int intel_sanitize_fbc_option(struct drm_i915_private *dev_priv)
        if (!HAS_FBC(dev_priv))
                return 0;
 
+       /* https://bugs.freedesktop.org/show_bug.cgi?id=108085 */
+       if (IS_GEMINILAKE(dev_priv))
+               return 0;
+
        if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9)
                return 1;
 
index 37f60cb..46cd0e7 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include <linux/circ_buf.h>
-#include <trace/events/dma_fence.h>
 
 #include "intel_guc_submission.h"
 #include "intel_lrc_reg.h"
index e94b5b1..e7c7be4 100644 (file)
@@ -311,10 +311,17 @@ retry:
        pipe_config->base.mode_changed = pipe_config->has_psr;
        pipe_config->crc_enabled = enable;
 
-       if (IS_HASWELL(dev_priv) && crtc->pipe == PIPE_A) {
+       if (IS_HASWELL(dev_priv) &&
+           pipe_config->base.active && crtc->pipe == PIPE_A &&
+           pipe_config->cpu_transcoder == TRANSCODER_EDP) {
+               bool old_need_power_well = pipe_config->pch_pfit.enabled ||
+                       pipe_config->pch_pfit.force_thru;
+               bool new_need_power_well = pipe_config->pch_pfit.enabled ||
+                       enable;
+
                pipe_config->pch_pfit.force_thru = enable;
-               if (pipe_config->cpu_transcoder == TRANSCODER_EDP &&
-                   pipe_config->pch_pfit.enabled != enable)
+
+               if (old_need_power_well != new_need_power_well)
                        pipe_config->base.connectors_changed = true;
        }
 
index c3c84a0..207bf74 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_IMX
        tristate "DRM Support for Freescale i.MX"
        select DRM_KMS_HELPER
index 119ec0a..fa5ffc4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_MEDIATEK
        tristate "DRM Support for Mediatek SoCs"
        depends on DRM
index c28b69f..e450387 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_MESON
        tristate "DRM Support for Amlogic Meson Display Controller"
        depends on DRM && OF && (ARM || ARM64)
index d4ea82f..c389e23 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 meson-drm-y := meson_drv.o meson_plane.o meson_crtc.o meson_venc_cvbs.o
 meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o meson_overlay.o
 
index 5579f8a..6857151 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index b62b9e5..8e3998c 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index 72b01e6..2310c96 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index 9614baa..7b6593f 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __MESON_DRV_H
index 779da21..df3f9dd 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 03e2f0c..1b2ef04 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __MESON_DW_HDMI_H
index bf8f1fa..2249004 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index e26b8b0..1460e18 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index b390347..58b4af5 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 4bd8752..ed993d2 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* Video Clock */
index 6faca73..7b7a0d8 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 97eaebb..985642a 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 2c5341c..6313a51 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index 9256ccf..ab7f76b 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2014 Endless Mobile
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Written by:
  *     Jasper St. Pierre <jstpierre@mecheye.net>
  */
index b590723..462c7cb 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
  * Copyright (C) 2014 Endless Mobile
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 0f84bdd..a112e8d 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* Video Input Unit */
index 8c52a34..bfee30f 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
  * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
  * Copyright (C) 2014 Endless Mobile
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 815177c..9fc82db 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2016 BayLibre, SAS
  * Author: Neil Armstrong <narmstrong@baylibre.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* Video Post Process */
index 49e972c..db07c7f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index db58578..91f3579 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_MGAG200
        tristate "Kernel modesetting driver for MGA G200 server engines"
        depends on DRM && PCI && MMU
index 3d91d1d..98d2044 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 mgag200-y   := mgag200_main.o mgag200_mode.o mgag200_cursor.o \
        mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
 
index 9f2029e..9c37e4d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config DRM_MSM
        tristate "MSM DRM"
index 9155daf..38e2cfa 100644 (file)
@@ -747,7 +747,7 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
         * will make sure that the refcounting is correct in case we need to
         * bring down the GX after a GMU failure
         */
-       if (!IS_ERR(gmu->gxpd))
+       if (!IS_ERR_OR_NULL(gmu->gxpd))
                pm_runtime_get(gmu->gxpd);
 
 out:
@@ -863,7 +863,7 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
         * domain. Usually the GMU does this but only if the shutdown sequence
         * was successful
         */
-       if (!IS_ERR(gmu->gxpd))
+       if (!IS_ERR_OR_NULL(gmu->gxpd))
                pm_runtime_put_sync(gmu->gxpd);
 
        clk_bulk_disable_unprepare(gmu->nr_clocks, gmu->clocks);
@@ -1234,7 +1234,7 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
 
        pm_runtime_disable(gmu->dev);
 
-       if (!IS_ERR(gmu->gxpd)) {
+       if (!IS_ERR_OR_NULL(gmu->gxpd)) {
                pm_runtime_disable(gmu->gxpd);
                dev_pm_domain_detach(gmu->gxpd, false);
        }
index 018df2c..45a5bc6 100644 (file)
@@ -15,7 +15,6 @@
 #include "dpu_hwio.h"
 #include "dpu_hw_lm.h"
 #include "dpu_hw_mdss.h"
-#include "dpu_kms.h"
 
 #define LM_OP_MODE                        0x00
 #define LM_OUT_SIZE                       0x04
index da1f727..ce1a555 100644 (file)
@@ -780,7 +780,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
        struct dpu_plane_state *pstate = to_dpu_plane_state(new_state);
        struct dpu_hw_fmt_layout layout;
        struct drm_gem_object *obj;
-       struct msm_gem_object *msm_obj;
        struct dma_fence *fence;
        struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
        int ret;
@@ -799,8 +798,7 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
         *       implicit fence and fb prepare by hand here.
         */
        obj = msm_framebuffer_bo(new_state->fb, 0);
-       msm_obj = to_msm_bo(obj);
-       fence = reservation_object_get_excl_rcu(msm_obj->resv);
+       fence = reservation_object_get_excl_rcu(obj->resv);
        if (fence)
                drm_atomic_set_fence_for_plane(new_state, fence);
 
index f5b1256..131c23a 100644 (file)
@@ -49,15 +49,13 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,
        struct msm_drm_private *priv = plane->dev->dev_private;
        struct msm_kms *kms = priv->kms;
        struct drm_gem_object *obj;
-       struct msm_gem_object *msm_obj;
        struct dma_fence *fence;
 
        if (!new_state->fb)
                return 0;
 
        obj = msm_framebuffer_bo(new_state->fb, 0);
-       msm_obj = to_msm_bo(obj);
-       fence = reservation_object_get_excl_rcu(msm_obj->resv);
+       fence = reservation_object_get_excl_rcu(obj->resv);
 
        drm_atomic_set_fence_for_plane(new_state, fence);
 
index eb33d2d..e20e6b4 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/types.h>
 #include <linux/of_graph.h>
 #include <linux/of_device.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <linux/kthread.h>
 
 #include <drm/drmP.h>
index 31d5a74..35f55dd 100644 (file)
@@ -803,7 +803,8 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
                seq_puts(m, "      vmas:");
 
                list_for_each_entry(vma, &msm_obj->vmas, list)
-                       seq_printf(m, " [%s: %08llx,%s,inuse=%d]", vma->aspace->name,
+                       seq_printf(m, " [%s: %08llx,%s,inuse=%d]",
+                               vma->aspace != NULL ? vma->aspace->name : NULL,
                                vma->iova, vma->mapped ? "mapped" : "unmapped",
                                vma->inuse);
 
index c5ac781..812d1b1 100644 (file)
@@ -86,10 +86,6 @@ struct msm_gem_object {
 
        struct llist_node freed;
 
-       /* normally (resv == &_resv) except for imported bo's */
-       struct reservation_object *resv;
-       struct reservation_object _resv;
-
        /* For physically contiguous buffers.  Used when we don't have
         * an IOMMU.  Also used for stolen/splashscreen buffer.
         */
index e9a8d90..0dca8f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_MXS
        bool
        help
index 857f3a4..ff6e358 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 mxsfb-y := mxsfb_drv.o mxsfb_crtc.o mxsfb_out.o
 obj-$(CONFIG_DRM_MXSFB)        += mxsfb.o
index 1f13951..dba2613 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_NOUVEAU
        tristate "Nouveau (NVIDIA) cards"
        depends on DRM && PCI && MMU
index 2216c58..7c41b05 100644 (file)
@@ -41,6 +41,7 @@ struct nv50_disp_interlock {
                NV50_DISP_INTERLOCK__SIZE
        } type;
        u32 data;
+       u32 wimm;
 };
 
 void corec37d_ntfy_init(struct nouveau_bo *, u32);
index 2e7a0c3..06ee238 100644 (file)
@@ -306,7 +306,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
                        asyh->set.or = head->func->or != NULL;
                }
 
-               if (asyh->state.mode_changed)
+               if (asyh->state.mode_changed || asyh->state.connectors_changed)
                        nv50_head_atomic_check_mode(head, asyh);
 
                if (asyh->state.color_mgmt_changed ||
@@ -413,6 +413,7 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)
        asyh->ovly = armh->ovly;
        asyh->dither = armh->dither;
        asyh->procamp = armh->procamp;
+       asyh->or = armh->or;
        asyh->dp = armh->dp;
        asyh->clr.mask = 0;
        asyh->set.mask = 0;
index 9103b84..f7dbd96 100644 (file)
@@ -75,6 +75,7 @@ wimmc37b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
                return ret;
        }
 
+       wndw->interlock.wimm = wndw->interlock.data;
        wndw->immd = func;
        return 0;
 }
index b951810..283ff69 100644 (file)
@@ -127,7 +127,7 @@ void
 nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 *interlock,
                    struct nv50_wndw_atom *asyw)
 {
-       if (interlock) {
+       if (interlock[NV50_DISP_INTERLOCK_CORE]) {
                asyw->image.mode = 0;
                asyw->image.interval = 1;
        }
@@ -149,7 +149,7 @@ nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 *interlock,
        if (asyw->set.point) {
                if (asyw->set.point = false, asyw->set.mask)
                        interlock[wndw->interlock.type] |= wndw->interlock.data;
-               interlock[NV50_DISP_INTERLOCK_WIMM] |= wndw->interlock.data;
+               interlock[NV50_DISP_INTERLOCK_WIMM] |= wndw->interlock.wimm;
 
                wndw->immd->point(wndw, asyw);
                wndw->immd->update(wndw, interlock);
index 22cd458..7c2fcab 100644 (file)
@@ -631,7 +631,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
        /* We need to check that the chipset is supported before booting
         * fbdev off the hardware, as there's no way to put it back.
         */
-       ret = nvkm_device_pci_new(pdev, NULL, "error", true, false, 0, &device);
+       ret = nvkm_device_pci_new(pdev, nouveau_config, "error",
+                                 true, false, 0, &device);
        if (ret)
                return ret;
 
index 7971096..10d91e8 100644 (file)
@@ -2540,6 +2540,41 @@ nv166_chipset = {
        .sec2 = tu102_sec2_new,
 };
 
+static const struct nvkm_device_chip
+nv167_chipset = {
+       .name = "TU117",
+       .bar = tu102_bar_new,
+       .bios = nvkm_bios_new,
+       .bus = gf100_bus_new,
+       .devinit = tu102_devinit_new,
+       .fault = tu102_fault_new,
+       .fb = gv100_fb_new,
+       .fuse = gm107_fuse_new,
+       .gpio = gk104_gpio_new,
+       .gsp = gv100_gsp_new,
+       .i2c = gm200_i2c_new,
+       .ibus = gm200_ibus_new,
+       .imem = nv50_instmem_new,
+       .ltc = gp102_ltc_new,
+       .mc = tu102_mc_new,
+       .mmu = tu102_mmu_new,
+       .pci = gp100_pci_new,
+       .pmu = gp102_pmu_new,
+       .therm = gp100_therm_new,
+       .timer = gk20a_timer_new,
+       .top = gk104_top_new,
+       .ce[0] = tu102_ce_new,
+       .ce[1] = tu102_ce_new,
+       .ce[2] = tu102_ce_new,
+       .ce[3] = tu102_ce_new,
+       .ce[4] = tu102_ce_new,
+       .disp = tu102_disp_new,
+       .dma = gv100_dma_new,
+       .fifo = tu102_fifo_new,
+       .nvdec[0] = gp102_nvdec_new,
+       .sec2 = tu102_sec2_new,
+};
+
 static int
 nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size,
                       struct nvkm_notify *notify)
@@ -2824,8 +2859,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
        u64 mmio_base, mmio_size;
        u32 boot0, strap;
        void __iomem *map;
-       int ret = -EEXIST;
-       int i;
+       int ret = -EEXIST, i;
+       unsigned chipset;
 
        mutex_lock(&nv_devices_mutex);
        if (nvkm_device_find_locked(handle))
@@ -2870,6 +2905,26 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
                strap = ioread32_native(map + 0x101000);
                iounmap(map);
 
+               /* chipset can be overridden for devel/testing purposes */
+               chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0);
+               if (chipset) {
+                       u32 override_boot0;
+
+                       if (chipset >= 0x10) {
+                               override_boot0  = ((chipset & 0x1ff) << 20);
+                               override_boot0 |= 0x000000a1;
+                       } else {
+                               if (chipset != 0x04)
+                                       override_boot0 = 0x20104000;
+                               else
+                                       override_boot0 = 0x20004000;
+                       }
+
+                       nvdev_warn(device, "CHIPSET OVERRIDE: %08x -> %08x\n",
+                                  boot0, override_boot0);
+                       boot0 = override_boot0;
+               }
+
                /* determine chipset and derive architecture from it */
                if ((boot0 & 0x1f000000) > 0) {
                        device->chipset = (boot0 & 0x1ff00000) >> 20;
@@ -2996,6 +3051,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
                case 0x162: device->chip = &nv162_chipset; break;
                case 0x164: device->chip = &nv164_chipset; break;
                case 0x166: device->chip = &nv166_chipset; break;
+               case 0x167: device->chip = &nv167_chipset; break;
                default:
                        nvdev_error(device, "unknown chipset (%08x)\n", boot0);
                        goto done;
index 5f301e6..818d21b 100644 (file)
@@ -365,8 +365,15 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps)
         * and it's better to have a failed modeset than that.
         */
        for (cfg = nvkm_dp_rates; cfg->rate; cfg++) {
-               if (cfg->nr <= outp_nr && cfg->nr <= outp_bw)
-                       failsafe = cfg;
+               if (cfg->nr <= outp_nr && cfg->nr <= outp_bw) {
+                       /* Try to respect sink limits too when selecting
+                        * lowest link configuration.
+                        */
+                       if (!failsafe ||
+                           (cfg->nr <= sink_nr && cfg->bw <= sink_bw))
+                               failsafe = cfg;
+               }
+
                if (failsafe && cfg[1].rate < dataKBps)
                        break;
        }
index b3d08c5..5417e7a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_OMAP
        tristate "OMAP DRM"
        depends on DRM
index 7b0bcb4..c2566da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "OMAPDRM External Display Device Drivers"
 
 config DRM_OMAP_ENCODER_OPA362
index f24ebf7..956f23e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config OMAP2_DSS_INIT
        bool
 
index e36dbb4..e281fc5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_PANEL
        bool
        depends on DRM
index 970f669..3b2bced 100644 (file)
@@ -165,6 +165,10 @@ err_out0:
 
 void panfrost_device_fini(struct panfrost_device *pfdev)
 {
+       panfrost_job_fini(pfdev);
+       panfrost_mmu_fini(pfdev);
+       panfrost_gpu_fini(pfdev);
+       panfrost_reset_fini(pfdev);
        panfrost_regulator_fini(pfdev);
        panfrost_clk_fini(pfdev);
 }
index 94b0819..d11e228 100644 (file)
@@ -219,7 +219,8 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
 fail_job:
        panfrost_job_put(job);
 fail_out_sync:
-       drm_syncobj_put(sync_out);
+       if (sync_out)
+               drm_syncobj_put(sync_out);
 
        return ret;
 }
index e5e2abd..80f6748 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_PL111
        tristate "DRM Support for PL111 CLCD Controller"
        depends on DRM
index 0c5d391..4501597 100644 (file)
@@ -531,14 +531,15 @@ pl111_init_clock_divider(struct drm_device *drm)
                dev_err(drm->dev, "CLCD: unable to get clcdclk.\n");
                return PTR_ERR(parent);
        }
+
+       spin_lock_init(&priv->tim2_lock);
+
        /* If the clock divider is broken, use the parent directly */
        if (priv->variant->broken_clockdivider) {
                priv->clk = parent;
                return 0;
        }
        parent_name = __clk_get_name(parent);
-
-       spin_lock_init(&priv->tim2_lock);
        div->init = &init;
 
        ret = devm_clk_hw_register(drm->dev, div);
index 1c318ad..38f4ee0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/amba/clcd-regs.h>
 #include <linux/device.h>
 #include <linux/of.h>
index 378da59..d0d691b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_QXL
        tristate "QXL virtual GPU"
        depends on DRM && PCI && MMU
index fc59d42..1b6c201 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 1a6700e..ae8a186 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 9909f5c..6f60f48 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_RADEON_USERPTR
        bool "Always enable userptr support"
        depends on DRM_RADEON
index aa898c6..433df70 100644 (file)
@@ -922,12 +922,12 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div,
        ref_div_max = max(min(100 / post_div, ref_div_max), 1u);
 
        /* get matching reference and feedback divider */
-       *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
+       *ref_div = min(max(den/post_div, 1u), ref_div_max);
        *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);
 
        /* limit fb divider to its maximum */
        if (*fb_div > fb_div_max) {
-               *ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div);
+               *ref_div = (*ref_div * fb_div_max)/(*fb_div);
                *fb_div = fb_div_max;
        }
 }
index 2cdf3b6..6f4222f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ROCKCHIP
        tristate "DRM Support for Rockchip"
        depends on DRM && ROCKCHIP_IOMMU
index cfd436b..3e52076 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 1bb73dc..8ec64ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \
                       test-drm_format.o test-drm_framebuffer.o \
                      test-drm_damage_helper.o
index 286a0ee..388f984 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Test cases for the drm_mm range manager
  */
index 7bf4c13..02b0253 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 1963cc1..d0cfdd3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_STI
        tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
        depends on OF && DRM && (ARCH_STI || ARCH_MULTIPLATFORM)
index d15b10d..b7d6691 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_STM
        tristate "DRM Support for STMicroelectronics SoC Series"
        depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM)
index d883adc..4df5caf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 stm-drm-y := \
        drv.o \
        ltdc.o
index 1dbbc3a..37e90e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_SUN4I
        tristate "DRM Support for Allwinner A10 Display Engine"
        depends on DRM && (ARM || ARM64) && COMMON_CLK
index fb985ba..2598741 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/io.h>
 
 #include "sun4i_hdmi.h"
 
index 74bd4ae..03b7d0f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index cf54847..1d1269f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_TEGRA
        tristate "NVIDIA Tegra DRM"
        depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
index cb7df20..9f505a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_TILCDC
        tristate "DRM Support for TI LCDC Display Controller"
        depends on DRM && OF && ARM
index 2c408ac..87819c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig DRM_TINYDRM
        tristate "Support for simple displays"
        depends on DRM
index f823066..48ec8ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DRM_TINYDRM)              += core/
 
 # Controllers
index 6f8f764..01065e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tinydrm-y := tinydrm-pipe.o tinydrm-helpers.o
 
 obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
index c5f03bf..e2d163c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_TVE200
        tristate "DRM Support for Faraday TV Encoder TVE200"
        depends on DRM
index 6b7a6a1..69948ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tve200_drm-y +=        tve200_display.o \
                tve200_drv.o
 
index 1616ec4..b4d179b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_UDL
        tristate "DisplayLink"
        depends on DRM
index 36f2e82..e5bb6f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o
 
 obj-$(CONFIG_DRM_UDL) := udl.o
index 556f626..a288921 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * udl_dmabuf.c
  *
  * Copyright (c) 2014 The Chromium OS Authors
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <drm/drmP.h>
index 75a74c4..9a5c446 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_V3D
        tristate "Broadcom V3D 3.x and newer"
        depends on ARCH_BCM || ARCH_BCMSTB || COMPILE_TEST
index 34446e1..db4cfc1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Please keep these build lists sorted!
 
 # core driver code
index fdae18a..7c2317e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_VC4
        tristate "Broadcom VC4 Graphics"
        depends on ARCH_BCM || ARCH_BCM2835 || COMPILE_TEST
index 9412709..2ea4e20 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/component.h>
 #include <linux/dmaengine.h>
 #include <linux/i2c.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
index cb5d413..55eb5be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 vgem-y := vgem_drv.o vgem_fence.o
 
 obj-$(CONFIG_DRM_VGEM) += vgem.o
index 751fa8b..84db4ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
index 0c384d9..ba36e93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_VIRTIO_GPU
        tristate "Virtio GPU driver"
        depends on DRM && VIRTIO && MMU
index 3796691..89f09be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 vkms-y := vkms_drv.o vkms_plane.o vkms_output.o vkms_crtc.o vkms_gem.o vkms_crc.o
 
 obj-$(CONFIG_DRM_VKMS) += vkms.o
index f969d48..fab1373 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_XEN
        bool "DRM Support for Xen guest OS"
        depends on XEN
index 5b36421..90ebaed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DRM_ZTE
        tristate "DRM Support for ZTE SoCs"
        depends on DRM && ARCH_ZX
index 9191632..cf987a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TEGRA_HOST1X
        tristate "NVIDIA Tegra host1x driver"
        depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
index fe6f8c5..061fb99 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IMX_IPUV3_CORE
        tristate "IPUv3 core support"
        depends on SOC_IMX5 || SOC_IMX6Q || ARCH_MULTIPLATFORM || COMPILE_TEST
index d5f1d8e..84ab482 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VGA_ARB
        bool "VGA Arbitration" if EXPERT
        default y
index 14ca30b..e920644 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VGA_ARB)  += vgaarb.o
 obj-$(CONFIG_VGA_SWITCHEROO) += vga_switcheroo.o
index c3c390c..3872e03 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HID driver configuration
 #
index 3280aff..ac8946f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  HID driver for Aureal Cy se W-01RN USB_V3.1 devices
  *
index b66617a..0e2ae47 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "I2C HID support"
        depends on I2C
 
index 099e1ce..681b389 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the I2C input drivers
 #
index 786adbc..c6c9cfe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Intel ISH HID support"
        depends on (X86_64 || COMPILE_TEST) && PCI
 
index 2de97e4..f0a82b1 100644 (file)
@@ -23,4 +23,4 @@ intel-ishtp-hid-objs += ishtp-hid-client.o
 obj-$(CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ishtp-loader.o
 intel-ishtp-loader-objs += ishtp-fw-loader.o
 
-ccflags-y += -Idrivers/hid/intel-ish-hid/ishtp
+ccflags-y += -I $(srctree)/$(src)/ishtp
index e50d8fe..b5f3a3c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "USB HID support"
        depends on USB
 
index 2c76de4..bcddb06 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HSI driver configuration
 #
index d612620..3c423a2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HSI clients configuration
 #
index 2607232..8fab835 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for HSI clients
 #
index 48e4eda..3ad4a5a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HSI controllers configuration
 #
index 7aba9c7..41aab93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for HSI controllers drivers
 #
index 1915a18..650dd71 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Hardware monitoring chip drivers configuration
 #
index c4dd630..40c489b 100644 (file)
@@ -1,9 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Google, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 or later as
- * published by the Free Software Foundation.
  */
 
 #include <linux/clk.h>
@@ -830,10 +827,8 @@ static int aspeed_create_pwm_cooling(struct device *dev,
        }
        snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port);
 
-       cdev->tcdev = thermal_of_cooling_device_register(child,
-                                                        cdev->name,
-                                                        cdev,
-                                                        &aspeed_pwm_cool_ops);
+       cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
+                                       cdev->name, cdev, &aspeed_pwm_cool_ops);
        if (IS_ERR(cdev->tcdev))
                return PTR_ERR(cdev->tcdev);
 
index 6c83c38..5f0f346 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * g762 - Driver for the Global Mixed-mode Technology Inc. fan speed
  *        PWM controller chips from G762 family, i.e. G762 and G763
  *
  * g762: minimal datasheet available at:
  *       http://www.gmt.com.tw/product/datasheet/EDS-762_3.pdf
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation.
  */
 
 #include <linux/device.h>
index f1bf67a..3f6e5b4 100644 (file)
@@ -498,6 +498,11 @@ static const struct of_device_id of_gpio_fan_match[] = {
 };
 MODULE_DEVICE_TABLE(of, of_gpio_fan_match);
 
+static void gpio_fan_stop(void *data)
+{
+       set_fan_speed(data, 0);
+}
+
 static int gpio_fan_probe(struct platform_device *pdev)
 {
        int err;
@@ -532,6 +537,7 @@ static int gpio_fan_probe(struct platform_device *pdev)
                err = fan_ctrl_init(fan_data);
                if (err)
                        return err;
+               devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
        }
 
        /* Make this driver part of hwmon class. */
@@ -543,32 +549,20 @@ static int gpio_fan_probe(struct platform_device *pdev)
                return PTR_ERR(fan_data->hwmon_dev);
 
        /* Optional cooling device register for Device tree platforms */
-       fan_data->cdev = thermal_of_cooling_device_register(np,
-                                                           "gpio-fan",
-                                                           fan_data,
-                                                           &gpio_fan_cool_ops);
+       fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
+                               "gpio-fan", fan_data, &gpio_fan_cool_ops);
 
        dev_info(dev, "GPIO fan initialized\n");
 
        return 0;
 }
 
-static int gpio_fan_remove(struct platform_device *pdev)
+static void gpio_fan_shutdown(struct platform_device *pdev)
 {
        struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
 
-       if (!IS_ERR(fan_data->cdev))
-               thermal_cooling_device_unregister(fan_data->cdev);
-
        if (fan_data->gpios)
                set_fan_speed(fan_data, 0);
-
-       return 0;
-}
-
-static void gpio_fan_shutdown(struct platform_device *pdev)
-{
-       gpio_fan_remove(pdev);
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -602,7 +596,6 @@ static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
 
 static struct platform_driver gpio_fan_driver = {
        .probe          = gpio_fan_probe,
-       .remove         = gpio_fan_remove,
        .shutdown       = gpio_fan_shutdown,
        .driver = {
                .name   = "gpio-fan",
index cd91510..e694c46 100644 (file)
@@ -118,9 +118,7 @@ static DEFINE_IDA(hwmon_ida);
  * The complex conditional is necessary to avoid a cyclic dependency
  * between hwmon and thermal_sys modules.
  */
-#if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
-       (!defined(CONFIG_THERMAL_HWMON) || \
-        !(defined(MODULE) && IS_MODULE(CONFIG_THERMAL)))
+#ifdef CONFIG_THERMAL_OF
 static int hwmon_thermal_get_temp(void *data, int *temp)
 {
        struct hwmon_thermal_data *tdata = data;
index 93a5d51..4994c90 100644 (file)
@@ -1,24 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * k8temp.c - Linux kernel module for hardware monitoring
  *
  * Copyright (C) 2006 Rudolf Marek <r.marek@assembler.cz>
  *
  * Inspired from the w83785 and amd756 drivers.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 570791f..019e770 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Lantiq cpu temperature sensor driver
  *
  * Copyright (C) 2017 Florian Eckert <fe@dev.tdt.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * This 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
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>
  */
 
 #include <linux/bitops.h>
index f816d2a..ed8d59d 100644 (file)
@@ -465,42 +465,42 @@ static int mlxreg_fan_config(struct mlxreg_fan *fan,
 static int mlxreg_fan_probe(struct platform_device *pdev)
 {
        struct mlxreg_core_platform_data *pdata;
+       struct device *dev = &pdev->dev;
        struct mlxreg_fan *fan;
        struct device *hwm;
        int err;
 
-       pdata = dev_get_platdata(&pdev->dev);
+       pdata = dev_get_platdata(dev);
        if (!pdata) {
-               dev_err(&pdev->dev, "Failed to get platform data.\n");
+               dev_err(dev, "Failed to get platform data.\n");
                return -EINVAL;
        }
 
-       fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
+       fan = devm_kzalloc(dev, sizeof(*fan), GFP_KERNEL);
        if (!fan)
                return -ENOMEM;
 
-       fan->dev = &pdev->dev;
+       fan->dev = dev;
        fan->regmap = pdata->regmap;
-       platform_set_drvdata(pdev, fan);
 
        err = mlxreg_fan_config(fan, pdata);
        if (err)
                return err;
 
-       hwm = devm_hwmon_device_register_with_info(&pdev->dev, "mlxreg_fan",
+       hwm = devm_hwmon_device_register_with_info(dev, "mlxreg_fan",
                                                   fan,
                                                   &mlxreg_fan_hwmon_chip_info,
                                                   NULL);
        if (IS_ERR(hwm)) {
-               dev_err(&pdev->dev, "Failed to register hwmon device\n");
+               dev_err(dev, "Failed to register hwmon device\n");
                return PTR_ERR(hwm);
        }
 
        if (IS_REACHABLE(CONFIG_THERMAL)) {
-               fan->cdev = thermal_cooling_device_register("mlxreg_fan", fan,
-                                               &mlxreg_fan_cooling_ops);
+               fan->cdev = devm_thermal_of_cooling_device_register(dev,
+                       NULL, "mlxreg_fan", fan, &mlxreg_fan_cooling_ops);
                if (IS_ERR(fan->cdev)) {
-                       dev_err(&pdev->dev, "Failed to register cooling device\n");
+                       dev_err(dev, "Failed to register cooling device\n");
                        return PTR_ERR(fan->cdev);
                }
        }
@@ -508,22 +508,11 @@ static int mlxreg_fan_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mlxreg_fan_remove(struct platform_device *pdev)
-{
-       struct mlxreg_fan *fan = platform_get_drvdata(pdev);
-
-       if (IS_REACHABLE(CONFIG_THERMAL))
-               thermal_cooling_device_unregister(fan->cdev);
-
-       return 0;
-}
-
 static struct platform_driver mlxreg_fan_driver = {
        .driver = {
            .name = "mlxreg-fan",
        },
        .probe = mlxreg_fan_probe,
-       .remove = mlxreg_fan_remove,
 };
 
 module_platform_driver(mlxreg_fan_driver);
index 1dc0cd4..09aaefa 100644 (file)
@@ -846,10 +846,8 @@ static int npcm7xx_create_pwm_cooling(struct device *dev,
        snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
                 pwm_port);
 
-       cdev->tcdev = thermal_of_cooling_device_register(child,
-                                                        cdev->name,
-                                                        cdev,
-                                                        &npcm7xx_pwm_cool_ops);
+       cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
+                               cdev->name, cdev, &npcm7xx_pwm_cool_ops);
        if (IS_ERR(cdev->tcdev))
                return PTR_ERR(cdev->tcdev);
 
index 1658634..35a7070 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # On-Chip Controller configuration
 #
index 493588d..8100617 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 occ-hwmon-common-objs := common.o sysfs.o
 occ-p8-hwmon-objs := p8_i2c.o
 occ-p9-hwmon-objs := p9_sbe.o
index 7edab7e..30751eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PMBus chip drivers configuration
 #
index eead8af..5fb2745 100644 (file)
@@ -273,27 +273,40 @@ static int pwm_fan_of_get_cooling_data(struct device *dev,
        return 0;
 }
 
+static void pwm_fan_regulator_disable(void *data)
+{
+       regulator_disable(data);
+}
+
+static void pwm_fan_pwm_disable(void *__ctx)
+{
+       struct pwm_fan_ctx *ctx = __ctx;
+       pwm_disable(ctx->pwm);
+       del_timer_sync(&ctx->rpm_timer);
+}
+
 static int pwm_fan_probe(struct platform_device *pdev)
 {
        struct thermal_cooling_device *cdev;
+       struct device *dev = &pdev->dev;
        struct pwm_fan_ctx *ctx;
        struct device *hwmon;
        int ret;
        struct pwm_state state = { };
        u32 ppr = 2;
 
-       ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
+       ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
                return -ENOMEM;
 
        mutex_init(&ctx->lock);
 
-       ctx->pwm = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, NULL);
+       ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
        if (IS_ERR(ctx->pwm)) {
                ret = PTR_ERR(ctx->pwm);
 
                if (ret != -EPROBE_DEFER)
-                       dev_err(&pdev->dev, "Could not get PWM: %d\n", ret);
+                       dev_err(dev, "Could not get PWM: %d\n", ret);
 
                return ret;
        }
@@ -304,7 +317,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
        if (ctx->irq == -EPROBE_DEFER)
                return ctx->irq;
 
-       ctx->reg_en = devm_regulator_get_optional(&pdev->dev, "fan");
+       ctx->reg_en = devm_regulator_get_optional(dev, "fan");
        if (IS_ERR(ctx->reg_en)) {
                if (PTR_ERR(ctx->reg_en) != -ENODEV)
                        return PTR_ERR(ctx->reg_en);
@@ -313,10 +326,11 @@ static int pwm_fan_probe(struct platform_device *pdev)
        } else {
                ret = regulator_enable(ctx->reg_en);
                if (ret) {
-                       dev_err(&pdev->dev,
-                               "Failed to enable fan supply: %d\n", ret);
+                       dev_err(dev, "Failed to enable fan supply: %d\n", ret);
                        return ret;
                }
+               devm_add_action_or_reset(dev, pwm_fan_regulator_disable,
+                                        ctx->reg_en);
        }
 
        ctx->pwm_value = MAX_PWM;
@@ -328,91 +342,57 @@ static int pwm_fan_probe(struct platform_device *pdev)
 
        ret = pwm_apply_state(ctx->pwm, &state);
        if (ret) {
-               dev_err(&pdev->dev, "Failed to configure PWM: %d\n", ret);
-               goto err_reg_disable;
+               dev_err(dev, "Failed to configure PWM: %d\n", ret);
+               return ret;
        }
-
        timer_setup(&ctx->rpm_timer, sample_timer, 0);
+       devm_add_action_or_reset(dev, pwm_fan_pwm_disable, ctx);
 
-       of_property_read_u32(pdev->dev.of_node, "pulses-per-revolution", &ppr);
+       of_property_read_u32(dev->of_node, "pulses-per-revolution", &ppr);
        ctx->pulses_per_revolution = ppr;
        if (!ctx->pulses_per_revolution) {
-               dev_err(&pdev->dev, "pulses-per-revolution can't be zero.\n");
-               ret = -EINVAL;
-               goto err_pwm_disable;
+               dev_err(dev, "pulses-per-revolution can't be zero.\n");
+               return -EINVAL;
        }
 
        if (ctx->irq > 0) {
-               ret = devm_request_irq(&pdev->dev, ctx->irq, pulse_handler, 0,
+               ret = devm_request_irq(dev, ctx->irq, pulse_handler, 0,
                                       pdev->name, ctx);
                if (ret) {
-                       dev_err(&pdev->dev,
-                               "Failed to request interrupt: %d\n", ret);
-                       goto err_pwm_disable;
+                       dev_err(dev, "Failed to request interrupt: %d\n", ret);
+                       return ret;
                }
                ctx->sample_start = ktime_get();
                mod_timer(&ctx->rpm_timer, jiffies + HZ);
        }
 
-       hwmon = devm_hwmon_device_register_with_groups(&pdev->dev, "pwmfan",
+       hwmon = devm_hwmon_device_register_with_groups(dev, "pwmfan",
                                                       ctx, pwm_fan_groups);
        if (IS_ERR(hwmon)) {
-               ret = PTR_ERR(hwmon);
-               dev_err(&pdev->dev,
-                       "Failed to register hwmon device: %d\n", ret);
-               goto err_del_timer;
+               dev_err(dev, "Failed to register hwmon device\n");
+               return PTR_ERR(hwmon);
        }
 
-       ret = pwm_fan_of_get_cooling_data(&pdev->dev, ctx);
+       ret = pwm_fan_of_get_cooling_data(dev, ctx);
        if (ret)
-               goto err_del_timer;
+               return ret;
 
        ctx->pwm_fan_state = ctx->pwm_fan_max_state;
        if (IS_ENABLED(CONFIG_THERMAL)) {
-               cdev = thermal_of_cooling_device_register(pdev->dev.of_node,
-                                                         "pwm-fan", ctx,
-                                                         &pwm_fan_cooling_ops);
+               cdev = devm_thermal_of_cooling_device_register(dev,
+                       dev->of_node, "pwm-fan", ctx, &pwm_fan_cooling_ops);
                if (IS_ERR(cdev)) {
                        ret = PTR_ERR(cdev);
-                       dev_err(&pdev->dev,
+                       dev_err(dev,
                                "Failed to register pwm-fan as cooling device: %d\n",
                                ret);
-                       goto err_del_timer;
+                       return ret;
                }
                ctx->cdev = cdev;
                thermal_cdev_update(cdev);
        }
 
        return 0;
-
-err_del_timer:
-       del_timer_sync(&ctx->rpm_timer);
-
-err_pwm_disable:
-       state.enabled = false;
-       pwm_apply_state(ctx->pwm, &state);
-
-err_reg_disable:
-       if (ctx->reg_en)
-               regulator_disable(ctx->reg_en);
-
-       return ret;
-}
-
-static int pwm_fan_remove(struct platform_device *pdev)
-{
-       struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
-
-       thermal_cooling_device_unregister(ctx->cdev);
-       del_timer_sync(&ctx->rpm_timer);
-
-       if (ctx->pwm_value)
-               pwm_disable(ctx->pwm);
-
-       if (ctx->reg_en)
-               regulator_disable(ctx->reg_en);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -480,7 +460,6 @@ MODULE_DEVICE_TABLE(of, of_pwm_fan_match);
 
 static struct platform_driver pwm_fan_driver = {
        .probe          = pwm_fan_probe,
-       .remove         = pwm_fan_remove,
        .driver = {
                .name           = "pwm-fan",
                .pm             = &pwm_fan_pm,
index f2816c7..b23cff2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ultra45_env.c: Driver for Ultra45 PIC16F747 environmental monitor.
  *
index a3cd91f..f2a5af2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * APM X-Gene SoC Hardware Monitoring Driver
  *
@@ -5,19 +6,6 @@
  * Author: Loc Ho <lho@apm.com>
  *         Hoan Tran <hotran@apm.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * This driver provides the following features:
  *  - Retrieve CPU total power (uW)
  *  - Retrieve IO total power (uW)
index f68e025..1308583 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "HW tracing support"
 
 source "drivers/hwtracing/stm/Kconfig"
index 18e8d03..5487d4a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Coresight configuration
 #
index ca0527d..4b63593 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INTEL_TH
        tristate "Intel(R) Trace Hub controller"
        depends on HAS_DMA && HAS_IOMEM
index 752dd66..d0e92a8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config STM
        tristate "System Trace Module devices"
        select CONFIGFS_FS
index c6b7fc7..abedd55 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # I2C subsystem configuration
 #
index f1cfe7e..aea5235 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # I2C algorithm drivers configuration
 #
index 215303f..9b319a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the i2c algorithms
 #
index 2618643..ee5dfb5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Sensor device configuration
 #
index 87197ec..fb7a046 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * I2C bus driver for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/interrupt.h>
index a7ac746..63cbb9c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * X-Gene SLIMpro I2C Driver
  *
@@ -5,22 +6,8 @@
  * Author: Feng Kan <fkan@apm.com>
  * Author: Hieu Le <hnle@apm.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * This driver provides support for X-Gene SLIMpro I2C device access
  * using the APM X-Gene SLIMpro mailbox driver.
- *
  */
 #include <acpi/pcc.h>
 #include <linux/acpi.h>
index 9732a81..d389d4f 100644 (file)
@@ -714,7 +714,7 @@ static int i2c_dev_irq_from_resources(const struct resource *resources,
 }
 
 /**
- * i2c_new_device - instantiate an i2c device
+ * i2c_new_client_device - instantiate an i2c device
  * @adap: the adapter managing the device
  * @info: describes one I2C device; bus_num is ignored
  * Context: can sleep
@@ -727,17 +727,17 @@ static int i2c_dev_irq_from_resources(const struct resource *resources,
  * before any i2c_adapter could exist.
  *
  * This returns the new i2c client, which may be saved for later use with
- * i2c_unregister_device(); or NULL to indicate an error.
+ * i2c_unregister_device(); or an ERR_PTR to describe the error.
  */
-struct i2c_client *
-i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
+static struct i2c_client *
+i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
 {
        struct i2c_client       *client;
        int                     status;
 
        client = kzalloc(sizeof *client, GFP_KERNEL);
        if (!client)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        client->adapter = adap;
 
@@ -803,7 +803,31 @@ out_err:
                client->name, client->addr, status);
 out_err_silent:
        kfree(client);
-       return NULL;
+       return ERR_PTR(status);
+}
+EXPORT_SYMBOL_GPL(i2c_new_client_device);
+
+/**
+ * i2c_new_device - instantiate an i2c device
+ * @adap: the adapter managing the device
+ * @info: describes one I2C device; bus_num is ignored
+ * Context: can sleep
+ *
+ * This deprecated function has the same functionality as
+ * @i2c_new_client_device, it just returns NULL instead of an ERR_PTR in case of
+ * an error for compatibility with current I2C API. It will be removed once all
+ * users are converted.
+ *
+ * This returns the new i2c client, which may be saved for later use with
+ * i2c_unregister_device(); or NULL to indicate an error.
+ */
+struct i2c_client *
+i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
+{
+       struct i2c_client *ret;
+
+       ret = i2c_new_client_device(adap, info);
+       return IS_ERR(ret) ? NULL : ret;
 }
 EXPORT_SYMBOL_GPL(i2c_new_device);
 
@@ -854,7 +878,7 @@ static struct i2c_driver dummy_driver = {
 };
 
 /**
- * i2c_new_dummy - return a new i2c device bound to a dummy driver
+ * i2c_new_dummy_device - return a new i2c device bound to a dummy driver
  * @adapter: the adapter managing the device
  * @address: seven bit address to be used
  * Context: can sleep
@@ -869,18 +893,86 @@ static struct i2c_driver dummy_driver = {
  * different driver.
  *
  * This returns the new i2c client, which should be saved for later use with
- * i2c_unregister_device(); or NULL to indicate an error.
+ * i2c_unregister_device(); or an ERR_PTR to describe the error.
  */
-struct i2c_client *i2c_new_dummy(struct i2c_adapter *adapter, u16 address)
+static struct i2c_client *
+i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address)
 {
        struct i2c_board_info info = {
                I2C_BOARD_INFO("dummy", address),
        };
 
-       return i2c_new_device(adapter, &info);
+       return i2c_new_client_device(adapter, &info);
+}
+EXPORT_SYMBOL_GPL(i2c_new_dummy_device);
+
+/**
+ * i2c_new_dummy - return a new i2c device bound to a dummy driver
+ * @adapter: the adapter managing the device
+ * @address: seven bit address to be used
+ * Context: can sleep
+ *
+ * This deprecated function has the same functionality as @i2c_new_dummy_device,
+ * it just returns NULL instead of an ERR_PTR in case of an error for
+ * compatibility with current I2C API. It will be removed once all users are
+ * converted.
+ *
+ * This returns the new i2c client, which should be saved for later use with
+ * i2c_unregister_device(); or NULL to indicate an error.
+ */
+struct i2c_client *i2c_new_dummy(struct i2c_adapter *adapter, u16 address)
+{
+       struct i2c_client *ret;
+
+       ret = i2c_new_dummy_device(adapter, address);
+       return IS_ERR(ret) ? NULL : ret;
 }
 EXPORT_SYMBOL_GPL(i2c_new_dummy);
 
+struct i2c_dummy_devres {
+       struct i2c_client *client;
+};
+
+static void devm_i2c_release_dummy(struct device *dev, void *res)
+{
+       struct i2c_dummy_devres *this = res;
+
+       i2c_unregister_device(this->client);
+}
+
+/**
+ * devm_i2c_new_dummy_device - return a new i2c device bound to a dummy driver
+ * @dev: device the managed resource is bound to
+ * @adapter: the adapter managing the device
+ * @address: seven bit address to be used
+ * Context: can sleep
+ *
+ * This is the device-managed version of @i2c_new_dummy_device. It returns the
+ * new i2c client or an ERR_PTR in case of an error.
+ */
+struct i2c_client *devm_i2c_new_dummy_device(struct device *dev,
+                                            struct i2c_adapter *adapter,
+                                            u16 address)
+{
+       struct i2c_dummy_devres *dr;
+       struct i2c_client *client;
+
+       dr = devres_alloc(devm_i2c_release_dummy, sizeof(*dr), GFP_KERNEL);
+       if (!dr)
+               return ERR_PTR(-ENOMEM);
+
+       client = i2c_new_dummy_device(adapter, address);
+       if (IS_ERR(client)) {
+               devres_free(dr);
+       } else {
+               dr->client = client;
+               devres_add(dev, dr);
+       }
+
+       return client;
+}
+EXPORT_SYMBOL_GPL(devm_i2c_new_dummy_device);
+
 /**
  * i2c_new_secondary_device - Helper to get the instantiated secondary address
  * and create the associated device
@@ -1000,9 +1092,9 @@ i2c_sysfs_new_device(struct device *dev, struct device_attribute *attr,
                info.flags |= I2C_CLIENT_SLAVE;
        }
 
-       client = i2c_new_device(adap, &info);
-       if (!client)
-               return -EINVAL;
+       client = i2c_new_client_device(adap, &info);
+       if (IS_ERR(client))
+               return PTR_ERR(client);
 
        /* Keep track of the added device */
        mutex_lock(&adap->userspace_clients_lock);
index 52a4a92..c6040aa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multiplexer I2C chip drivers configuration
 #
index 26c6b58..4e80a1f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CDNS_I3C_MASTER
        tristate "Cadence I3C master driver"
        depends on I3C
index fc53939..7eea9e0 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CDNS_I3C_MASTER)          += i3c-master-cdns.o
 obj-$(CONFIG_DW_I3C_MASTER)            += dw-i3c-master.o
index 19fcd07..fdd2a62 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IDE ATA ATAPI Block device driver configuration
 #
index c7eaf20..4c959ce 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 1999-2002     Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2007          MontaVista Software, Inc. <source@mvista.com>
index 8f3570e..3268931 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
index 76650e9..e08b0aa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 2003 ATI Inc. <hyu@ati.com>
  *  Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz
index 004243b..f48decb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995-1996  Linus Torvalds & authors (see below)
  */
index b127ed6..a1898e1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
  *           Due to massive hardware bugs, UltraDMA is only supported
index f582007..bc01660 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
  *  Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator
index 8722df3..714e8cd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
index 0a3f9bc..fd3b5da 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 1999-2003             Andre Hedrick <andre@linux-ide.org>
  * Portions Copyright (C) 2001         Sun Microsystems, Inc.
index 1e0fd3a..0dae65a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995-2000  Linus Torvalds & author (see below)
  */
index 80e933b..329c7e4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 1996-2004 Russell King.
  *
index 547d7cf..06c6215 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/kernel.h>
 #include <linux/init.h>
index 33a28cd..80bc3bf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ATAPI support.
  */
index 289d16c..b7c2c0b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/export.h>
index e1323e0..2f37821 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/kernel.h>
 #include <linux/export.h>
index f233b34..dba9ad5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/string.h>
index 1976397..18c20a7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/kernel.h>
 #include <linux/export.h>
index af5119a..d48c170 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IDE ioctls handling.
  */
index d55e9eb..d1445d7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 2000-2002    Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2003         Red Hat
index 30fe363..be65b41 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/export.h>
 #include <linux/ide.h>
index 78cb79e..7b9f655 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
index 4ad8249..e867129 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1994-1998   Linus Torvalds & authors (see below)
  *  Copyright (C) 2005, 2007  Bartlomiej Zolnierkiewicz
index a5dc135..0363d73 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1997-1998    Mark Lord
  *  Copyright (C) 2003         Red Hat
index 17b2e37..aab6a10 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 2000-2002       Michael Cornwell <cornwell@acm.org>
  *  Copyright (C) 2000-2002       Andre Hedrick <andre@linux-ide.org>
index eb42188..0b9709b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
index 6ee866f..9a9c64f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1994-1998        Linus Torvalds & authors (see below)
  *  Copyright (C) 2003-2005, 2007   Bartlomiej Zolnierkiewicz
index 6b92846..d0bf443 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ITE 8213 IDE driver
  *
index 392fd10..11a672a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 1997-1998     Mark Lord <mlord@pobox.com>
  * Copyright (C) 1998          Eddie C. Dost <ecd@skynet.be>
index 26a4500..c374f82 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1996-1998  Linus Torvalds & authors (see below)
  */
index 224ad46..5248ac0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1998-2002            Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2006-2007, 2009      MontaVista Software, Inc.
index a6fb6a8..6ce318e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1996-2001  Linus Torvalds & author (see below)
  */
index d73c3d1..0ab8b86 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 1996-2002 Russell King.
  */
index f4b66f7..fce2b7d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995-1998  Linus Torvalds & author (see below)
  */
index a97affc..ac6fc3f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 1998-2000 Michel Aubry
  * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
index 3300dac..5c24c42 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SL82C105/Winbond 553 IDE driver
  *
index 8af92bb..f521d5e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
index 3aa0fea..870e235 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Copyright (C) 1995-1996  Linus Torvalds & author (see below)
  */
index 55bcf80..6707d25 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INTEL_IDLE
        bool "Cpuidle Driver for Intel Processors"
        depends on CPU_IDLE
index 0007111..0a3c375 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INTEL_IDLE)                       += intel_idle.o
 
index a22cbee..1d736a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Industrial I/O subsystem configuration
 #
index 62a970a..9b9656c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Accelerometer drivers
 #
index 006794a..2a8c311 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * 3-axis accelerometer driver supporting SPI Bosch-Sensortec accelerometer chip
  * Copyright © 2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/device.h>
index b7d0078..011aeff 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/spi/spi.h>
index 2036eca..f96a770 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ADC drivers
 #
index 4735f8a..c599ffa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Qualcomm PM8xxx PMIC XOADC driver
  *
index c91eef0..4fa3978 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Analog Front End drivers
 #
index 5fabb7b..4c56c8e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for industrial I/O Analog Front Ends (AFE)
 #
index e9c5f2c..863d735 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Gain Amplifiers, etc.
 #
index 8da4b78..9abef2e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile iio/amplifiers
 #
index 338774c..63f265c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Industrial I/O generic buffer implementations
 #
index 70c302a..e78fc08 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index 5dc11a3..fa45860 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chemical sensors
 #
index f5d1365..f97270b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for IIO chemical sensors
 #
index e108996..2b9ee91 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IIO common modules
 #
index 135f682..f9bf7ff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chrome OS Embedded Controller managed sensors library
 #
index ec716ff..7c2d6a9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for sensors seen through the ChromeOS EC sensor hub.
 #
index 8010537..24d4925 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Hid Sensor common modules
 #
index 22e7c5a..64b01a8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Hid sensor common modules.
 #
index 89398d0..45012b7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Measurements Specialties sensors common library
 #
index 7846428..028573b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Measurement Specialties sensor common modules.
 #
index 0ea4faf..5262409 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SSP sensor drivers and commons configuration
 #
index 1e0389e..ba83142 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for SSP sensor drivers and commons.
 #
index 865f1ca..91b98e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STMicroelectronics sensors common library
 #
index fbef910..cc42219 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DAC drivers
 #
index c4fd108..5c5c2f8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Industrial I/O subsystem Dummy Driver configuration
 #
index dc5e0b7..c86db8b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Frequency
 #      Direct Digital Synthesis drivers (DDS)
index 2bca03f..f2e396d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile iio/frequency
 #
index 61c00ce..95e6f96 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IIO Digital Gyroscope Sensor drivers configuration
 #
index 934a092..4fc9c6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
index 021ea5f..182a59c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/spi/spi.h>
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
index 0a40616..80154bc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * MPU3050 gyroscope driver
  *
index 93f08b3..afa8018 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
index a2ecb4c..a89f3ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Health sensors
 #
index 3558f9d..9108171 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for IIO Health sensors
 #
index f1a8ec9..6c5507a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # humidity sensor drivers
 #
index 156630a..4957e6d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IIO imu drivers configuration
 #
index 005c17c..9d14d85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # BMI160 IMU driver
 #
index 10365e4..fdcfedd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Bosch BMI160 IMU
 #
index d2fe9db..395f3bd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # inv-mpu6050 drivers for Invensense MPU devices and combos
 #
index 9e59297..002a423 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config IIO_ST_LSM6DSX
        tristate "ST_LSM6DSx driver for STM 6-axis IMU MEMS sensors"
index e5f733c..28cc673 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 st_lsm6dsx-y := st_lsm6dsx_core.o st_lsm6dsx_buffer.o \
                st_lsm6dsx_shub.o
 
index 06ca3f7..4a5eff3 100644 (file)
@@ -733,11 +733,11 @@ static int iio_channel_read_avail(struct iio_channel *chan,
                                                 vals, type, length, info);
 }
 
-int iio_read_avail_channel_raw(struct iio_channel *chan,
-                              const int **vals, int *length)
+int iio_read_avail_channel_attribute(struct iio_channel *chan,
+                                    const int **vals, int *type, int *length,
+                                    enum iio_chan_info_enum attribute)
 {
        int ret;
-       int type;
 
        mutex_lock(&chan->indio_dev->info_exist_lock);
        if (!chan->indio_dev->info) {
@@ -745,11 +745,23 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
                goto err_unlock;
        }
 
-       ret = iio_channel_read_avail(chan,
-                                    vals, &type, length, IIO_CHAN_INFO_RAW);
+       ret = iio_channel_read_avail(chan, vals, type, length, attribute);
 err_unlock:
        mutex_unlock(&chan->indio_dev->info_exist_lock);
 
+       return ret;
+}
+EXPORT_SYMBOL_GPL(iio_read_avail_channel_attribute);
+
+int iio_read_avail_channel_raw(struct iio_channel *chan,
+                              const int **vals, int *length)
+{
+       int ret;
+       int type;
+
+       ret = iio_read_avail_channel_attribute(chan, vals, &type, length,
+                                        IIO_CHAN_INFO_RAW);
+
        if (ret >= 0 && type != IIO_VAL_INT)
                /* raw values are assumed to be IIO_VAL_INT */
                ret = -EINVAL;
index 954c958..e3fd00b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 #
 # Light sensors
index 036f3bb..340d64d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ROHM 1780GLI Ambient Light Sensor Driver
  *
index e454bc6..964ede4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * CM3605 Ambient Light and Proximity Sensor
  *
index 8a63cbb..1697a8c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Magnetometer sensors
 #
index f4d0a6c..fc7e910 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for the Asahi Kasei EMD Corporation AK8974
  * and Aichi Steel AMI305 magnetometer chips.
index 43d08c0..893bec5 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * A sensor driver for the magnetometer AK8975.
  *
  * Magnetic compass sensor driver for monitoring magnetic flux information.
  *
  * Copyright (c) 2010, NVIDIA Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <linux/module.h>
index 735a7b0..a1e1332 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multiplexer drivers
 #
index 68be3c4..f069ab7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for industrial I/O multiplexer drivers
 #
index e3aa1e5..a505583 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Inclinometer sensors
 #
index 4734dab..7800ed2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for industrial I/O Inclinometer sensor drivers
 #
index a81a3a1..ebc7c72 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Potentiometer drivers
 #
index 1e3baf2..72501bf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Potentiostat drivers
 #
index 64d315e..be78b46 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for industrial I/O potentiostat drivers
 #
index efeb89f..b191811 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Pressure drivers
 #
index 03742b1..acd9a37 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/acpi.h>
index 17bc955..9d57b7a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SPI interface for the BMP280 driver
  *
index e9f254a..6b5cce6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Proximity sensors
 #
index 786801b..47dbfea 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Resolver/Synchro drivers
 #
index 398d82d..fa55813 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Resolver/Synchro drivers
 #
index c185cbe..737faa0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Temperature sensor drivers
 #
index a633d2c..8cef2f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Industrial I/O standalone triggers
 #
index cbfbea4..8ba41cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig INFINIBAND
        tristate "InfiniBand support"
        depends on HAS_IOMEM && HAS_DMA
index fad0b44..8603cdf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND)               += core/
 obj-$(CONFIG_INFINIBAND)               += hw/
 obj-$(CONFIG_INFINIBAND)               += ulp/
index ba01b90..2f7d141 100644 (file)
@@ -731,8 +731,8 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec,
        if (rec->roce.route_resolved)
                return 0;
 
-       rdma_gid2ip(&sgid._sockaddr, &rec->sgid);
-       rdma_gid2ip(&dgid._sockaddr, &rec->dgid);
+       rdma_gid2ip((struct sockaddr *)&sgid, &rec->sgid);
+       rdma_gid2ip((struct sockaddr *)&dgid, &rec->dgid);
 
        if (sgid._sockaddr.sa_family != dgid._sockaddr.sa_family)
                return -EINVAL;
@@ -743,7 +743,7 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec,
        dev_addr.net = &init_net;
        dev_addr.sgid_attr = attr;
 
-       ret = addr_resolve(&sgid._sockaddr, &dgid._sockaddr,
+       ret = addr_resolve((struct sockaddr *)&sgid, (struct sockaddr *)&dgid,
                           &dev_addr, false, true, 0);
        if (ret)
                return ret;
@@ -815,22 +815,22 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
        struct rdma_dev_addr dev_addr;
        struct resolve_cb_context ctx;
        union {
-               struct sockaddr     _sockaddr;
                struct sockaddr_in  _sockaddr_in;
                struct sockaddr_in6 _sockaddr_in6;
        } sgid_addr, dgid_addr;
        int ret;
 
-       rdma_gid2ip(&sgid_addr._sockaddr, sgid);
-       rdma_gid2ip(&dgid_addr._sockaddr, dgid);
+       rdma_gid2ip((struct sockaddr *)&sgid_addr, sgid);
+       rdma_gid2ip((struct sockaddr *)&dgid_addr, dgid);
 
        memset(&dev_addr, 0, sizeof(dev_addr));
        dev_addr.net = &init_net;
        dev_addr.sgid_attr = sgid_attr;
 
        init_completion(&ctx.comp);
-       ret = rdma_resolve_ip(&sgid_addr._sockaddr, &dgid_addr._sockaddr,
-                             &dev_addr, 1000, resolve_cb, true, &ctx);
+       ret = rdma_resolve_ip((struct sockaddr *)&sgid_addr,
+                             (struct sockaddr *)&dgid_addr, &dev_addr, 1000,
+                             resolve_cb, true, &ctx);
        if (ret)
                return ret;
 
index 98eadd3..69188cb 100644 (file)
@@ -1347,32 +1347,35 @@ static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
        return 0;
 }
 
-static int nldev_get_sys_get_dumpit(struct sk_buff *skb,
-                                   struct netlink_callback *cb)
+static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
+                             struct netlink_ext_ack *extack)
 {
        struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
-       struct nlmsghdr *nlh;
+       struct sk_buff *msg;
        int err;
 
-       err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
-                         nldev_policy, NULL);
+       err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
+                         nldev_policy, extack);
        if (err)
                return err;
 
-       nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
+       msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+       if (!msg)
+               return -ENOMEM;
+
+       nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
                        RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
                                         RDMA_NLDEV_CMD_SYS_GET),
                        0, 0);
 
-       err = nla_put_u8(skb, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
+       err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
                         (u8)ib_devices_shared_netns);
        if (err) {
-               nlmsg_cancel(skb, nlh);
+               nlmsg_free(msg);
                return err;
        }
-
-       nlmsg_end(skb, nlh);
-       return skb->len;
+       nlmsg_end(msg, nlh);
+       return rdma_nl_unicast(msg, NETLINK_CB(skb).portid);
 }
 
 static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1442,7 +1445,7 @@ static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = {
                .dump = nldev_res_get_pd_dumpit,
        },
        [RDMA_NLDEV_CMD_SYS_GET] = {
-               .dump = nldev_get_sys_get_dumpit,
+               .doit = nldev_sys_get_doit,
        },
        [RDMA_NLDEV_CMD_SYS_SET] = {
                .doit = nldev_set_sys_set_doit,
index 51e8234..ab8779d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_BNXT_RE
         tristate "Broadcom Netxtreme HCA support"
         depends on 64BIT
index a7b77cb..8c1a72b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_CXGB3
        tristate "Chelsio RDMA Driver"
        depends on CHELSIO_T3
index e0522a5..b49e8d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_CXGB4
        tristate "Chelsio T4/T5 RDMA Driver"
        depends on CHELSIO_T4 && INET
index 31a87d9..291d259 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4
 ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb
 
index 7b146b6..0653f4f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_HFI1
        tristate "Intel OPA Gen1 support"
        depends on X86_64 && INFINIBAND_RDMAVT && I2C
index fddb5fd..61cda7d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_HNS
        tristate "HNS RoCE Driver"
        depends on NET_VENDOR_HISILICON
index eee5205..f22d992 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Hisilicon RoCE drivers.
 #
index d867ef1..e4b45f4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_I40IW
        tristate "Intel(R) Ethernet X722 iWARP Driver"
        depends on INET && I40E
index fc01dea..cc7c42f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MLX4_INFINIBAND
        tristate "Mellanox ConnectX HCA support"
        depends on NETDEVICES && ETHERNET && PCI && INET
index f4213b3..7b6757b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MLX4_INFINIBAND)  += mlx4_ib.o
 
 mlx4_ib-y :=   ah.o cq.o doorbell.o mad.o main.o mr.o qp.o srq.o mcg.o cm.o alias_GUID.o sysfs.o
index 8d651c0..ea248de 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MLX5_INFINIBAND
        tristate "Mellanox 5th generation network adapters (ConnectX series) support"
        depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
index 33f5adb..9924be8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MLX5_INFINIBAND)  += mlx5_ib.o
 
 mlx5_ib-y :=   main.o cq.o doorbell.o qp.o mem.o srq_cmd.o \
index 169ffff..80b42d0 100644 (file)
@@ -154,7 +154,7 @@ bool mlx5_ib_devx_is_flow_counter(void *obj, u32 *counter_id)
  * must be considered upon checking for a valid object id.
  * For that the opcode of the creator command is encoded as part of the obj_id.
  */
-static u64 get_enc_obj_id(u16 opcode, u32 obj_id)
+static u64 get_enc_obj_id(u32 opcode, u32 obj_id)
 {
        return ((u64)opcode << 32) | obj_id;
 }
@@ -167,7 +167,9 @@ static u64 devx_get_obj_id(const void *in)
        switch (opcode) {
        case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
        case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
-               obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT,
+               obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT |
+                                       MLX5_GET(general_obj_in_cmd_hdr, in,
+                                                obj_type) << 16,
                                        MLX5_GET(general_obj_in_cmd_hdr, in,
                                                 obj_id));
                break;
@@ -1171,6 +1173,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
        struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
        u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
        struct devx_obj *obj;
+       u16 obj_type = 0;
        int err;
        int uid;
        u32 obj_id;
@@ -1230,7 +1233,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
        if (err)
                goto err_copy;
 
-       obj->obj_id = get_enc_obj_id(opcode, obj_id);
+       if (opcode == MLX5_CMD_OP_CREATE_GENERAL_OBJECT)
+               obj_type = MLX5_GET(general_obj_in_cmd_hdr, cmd_in, obj_type);
+
+       obj->obj_id = get_enc_obj_id(opcode | obj_type << 16, obj_id);
+
        return 0;
 
 err_copy:
index da314c3..66ff527 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_MTHCA
        tristate "Mellanox HCA support"
        depends on PCI
index 52caae9..8245353 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_NES
        tristate "NetEffect RNIC Driver"
        depends on PCI && INET
index 97820c2..239689a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_NES) += iw_nes.o
 
 iw_nes-objs := nes.o nes_hw.o nes_nic.o nes_utils.o nes_verbs.o nes_cm.o nes_mgt.o
index c0cddc0..dd4ec38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_OCRDMA
        tristate "Emulex One Connect HCA support"
        depends on ETHERNET && NETDEVICES && PCI && INET && (IPV6 || IPV6=n)
index e3f20ca..14fba95 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y := -I $(srctree)/drivers/net/ethernet/emulex/benet
 
 obj-$(CONFIG_INFINIBAND_OCRDMA)        += ocrdma.o
index 1d4ea13..8d3e36d 100644 (file)
@@ -83,7 +83,6 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah,
        struct iphdr ipv4;
        const struct ib_global_route *ib_grh;
        union {
-               struct sockaddr     _sockaddr;
                struct sockaddr_in  _sockaddr_in;
                struct sockaddr_in6 _sockaddr_in6;
        } sgid_addr, dgid_addr;
@@ -133,9 +132,9 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah,
                ipv4.tot_len = htons(0);
                ipv4.ttl = ib_grh->hop_limit;
                ipv4.protocol = nxthdr;
-               rdma_gid2ip(&sgid_addr._sockaddr, sgid);
+               rdma_gid2ip((struct sockaddr *)&sgid_addr, sgid);
                ipv4.saddr = sgid_addr._sockaddr_in.sin_addr.s_addr;
-               rdma_gid2ip(&dgid_addr._sockaddr, &ib_grh->dgid);
+               rdma_gid2ip((struct sockaddr*)&dgid_addr, &ib_grh->dgid);
                ipv4.daddr = dgid_addr._sockaddr_in.sin_addr.s_addr;
                memcpy((u8 *)ah->av + eth_sz, &ipv4, sizeof(struct iphdr));
        } else {
index 32674b2..5127e2e 100644 (file)
@@ -2499,7 +2499,6 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
        u16 vlan_id = 0xFFFF;
        u8 mac_addr[6], hdr_type;
        union {
-               struct sockaddr     _sockaddr;
                struct sockaddr_in  _sockaddr_in;
                struct sockaddr_in6 _sockaddr_in6;
        } sgid_addr, dgid_addr;
@@ -2542,8 +2541,8 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
 
        hdr_type = rdma_gid_attr_network_type(sgid_attr);
        if (hdr_type == RDMA_NETWORK_IPV4) {
-               rdma_gid2ip(&sgid_addr._sockaddr, &sgid_attr->gid);
-               rdma_gid2ip(&dgid_addr._sockaddr, &grh->dgid);
+               rdma_gid2ip((struct sockaddr *)&sgid_addr, &sgid_attr->gid);
+               rdma_gid2ip((struct sockaddr *)&dgid_addr, &grh->dgid);
                memcpy(&cmd->params.dgid[0],
                       &dgid_addr._sockaddr_in.sin_addr.s_addr, 4);
                memcpy(&cmd->params.sgid[0],
index 9b9e3b1..9c30325 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_QEDR
        tristate "QLogic RoCE driver"
        depends on 64BIT && QEDE
index 1c0bc4f..c756798 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_QEDR) := qedr.o
 
 qedr-y := main.o verbs.o qedr_roce_cm.o qedr_iw_cm.o
index cb06314..376d19f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_QIB
        tristate "Intel PCIe HCA support"
        depends on 64BIT && INFINIBAND_RDMAVT
index d1dae2a..c0847d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_USNIC
        tristate "Verbs support for Cisco VIC"
        depends on NETDEVICES && ETHERNET && INET && PCI && INTEL_IOMMU
index 5a9790a..b99c9f0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_VMWARE_PVRDMA
        tristate "VMware Paravirtualized RDMA Driver"
        depends on NETDEVICES && ETHERNET && PCI && INET && VMXNET3
index 2f52e0a..0f5fa4e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_VMWARE_PVRDMA) += vmw_pvrdma.o
 
 vmw_pvrdma-y := pvrdma_cmd.o pvrdma_cq.o pvrdma_doorbell.o pvrdma_main.o pvrdma_misc.o pvrdma_mr.o pvrdma_qp.o pvrdma_srq.o pvrdma_verbs.o
index 8b095b2..ab48a9b 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_RDMAVT)                += rdmavt/
 obj-$(CONFIG_RDMA_RXE)                 += rxe/
index 7df896a..1f2759c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_RDMAVT
        tristate "RDMA verbs transport library"
        depends on X86_64 && ARCH_DMA_ADDR_T_64BIT
index 78b276a..b21962d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # rdmavt driver
 #
index 67ae960..d9bcfe7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config RDMA_RXE
        tristate "Software RDMA over Ethernet (RoCE) driver"
        depends on INET && PCI && INFINIBAND
index cda8eac..4760ce4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_IPOIB
        tristate "IP-over-InfiniBand"
        depends on NETDEVICES && INET && (IPV6 || IPV6=n)
index 299268f..1d29dff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_ISER
        tristate "iSCSI Extensions for RDMA (iSER)"
        depends on SCSI && INET && INFINIBAND_ADDR_TRANS
index fe6cd15..2f3e788 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_ISER)  += ib_iser.o
 
 ib_iser-y                      := iser_verbs.o iser_initiator.o iser_memory.o \
index 02f9759..1a3f5ca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_ISERT
        tristate "iSCSI Extensions for RDMA (iSER) target support"
        depends on INET && INFINIBAND_ADDR_TRANS && TARGET_CORE && ISCSI_TARGET
index a4a4766..e19b16c 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_ISERT) += ib_isert.o
index 48132ab..a1f266b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_OPA_VNIC
        tristate "Intel OPA VNIC support"
        depends on X86_64 && INFINIBAND
index 8061b28..a8c21d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile - Intel Omni-Path Virtual Network Controller driver
 # Copyright(c) 2017, Intel Corporation.
 #
index 99db8fe..6f5e7b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_SRP
        tristate "InfiniBand SCSI RDMA Protocol"
        depends on SCSI && INFINIBAND_ADDR_TRANS
index fb8b718..ce7567c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INFINIBAND_SRPT
        tristate "InfiniBand SCSI RDMA Protocol target support"
        depends on INFINIBAND && INFINIBAND_ADDR_TRANS && TARGET_CORE
index 43fbde4..2d13792 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INFINIBAND_SRPT)  += ib_srpt.o
index c5992cd..1efd315 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Input device configuration
 #
index d279454..24acb3b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Gameport configuration
 #
index d8f9c6e..72b9329 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Joystick driver configuration
 #
index 573191d..056a89a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Driver for the Gravis Grip Multiport, a gamepad "hub" that
  *  connects up to four 9-pin digital gamepads/joysticks.
index ab4dbcb..62dcc5b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # I-Force driver configuration
 #
index bc5bda2..fa79a49 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the I-Force driver
 #
index ff54e19..3833ac4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     SEGA Dreamcast controller driver
  *     Based on drivers/usb/iforce.c
index 1fe039d..7c4f19d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Input core configuration
 #
@@ -205,7 +206,7 @@ config KEYBOARD_LKKBD
 
 config KEYBOARD_EP93XX
        tristate "EP93xx Matrix Keypad support"
-       depends on ARCH_EP93XX
+       depends on ARCH_EP93XX || COMPILE_TEST
        select INPUT_MATRIXKMAP
        help
          Say Y here to enable the matrix keypad on the Cirrus EP93XX.
index 88e321b..b0ead71 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * D-Link DIR-685 router I2C-based Touchkeys input driver
  * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
index f77b295..575dac5 100644 (file)
@@ -27,8 +27,7 @@
 #include <linux/io.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/slab.h>
-
-#include <mach/hardware.h>
+#include <linux/soc/cirrus/ep93xx.h>
 #include <linux/platform_data/keypad-ep93xx.h>
 
 /*
@@ -137,10 +136,7 @@ static void ep93xx_keypad_config(struct ep93xx_keypad *keypad)
        struct ep93xx_keypad_platform_data *pdata = keypad->pdata;
        unsigned int val = 0;
 
-       if (pdata->flags & EP93XX_KEYPAD_KDIV)
-               clk_set_rate(keypad->clk, EP93XX_KEYTCHCLK_DIV4);
-       else
-               clk_set_rate(keypad->clk, EP93XX_KEYTCHCLK_DIV16);
+       clk_set_rate(keypad->clk, pdata->clk_rate);
 
        if (pdata->flags & EP93XX_KEYPAD_DISABLE_3_KEY)
                val |= KEY_INIT_DIS3KY;
index 875205f..a37a7a9 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix
  * keyboard controller
  *
  * Copyright (c) 2009-2011, NVIDIA Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #include <linux/kernel.h>
index 54d36f9..d07c1eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Input misc drivers configuration
 #
index fbe72af..bcf6174 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Cobalt button interface driver.
  *
  *  Copyright (C) 2007-2008  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/input-polldev.h>
 #include <linux/ioport.h>
index 1fe149f..4776273 100644 (file)
@@ -30,6 +30,8 @@ MODULE_ALIAS("platform:ixp4xx-beeper");
 
 static DEFINE_SPINLOCK(beep_lock);
 
+static int ixp4xx_timer2_irq;
+
 static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
 {
        unsigned long flags;
@@ -90,6 +92,7 @@ static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
 static int ixp4xx_spkr_probe(struct platform_device *dev)
 {
        struct input_dev *input_dev;
+       int irq;
        int err;
 
        input_dev = input_allocate_device();
@@ -110,15 +113,22 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
        input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
        input_dev->event = ixp4xx_spkr_event;
 
+       irq = platform_get_irq(dev, 0);
+       if (irq < 0) {
+               err = irq;
+               goto err_free_device;
+       }
+
        err = gpio_request(dev->id, "ixp4-beeper");
        if (err)
                goto err_free_device;
 
-       err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
+       err = request_irq(irq, &ixp4xx_spkr_interrupt,
                          IRQF_NO_SUSPEND, "ixp4xx-beeper",
                          (void *) dev->id);
        if (err)
                goto err_free_gpio;
+       ixp4xx_timer2_irq = irq;
 
        err = input_register_device(input_dev);
        if (err)
@@ -129,7 +139,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
        return 0;
 
  err_free_irq:
-       free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
+       free_irq(irq, (void *)dev->id);
  err_free_gpio:
        gpio_free(dev->id);
  err_free_device:
@@ -146,10 +156,10 @@ static int ixp4xx_spkr_remove(struct platform_device *dev)
        input_unregister_device(input_dev);
 
        /* turn the speaker off */
-       disable_irq(IRQ_IXP4XX_TIMER2);
+       disable_irq(ixp4xx_timer2_irq);
        ixp4xx_spkr_control(pin, 0);
 
-       free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
+       free_irq(ixp4xx_timer2_irq, (void *)dev->id);
        gpio_free(dev->id);
 
        return 0;
@@ -161,7 +171,7 @@ static void ixp4xx_spkr_shutdown(struct platform_device *dev)
        unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
 
        /* turn off the speaker */
-       disable_irq(IRQ_IXP4XX_TIMER2);
+       disable_irq(ixp4xx_timer2_irq);
        ixp4xx_spkr_control(pin, 0);
 }
 
index e8de3aa..c4e0e18 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * A driver for the Griffin Technology, Inc. "PowerMate" USB controller dial.
  *
index 62c5814..4412055 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Support for the S1 button on Routerboard 532
  *
index 7bbe79d..0fee6dd 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  SGI Volume Button interface driver
  *
  *  Copyright (C) 2008  Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/input-polldev.h>
 #include <linux/ioport.h>
index 4fd038d..60e1f31 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Power key driver for SiRF PrimaII
  *
  * Copyright (c) 2013 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index 4a5afc7..fe43e55 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Driver for PC-speaker like devices found on various Sparc systems.
  *
index 566a1e3..652c38e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mouse driver configuration
 #
index 25f0ecb..2de64d6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     SEGA Dreamcast mouse driver
  *     Based on drivers/usb/usbmouse.c
index fad2eae..a212ff7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RMI4 configuration
 #
index bfe436c..f3e18f8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Input core configuration
 #
index 04b96fe..a681a2c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Driver for Allwinner A10 PS2 host controller
  *
index a2b9f97..e4c0d9a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Tablet driver configuration
 #
index 75b5006..04b8557 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index ffd03cf..a1f3a0c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Pegasus Mobile Notetaker Pen input tablet driver
  *
index a2029c3..fb91f2d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Touchscreen driver configuration
 #
index 85cf9be..818f2e4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 9169aa0..e900640 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
index 07a8276..bfa4ca3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig INTERCONNECT
        tristate "On-Chip Interconnect management support"
        help
index 290d330..d5e70eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INTERCONNECT_QCOM
        bool "Qualcomm Network-on-Chip interconnect drivers"
        depends on ARCH_QCOM
index 15b8311..83664db 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # The IOVA library may also be used by non-IOMMU_API users
 config IOMMU_IOVA
        tristate
@@ -94,6 +95,7 @@ config IOMMU_DMA
        bool
        select IOMMU_API
        select IOMMU_IOVA
+       select IRQ_MSI_IOMMU
        select NEED_SG_DMA_LENGTH
 
 config FSL_PAMU
index 5e89804..129c4ba 100644 (file)
@@ -907,17 +907,18 @@ out_free_page:
        return NULL;
 }
 
-void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
+int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)
 {
-       struct device *dev = msi_desc_to_dev(irq_get_msi_desc(irq));
+       struct device *dev = msi_desc_to_dev(desc);
        struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
        struct iommu_dma_cookie *cookie;
        struct iommu_dma_msi_page *msi_page;
-       phys_addr_t msi_addr = (u64)msg->address_hi << 32 | msg->address_lo;
        unsigned long flags;
 
-       if (!domain || !domain->iova_cookie)
-               return;
+       if (!domain || !domain->iova_cookie) {
+               desc->iommu_cookie = NULL;
+               return 0;
+       }
 
        cookie = domain->iova_cookie;
 
@@ -930,19 +931,26 @@ void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
        msi_page = iommu_dma_get_msi_page(dev, msi_addr, domain);
        spin_unlock_irqrestore(&cookie->msi_lock, flags);
 
-       if (WARN_ON(!msi_page)) {
-               /*
-                * We're called from a void callback, so the best we can do is
-                * 'fail' by filling the message with obviously bogus values.
-                * Since we got this far due to an IOMMU being present, it's
-                * not like the existing address would have worked anyway...
-                */
-               msg->address_hi = ~0U;
-               msg->address_lo = ~0U;
-               msg->data = ~0U;
-       } else {
-               msg->address_hi = upper_32_bits(msi_page->iova);
-               msg->address_lo &= cookie_msi_granule(cookie) - 1;
-               msg->address_lo += lower_32_bits(msi_page->iova);
-       }
+       msi_desc_set_iommu_cookie(desc, msi_page);
+
+       if (!msi_page)
+               return -ENOMEM;
+       return 0;
+}
+
+void iommu_dma_compose_msi_msg(struct msi_desc *desc,
+                              struct msi_msg *msg)
+{
+       struct device *dev = msi_desc_to_dev(desc);
+       const struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
+       const struct iommu_dma_msi_page *msi_page;
+
+       msi_page = msi_desc_get_iommu_cookie(desc);
+
+       if (!domain || !domain->iova_cookie || WARN_ON(!msi_page))
+               return;
+
+       msg->address_hi = upper_32_bits(msi_page->iova);
+       msg->address_lo &= cookie_msi_granule(domain->iova_cookie) - 1;
+       msg->address_lo += lower_32_bits(msi_page->iova);
 }
index 81cf290..83f36f6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/cpumask.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
index 9fb0eb7..b4b87d6 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/of_iommu.h>
 
 #include <asm/cacheflush.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include "msm_iommu_hw-8xxx.h"
 #include "msm_iommu.h"
index 3949e55..68a422f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IPACK configuration.
 #
index 6f14ade..284f045 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the IPACK bridge device drivers.
 #
index 922ff5c..01c2dc9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BOARD_TPCI200
        tristate "Support for the TEWS TPCI-200 IndustryPack carrier board"
        depends on IPACK_BUS
index d8b7645..0301cae 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BOARD_TPCI200) += tpci200.o
index 907a8cb..75a62d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SERIAL_IPOCTAL
        tristate "IndustryPack IP-OCTAL uart support"
        depends on IPACK_BUS && TTY
index 6de18bd..67a7ed6 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SERIAL_IPOCTAL) += ipoctal.o
index 5438abb..659c5e0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "IRQ chip support"
 
 config IRQCHIP
@@ -6,7 +7,6 @@ config IRQCHIP
 
 config ARM_GIC
        bool
-       select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        select GENERIC_IRQ_MULTI_HANDLER
        select GENERIC_IRQ_EFFECTIVE_AFF_MASK
@@ -33,7 +33,6 @@ config GIC_NON_BANKED
 
 config ARM_GIC_V3
        bool
-       select IRQ_DOMAIN
        select GENERIC_IRQ_MULTI_HANDLER
        select IRQ_DOMAIN_HIERARCHY
        select PARTITION_PERCPU
@@ -59,7 +58,6 @@ config ARM_GIC_V3_ITS_FSL_MC
 
 config ARM_NVIC
        bool
-       select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        select GENERIC_IRQ_CHIP
 
@@ -160,6 +158,12 @@ config IMGPDC_IRQ
        select GENERIC_IRQ_CHIP
        select IRQ_DOMAIN
 
+config IXP4XX_IRQ
+       bool
+       select IRQ_DOMAIN
+       select GENERIC_IRQ_MULTI_HANDLER
+       select SPARSE_IRQ
+
 config MADERA_IRQ
        tristate
 
@@ -352,7 +356,6 @@ config STM32_EXTI
 config QCOM_IRQ_COMBINER
        bool "QCOM IRQ combiner support"
        depends on ARCH_QCOM && ACPI
-       select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        help
          Say yes here to add support for the IRQ combiner devices embedded
@@ -369,7 +372,6 @@ config IRQ_UNIPHIER_AIDET
 config MESON_IRQ_GPIO
        bool "Meson GPIO Interrupt Multiplexer"
        depends on ARCH_MESON
-       select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        help
          Support Meson SoC Family GPIO Interrupt Multiplexer
@@ -385,7 +387,6 @@ config GOLDFISH_PIC
 config QCOM_PDC
        bool "QCOM PDC"
        depends on ARCH_QCOM
-       select IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        help
          Power Domain Controller driver to manage and configure wakeup
@@ -425,6 +426,27 @@ config LS1X_IRQ
        help
          Support for the Loongson-1 platform Interrupt Controller.
 
+config TI_SCI_INTR_IRQCHIP
+       bool
+       depends on TI_SCI_PROTOCOL
+       select IRQ_DOMAIN_HIERARCHY
+       help
+         This enables the irqchip driver support for K3 Interrupt router
+         over TI System Control Interface available on some new TI's SoCs.
+         If you wish to use interrupt router irq resources managed by the
+         TI System Controller, say Y here. Otherwise, say N.
+
+config TI_SCI_INTA_IRQCHIP
+       bool
+       depends on TI_SCI_PROTOCOL
+       select IRQ_DOMAIN_HIERARCHY
+       select TI_SCI_INTA_MSI_DOMAIN
+       help
+         This enables the irqchip driver support for K3 Interrupt aggregator
+         over TI System Control Interface available on some new TI's SoCs.
+         If you wish to use interrupt aggregator irq resources managed by the
+         TI System Controller, say Y here. Otherwise, say N.
+
 endmenu
 
 config SIFIVE_PLIC
index 85972ae..606a003 100644 (file)
@@ -43,6 +43,7 @@ obj-$(CONFIG_ATMEL_AIC5_IRQ)  += irq-atmel-aic-common.o irq-atmel-aic5.o
 obj-$(CONFIG_I8259)                    += irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)               += irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)             += irq-mips-cpu.o
+obj-$(CONFIG_IXP4XX_IRQ)               += irq-ixp4xx.o
 obj-$(CONFIG_SIRF_IRQ)                 += irq-sirfsoc.o
 obj-$(CONFIG_JCORE_AIC)                        += irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)                 += irq-rda-intc.o
@@ -97,3 +98,5 @@ obj-$(CONFIG_SIFIVE_PLIC)             += irq-sifive-plic.o
 obj-$(CONFIG_IMX_IRQSTEER)             += irq-imx-irqsteer.o
 obj-$(CONFIG_MADERA_IRQ)               += irq-madera.o
 obj-$(CONFIG_LS1X_IRQ)                 += irq-ls1x.o
+obj-$(CONFIG_TI_SCI_INTR_IRQCHIP)      += irq-ti-sci-intr.o
+obj-$(CONFIG_TI_SCI_INTA_IRQCHIP)      += irq-ti-sci-inta.o
index 0f6e30e..0acebac 100644 (file)
@@ -343,6 +343,9 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
                goto out_unmap;
        }
 
+       pr_info("registered BCM7038 L1 intc (%pOF, IRQs: %d)\n",
+               dn, IRQS_PER_WORD * intc->n_words);
+
        return 0;
 
 out_unmap:
index 8968e5e..541bdca 100644 (file)
@@ -318,6 +318,9 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,
                }
        }
 
+       pr_info("registered %s intc (%pOF, parent IRQ(s): %d)\n",
+               intc_name, dn, data->num_parent_irqs);
+
        return 0;
 
 out_free_domain:
index 5e4ca13..a0642b5 100644 (file)
@@ -264,6 +264,8 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np,
                ct->chip.irq_set_wake = irq_gc_set_wake;
        }
 
+       pr_info("registered L2 intc (%pOF, parent irq: %d)\n", np, parent_irq);
+
        return 0;
 
 out_free_domain:
index ecafd29..c4aac09 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/of_irq.h>
 #include <linux/irqchip/arm-gic.h>
 #include <linux/platform_device.h>
-#include <linux/pm_clock.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
@@ -28,17 +27,27 @@ struct gic_clk_data {
        const char *const *clocks;
 };
 
+struct gic_chip_pm {
+       struct gic_chip_data *chip_data;
+       const struct gic_clk_data *clk_data;
+       struct clk_bulk_data *clks;
+};
+
 static int gic_runtime_resume(struct device *dev)
 {
-       struct gic_chip_data *gic = dev_get_drvdata(dev);
+       struct gic_chip_pm *chip_pm = dev_get_drvdata(dev);
+       struct gic_chip_data *gic = chip_pm->chip_data;
+       const struct gic_clk_data *data = chip_pm->clk_data;
        int ret;
 
-       ret = pm_clk_resume(dev);
-       if (ret)
+       ret = clk_bulk_prepare_enable(data->num_clocks, chip_pm->clks);
+       if (ret) {
+               dev_err(dev, "clk_enable failed: %d\n", ret);
                return ret;
+       }
 
        /*
-        * On the very first resume, the pointer to the driver data
+        * On the very first resume, the pointer to chip_pm->chip_data
         * will be NULL and this is intentional, because we do not
         * want to restore the GIC on the very first resume. So if
         * the pointer is not valid just return.
@@ -54,35 +63,14 @@ static int gic_runtime_resume(struct device *dev)
 
 static int gic_runtime_suspend(struct device *dev)
 {
-       struct gic_chip_data *gic = dev_get_drvdata(dev);
+       struct gic_chip_pm *chip_pm = dev_get_drvdata(dev);
+       struct gic_chip_data *gic = chip_pm->chip_data;
+       const struct gic_clk_data *data = chip_pm->clk_data;
 
        gic_dist_save(gic);
        gic_cpu_save(gic);
 
-       return pm_clk_suspend(dev);
-}
-
-static int gic_get_clocks(struct device *dev, const struct gic_clk_data *data)
-{
-       unsigned int i;
-       int ret;
-
-       if (!dev || !data)
-               return -EINVAL;
-
-       ret = pm_clk_create(dev);
-       if (ret)
-               return ret;
-
-       for (i = 0; i < data->num_clocks; i++) {
-               ret = of_pm_clk_add_clk(dev, data->clocks[i]);
-               if (ret) {
-                       dev_err(dev, "failed to add clock %s\n",
-                               data->clocks[i]);
-                       pm_clk_destroy(dev);
-                       return ret;
-               }
-       }
+       clk_bulk_disable_unprepare(data->num_clocks, chip_pm->clks);
 
        return 0;
 }
@@ -91,8 +79,8 @@ static int gic_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        const struct gic_clk_data *data;
-       struct gic_chip_data *gic;
-       int ret, irq;
+       struct gic_chip_pm *chip_pm;
+       int ret, irq, i;
 
        data = of_device_get_match_data(&pdev->dev);
        if (!data) {
@@ -100,28 +88,41 @@ static int gic_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       chip_pm = devm_kzalloc(dev, sizeof(*chip_pm), GFP_KERNEL);
+       if (!chip_pm)
+               return -ENOMEM;
+
        irq = irq_of_parse_and_map(dev->of_node, 0);
        if (!irq) {
                dev_err(dev, "no parent interrupt found!\n");
                return -EINVAL;
        }
 
-       ret = gic_get_clocks(dev, data);
+       chip_pm->clks = devm_kcalloc(dev, data->num_clocks,
+                                    sizeof(*chip_pm->clks), GFP_KERNEL);
+       if (!chip_pm->clks)
+               return -ENOMEM;
+
+       for (i = 0; i < data->num_clocks; i++)
+               chip_pm->clks[i].id = data->clocks[i];
+
+       ret = devm_clk_bulk_get(dev, data->num_clocks, chip_pm->clks);
        if (ret)
                goto irq_dispose;
 
+       chip_pm->clk_data = data;
+       dev_set_drvdata(dev, chip_pm);
+
        pm_runtime_enable(dev);
 
        ret = pm_runtime_get_sync(dev);
        if (ret < 0)
                goto rpm_disable;
 
-       ret = gic_of_init_child(dev, &gic, irq);
+       ret = gic_of_init_child(dev, &chip_pm->chip_data, irq);
        if (ret)
                goto rpm_put;
 
-       platform_set_drvdata(pdev, gic);
-
        pm_runtime_put(dev);
 
        dev_info(dev, "GIC IRQ controller registered\n");
@@ -132,7 +133,6 @@ rpm_put:
        pm_runtime_put_sync(dev);
 rpm_disable:
        pm_runtime_disable(dev);
-       pm_clk_destroy(dev);
 irq_dispose:
        irq_dispose_mapping(irq);
 
@@ -142,6 +142,8 @@ irq_dispose:
 static const struct dev_pm_ops gic_pm_ops = {
        SET_RUNTIME_PM_OPS(gic_runtime_suspend,
                           gic_runtime_resume, NULL)
+       SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+                                    pm_runtime_force_resume)
 };
 
 static const char * const gic400_clocks[] = {
index de14e06..3c77ab6 100644 (file)
@@ -110,7 +110,7 @@ static void gicv2m_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
        if (v2m->flags & GICV2M_NEEDS_SPI_OFFSET)
                msg->data -= v2m->spi_offset;
 
-       iommu_dma_map_msi_msg(data->irq, msg);
+       iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg);
 }
 
 static struct irq_chip gicv2m_irq_chip = {
@@ -167,6 +167,7 @@ static void gicv2m_unalloc_msi(struct v2m_data *v2m, unsigned int hwirq,
 static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
                                   unsigned int nr_irqs, void *args)
 {
+       msi_alloc_info_t *info = args;
        struct v2m_data *v2m = NULL, *tmp;
        int hwirq, offset, i, err = 0;
 
@@ -186,6 +187,11 @@ static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
 
        hwirq = v2m->spi_start + offset;
 
+       err = iommu_dma_prepare_msi(info->desc,
+                                   v2m->res.start + V2M_MSI_SETSPI_NS);
+       if (err)
+               return err;
+
        for (i = 0; i < nr_irqs; i++) {
                err = gicv2m_irq_gic_domain_alloc(domain, virq + i, hwirq + i);
                if (err)
index 128ac89..cfb9b4e 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/interrupt.h>
 #include <linux/irqdomain.h>
 #include <linux/list.h>
-#include <linux/list_sort.h>
 #include <linux/log2.h>
 #include <linux/memblock.h>
 #include <linux/mm.h>
@@ -1179,7 +1178,7 @@ static void its_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
        msg->address_hi         = upper_32_bits(addr);
        msg->data               = its_get_event_id(d);
 
-       iommu_dma_map_msi_msg(d->irq, msg);
+       iommu_dma_compose_msi_msg(irq_data_get_msi_desc(d), msg);
 }
 
 static int its_irq_set_irqchip_state(struct irq_data *d,
@@ -1465,9 +1464,8 @@ static struct lpi_range *mk_lpi_range(u32 base, u32 span)
 {
        struct lpi_range *range;
 
-       range = kzalloc(sizeof(*range), GFP_KERNEL);
+       range = kmalloc(sizeof(*range), GFP_KERNEL);
        if (range) {
-               INIT_LIST_HEAD(&range->entry);
                range->base_id = base;
                range->span = span;
        }
@@ -1475,31 +1473,6 @@ static struct lpi_range *mk_lpi_range(u32 base, u32 span)
        return range;
 }
 
-static int lpi_range_cmp(void *priv, struct list_head *a, struct list_head *b)
-{
-       struct lpi_range *ra, *rb;
-
-       ra = container_of(a, struct lpi_range, entry);
-       rb = container_of(b, struct lpi_range, entry);
-
-       return ra->base_id - rb->base_id;
-}
-
-static void merge_lpi_ranges(void)
-{
-       struct lpi_range *range, *tmp;
-
-       list_for_each_entry_safe(range, tmp, &lpi_range_list, entry) {
-               if (!list_is_last(&range->entry, &lpi_range_list) &&
-                   (tmp->base_id == (range->base_id + range->span))) {
-                       tmp->base_id = range->base_id;
-                       tmp->span += range->span;
-                       list_del(&range->entry);
-                       kfree(range);
-               }
-       }
-}
-
 static int alloc_lpi_range(u32 nr_lpis, u32 *base)
 {
        struct lpi_range *range, *tmp;
@@ -1529,25 +1502,49 @@ static int alloc_lpi_range(u32 nr_lpis, u32 *base)
        return err;
 }
 
+static void merge_lpi_ranges(struct lpi_range *a, struct lpi_range *b)
+{
+       if (&a->entry == &lpi_range_list || &b->entry == &lpi_range_list)
+               return;
+       if (a->base_id + a->span != b->base_id)
+               return;
+       b->base_id = a->base_id;
+       b->span += a->span;
+       list_del(&a->entry);
+       kfree(a);
+}
+
 static int free_lpi_range(u32 base, u32 nr_lpis)
 {
-       struct lpi_range *new;
-       int err = 0;
+       struct lpi_range *new, *old;
+
+       new = mk_lpi_range(base, nr_lpis);
+       if (!new)
+               return -ENOMEM;
 
        mutex_lock(&lpi_range_lock);
 
-       new = mk_lpi_range(base, nr_lpis);
-       if (!new) {
-               err = -ENOMEM;
-               goto out;
+       list_for_each_entry_reverse(old, &lpi_range_list, entry) {
+               if (old->base_id < base)
+                       break;
        }
+       /*
+        * old is the last element with ->base_id smaller than base,
+        * so new goes right after it. If there are no elements with
+        * ->base_id smaller than base, &old->entry ends up pointing
+        * at the head of the list, and inserting new it the start of
+        * the list is the right thing to do in that case as well.
+        */
+       list_add(&new->entry, &old->entry);
+       /*
+        * Now check if we can merge with the preceding and/or
+        * following ranges.
+        */
+       merge_lpi_ranges(old, new);
+       merge_lpi_ranges(new, list_next_entry(new, entry));
 
-       list_add(&new->entry, &lpi_range_list);
-       list_sort(NULL, &lpi_range_list, lpi_range_cmp);
-       merge_lpi_ranges();
-out:
        mutex_unlock(&lpi_range_lock);
-       return err;
+       return 0;
 }
 
 static int __init its_lpi_init(u32 id_bits)
@@ -2487,7 +2484,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev,
        int err = 0;
 
        /*
-        * We ignore "dev" entierely, and rely on the dev_id that has
+        * We ignore "dev" entirely, and rely on the dev_id that has
         * been passed via the scratchpad. This limits this domain's
         * usefulness to upper layers that definitely know that they
         * are built on top of the ITS.
@@ -2566,6 +2563,7 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
 {
        msi_alloc_info_t *info = args;
        struct its_device *its_dev = info->scratchpad[0].ptr;
+       struct its_node *its = its_dev->its;
        irq_hw_number_t hwirq;
        int err;
        int i;
@@ -2574,6 +2572,10 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
        if (err)
                return err;
 
+       err = iommu_dma_prepare_msi(info->desc, its->get_msi_base(its_dev));
+       if (err)
+               return err;
+
        for (i = 0; i < nr_irqs; i++) {
                err = its_irq_gic_domain_alloc(domain, virq + i, hwirq + i);
                if (err)
index fbfa7ff..563a9b3 100644 (file)
@@ -84,6 +84,7 @@ static void mbi_free_msi(struct mbi_range *mbi, unsigned int hwirq,
 static int mbi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
                                   unsigned int nr_irqs, void *args)
 {
+       msi_alloc_info_t *info = args;
        struct mbi_range *mbi = NULL;
        int hwirq, offset, i, err = 0;
 
@@ -104,6 +105,11 @@ static int mbi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
 
        hwirq = mbi->spi_start + offset;
 
+       err = iommu_dma_prepare_msi(info->desc,
+                                   mbi_phys_base + GICD_SETSPI_NSR);
+       if (err)
+               return err;
+
        for (i = 0; i < nr_irqs; i++) {
                err = mbi_irq_gic_domain_alloc(domain, virq + i, hwirq + i);
                if (err)
@@ -142,7 +148,7 @@ static void mbi_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
        msg[0].address_lo = lower_32_bits(mbi_phys_base + GICD_SETSPI_NSR);
        msg[0].data = data->parent_data->hwirq;
 
-       iommu_dma_map_msi_msg(data->irq, msg);
+       iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg);
 }
 
 #ifdef CONFIG_PCI_MSI
@@ -202,7 +208,7 @@ static void mbi_compose_mbi_msg(struct irq_data *data, struct msi_msg *msg)
        msg[1].address_lo = lower_32_bits(mbi_phys_base + GICD_CLRSPI_NSR);
        msg[1].data = data->parent_data->hwirq;
 
-       iommu_dma_map_msi_msg(data->irq, &msg[1]);
+       iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), &msg[1]);
 }
 
 /* Platform-MSI specific irqchip */
index 88df3d0..290531e 100644 (file)
@@ -144,7 +144,6 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
        struct irqsteer_data *data;
-       struct resource *res;
        u32 irqs_num;
        int i, ret;
 
@@ -152,8 +151,7 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
        if (!data)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       data->regs = devm_ioremap_resource(&pdev->dev, res);
+       data->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(data->regs)) {
                dev_err(&pdev->dev, "failed to initialize reg\n");
                return PTR_ERR(data->regs);
diff --git a/drivers/irqchip/irq-ixp4xx.c b/drivers/irqchip/irq-ixp4xx.c
new file mode 100644 (file)
index 0000000..d576809
--- /dev/null
@@ -0,0 +1,403 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * irqchip for the IXP4xx interrupt controller
+ * Copyright (C) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Based on arch/arm/mach-ixp4xx/common.c
+ * Copyright 2002 (C) Intel Corporation
+ * Copyright 2003-2004 (C) MontaVista, Software, Inc.
+ * Copyright (C) Deepak Saxena <dsaxena@plexity.net>
+ */
+#include <linux/bitops.h>
+#include <linux/gpio/driver.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/irq-ixp4xx.h>
+#include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include <linux/cpu.h>
+
+#include <asm/exception.h>
+#include <asm/mach/irq.h>
+
+#define IXP4XX_ICPR    0x00 /* Interrupt Status */
+#define IXP4XX_ICMR    0x04 /* Interrupt Enable */
+#define IXP4XX_ICLR    0x08 /* Interrupt IRQ/FIQ Select */
+#define IXP4XX_ICIP    0x0C /* IRQ Status */
+#define IXP4XX_ICFP    0x10 /* FIQ Status */
+#define IXP4XX_ICHR    0x14 /* Interrupt Priority */
+#define IXP4XX_ICIH    0x18 /* IRQ Highest Pri Int */
+#define IXP4XX_ICFH    0x1C /* FIQ Highest Pri Int */
+
+/* IXP43x and IXP46x-only */
+#define        IXP4XX_ICPR2    0x20 /* Interrupt Status 2 */
+#define        IXP4XX_ICMR2    0x24 /* Interrupt Enable 2 */
+#define        IXP4XX_ICLR2    0x28 /* Interrupt IRQ/FIQ Select 2 */
+#define IXP4XX_ICIP2   0x2C /* IRQ Status */
+#define IXP4XX_ICFP2   0x30 /* FIQ Status */
+#define IXP4XX_ICEEN   0x34 /* Error High Pri Enable */
+
+/**
+ * struct ixp4xx_irq - state container for the Faraday IRQ controller
+ * @irqbase: IRQ controller memory base in virtual memory
+ * @is_356: if this is an IXP43x, IXP45x or IX46x SoC (with 64 IRQs)
+ * @irqchip: irqchip for this instance
+ * @domain: IRQ domain for this instance
+ */
+struct ixp4xx_irq {
+       void __iomem *irqbase;
+       bool is_356;
+       struct irq_chip irqchip;
+       struct irq_domain *domain;
+};
+
+/* Local static state container */
+static struct ixp4xx_irq ixirq;
+
+/* GPIO Clocks */
+#define IXP4XX_GPIO_CLK_0              14
+#define IXP4XX_GPIO_CLK_1              15
+
+static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
+{
+       /* All are level active high (asserted) here */
+       if (type != IRQ_TYPE_LEVEL_HIGH)
+               return -EINVAL;
+       return 0;
+}
+
+static void ixp4xx_irq_mask(struct irq_data *d)
+{
+       struct ixp4xx_irq *ixi = irq_data_get_irq_chip_data(d);
+       u32 val;
+
+       if (ixi->is_356 && d->hwirq >= 32) {
+               val = __raw_readl(ixi->irqbase + IXP4XX_ICMR2);
+               val &= ~BIT(d->hwirq - 32);
+               __raw_writel(val, ixi->irqbase + IXP4XX_ICMR2);
+       } else {
+               val = __raw_readl(ixi->irqbase + IXP4XX_ICMR);
+               val &= ~BIT(d->hwirq);
+               __raw_writel(val, ixi->irqbase + IXP4XX_ICMR);
+       }
+}
+
+/*
+ * Level triggered interrupts on GPIO lines can only be cleared when the
+ * interrupt condition disappears.
+ */
+static void ixp4xx_irq_unmask(struct irq_data *d)
+{
+       struct ixp4xx_irq *ixi = irq_data_get_irq_chip_data(d);
+       u32 val;
+
+       if (ixi->is_356 && d->hwirq >= 32) {
+               val = __raw_readl(ixi->irqbase + IXP4XX_ICMR2);
+               val |= BIT(d->hwirq - 32);
+               __raw_writel(val, ixi->irqbase + IXP4XX_ICMR2);
+       } else {
+               val = __raw_readl(ixi->irqbase + IXP4XX_ICMR);
+               val |= BIT(d->hwirq);
+               __raw_writel(val, ixi->irqbase + IXP4XX_ICMR);
+       }
+}
+
+asmlinkage void __exception_irq_entry ixp4xx_handle_irq(struct pt_regs *regs)
+{
+       struct ixp4xx_irq *ixi = &ixirq;
+       unsigned long status;
+       int i;
+
+       status = __raw_readl(ixi->irqbase + IXP4XX_ICIP);
+       for_each_set_bit(i, &status, 32)
+               handle_domain_irq(ixi->domain, i, regs);
+
+       /*
+        * IXP465/IXP435 has an upper IRQ status register
+        */
+       if (ixi->is_356) {
+               status = __raw_readl(ixi->irqbase + IXP4XX_ICIP2);
+               for_each_set_bit(i, &status, 32)
+                       handle_domain_irq(ixi->domain, i + 32, regs);
+       }
+}
+
+static int ixp4xx_irq_domain_translate(struct irq_domain *domain,
+                                      struct irq_fwspec *fwspec,
+                                      unsigned long *hwirq,
+                                      unsigned int *type)
+{
+       /* We support standard DT translation */
+       if (is_of_node(fwspec->fwnode) && fwspec->param_count == 2) {
+               *hwirq = fwspec->param[0];
+               *type = fwspec->param[1];
+               return 0;
+       }
+
+       if (is_fwnode_irqchip(fwspec->fwnode)) {
+               if (fwspec->param_count != 2)
+                       return -EINVAL;
+               *hwirq = fwspec->param[0];
+               *type = fwspec->param[1];
+               WARN_ON(*type == IRQ_TYPE_NONE);
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static int ixp4xx_irq_domain_alloc(struct irq_domain *d,
+                                  unsigned int irq, unsigned int nr_irqs,
+                                  void *data)
+{
+       struct ixp4xx_irq *ixi = d->host_data;
+       irq_hw_number_t hwirq;
+       unsigned int type = IRQ_TYPE_NONE;
+       struct irq_fwspec *fwspec = data;
+       int ret;
+       int i;
+
+       ret = ixp4xx_irq_domain_translate(d, fwspec, &hwirq, &type);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < nr_irqs; i++) {
+               /*
+                * TODO: after converting IXP4xx to only device tree, set
+                * handle_bad_irq as default handler and assume all consumers
+                * call .set_type() as this is provided in the second cell in
+                * the device tree phandle.
+                */
+               irq_domain_set_info(d,
+                                   irq + i,
+                                   hwirq + i,
+                                   &ixi->irqchip,
+                                   ixi,
+                                   handle_level_irq,
+                                   NULL, NULL);
+               irq_set_probe(irq + i);
+       }
+
+       return 0;
+}
+
+/*
+ * This needs to be a hierarchical irqdomain to work well with the
+ * GPIO irqchip (which is lower in the hierarchy)
+ */
+static const struct irq_domain_ops ixp4xx_irqdomain_ops = {
+       .translate = ixp4xx_irq_domain_translate,
+       .alloc = ixp4xx_irq_domain_alloc,
+       .free = irq_domain_free_irqs_common,
+};
+
+/**
+ * ixp4xx_get_irq_domain() - retrieve the ixp4xx irq domain
+ *
+ * This function will go away when we transition to DT probing.
+ */
+struct irq_domain *ixp4xx_get_irq_domain(void)
+{
+       struct ixp4xx_irq *ixi = &ixirq;
+
+       return ixi->domain;
+}
+EXPORT_SYMBOL_GPL(ixp4xx_get_irq_domain);
+
+/*
+ * This is the Linux IRQ to hwirq mapping table. This goes away when
+ * we have DT support as all IRQ resources are defined in the device
+ * tree. It will register all the IRQs that are not used by the hierarchical
+ * GPIO IRQ chip. The "holes" inbetween these IRQs will be requested by
+ * the GPIO driver using . This is a step-gap solution.
+ */
+struct ixp4xx_irq_chunk {
+       int irq;
+       int hwirq;
+       int nr_irqs;
+};
+
+static const struct ixp4xx_irq_chunk ixp4xx_irq_chunks[] = {
+       {
+               .irq = 16,
+               .hwirq = 0,
+               .nr_irqs = 6,
+       },
+       {
+               .irq = 24,
+               .hwirq = 8,
+               .nr_irqs = 11,
+       },
+       {
+               .irq = 46,
+               .hwirq = 30,
+               .nr_irqs = 2,
+       },
+       /* Only on the 436 variants */
+       {
+               .irq = 48,
+               .hwirq = 32,
+               .nr_irqs = 10,
+       },
+};
+
+/**
+ * ixp4x_irq_setup() - Common setup code for the IXP4xx interrupt controller
+ * @ixi: State container
+ * @irqbase: Virtual memory base for the interrupt controller
+ * @fwnode: Corresponding fwnode abstraction for this controller
+ * @is_356: if this is an IXP43x, IXP45x or IXP46x SoC variant
+ */
+static int ixp4xx_irq_setup(struct ixp4xx_irq *ixi,
+                           void __iomem *irqbase,
+                           struct fwnode_handle *fwnode,
+                           bool is_356)
+{
+       int nr_irqs;
+
+       ixi->irqbase = irqbase;
+       ixi->is_356 = is_356;
+
+       /* Route all sources to IRQ instead of FIQ */
+       __raw_writel(0x0, ixi->irqbase + IXP4XX_ICLR);
+
+       /* Disable all interrupts */
+       __raw_writel(0x0, ixi->irqbase + IXP4XX_ICMR);
+
+       if (is_356) {
+               /* Route upper 32 sources to IRQ instead of FIQ */
+               __raw_writel(0x0, ixi->irqbase + IXP4XX_ICLR2);
+
+               /* Disable upper 32 interrupts */
+               __raw_writel(0x0, ixi->irqbase + IXP4XX_ICMR2);
+
+               nr_irqs = 64;
+       } else {
+               nr_irqs = 32;
+       }
+
+       ixi->irqchip.name = "IXP4xx";
+       ixi->irqchip.irq_mask = ixp4xx_irq_mask;
+       ixi->irqchip.irq_unmask = ixp4xx_irq_unmask;
+       ixi->irqchip.irq_set_type = ixp4xx_set_irq_type;
+
+       ixi->domain = irq_domain_create_linear(fwnode, nr_irqs,
+                                              &ixp4xx_irqdomain_ops,
+                                              ixi);
+       if (!ixi->domain) {
+               pr_crit("IXP4XX: can not add primary irqdomain\n");
+               return -ENODEV;
+       }
+
+       set_handle_irq(ixp4xx_handle_irq);
+
+       return 0;
+}
+
+/**
+ * ixp4xx_irq_init() - Function to initialize the irqchip from boardfiles
+ * @irqbase: physical base for the irq controller
+ * @is_356: if this is an IXP43x, IXP45x or IXP46x SoC variant
+ */
+void __init ixp4xx_irq_init(resource_size_t irqbase,
+                           bool is_356)
+{
+       struct ixp4xx_irq *ixi = &ixirq;
+       void __iomem *base;
+       struct fwnode_handle *fwnode;
+       struct irq_fwspec fwspec;
+       int nr_chunks;
+       int ret;
+       int i;
+
+       base = ioremap(irqbase, 0x100);
+       if (!base) {
+               pr_crit("IXP4XX: could not ioremap interrupt controller\n");
+               return;
+       }
+       fwnode = irq_domain_alloc_fwnode(base);
+       if (!fwnode) {
+               pr_crit("IXP4XX: no domain handle\n");
+               return;
+       }
+       ret = ixp4xx_irq_setup(ixi, base, fwnode, is_356);
+       if (ret) {
+               pr_crit("IXP4XX: failed to set up irqchip\n");
+               irq_domain_free_fwnode(fwnode);
+       }
+
+       nr_chunks = ARRAY_SIZE(ixp4xx_irq_chunks);
+       if (!is_356)
+               nr_chunks--;
+
+       /*
+        * After adding OF support, this is no longer needed: irqs
+        * will be allocated for the respective fwnodes.
+        */
+       for (i = 0; i < nr_chunks; i++) {
+               const struct ixp4xx_irq_chunk *chunk = &ixp4xx_irq_chunks[i];
+
+               pr_info("Allocate Linux IRQs %d..%d HW IRQs %d..%d\n",
+                       chunk->irq, chunk->irq + chunk->nr_irqs - 1,
+                       chunk->hwirq, chunk->hwirq + chunk->nr_irqs - 1);
+               fwspec.fwnode = fwnode;
+               fwspec.param[0] = chunk->hwirq;
+               fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH;
+               fwspec.param_count = 2;
+               ret = __irq_domain_alloc_irqs(ixi->domain,
+                                             chunk->irq,
+                                             chunk->nr_irqs,
+                                             NUMA_NO_NODE,
+                                             &fwspec,
+                                             false,
+                                             NULL);
+               if (ret < 0) {
+                       pr_crit("IXP4XX: can not allocate irqs in hierarchy %d\n",
+                               ret);
+                       return;
+               }
+       }
+}
+EXPORT_SYMBOL_GPL(ixp4xx_irq_init);
+
+#ifdef CONFIG_OF
+int __init ixp4xx_of_init_irq(struct device_node *np,
+                             struct device_node *parent)
+{
+       struct ixp4xx_irq *ixi = &ixirq;
+       void __iomem *base;
+       struct fwnode_handle *fwnode;
+       bool is_356;
+       int ret;
+
+       base = of_iomap(np, 0);
+       if (!base) {
+               pr_crit("IXP4XX: could not ioremap interrupt controller\n");
+               return -ENODEV;
+       }
+       fwnode = of_node_to_fwnode(np);
+
+       /* These chip variants have 64 interrupts */
+       is_356 = of_device_is_compatible(np, "intel,ixp43x-interrupt") ||
+               of_device_is_compatible(np, "intel,ixp45x-interrupt") ||
+               of_device_is_compatible(np, "intel,ixp46x-interrupt");
+
+       ret = ixp4xx_irq_setup(ixi, base, fwnode, is_356);
+       if (ret)
+               pr_crit("IXP4XX: failed to set up irqchip\n");
+
+       return ret;
+}
+IRQCHIP_DECLARE(ixp42x, "intel,ixp42x-interrupt",
+               ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp43x, "intel,ixp43x-interrupt",
+               ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp45x, "intel,ixp45x-interrupt",
+               ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp46x, "intel,ixp46x-interrupt",
+               ixp4xx_of_init_irq);
+#endif
index c671b32..669d291 100644 (file)
@@ -100,7 +100,7 @@ static void ls_scfg_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
                msg->data |= cpumask_first(mask);
        }
 
-       iommu_dma_map_msi_msg(data->irq, msg);
+       iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg);
 }
 
 static int ls_scfg_msi_set_affinity(struct irq_data *irq_data,
@@ -141,6 +141,7 @@ static int ls_scfg_msi_domain_irq_alloc(struct irq_domain *domain,
                                        unsigned int nr_irqs,
                                        void *args)
 {
+       msi_alloc_info_t *info = args;
        struct ls_scfg_msi *msi_data = domain->host_data;
        int pos, err = 0;
 
@@ -157,6 +158,10 @@ static int ls_scfg_msi_domain_irq_alloc(struct irq_domain *domain,
        if (err)
                return err;
 
+       err = iommu_dma_prepare_msi(info->desc, msi_data->msiir_addr);
+       if (err)
+               return err;
+
        irq_domain_set_info(domain, virq, pos,
                            &ls_scfg_msi_parent_chip, msi_data,
                            handle_simple_irq, NULL, NULL);
index e8b31f5..a671938 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright (C) 2014 Oleksij Rempel <linux@rempel-privat.de>
  *     Add Alphascale ASM9260 support.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/kernel.h>
index 8c03952..04c05a1 100644 (file)
@@ -389,10 +389,8 @@ static int intc_irqpin_probe(struct platform_device *pdev)
        int k;
 
        p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
-       if (!p) {
-               dev_err(dev, "failed to allocate driver data\n");
+       if (!p)
                return -ENOMEM;
-       }
 
        /* deal with driver instance configuration */
        of_property_read_u32(dev->of_node, "sense-bitfield-width",
index e133684..c86faaa 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * interrupt controller support for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/init.h>
index 7bd1d4c..e00f2fa 100644 (file)
 #include <linux/irqchip.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/of_platform.h>
 #include <linux/syscore_ops.h>
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -37,12 +39,6 @@ struct stm32_exti_bank {
 
 #define UNDEF_REG ~0
 
-enum stm32_exti_hwspinlock {
-       HWSPINLOCK_UNKNOWN,
-       HWSPINLOCK_NONE,
-       HWSPINLOCK_READY,
-};
-
 struct stm32_desc_irq {
        u32 exti;
        u32 irq_parent;
@@ -69,8 +65,6 @@ struct stm32_exti_host_data {
        void __iomem *base;
        struct stm32_exti_chip_data *chips_data;
        const struct stm32_exti_drv_data *drv_data;
-       struct device_node *node;
-       enum stm32_exti_hwspinlock hwlock_state;
        struct hwspinlock *hwlock;
 };
 
@@ -285,49 +279,27 @@ static int stm32_exti_set_type(struct irq_data *d,
 
 static int stm32_exti_hwspin_lock(struct stm32_exti_chip_data *chip_data)
 {
-       struct stm32_exti_host_data *host_data = chip_data->host_data;
-       struct hwspinlock *hwlock;
-       int id, ret = 0, timeout = 0;
-
-       /* first time, check for hwspinlock availability */
-       if (unlikely(host_data->hwlock_state == HWSPINLOCK_UNKNOWN)) {
-               id = of_hwspin_lock_get_id(host_data->node, 0);
-               if (id >= 0) {
-                       hwlock = hwspin_lock_request_specific(id);
-                       if (hwlock) {
-                               /* found valid hwspinlock */
-                               host_data->hwlock_state = HWSPINLOCK_READY;
-                               host_data->hwlock = hwlock;
-                               pr_debug("%s hwspinlock = %d\n", __func__, id);
-                       } else {
-                               host_data->hwlock_state = HWSPINLOCK_NONE;
-                       }
-               } else if (id != -EPROBE_DEFER) {
-                       host_data->hwlock_state = HWSPINLOCK_NONE;
-               } else {
-                       /* hwspinlock driver shall be ready at that stage */
-                       ret = -EPROBE_DEFER;
-               }
-       }
+       int ret, timeout = 0;
 
-       if (likely(host_data->hwlock_state == HWSPINLOCK_READY)) {
-               /*
-                * Use the x_raw API since we are under spin_lock protection.
-                * Do not use the x_timeout API because we are under irq_disable
-                * mode (see __setup_irq())
-                */
-               do {
-                       ret = hwspin_trylock_raw(host_data->hwlock);
-                       if (!ret)
-                               return 0;
-
-                       udelay(HWSPNLCK_RETRY_DELAY);
-                       timeout += HWSPNLCK_RETRY_DELAY;
-               } while (timeout < HWSPNLCK_TIMEOUT);
-
-               if (ret == -EBUSY)
-                       ret = -ETIMEDOUT;
-       }
+       if (!chip_data->host_data->hwlock)
+               return 0;
+
+       /*
+        * Use the x_raw API since we are under spin_lock protection.
+        * Do not use the x_timeout API because we are under irq_disable
+        * mode (see __setup_irq())
+        */
+       do {
+               ret = hwspin_trylock_raw(chip_data->host_data->hwlock);
+               if (!ret)
+                       return 0;
+
+               udelay(HWSPNLCK_RETRY_DELAY);
+               timeout += HWSPNLCK_RETRY_DELAY;
+       } while (timeout < HWSPNLCK_TIMEOUT);
+
+       if (ret == -EBUSY)
+               ret = -ETIMEDOUT;
 
        if (ret)
                pr_err("%s can't get hwspinlock (%d)\n", __func__, ret);
@@ -337,7 +309,7 @@ static int stm32_exti_hwspin_lock(struct stm32_exti_chip_data *chip_data)
 
 static void stm32_exti_hwspin_unlock(struct stm32_exti_chip_data *chip_data)
 {
-       if (likely(chip_data->host_data->hwlock_state == HWSPINLOCK_READY))
+       if (chip_data->host_data->hwlock)
                hwspin_unlock_raw(chip_data->host_data->hwlock);
 }
 
@@ -586,8 +558,7 @@ static int stm32_exti_h_set_affinity(struct irq_data *d,
        return -EINVAL;
 }
 
-#ifdef CONFIG_PM
-static int stm32_exti_h_suspend(void)
+static int __maybe_unused stm32_exti_h_suspend(void)
 {
        struct stm32_exti_chip_data *chip_data;
        int i;
@@ -602,7 +573,7 @@ static int stm32_exti_h_suspend(void)
        return 0;
 }
 
-static void stm32_exti_h_resume(void)
+static void __maybe_unused stm32_exti_h_resume(void)
 {
        struct stm32_exti_chip_data *chip_data;
        int i;
@@ -616,17 +587,22 @@ static void stm32_exti_h_resume(void)
 }
 
 static struct syscore_ops stm32_exti_h_syscore_ops = {
+#ifdef CONFIG_PM_SLEEP
        .suspend        = stm32_exti_h_suspend,
        .resume         = stm32_exti_h_resume,
+#endif
 };
 
-static void stm32_exti_h_syscore_init(void)
+static void stm32_exti_h_syscore_init(struct stm32_exti_host_data *host_data)
 {
+       stm32_host_data = host_data;
        register_syscore_ops(&stm32_exti_h_syscore_ops);
 }
-#else
-static inline void stm32_exti_h_syscore_init(void) {}
-#endif
+
+static void stm32_exti_h_syscore_deinit(void)
+{
+       unregister_syscore_ops(&stm32_exti_h_syscore_ops);
+}
 
 static struct irq_chip stm32_exti_h_chip = {
        .name                   = "stm32-exti-h",
@@ -683,8 +659,6 @@ stm32_exti_host_data *stm32_exti_host_init(const struct stm32_exti_drv_data *dd,
                return NULL;
 
        host_data->drv_data = dd;
-       host_data->node = node;
-       host_data->hwlock_state = HWSPINLOCK_UNKNOWN;
        host_data->chips_data = kcalloc(dd->bank_nr,
                                        sizeof(struct stm32_exti_chip_data),
                                        GFP_KERNEL);
@@ -711,7 +685,8 @@ free_host_data:
 
 static struct
 stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
-                                          u32 bank_idx)
+                                          u32 bank_idx,
+                                          struct device_node *node)
 {
        const struct stm32_exti_bank *stm32_bank;
        struct stm32_exti_chip_data *chip_data;
@@ -731,7 +706,7 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
        writel_relaxed(0, base + stm32_bank->imr_ofst);
        writel_relaxed(0, base + stm32_bank->emr_ofst);
 
-       pr_info("%pOF: bank%d\n", h_data->node, bank_idx);
+       pr_info("%pOF: bank%d\n", node, bank_idx);
 
        return chip_data;
 }
@@ -771,7 +746,7 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data,
                struct stm32_exti_chip_data *chip_data;
 
                stm32_bank = drv_data->exti_banks[i];
-               chip_data = stm32_exti_chip_init(host_data, i);
+               chip_data = stm32_exti_chip_init(host_data, i, node);
 
                gc = irq_get_domain_generic_chip(domain, i * IRQS_PER_BANK);
 
@@ -815,50 +790,130 @@ static const struct irq_domain_ops stm32_exti_h_domain_ops = {
        .xlate = irq_domain_xlate_twocell,
 };
 
-static int
-__init stm32_exti_hierarchy_init(const struct stm32_exti_drv_data *drv_data,
-                                struct device_node *node,
-                                struct device_node *parent)
+static void stm32_exti_remove_irq(void *data)
+{
+       struct irq_domain *domain = data;
+
+       irq_domain_remove(domain);
+}
+
+static int stm32_exti_remove(struct platform_device *pdev)
+{
+       stm32_exti_h_syscore_deinit();
+       return 0;
+}
+
+static int stm32_exti_probe(struct platform_device *pdev)
 {
+       int ret, i;
+       struct device *dev = &pdev->dev;
+       struct device_node *np = dev->of_node;
        struct irq_domain *parent_domain, *domain;
        struct stm32_exti_host_data *host_data;
-       int ret, i;
+       const struct stm32_exti_drv_data *drv_data;
+       struct resource *res;
 
-       parent_domain = irq_find_host(parent);
-       if (!parent_domain) {
-               pr_err("interrupt-parent not found\n");
-               return -EINVAL;
+       host_data = devm_kzalloc(dev, sizeof(*host_data), GFP_KERNEL);
+       if (!host_data)
+               return -ENOMEM;
+
+       /* check for optional hwspinlock which may be not available yet */
+       ret = of_hwspin_lock_get_id(np, 0);
+       if (ret == -EPROBE_DEFER)
+               /* hwspinlock framework not yet ready */
+               return ret;
+
+       if (ret >= 0) {
+               host_data->hwlock = devm_hwspin_lock_request_specific(dev, ret);
+               if (!host_data->hwlock) {
+                       dev_err(dev, "Failed to request hwspinlock\n");
+                       return -EINVAL;
+               }
+       } else if (ret != -ENOENT) {
+               /* note: ENOENT is a valid case (means 'no hwspinlock') */
+               dev_err(dev, "Failed to get hwspinlock\n");
+               return ret;
        }
 
-       host_data = stm32_exti_host_init(drv_data, node);
-       if (!host_data)
+       /* initialize host_data */
+       drv_data = of_device_get_match_data(dev);
+       if (!drv_data) {
+               dev_err(dev, "no of match data\n");
+               return -ENODEV;
+       }
+       host_data->drv_data = drv_data;
+
+       host_data->chips_data = devm_kcalloc(dev, drv_data->bank_nr,
+                                            sizeof(*host_data->chips_data),
+                                            GFP_KERNEL);
+       if (!host_data->chips_data)
                return -ENOMEM;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       host_data->base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(host_data->base)) {
+               dev_err(dev, "Unable to map registers\n");
+               return PTR_ERR(host_data->base);
+       }
+
        for (i = 0; i < drv_data->bank_nr; i++)
-               stm32_exti_chip_init(host_data, i);
+               stm32_exti_chip_init(host_data, i, np);
+
+       parent_domain = irq_find_host(of_irq_find_parent(np));
+       if (!parent_domain) {
+               dev_err(dev, "GIC interrupt-parent not found\n");
+               return -EINVAL;
+       }
 
        domain = irq_domain_add_hierarchy(parent_domain, 0,
                                          drv_data->bank_nr * IRQS_PER_BANK,
-                                         node, &stm32_exti_h_domain_ops,
+                                         np, &stm32_exti_h_domain_ops,
                                          host_data);
 
        if (!domain) {
-               pr_err("%pOFn: Could not register exti domain.\n", node);
-               ret = -ENOMEM;
-               goto out_unmap;
+               dev_err(dev, "Could not register exti domain\n");
+               return -ENOMEM;
        }
 
-       stm32_exti_h_syscore_init();
+       ret = devm_add_action_or_reset(dev, stm32_exti_remove_irq, domain);
+       if (ret)
+               return ret;
+
+       stm32_exti_h_syscore_init(host_data);
 
        return 0;
+}
 
-out_unmap:
-       iounmap(host_data->base);
-       kfree(host_data->chips_data);
-       kfree(host_data);
-       return ret;
+/* platform driver only for MP1 */
+static const struct of_device_id stm32_exti_ids[] = {
+       { .compatible = "st,stm32mp1-exti", .data = &stm32mp1_drv_data},
+       {},
+};
+MODULE_DEVICE_TABLE(of, stm32_exti_ids);
+
+static struct platform_driver stm32_exti_driver = {
+       .probe          = stm32_exti_probe,
+       .remove         = stm32_exti_remove,
+       .driver         = {
+               .name   = "stm32_exti",
+               .of_match_table = stm32_exti_ids,
+       },
+};
+
+static int __init stm32_exti_arch_init(void)
+{
+       return platform_driver_register(&stm32_exti_driver);
 }
 
+static void __exit stm32_exti_arch_exit(void)
+{
+       return platform_driver_unregister(&stm32_exti_driver);
+}
+
+arch_initcall(stm32_exti_arch_init);
+module_exit(stm32_exti_arch_exit);
+
+/* no platform driver for F4 and H7 */
 static int __init stm32f4_exti_of_init(struct device_node *np,
                                       struct device_node *parent)
 {
@@ -874,11 +929,3 @@ static int __init stm32h7_exti_of_init(struct device_node *np,
 }
 
 IRQCHIP_DECLARE(stm32h7_exti, "st,stm32h7-exti", stm32h7_exti_of_init);
-
-static int __init stm32mp1_exti_of_init(struct device_node *np,
-                                       struct device_node *parent)
-{
-       return stm32_exti_hierarchy_init(&stm32mp1_drv_data, np, parent);
-}
-
-IRQCHIP_DECLARE(stm32mp1_exti, "st,stm32mp1-exti", stm32mp1_exti_of_init);
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
new file mode 100644 (file)
index 0000000..011b60a
--- /dev/null
@@ -0,0 +1,615 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Texas Instruments' K3 Interrupt Aggregator irqchip driver
+ *
+ * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
+ *     Lokesh Vutla <lokeshvutla@ti.com>
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/interrupt.h>
+#include <linux/msi.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/soc/ti/ti_sci_inta_msi.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+#include <asm-generic/msi.h>
+
+#define TI_SCI_DEV_ID_MASK     0xffff
+#define TI_SCI_DEV_ID_SHIFT    16
+#define TI_SCI_IRQ_ID_MASK     0xffff
+#define TI_SCI_IRQ_ID_SHIFT    0
+#define HWIRQ_TO_DEVID(hwirq)  (((hwirq) >> (TI_SCI_DEV_ID_SHIFT)) & \
+                                (TI_SCI_DEV_ID_MASK))
+#define HWIRQ_TO_IRQID(hwirq)  ((hwirq) & (TI_SCI_IRQ_ID_MASK))
+#define TO_HWIRQ(dev, index)   ((((dev) & TI_SCI_DEV_ID_MASK) << \
+                                TI_SCI_DEV_ID_SHIFT) | \
+                               ((index) & TI_SCI_IRQ_ID_MASK))
+
+#define MAX_EVENTS_PER_VINT    64
+#define VINT_ENABLE_SET_OFFSET 0x0
+#define VINT_ENABLE_CLR_OFFSET 0x8
+#define VINT_STATUS_OFFSET     0x18
+
+/**
+ * struct ti_sci_inta_event_desc - Description of an event coming to
+ *                                Interrupt Aggregator. This serves
+ *                                as a mapping table for global event,
+ *                                hwirq and vint bit.
+ * @global_event:      Global event number corresponding to this event
+ * @hwirq:             Hwirq of the incoming interrupt
+ * @vint_bit:          Corresponding vint bit to which this event is attached.
+ */
+struct ti_sci_inta_event_desc {
+       u16 global_event;
+       u32 hwirq;
+       u8 vint_bit;
+};
+
+/**
+ * struct ti_sci_inta_vint_desc - Description of a virtual interrupt coming out
+ *                               of Interrupt Aggregator.
+ * @domain:            Pointer to IRQ domain to which this vint belongs.
+ * @list:              List entry for the vint list
+ * @event_map:         Bitmap to manage the allocation of events to vint.
+ * @events:            Array of event descriptors assigned to this vint.
+ * @parent_virq:       Linux IRQ number that gets attached to parent
+ * @vint_id:           TISCI vint ID
+ */
+struct ti_sci_inta_vint_desc {
+       struct irq_domain *domain;
+       struct list_head list;
+       DECLARE_BITMAP(event_map, MAX_EVENTS_PER_VINT);
+       struct ti_sci_inta_event_desc events[MAX_EVENTS_PER_VINT];
+       unsigned int parent_virq;
+       u16 vint_id;
+};
+
+/**
+ * struct ti_sci_inta_irq_domain - Structure representing a TISCI based
+ *                                Interrupt Aggregator IRQ domain.
+ * @sci:               Pointer to TISCI handle
+ * @vint:              TISCI resource pointer representing IA inerrupts.
+ * @global_event:      TISCI resource pointer representing global events.
+ * @vint_list:         List of the vints active in the system
+ * @vint_mutex:                Mutex to protect vint_list
+ * @base:              Base address of the memory mapped IO registers
+ * @pdev:              Pointer to platform device.
+ */
+struct ti_sci_inta_irq_domain {
+       const struct ti_sci_handle *sci;
+       struct ti_sci_resource *vint;
+       struct ti_sci_resource *global_event;
+       struct list_head vint_list;
+       /* Mutex to protect vint list */
+       struct mutex vint_mutex;
+       void __iomem *base;
+       struct platform_device *pdev;
+};
+
+#define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
+                                       events[i])
+
+/**
+ * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs
+ * @desc:      Pointer to irq_desc corresponding to the irq
+ */
+static void ti_sci_inta_irq_handler(struct irq_desc *desc)
+{
+       struct ti_sci_inta_vint_desc *vint_desc;
+       struct ti_sci_inta_irq_domain *inta;
+       struct irq_domain *domain;
+       unsigned int virq, bit;
+       unsigned long val;
+
+       vint_desc = irq_desc_get_handler_data(desc);
+       domain = vint_desc->domain;
+       inta = domain->host_data;
+
+       chained_irq_enter(irq_desc_get_chip(desc), desc);
+
+       val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
+                           VINT_STATUS_OFFSET);
+
+       for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
+               virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);
+               if (virq)
+                       generic_handle_irq(virq);
+       }
+
+       chained_irq_exit(irq_desc_get_chip(desc), desc);
+}
+
+/**
+ * ti_sci_inta_alloc_parent_irq() - Allocate parent irq to Interrupt aggregator
+ * @domain:    IRQ domain corresponding to Interrupt Aggregator
+ *
+ * Return 0 if all went well else corresponding error value.
+ */
+static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_domain *domain)
+{
+       struct ti_sci_inta_irq_domain *inta = domain->host_data;
+       struct ti_sci_inta_vint_desc *vint_desc;
+       struct irq_fwspec parent_fwspec;
+       unsigned int parent_virq;
+       u16 vint_id;
+
+       vint_id = ti_sci_get_free_resource(inta->vint);
+       if (vint_id == TI_SCI_RESOURCE_NULL)
+               return ERR_PTR(-EINVAL);
+
+       vint_desc = kzalloc(sizeof(*vint_desc), GFP_KERNEL);
+       if (!vint_desc)
+               return ERR_PTR(-ENOMEM);
+
+       vint_desc->domain = domain;
+       vint_desc->vint_id = vint_id;
+       INIT_LIST_HEAD(&vint_desc->list);
+
+       parent_fwspec.fwnode = of_node_to_fwnode(of_irq_find_parent(dev_of_node(&inta->pdev->dev)));
+       parent_fwspec.param_count = 2;
+       parent_fwspec.param[0] = inta->pdev->id;
+       parent_fwspec.param[1] = vint_desc->vint_id;
+
+       parent_virq = irq_create_fwspec_mapping(&parent_fwspec);
+       if (parent_virq <= 0) {
+               kfree(vint_desc);
+               return ERR_PTR(parent_virq);
+       }
+       vint_desc->parent_virq = parent_virq;
+
+       list_add_tail(&vint_desc->list, &inta->vint_list);
+       irq_set_chained_handler_and_data(vint_desc->parent_virq,
+                                        ti_sci_inta_irq_handler, vint_desc);
+
+       return vint_desc;
+}
+
+/**
+ * ti_sci_inta_alloc_event() - Attach an event to a IA vint.
+ * @vint_desc: Pointer to vint_desc to which the event gets attached
+ * @free_bit:  Bit inside vint to which event gets attached
+ * @hwirq:     hwirq of the input event
+ *
+ * Return event_desc pointer if all went ok else appropriate error value.
+ */
+static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta_vint_desc *vint_desc,
+                                                             u16 free_bit,
+                                                             u32 hwirq)
+{
+       struct ti_sci_inta_irq_domain *inta = vint_desc->domain->host_data;
+       struct ti_sci_inta_event_desc *event_desc;
+       u16 dev_id, dev_index;
+       int err;
+
+       dev_id = HWIRQ_TO_DEVID(hwirq);
+       dev_index = HWIRQ_TO_IRQID(hwirq);
+
+       event_desc = &vint_desc->events[free_bit];
+       event_desc->hwirq = hwirq;
+       event_desc->vint_bit = free_bit;
+       event_desc->global_event = ti_sci_get_free_resource(inta->global_event);
+       if (event_desc->global_event == TI_SCI_RESOURCE_NULL)
+               return ERR_PTR(-EINVAL);
+
+       err = inta->sci->ops.rm_irq_ops.set_event_map(inta->sci,
+                                                     dev_id, dev_index,
+                                                     inta->pdev->id,
+                                                     vint_desc->vint_id,
+                                                     event_desc->global_event,
+                                                     free_bit);
+       if (err)
+               goto free_global_event;
+
+       return event_desc;
+free_global_event:
+       ti_sci_release_resource(inta->global_event, event_desc->global_event);
+       return ERR_PTR(err);
+}
+
+/**
+ * ti_sci_inta_alloc_irq() -  Allocate an irq within INTA domain
+ * @domain:    irq_domain pointer corresponding to INTA
+ * @hwirq:     hwirq of the input event
+ *
+ * Note: Allocation happens in the following manner:
+ *     - Find a free bit available in any of the vints available in the list.
+ *     - If not found, allocate a vint from the vint pool
+ *     - Attach the free bit to input hwirq.
+ * Return event_desc if all went ok else appropriate error value.
+ */
+static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_irq(struct irq_domain *domain,
+                                                           u32 hwirq)
+{
+       struct ti_sci_inta_irq_domain *inta = domain->host_data;
+       struct ti_sci_inta_vint_desc *vint_desc = NULL;
+       struct ti_sci_inta_event_desc *event_desc;
+       u16 free_bit;
+
+       mutex_lock(&inta->vint_mutex);
+       list_for_each_entry(vint_desc, &inta->vint_list, list) {
+               free_bit = find_first_zero_bit(vint_desc->event_map,
+                                              MAX_EVENTS_PER_VINT);
+               if (free_bit != MAX_EVENTS_PER_VINT) {
+                       set_bit(free_bit, vint_desc->event_map);
+                       goto alloc_event;
+               }
+       }
+
+       /* No free bits available. Allocate a new vint */
+       vint_desc = ti_sci_inta_alloc_parent_irq(domain);
+       if (IS_ERR(vint_desc)) {
+               mutex_unlock(&inta->vint_mutex);
+               return ERR_PTR(PTR_ERR(vint_desc));
+       }
+
+       free_bit = find_first_zero_bit(vint_desc->event_map,
+                                      MAX_EVENTS_PER_VINT);
+       set_bit(free_bit, vint_desc->event_map);
+
+alloc_event:
+       event_desc = ti_sci_inta_alloc_event(vint_desc, free_bit, hwirq);
+       if (IS_ERR(event_desc))
+               clear_bit(free_bit, vint_desc->event_map);
+
+       mutex_unlock(&inta->vint_mutex);
+       return event_desc;
+}
+
+/**
+ * ti_sci_inta_free_parent_irq() - Free a parent irq to INTA
+ * @inta:      Pointer to inta domain.
+ * @vint_desc: Pointer to vint_desc that needs to be freed.
+ */
+static void ti_sci_inta_free_parent_irq(struct ti_sci_inta_irq_domain *inta,
+                                       struct ti_sci_inta_vint_desc *vint_desc)
+{
+       if (find_first_bit(vint_desc->event_map, MAX_EVENTS_PER_VINT) == MAX_EVENTS_PER_VINT) {
+               list_del(&vint_desc->list);
+               ti_sci_release_resource(inta->vint, vint_desc->vint_id);
+               irq_dispose_mapping(vint_desc->parent_virq);
+               kfree(vint_desc);
+       }
+}
+
+/**
+ * ti_sci_inta_free_irq() - Free an IRQ within INTA domain
+ * @event_desc:        Pointer to event_desc that needs to be freed.
+ * @hwirq:     Hwirq number within INTA domain that needs to be freed
+ */
+static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc,
+                                u32 hwirq)
+{
+       struct ti_sci_inta_vint_desc *vint_desc;
+       struct ti_sci_inta_irq_domain *inta;
+
+       vint_desc = to_vint_desc(event_desc, event_desc->vint_bit);
+       inta = vint_desc->domain->host_data;
+       /* 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),
+                                                inta->pdev->id,
+                                                vint_desc->vint_id,
+                                                event_desc->global_event,
+                                                event_desc->vint_bit);
+
+       clear_bit(event_desc->vint_bit, vint_desc->event_map);
+       ti_sci_release_resource(inta->global_event, event_desc->global_event);
+       event_desc->global_event = TI_SCI_RESOURCE_NULL;
+       event_desc->hwirq = 0;
+
+       ti_sci_inta_free_parent_irq(inta, vint_desc);
+       mutex_unlock(&inta->vint_mutex);
+}
+
+/**
+ * ti_sci_inta_request_resources() - Allocate resources for input irq
+ * @data: Pointer to corresponding irq_data
+ *
+ * Note: This is the core api where the actual allocation happens for input
+ *      hwirq. This allocation involves creating a parent irq for vint.
+ *      If this is done in irq_domain_ops.alloc() then a deadlock is reached
+ *      for allocation. So this allocation is being done in request_resources()
+ *
+ * Return: 0 if all went well else corresponding error.
+ */
+static int ti_sci_inta_request_resources(struct irq_data *data)
+{
+       struct ti_sci_inta_event_desc *event_desc;
+
+       event_desc = ti_sci_inta_alloc_irq(data->domain, data->hwirq);
+       if (IS_ERR(event_desc))
+               return PTR_ERR(event_desc);
+
+       data->chip_data = event_desc;
+
+       return 0;
+}
+
+/**
+ * ti_sci_inta_release_resources - Release resources for input irq
+ * @data: Pointer to corresponding irq_data
+ *
+ * Note: Corresponding to request_resources(), all the unmapping and deletion
+ *      of parent vint irqs happens in this api.
+ */
+static void ti_sci_inta_release_resources(struct irq_data *data)
+{
+       struct ti_sci_inta_event_desc *event_desc;
+
+       event_desc = irq_data_get_irq_chip_data(data);
+       ti_sci_inta_free_irq(event_desc, data->hwirq);
+}
+
+/**
+ * ti_sci_inta_manage_event() - Control the event based on the offset
+ * @data:      Pointer to corresponding irq_data
+ * @offset:    register offset using which event is controlled.
+ */
+static void ti_sci_inta_manage_event(struct irq_data *data, u32 offset)
+{
+       struct ti_sci_inta_event_desc *event_desc;
+       struct ti_sci_inta_vint_desc *vint_desc;
+       struct ti_sci_inta_irq_domain *inta;
+
+       event_desc = irq_data_get_irq_chip_data(data);
+       vint_desc = to_vint_desc(event_desc, event_desc->vint_bit);
+       inta = data->domain->host_data;
+
+       writeq_relaxed(BIT(event_desc->vint_bit),
+                      inta->base + vint_desc->vint_id * 0x1000 + offset);
+}
+
+/**
+ * ti_sci_inta_mask_irq() - Mask an event
+ * @data:      Pointer to corresponding irq_data
+ */
+static void ti_sci_inta_mask_irq(struct irq_data *data)
+{
+       ti_sci_inta_manage_event(data, VINT_ENABLE_CLR_OFFSET);
+}
+
+/**
+ * ti_sci_inta_unmask_irq() - Unmask an event
+ * @data:      Pointer to corresponding irq_data
+ */
+static void ti_sci_inta_unmask_irq(struct irq_data *data)
+{
+       ti_sci_inta_manage_event(data, VINT_ENABLE_SET_OFFSET);
+}
+
+/**
+ * ti_sci_inta_ack_irq() - Ack an event
+ * @data:      Pointer to corresponding irq_data
+ */
+static void ti_sci_inta_ack_irq(struct irq_data *data)
+{
+       /*
+        * Do not clear the event if hardware is capable of sending
+        * a down event.
+        */
+       if (irqd_get_trigger_type(data) != IRQF_TRIGGER_HIGH)
+               ti_sci_inta_manage_event(data, VINT_STATUS_OFFSET);
+}
+
+static int ti_sci_inta_set_affinity(struct irq_data *d,
+                                   const struct cpumask *mask_val, bool force)
+{
+       return -EINVAL;
+}
+
+/**
+ * ti_sci_inta_set_type() - Update the trigger type of the irq.
+ * @data:      Pointer to corresponding irq_data
+ * @type:      Trigger type as specified by user
+ *
+ * Note: This updates the handle_irq callback for level msi.
+ *
+ * Return 0 if all went well else appropriate error.
+ */
+static int ti_sci_inta_set_type(struct irq_data *data, unsigned int type)
+{
+       /*
+        * .alloc default sets handle_edge_irq. But if the user specifies
+        * that IRQ is level MSI, then update the handle to handle_level_irq
+        */
+       switch (type & IRQ_TYPE_SENSE_MASK) {
+       case IRQF_TRIGGER_HIGH:
+               irq_set_handler_locked(data, handle_level_irq);
+               return 0;
+       case IRQF_TRIGGER_RISING:
+               return 0;
+       default:
+               return -EINVAL;
+       }
+
+       return -EINVAL;
+}
+
+static struct irq_chip ti_sci_inta_irq_chip = {
+       .name                   = "INTA",
+       .irq_ack                = ti_sci_inta_ack_irq,
+       .irq_mask               = ti_sci_inta_mask_irq,
+       .irq_set_type           = ti_sci_inta_set_type,
+       .irq_unmask             = ti_sci_inta_unmask_irq,
+       .irq_set_affinity       = ti_sci_inta_set_affinity,
+       .irq_request_resources  = ti_sci_inta_request_resources,
+       .irq_release_resources  = ti_sci_inta_release_resources,
+};
+
+/**
+ * ti_sci_inta_irq_domain_free() - Free an IRQ from the IRQ domain
+ * @domain:    Domain to which the irqs belong
+ * @virq:      base linux virtual IRQ to be freed.
+ * @nr_irqs:   Number of continuous irqs to be freed
+ */
+static void ti_sci_inta_irq_domain_free(struct irq_domain *domain,
+                                       unsigned int virq, unsigned int nr_irqs)
+{
+       struct irq_data *data = irq_domain_get_irq_data(domain, virq);
+
+       irq_domain_reset_irq_data(data);
+}
+
+/**
+ * ti_sci_inta_irq_domain_alloc() - Allocate Interrupt aggregator IRQs
+ * @domain:    Point to the interrupt aggregator IRQ domain
+ * @virq:      Corresponding Linux virtual IRQ number
+ * @nr_irqs:   Continuous irqs to be allocated
+ * @data:      Pointer to firmware specifier
+ *
+ * No actual allocation happens here.
+ *
+ * Return 0 if all went well else appropriate error value.
+ */
+static int ti_sci_inta_irq_domain_alloc(struct irq_domain *domain,
+                                       unsigned int virq, unsigned int nr_irqs,
+                                       void *data)
+{
+       msi_alloc_info_t *arg = data;
+
+       irq_domain_set_info(domain, virq, arg->hwirq, &ti_sci_inta_irq_chip,
+                           NULL, handle_edge_irq, NULL, NULL);
+
+       return 0;
+}
+
+static const struct irq_domain_ops ti_sci_inta_irq_domain_ops = {
+       .free           = ti_sci_inta_irq_domain_free,
+       .alloc          = ti_sci_inta_irq_domain_alloc,
+};
+
+static struct irq_chip ti_sci_inta_msi_irq_chip = {
+       .name                   = "MSI-INTA",
+       .flags                  = IRQCHIP_SUPPORTS_LEVEL_MSI,
+};
+
+static void ti_sci_inta_msi_set_desc(msi_alloc_info_t *arg,
+                                    struct msi_desc *desc)
+{
+       struct platform_device *pdev = to_platform_device(desc->dev);
+
+       arg->desc = desc;
+       arg->hwirq = TO_HWIRQ(pdev->id, desc->inta.dev_index);
+}
+
+static struct msi_domain_ops ti_sci_inta_msi_ops = {
+       .set_desc       = ti_sci_inta_msi_set_desc,
+};
+
+static struct msi_domain_info ti_sci_inta_msi_domain_info = {
+       .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
+                  MSI_FLAG_LEVEL_CAPABLE),
+       .ops    = &ti_sci_inta_msi_ops,
+       .chip   = &ti_sci_inta_msi_irq_chip,
+};
+
+static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
+{
+       struct irq_domain *parent_domain, *domain, *msi_domain;
+       struct device_node *parent_node, *node;
+       struct ti_sci_inta_irq_domain *inta;
+       struct device *dev = &pdev->dev;
+       struct resource *res;
+       int ret;
+
+       node = dev_of_node(dev);
+       parent_node = of_irq_find_parent(node);
+       if (!parent_node) {
+               dev_err(dev, "Failed to get IRQ parent node\n");
+               return -ENODEV;
+       }
+
+       parent_domain = irq_find_host(parent_node);
+       if (!parent_domain)
+               return -EPROBE_DEFER;
+
+       inta = devm_kzalloc(dev, sizeof(*inta), GFP_KERNEL);
+       if (!inta)
+               return -ENOMEM;
+
+       inta->pdev = pdev;
+       inta->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
+       if (IS_ERR(inta->sci)) {
+               ret = PTR_ERR(inta->sci);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(dev, "ti,sci read fail %d\n", ret);
+               inta->sci = NULL;
+               return ret;
+       }
+
+       ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &pdev->id);
+       if (ret) {
+               dev_err(dev, "missing 'ti,sci-dev-id' property\n");
+               return -EINVAL;
+       }
+
+       inta->vint = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
+                                                "ti,sci-rm-range-vint");
+       if (IS_ERR(inta->vint)) {
+               dev_err(dev, "VINT resource allocation failed\n");
+               return PTR_ERR(inta->vint);
+       }
+
+       inta->global_event = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
+                                               "ti,sci-rm-range-global-event");
+       if (IS_ERR(inta->global_event)) {
+               dev_err(dev, "Global event resource allocation failed\n");
+               return PTR_ERR(inta->global_event);
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       inta->base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(inta->base))
+               return -ENODEV;
+
+       domain = irq_domain_add_linear(dev_of_node(dev),
+                                      ti_sci_get_num_resources(inta->vint),
+                                      &ti_sci_inta_irq_domain_ops, inta);
+       if (!domain) {
+               dev_err(dev, "Failed to allocate IRQ domain\n");
+               return -ENOMEM;
+       }
+
+       msi_domain = ti_sci_inta_msi_create_irq_domain(of_node_to_fwnode(node),
+                                               &ti_sci_inta_msi_domain_info,
+                                               domain);
+       if (!msi_domain) {
+               irq_domain_remove(domain);
+               dev_err(dev, "Failed to allocate msi domain\n");
+               return -ENOMEM;
+       }
+
+       INIT_LIST_HEAD(&inta->vint_list);
+       mutex_init(&inta->vint_mutex);
+
+       return 0;
+}
+
+static const struct of_device_id ti_sci_inta_irq_domain_of_match[] = {
+       { .compatible = "ti,sci-inta", },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ti_sci_inta_irq_domain_of_match);
+
+static struct platform_driver ti_sci_inta_irq_domain_driver = {
+       .probe = ti_sci_inta_irq_domain_probe,
+       .driver = {
+               .name = "ti-sci-inta",
+               .of_match_table = ti_sci_inta_irq_domain_of_match,
+       },
+};
+module_platform_driver(ti_sci_inta_irq_domain_driver);
+
+MODULE_AUTHOR("Lokesh Vutla <lokeshvutla@ticom>");
+MODULE_DESCRIPTION("K3 Interrupt Aggregator driver over TI SCI protocol");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/irqchip/irq-ti-sci-intr.c b/drivers/irqchip/irq-ti-sci-intr.c
new file mode 100644 (file)
index 0000000..59d51a2
--- /dev/null
@@ -0,0 +1,275 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Texas Instruments' K3 Interrupt Router irqchip driver
+ *
+ * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
+ *     Lokesh Vutla <lokeshvutla@ti.com>
+ */
+
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+#define TI_SCI_DEV_ID_MASK     0xffff
+#define TI_SCI_DEV_ID_SHIFT    16
+#define TI_SCI_IRQ_ID_MASK     0xffff
+#define TI_SCI_IRQ_ID_SHIFT    0
+#define HWIRQ_TO_DEVID(hwirq)  (((hwirq) >> (TI_SCI_DEV_ID_SHIFT)) & \
+                                (TI_SCI_DEV_ID_MASK))
+#define HWIRQ_TO_IRQID(hwirq)  ((hwirq) & (TI_SCI_IRQ_ID_MASK))
+#define TO_HWIRQ(dev, index)   ((((dev) & TI_SCI_DEV_ID_MASK) << \
+                                TI_SCI_DEV_ID_SHIFT) | \
+                               ((index) & TI_SCI_IRQ_ID_MASK))
+
+/**
+ * struct ti_sci_intr_irq_domain - Structure representing a TISCI based
+ *                                Interrupt Router IRQ domain.
+ * @sci:       Pointer to TISCI handle
+ * @dst_irq:   TISCI resource pointer representing GIC irq controller.
+ * @dst_id:    TISCI device ID of the GIC irq controller.
+ * @type:      Specifies the trigger type supported by this Interrupt Router
+ */
+struct ti_sci_intr_irq_domain {
+       const struct ti_sci_handle *sci;
+       struct ti_sci_resource *dst_irq;
+       u32 dst_id;
+       u32 type;
+};
+
+static struct irq_chip ti_sci_intr_irq_chip = {
+       .name                   = "INTR",
+       .irq_eoi                = irq_chip_eoi_parent,
+       .irq_mask               = irq_chip_mask_parent,
+       .irq_unmask             = irq_chip_unmask_parent,
+       .irq_set_type           = irq_chip_set_type_parent,
+       .irq_retrigger          = irq_chip_retrigger_hierarchy,
+       .irq_set_affinity       = irq_chip_set_affinity_parent,
+};
+
+/**
+ * ti_sci_intr_irq_domain_translate() - Retrieve hwirq and type from
+ *                                     IRQ firmware specific handler.
+ * @domain:    Pointer to IRQ domain
+ * @fwspec:    Pointer to IRQ specific firmware structure
+ * @hwirq:     IRQ number identified by hardware
+ * @type:      IRQ type
+ *
+ * Return 0 if all went ok else appropriate error.
+ */
+static int ti_sci_intr_irq_domain_translate(struct irq_domain *domain,
+                                           struct irq_fwspec *fwspec,
+                                           unsigned long *hwirq,
+                                           unsigned int *type)
+{
+       struct ti_sci_intr_irq_domain *intr = domain->host_data;
+
+       if (fwspec->param_count != 2)
+               return -EINVAL;
+
+       *hwirq = TO_HWIRQ(fwspec->param[0], fwspec->param[1]);
+       *type = intr->type;
+
+       return 0;
+}
+
+/**
+ * ti_sci_intr_irq_domain_free() - Free the specified IRQs from the domain.
+ * @domain:    Domain to which the irqs belong
+ * @virq:      Linux virtual IRQ to be freed.
+ * @nr_irqs:   Number of continuous irqs to be freed
+ */
+static void ti_sci_intr_irq_domain_free(struct irq_domain *domain,
+                                       unsigned int virq, unsigned int nr_irqs)
+{
+       struct ti_sci_intr_irq_domain *intr = domain->host_data;
+       struct irq_data *data, *parent_data;
+       u16 dev_id, irq_index;
+
+       parent_data = irq_domain_get_irq_data(domain->parent, virq);
+       data = irq_domain_get_irq_data(domain, virq);
+       irq_index = HWIRQ_TO_IRQID(data->hwirq);
+       dev_id = HWIRQ_TO_DEVID(data->hwirq);
+
+       intr->sci->ops.rm_irq_ops.free_irq(intr->sci, dev_id, irq_index,
+                                          intr->dst_id, parent_data->hwirq);
+       ti_sci_release_resource(intr->dst_irq, parent_data->hwirq);
+       irq_domain_free_irqs_parent(domain, virq, 1);
+       irq_domain_reset_irq_data(data);
+}
+
+/**
+ * ti_sci_intr_alloc_gic_irq() - Allocate GIC specific IRQ
+ * @domain:    Pointer to the interrupt router IRQ domain
+ * @virq:      Corresponding Linux virtual IRQ number
+ * @hwirq:     Corresponding hwirq for the IRQ within this IRQ domain
+ *
+ * Returns 0 if all went well else appropriate error pointer.
+ */
+static int ti_sci_intr_alloc_gic_irq(struct irq_domain *domain,
+                                    unsigned int virq, u32 hwirq)
+{
+       struct ti_sci_intr_irq_domain *intr = domain->host_data;
+       struct irq_fwspec fwspec;
+       u16 dev_id, irq_index;
+       u16 dst_irq;
+       int err;
+
+       dev_id = HWIRQ_TO_DEVID(hwirq);
+       irq_index = HWIRQ_TO_IRQID(hwirq);
+
+       dst_irq = ti_sci_get_free_resource(intr->dst_irq);
+       if (dst_irq == TI_SCI_RESOURCE_NULL)
+               return -EINVAL;
+
+       fwspec.fwnode = domain->parent->fwnode;
+       fwspec.param_count = 3;
+       fwspec.param[0] = 0;    /* SPI */
+       fwspec.param[1] = dst_irq - 32; /* SPI offset */
+       fwspec.param[2] = intr->type;
+
+       err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
+       if (err)
+               goto err_irqs;
+
+       err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci, dev_id, irq_index,
+                                               intr->dst_id, dst_irq);
+       if (err)
+               goto err_msg;
+
+       return 0;
+
+err_msg:
+       irq_domain_free_irqs_parent(domain, virq, 1);
+err_irqs:
+       ti_sci_release_resource(intr->dst_irq, dst_irq);
+       return err;
+}
+
+/**
+ * ti_sci_intr_irq_domain_alloc() - Allocate Interrupt router IRQs
+ * @domain:    Point to the interrupt router IRQ domain
+ * @virq:      Corresponding Linux virtual IRQ number
+ * @nr_irqs:   Continuous irqs to be allocated
+ * @data:      Pointer to firmware specifier
+ *
+ * Return 0 if all went well else appropriate error value.
+ */
+static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain,
+                                       unsigned int virq, unsigned int nr_irqs,
+                                       void *data)
+{
+       struct irq_fwspec *fwspec = data;
+       unsigned long hwirq;
+       unsigned int flags;
+       int err;
+
+       err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &flags);
+       if (err)
+               return err;
+
+       err = ti_sci_intr_alloc_gic_irq(domain, virq, hwirq);
+       if (err)
+               return err;
+
+       irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
+                                     &ti_sci_intr_irq_chip, NULL);
+
+       return 0;
+}
+
+static const struct irq_domain_ops ti_sci_intr_irq_domain_ops = {
+       .free           = ti_sci_intr_irq_domain_free,
+       .alloc          = ti_sci_intr_irq_domain_alloc,
+       .translate      = ti_sci_intr_irq_domain_translate,
+};
+
+static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
+{
+       struct irq_domain *parent_domain, *domain;
+       struct ti_sci_intr_irq_domain *intr;
+       struct device_node *parent_node;
+       struct device *dev = &pdev->dev;
+       int ret;
+
+       parent_node = of_irq_find_parent(dev_of_node(dev));
+       if (!parent_node) {
+               dev_err(dev, "Failed to get IRQ parent node\n");
+               return -ENODEV;
+       }
+
+       parent_domain = irq_find_host(parent_node);
+       if (!parent_domain) {
+               dev_err(dev, "Failed to find IRQ parent domain\n");
+               return -ENODEV;
+       }
+
+       intr = devm_kzalloc(dev, sizeof(*intr), GFP_KERNEL);
+       if (!intr)
+               return -ENOMEM;
+
+       ret = of_property_read_u32(dev_of_node(dev), "ti,intr-trigger-type",
+                                  &intr->type);
+       if (ret) {
+               dev_err(dev, "missing ti,intr-trigger-type property\n");
+               return -EINVAL;
+       }
+
+       intr->sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
+       if (IS_ERR(intr->sci)) {
+               ret = PTR_ERR(intr->sci);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(dev, "ti,sci read fail %d\n", ret);
+               intr->sci = NULL;
+               return ret;
+       }
+
+       ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dst-id",
+                                  &intr->dst_id);
+       if (ret) {
+               dev_err(dev, "missing 'ti,sci-dst-id' property\n");
+               return -EINVAL;
+       }
+
+       intr->dst_irq = devm_ti_sci_get_of_resource(intr->sci, dev,
+                                                   intr->dst_id,
+                                                   "ti,sci-rm-range-girq");
+       if (IS_ERR(intr->dst_irq)) {
+               dev_err(dev, "Destination irq resource allocation failed\n");
+               return PTR_ERR(intr->dst_irq);
+       }
+
+       domain = irq_domain_add_hierarchy(parent_domain, 0, 0, dev_of_node(dev),
+                                         &ti_sci_intr_irq_domain_ops, intr);
+       if (!domain) {
+               dev_err(dev, "Failed to allocate IRQ domain\n");
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+static const struct of_device_id ti_sci_intr_irq_domain_of_match[] = {
+       { .compatible = "ti,sci-intr", },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ti_sci_intr_irq_domain_of_match);
+
+static struct platform_driver ti_sci_intr_irq_domain_driver = {
+       .probe = ti_sci_intr_irq_domain_probe,
+       .driver = {
+               .name = "ti-sci-intr",
+               .of_match_table = ti_sci_intr_irq_domain_of_match,
+       },
+};
+module_platform_driver(ti_sci_intr_irq_domain_driver);
+
+MODULE_AUTHOR("Lokesh Vutla <lokeshvutla@ticom>");
+MODULE_DESCRIPTION("K3 Interrupt Router driver over TI SCI protocol");
+MODULE_LICENSE("GPL v2");
index ef661ac..1ca4d70 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ISDN device configuration
 #
index 7641b30..abaadce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAPI_TRACE
        bool "CAPI trace support"
        default y
index dd4a202..07684fe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the dss1_divert ISDN module
 
 # Each configuration option enables a list of files.
index 83f62b8..fe41e9c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig ISDN_DRV_GIGASET
        tristate "Siemens Gigaset support"
        depends on TTY
index 95c4030..0d609b5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ISDN hardware drivers
 #
index e503032..a43760a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the CAPI hardware drivers
 
 # Object files in subdirectories
index b99b906..81483db 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ISDN AVM drivers
 #
index fda912b..a7a34a8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Hardware for mISDN
 #
index 38cfc8b..43d98cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menu "Passive cards"
 
index b8dd149..bcc37e9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* $Id: teles_cs.c,v 1.1.2.2 2004/01/25 15:07:06 keil Exp $ */
 /*======================================================================
 
index e86bc65..1971ef8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HYSDN
        tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)"
        depends on m && PROC_FS && PCI
index da63b63..e01f17f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the hysdn ISDN device driver
 
 # Each configuration option enables a list of files.
index 68e54d9..caa1b52 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Old ISDN4Linux config
 #
index 317cd3c..5ff4c0e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the isdnloop ISDN device driver
 
 # Each configuration option enables a list of files.
index c0730d5..26cf0ac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # modularer ISDN driver
 #
index d4b6f01..6d2088f 100644 (file)
@@ -1676,9 +1676,9 @@ dsp_cmx_send(void *arg)
 #ifdef CMX_CONF_DEBUG
                        if (conf->software && members > 1)
 #else
-                               if (conf->software && members > 2)
+                       if (conf->software && members > 2)
 #endif
-                                       mustmix = 1;
+                               mustmix = 1;
                }
 
                /* transmission required */
@@ -1699,263 +1699,262 @@ dsp_cmx_send(void *arg)
 #ifdef CMX_CONF_DEBUG
                if (conf->software && members > 1) {
 #else
-                       if (conf->software && members > 2) {
+               if (conf->software && members > 2) {
 #endif
-                               /* check for hdlc conf */
-                               member = list_entry(conf->mlist.next,
-                                                   struct dsp_conf_member, list);
-                               if (member->dsp->hdlc)
-                                       continue;
-                               /* mix all data */
-                               memset(mixbuffer, 0, length * sizeof(s32));
-                               list_for_each_entry(member, &conf->mlist, list) {
-                                       dsp = member->dsp;
-                                       /* get range of data to mix */
-                                       c = mixbuffer;
-                                       q = dsp->rx_buff;
-                                       r = dsp->rx_R;
-                                       rr = (r + length) & CMX_BUFF_MASK;
-                                       /* add member's data */
-                                       while (r != rr) {
-                                               *c++ += dsp_audio_law_to_s32[q[r]];
-                                               r = (r + 1) & CMX_BUFF_MASK;
-                                       }
+                       /* check for hdlc conf */
+                       member = list_entry(conf->mlist.next,
+                                           struct dsp_conf_member, list);
+                       if (member->dsp->hdlc)
+                               continue;
+                       /* mix all data */
+                       memset(mixbuffer, 0, length * sizeof(s32));
+                       list_for_each_entry(member, &conf->mlist, list) {
+                               dsp = member->dsp;
+                               /* get range of data to mix */
+                               c = mixbuffer;
+                               q = dsp->rx_buff;
+                               r = dsp->rx_R;
+                               rr = (r + length) & CMX_BUFF_MASK;
+                               /* add member's data */
+                               while (r != rr) {
+                                       *c++ += dsp_audio_law_to_s32[q[r]];
+                                       r = (r + 1) & CMX_BUFF_MASK;
                                }
+                       }
 
-                               /* process each member */
-                               list_for_each_entry(member, &conf->mlist, list) {
-                                       /* transmission */
-                                       dsp_cmx_send_member(member->dsp, length,
-                                                           mixbuffer, members);
-                               }
+                       /* process each member */
+                       list_for_each_entry(member, &conf->mlist, list) {
+                               /* transmission */
+                               dsp_cmx_send_member(member->dsp, length,
+                                                   mixbuffer, members);
+                       }
+               }
+       }
+
+       /* delete rx-data, increment buffers, change pointers */
+       list_for_each_entry(dsp, &dsp_ilist, list) {
+               if (dsp->hdlc)
+                       continue;
+               p = dsp->rx_buff;
+               q = dsp->tx_buff;
+               r = dsp->rx_R;
+               /* move receive pointer when receiving */
+               if (!dsp->rx_is_off) {
+                       rr = (r + length) & CMX_BUFF_MASK;
+                       /* delete rx-data */
+                       while (r != rr) {
+                               p[r] = dsp_silence;
+                               r = (r + 1) & CMX_BUFF_MASK;
                        }
+                       /* increment rx-buffer pointer */
+                       dsp->rx_R = r; /* write incremented read pointer */
                }
 
-               /* delete rx-data, increment buffers, change pointers */
-               list_for_each_entry(dsp, &dsp_ilist, list) {
-                       if (dsp->hdlc)
-                               continue;
-                       p = dsp->rx_buff;
-                       q = dsp->tx_buff;
-                       r = dsp->rx_R;
-                       /* move receive pointer when receiving */
-                       if (!dsp->rx_is_off) {
-                               rr = (r + length) & CMX_BUFF_MASK;
+               /* check current rx_delay */
+               delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
+               if (delay >= CMX_BUFF_HALF)
+                       delay = 0; /* will be the delay before next write */
+               /* check for lower delay */
+               if (delay < dsp->rx_delay[0])
+                       dsp->rx_delay[0] = delay;
+               /* check current tx_delay */
+               delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
+               if (delay >= CMX_BUFF_HALF)
+                       delay = 0; /* will be the delay before next write */
+               /* check for lower delay */
+               if (delay < dsp->tx_delay[0])
+                       dsp->tx_delay[0] = delay;
+               if (jittercheck) {
+                       /* find the lowest of all rx_delays */
+                       delay = dsp->rx_delay[0];
+                       i = 1;
+                       while (i < MAX_SECONDS_JITTER_CHECK) {
+                               if (delay > dsp->rx_delay[i])
+                                       delay = dsp->rx_delay[i];
+                               i++;
+                       }
+                       /*
+                        * remove rx_delay only if we have delay AND we
+                        * have not preset cmx_delay AND
+                        * the delay is greater dsp_poll
+                        */
+                       if (delay > dsp_poll && !dsp->cmx_delay) {
+                               if (dsp_debug & DEBUG_DSP_CLOCK)
+                                       printk(KERN_DEBUG
+                                              "%s lowest rx_delay of %d bytes for"
+                                              " dsp %s are now removed.\n",
+                                              __func__, delay,
+                                              dsp->name);
+                               r = dsp->rx_R;
+                               rr = (r + delay - (dsp_poll >> 1))
+                                       & CMX_BUFF_MASK;
                                /* delete rx-data */
                                while (r != rr) {
                                        p[r] = dsp_silence;
                                        r = (r + 1) & CMX_BUFF_MASK;
                                }
                                /* increment rx-buffer pointer */
-                               dsp->rx_R = r; /* write incremented read pointer */
+                               dsp->rx_R = r;
+                               /* write incremented read pointer */
                        }
-
-                       /* check current rx_delay */
-                       delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
-                       if (delay >= CMX_BUFF_HALF)
-                               delay = 0; /* will be the delay before next write */
-                       /* check for lower delay */
-                       if (delay < dsp->rx_delay[0])
-                               dsp->rx_delay[0] = delay;
-                       /* check current tx_delay */
-                       delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
-                       if (delay >= CMX_BUFF_HALF)
-                               delay = 0; /* will be the delay before next write */
-                       /* check for lower delay */
-                       if (delay < dsp->tx_delay[0])
-                               dsp->tx_delay[0] = delay;
-                       if (jittercheck) {
-                               /* find the lowest of all rx_delays */
-                               delay = dsp->rx_delay[0];
-                               i = 1;
-                               while (i < MAX_SECONDS_JITTER_CHECK) {
-                                       if (delay > dsp->rx_delay[i])
-                                               delay = dsp->rx_delay[i];
-                                       i++;
-                               }
-                               /*
-                                * remove rx_delay only if we have delay AND we
-                                * have not preset cmx_delay AND
-                                * the delay is greater dsp_poll
-                                */
-                               if (delay > dsp_poll && !dsp->cmx_delay) {
-                                       if (dsp_debug & DEBUG_DSP_CLOCK)
-                                               printk(KERN_DEBUG
-                                                      "%s lowest rx_delay of %d bytes for"
-                                                      " dsp %s are now removed.\n",
-                                                      __func__, delay,
-                                                      dsp->name);
-                                       r = dsp->rx_R;
-                                       rr = (r + delay - (dsp_poll >> 1))
-                                               & CMX_BUFF_MASK;
-                                       /* delete rx-data */
-                                       while (r != rr) {
-                                               p[r] = dsp_silence;
-                                               r = (r + 1) & CMX_BUFF_MASK;
-                                       }
-                                       /* increment rx-buffer pointer */
-                                       dsp->rx_R = r;
-                                       /* write incremented read pointer */
-                               }
-                               /* find the lowest of all tx_delays */
-                               delay = dsp->tx_delay[0];
-                               i = 1;
-                               while (i < MAX_SECONDS_JITTER_CHECK) {
-                                       if (delay > dsp->tx_delay[i])
-                                               delay = dsp->tx_delay[i];
-                                       i++;
-                               }
-                               /*
-                                * remove delay only if we have delay AND we
-                                * have enabled tx_dejitter
-                                */
-                               if (delay > dsp_poll && dsp->tx_dejitter) {
-                                       if (dsp_debug & DEBUG_DSP_CLOCK)
-                                               printk(KERN_DEBUG
-                                                      "%s lowest tx_delay of %d bytes for"
-                                                      " dsp %s are now removed.\n",
-                                                      __func__, delay,
-                                                      dsp->name);
-                                       r = dsp->tx_R;
-                                       rr = (r + delay - (dsp_poll >> 1))
-                                               & CMX_BUFF_MASK;
-                                       /* delete tx-data */
-                                       while (r != rr) {
-                                               q[r] = dsp_silence;
-                                               r = (r + 1) & CMX_BUFF_MASK;
-                                       }
-                                       /* increment rx-buffer pointer */
-                                       dsp->tx_R = r;
-                                       /* write incremented read pointer */
-                               }
-                               /* scroll up delays */
-                               i = MAX_SECONDS_JITTER_CHECK - 1;
-                               while (i) {
-                                       dsp->rx_delay[i] = dsp->rx_delay[i - 1];
-                                       dsp->tx_delay[i] = dsp->tx_delay[i - 1];
-                                       i--;
+                       /* find the lowest of all tx_delays */
+                       delay = dsp->tx_delay[0];
+                       i = 1;
+                       while (i < MAX_SECONDS_JITTER_CHECK) {
+                               if (delay > dsp->tx_delay[i])
+                                       delay = dsp->tx_delay[i];
+                               i++;
+                       }
+                       /*
+                        * remove delay only if we have delay AND we
+                        * have enabled tx_dejitter
+                        */
+                       if (delay > dsp_poll && dsp->tx_dejitter) {
+                               if (dsp_debug & DEBUG_DSP_CLOCK)
+                                       printk(KERN_DEBUG
+                                              "%s lowest tx_delay of %d bytes for"
+                                              " dsp %s are now removed.\n",
+                                              __func__, delay,
+                                              dsp->name);
+                               r = dsp->tx_R;
+                               rr = (r + delay - (dsp_poll >> 1))
+                                       & CMX_BUFF_MASK;
+                               /* delete tx-data */
+                               while (r != rr) {
+                                       q[r] = dsp_silence;
+                                       r = (r + 1) & CMX_BUFF_MASK;
                                }
-                               dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
-                               dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
+                               /* increment rx-buffer pointer */
+                               dsp->tx_R = r;
+                               /* write incremented read pointer */
                        }
+                       /* scroll up delays */
+                       i = MAX_SECONDS_JITTER_CHECK - 1;
+                       while (i) {
+                               dsp->rx_delay[i] = dsp->rx_delay[i - 1];
+                               dsp->tx_delay[i] = dsp->tx_delay[i - 1];
+                               i--;
+                       }
+                       dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
+                       dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
                }
+       }
 
-               /* if next event would be in the past ... */
-               if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0)
-                       dsp_spl_jiffies = jiffies + 1;
-               else
-                       dsp_spl_jiffies += dsp_tics;
+       /* if next event would be in the past ... */
+       if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0)
+               dsp_spl_jiffies = jiffies + 1;
+       else
+               dsp_spl_jiffies += dsp_tics;
 
-               dsp_spl_tl.expires = dsp_spl_jiffies;
-               add_timer(&dsp_spl_tl);
+       dsp_spl_tl.expires = dsp_spl_jiffies;
+       add_timer(&dsp_spl_tl);
 
-               /* unlock */
-               spin_unlock_irqrestore(&dsp_lock, flags);
-       }
+       /* unlock */
+       spin_unlock_irqrestore(&dsp_lock, flags);
+}
 
 /*
  * audio data is transmitted from upper layer to the dsp
  */
-       void
-               dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb)
-       {
-               u_int w, ww;
-               u8 *d, *p;
-               int space; /* todo: , l = skb->len; */
+void
+dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb)
+{
+       u_int w, ww;
+       u8 *d, *p;
+       int space; /* todo: , l = skb->len; */
 #ifdef CMX_TX_DEBUG
-               char debugbuf[256] = "";
+       char debugbuf[256] = "";
 #endif
 
-               /* check if there is enough space, and then copy */
-               w = dsp->tx_W;
-               ww = dsp->tx_R;
-               p = dsp->tx_buff;
-               d = skb->data;
-               space = (ww - w - 1) & CMX_BUFF_MASK;
-               /* write-pointer should not overrun nor reach read pointer */
-               if (space < skb->len) {
-                       /* write to the space we have left */
-                       ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */
-                       if (dsp_debug & DEBUG_DSP_CLOCK)
-                               printk(KERN_DEBUG "%s: TX overflow space=%d skb->len="
-                                      "%d, w=0x%04x, ww=0x%04x\n", __func__, space,
-                                      skb->len, w, ww);
-               } else
-                       /* write until all byte are copied */
-                       ww = (w + skb->len) & CMX_BUFF_MASK;
-               dsp->tx_W = ww;
-
+       /* check if there is enough space, and then copy */
+       w = dsp->tx_W;
+       ww = dsp->tx_R;
+       p = dsp->tx_buff;
+       d = skb->data;
+       space = (ww - w - 1) & CMX_BUFF_MASK;
+       /* write-pointer should not overrun nor reach read pointer */
+       if (space < skb->len) {
+               /* write to the space we have left */
+               ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */
+               if (dsp_debug & DEBUG_DSP_CLOCK)
+                       printk(KERN_DEBUG "%s: TX overflow space=%d skb->len="
+                              "%d, w=0x%04x, ww=0x%04x\n", __func__, space,
+                              skb->len, w, ww);
+       } else
+               /* write until all byte are copied */
+               ww = (w + skb->len) & CMX_BUFF_MASK;
+       dsp->tx_W = ww;
                /* show current buffer */
 #ifdef CMX_DEBUG
-               printk(KERN_DEBUG
-                      "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
-                      (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
+       printk(KERN_DEBUG
+              "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
+              (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
 #endif
 
-               /* copy transmit data to tx-buffer */
+       /* copy transmit data to tx-buffer */
 #ifdef CMX_TX_DEBUG
-               sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p);
+       sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p);
 #endif
-               while (w != ww) {
+       while (w != ww) {
 #ifdef CMX_TX_DEBUG
-                       if (strlen(debugbuf) < 48)
-                               sprintf(debugbuf + strlen(debugbuf), " %02x", *d);
+               if (strlen(debugbuf) < 48)
+                       sprintf(debugbuf + strlen(debugbuf), " %02x", *d);
 #endif
-                       p[w] = *d++;
-                       w = (w + 1) & CMX_BUFF_MASK;
-               }
+               p[w] = *d++;
+               w = (w + 1) & CMX_BUFF_MASK;
+       }
 #ifdef CMX_TX_DEBUG
-               printk(KERN_DEBUG "%s\n", debugbuf);
+       printk(KERN_DEBUG "%s\n", debugbuf);
 #endif
 
-       }
+}
 
 /*
  * hdlc data is received from card and sent to all members.
  */
-       void
-               dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb)
-       {
-               struct sk_buff *nskb = NULL;
-               struct dsp_conf_member *member;
-               struct mISDNhead *hh;
-
-               /* not if not active */
-               if (!dsp->b_active)
-                       return;
+void
+dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb)
+{
+       struct sk_buff *nskb = NULL;
+       struct dsp_conf_member *member;
+       struct mISDNhead *hh;
 
-               /* check if we have sompen */
-               if (skb->len < 1)
-                       return;
+       /* not if not active */
+       if (!dsp->b_active)
+               return;
 
-               /* no conf */
-               if (!dsp->conf) {
-                       /* in case of software echo */
-                       if (dsp->echo.software) {
-                               nskb = skb_clone(skb, GFP_ATOMIC);
-                               if (nskb) {
-                                       hh = mISDN_HEAD_P(nskb);
-                                       hh->prim = PH_DATA_REQ;
-                                       hh->id = 0;
-                                       skb_queue_tail(&dsp->sendq, nskb);
-                                       schedule_work(&dsp->workq);
-                               }
+       /* check if we have sompen */
+       if (skb->len < 1)
+               return;
+
+       /* no conf */
+       if (!dsp->conf) {
+               /* in case of software echo */
+               if (dsp->echo.software) {
+                       nskb = skb_clone(skb, GFP_ATOMIC);
+                       if (nskb) {
+                               hh = mISDN_HEAD_P(nskb);
+                               hh->prim = PH_DATA_REQ;
+                               hh->id = 0;
+                               skb_queue_tail(&dsp->sendq, nskb);
+                               schedule_work(&dsp->workq);
                        }
-                       return;
                }
-               /* in case of hardware conference */
-               if (dsp->conf->hardware)
-                       return;
-               list_for_each_entry(member, &dsp->conf->mlist, list) {
-                       if (dsp->echo.software || member->dsp != dsp) {
-                               nskb = skb_clone(skb, GFP_ATOMIC);
-                               if (nskb) {
-                                       hh = mISDN_HEAD_P(nskb);
-                                       hh->prim = PH_DATA_REQ;
-                                       hh->id = 0;
-                                       skb_queue_tail(&member->dsp->sendq, nskb);
-                                       schedule_work(&member->dsp->workq);
-                               }
+               return;
+       }
+       /* in case of hardware conference */
+       if (dsp->conf->hardware)
+               return;
+       list_for_each_entry(member, &dsp->conf->mlist, list) {
+               if (dsp->echo.software || member->dsp != dsp) {
+                       nskb = skb_clone(skb, GFP_ATOMIC);
+                       if (nskb) {
+                               hh = mISDN_HEAD_P(nskb);
+                               hh->prim = PH_DATA_REQ;
+                               hh->id = 0;
+                               skb_queue_tail(&member->dsp->sendq, nskb);
+                               schedule_work(&member->dsp->workq);
                        }
                }
        }
+}
index a14e35d..84e1d4c 100644 (file)
@@ -393,7 +393,7 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        memcpy(di.channelmap, dev->channelmap,
                               sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
-                       strcpy(di.name, dev_name(&dev->dev));
+                       strscpy(di.name, dev_name(&dev->dev), sizeof(di.name));
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
                                err = -EFAULT;
                } else
@@ -676,7 +676,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        memcpy(di.channelmap, dev->channelmap,
                               sizeof(di.channelmap));
                        di.nrbchan = dev->nrbchan;
-                       strcpy(di.name, dev_name(&dev->dev));
+                       strscpy(di.name, dev_name(&dev->dev), sizeof(di.name));
                        if (copy_to_user((void __user *)arg, &di, sizeof(di)))
                                err = -EFAULT;
                } else
@@ -690,6 +690,7 @@ base_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        err = -EFAULT;
                        break;
                }
+               dn.name[sizeof(dn.name) - 1] = '\0';
                dev = get_mdevice(dn.id);
                if (dev)
                        err = device_rename(&dev->dev, dn.name);
index 71be87b..760f73a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LEDS_GPIO_REGISTER
        bool
        help
index 492789f..f512e99 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/module.h>
index 9be1957..ef22e1e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 2006 - Florian Fainelli <florian@openwrt.org>
  *
index 8d066fa..045c239 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  LEDs driver for the Cobalt Raq series.
  *
  *  Copyright (C) 2007  Yoichi Yuasa <yuasa@linux-mips.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/init.h>
 #include <linux/io.h>
index fcd1215..db5af83 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * LEDs driver for the "User LED" on Routerboard532
  *
index 7c09db8..eba7313 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* leds-sunfire.c: SUNW,Ultra-Enterprise LED driver.
  *
  * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
index 8f343af..c59035e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * leds-tca6507
  *
index 23cc85e..7fa9d17 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig LEDS_TRIGGERS
        bool "LED Trigger support"
        depends on LEDS_CLASS
index a872cd7..8f39f9b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Open-Channel SSD NVM configuration
 #
index 5f82036..0df7454 100644 (file)
@@ -45,6 +45,8 @@ struct nvm_dev_map {
        int num_ch;
 };
 
+static void nvm_free(struct kref *ref);
+
 static struct nvm_target *nvm_find_target(struct nvm_dev *dev, const char *name)
 {
        struct nvm_target *tgt;
@@ -325,6 +327,7 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
        struct nvm_target *t;
        struct nvm_tgt_dev *tgt_dev;
        void *targetdata;
+       unsigned int mdts;
        int ret;
 
        switch (create->conf.type) {
@@ -412,8 +415,12 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
        tdisk->private_data = targetdata;
        tqueue->queuedata = targetdata;
 
-       blk_queue_max_hw_sectors(tqueue,
-                       (dev->geo.csecs >> 9) * NVM_MAX_VLBA);
+       mdts = (dev->geo.csecs >> 9) * NVM_MAX_VLBA;
+       if (dev->geo.mdts) {
+               mdts = min_t(u32, dev->geo.mdts,
+                               (dev->geo.csecs >> 9) * NVM_MAX_VLBA);
+       }
+       blk_queue_max_hw_sectors(tqueue, mdts);
 
        set_capacity(tdisk, tt->capacity(targetdata));
        add_disk(tdisk);
@@ -476,7 +483,6 @@ static void __nvm_remove_target(struct nvm_target *t, bool graceful)
 
 /**
  * nvm_remove_tgt - Removes a target from the media manager
- * @dev:       device
  * @remove:    ioctl structure with target name to remove.
  *
  * Returns:
@@ -484,18 +490,28 @@ static void __nvm_remove_target(struct nvm_target *t, bool graceful)
  * 1: on not found
  * <0: on error
  */
-static int nvm_remove_tgt(struct nvm_dev *dev, struct nvm_ioctl_remove *remove)
+static int nvm_remove_tgt(struct nvm_ioctl_remove *remove)
 {
        struct nvm_target *t;
+       struct nvm_dev *dev;
 
-       mutex_lock(&dev->mlock);
-       t = nvm_find_target(dev, remove->tgtname);
-       if (!t) {
+       down_read(&nvm_lock);
+       list_for_each_entry(dev, &nvm_devices, devices) {
+               mutex_lock(&dev->mlock);
+               t = nvm_find_target(dev, remove->tgtname);
+               if (t) {
+                       mutex_unlock(&dev->mlock);
+                       break;
+               }
                mutex_unlock(&dev->mlock);
-               return 1;
        }
+       up_read(&nvm_lock);
+
+       if (!t)
+               return 1;
+
        __nvm_remove_target(t, true);
-       mutex_unlock(&dev->mlock);
+       kref_put(&dev->ref, nvm_free);
 
        return 0;
 }
@@ -1089,15 +1105,16 @@ err_fmtype:
        return ret;
 }
 
-static void nvm_free(struct nvm_dev *dev)
+static void nvm_free(struct kref *ref)
 {
-       if (!dev)
-               return;
+       struct nvm_dev *dev = container_of(ref, struct nvm_dev, ref);
 
        if (dev->dma_pool)
                dev->ops->destroy_dma_pool(dev->dma_pool);
 
-       nvm_unregister_map(dev);
+       if (dev->rmap)
+               nvm_unregister_map(dev);
+
        kfree(dev->lun_map);
        kfree(dev);
 }
@@ -1134,7 +1151,13 @@ err:
 
 struct nvm_dev *nvm_alloc_dev(int node)
 {
-       return kzalloc_node(sizeof(struct nvm_dev), GFP_KERNEL, node);
+       struct nvm_dev *dev;
+
+       dev = kzalloc_node(sizeof(struct nvm_dev), GFP_KERNEL, node);
+       if (dev)
+               kref_init(&dev->ref);
+
+       return dev;
 }
 EXPORT_SYMBOL(nvm_alloc_dev);
 
@@ -1142,12 +1165,16 @@ int nvm_register(struct nvm_dev *dev)
 {
        int ret, exp_pool_size;
 
-       if (!dev->q || !dev->ops)
+       if (!dev->q || !dev->ops) {
+               kref_put(&dev->ref, nvm_free);
                return -EINVAL;
+       }
 
        ret = nvm_init(dev);
-       if (ret)
+       if (ret) {
+               kref_put(&dev->ref, nvm_free);
                return ret;
+       }
 
        exp_pool_size = max_t(int, PAGE_SIZE,
                              (NVM_MAX_VLBA * (sizeof(u64) + dev->geo.sos)));
@@ -1157,7 +1184,7 @@ int nvm_register(struct nvm_dev *dev)
                                                  exp_pool_size);
        if (!dev->dma_pool) {
                pr_err("nvm: could not create dma pool\n");
-               nvm_free(dev);
+               kref_put(&dev->ref, nvm_free);
                return -ENOMEM;
        }
 
@@ -1179,6 +1206,7 @@ void nvm_unregister(struct nvm_dev *dev)
                if (t->dev->parent != dev)
                        continue;
                __nvm_remove_target(t, false);
+               kref_put(&dev->ref, nvm_free);
        }
        mutex_unlock(&dev->mlock);
 
@@ -1186,13 +1214,14 @@ void nvm_unregister(struct nvm_dev *dev)
        list_del(&dev->devices);
        up_write(&nvm_lock);
 
-       nvm_free(dev);
+       kref_put(&dev->ref, nvm_free);
 }
 EXPORT_SYMBOL(nvm_unregister);
 
 static int __nvm_configure_create(struct nvm_ioctl_create *create)
 {
        struct nvm_dev *dev;
+       int ret;
 
        down_write(&nvm_lock);
        dev = nvm_find_nvm_dev(create->dev);
@@ -1203,7 +1232,12 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create)
                return -EINVAL;
        }
 
-       return nvm_create_tgt(dev, create);
+       kref_get(&dev->ref);
+       ret = nvm_create_tgt(dev, create);
+       if (ret)
+               kref_put(&dev->ref, nvm_free);
+
+       return ret;
 }
 
 static long nvm_ioctl_info(struct file *file, void __user *arg)
@@ -1322,8 +1356,6 @@ static long nvm_ioctl_dev_create(struct file *file, void __user *arg)
 static long nvm_ioctl_dev_remove(struct file *file, void __user *arg)
 {
        struct nvm_ioctl_remove remove;
-       struct nvm_dev *dev;
-       int ret = 0;
 
        if (copy_from_user(&remove, arg, sizeof(struct nvm_ioctl_remove)))
                return -EFAULT;
@@ -1335,13 +1367,7 @@ static long nvm_ioctl_dev_remove(struct file *file, void __user *arg)
                return -EINVAL;
        }
 
-       list_for_each_entry(dev, &nvm_devices, devices) {
-               ret = nvm_remove_tgt(dev, &remove);
-               if (!ret)
-                       break;
-       }
-
-       return ret;
+       return nvm_remove_tgt(&remove);
 }
 
 /* kept for compatibility reasons */
index c9fa26f..5c1034c 100644 (file)
@@ -18,7 +18,8 @@
 
 #include "pblk.h"
 
-int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags)
+void pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
+                               unsigned long flags)
 {
        struct request_queue *q = pblk->dev->q;
        struct pblk_w_ctx w_ctx;
@@ -43,6 +44,7 @@ retry:
                goto retry;
        case NVM_IO_ERR:
                pblk_pipeline_stop(pblk);
+               bio_io_error(bio);
                goto out;
        }
 
@@ -79,7 +81,9 @@ retry:
 out:
        generic_end_io_acct(q, REQ_OP_WRITE, &pblk->disk->part0, start_time);
        pblk_write_should_kick(pblk);
-       return ret;
+
+       if (ret == NVM_IO_DONE)
+               bio_endio(bio);
 }
 
 /*
index 6ca8688..7735378 100644 (file)
@@ -562,11 +562,9 @@ int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd)
 
 int pblk_submit_io_sync_sem(struct pblk *pblk, struct nvm_rq *rqd)
 {
-       struct ppa_addr *ppa_list;
+       struct ppa_addr *ppa_list = nvm_rq_to_ppa_list(rqd);
        int ret;
 
-       ppa_list = (rqd->nr_ppas > 1) ? rqd->ppa_list : &rqd->ppa_addr;
-
        pblk_down_chunk(pblk, ppa_list[0]);
        ret = pblk_submit_io_sync(pblk, rqd);
        pblk_up_chunk(pblk, ppa_list[0]);
@@ -725,6 +723,7 @@ int pblk_line_smeta_read(struct pblk *pblk, struct pblk_line *line)
        struct nvm_tgt_dev *dev = pblk->dev;
        struct pblk_line_meta *lm = &pblk->lm;
        struct bio *bio;
+       struct ppa_addr *ppa_list;
        struct nvm_rq rqd;
        u64 paddr = pblk_line_smeta_start(pblk, line);
        int i, ret;
@@ -748,9 +747,10 @@ int pblk_line_smeta_read(struct pblk *pblk, struct pblk_line *line)
        rqd.opcode = NVM_OP_PREAD;
        rqd.nr_ppas = lm->smeta_sec;
        rqd.is_seq = 1;
+       ppa_list = nvm_rq_to_ppa_list(&rqd);
 
        for (i = 0; i < lm->smeta_sec; i++, paddr++)
-               rqd.ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line->id);
+               ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line->id);
 
        ret = pblk_submit_io_sync(pblk, &rqd);
        if (ret) {
@@ -761,8 +761,10 @@ int pblk_line_smeta_read(struct pblk *pblk, struct pblk_line *line)
 
        atomic_dec(&pblk->inflight_io);
 
-       if (rqd.error)
+       if (rqd.error && rqd.error != NVM_RSP_WARN_HIGHECC) {
                pblk_log_read_err(pblk, &rqd);
+               ret = -EIO;
+       }
 
 clear_rqd:
        pblk_free_rqd_meta(pblk, &rqd);
@@ -775,6 +777,7 @@ static int pblk_line_smeta_write(struct pblk *pblk, struct pblk_line *line,
        struct nvm_tgt_dev *dev = pblk->dev;
        struct pblk_line_meta *lm = &pblk->lm;
        struct bio *bio;
+       struct ppa_addr *ppa_list;
        struct nvm_rq rqd;
        __le64 *lba_list = emeta_to_lbas(pblk, line->emeta->buf);
        __le64 addr_empty = cpu_to_le64(ADDR_EMPTY);
@@ -799,12 +802,13 @@ static int pblk_line_smeta_write(struct pblk *pblk, struct pblk_line *line,
        rqd.opcode = NVM_OP_PWRITE;
        rqd.nr_ppas = lm->smeta_sec;
        rqd.is_seq = 1;
+       ppa_list = nvm_rq_to_ppa_list(&rqd);
 
        for (i = 0; i < lm->smeta_sec; i++, paddr++) {
                struct pblk_sec_meta *meta = pblk_get_meta(pblk,
                                                           rqd.meta_list, i);
 
-               rqd.ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line->id);
+               ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line->id);
                meta->lba = lba_list[paddr] = addr_empty;
        }
 
@@ -834,8 +838,9 @@ int pblk_line_emeta_read(struct pblk *pblk, struct pblk_line *line,
        struct nvm_geo *geo = &dev->geo;
        struct pblk_line_mgmt *l_mg = &pblk->l_mg;
        struct pblk_line_meta *lm = &pblk->lm;
-       void *ppa_list, *meta_list;
+       void *ppa_list_buf, *meta_list;
        struct bio *bio;
+       struct ppa_addr *ppa_list;
        struct nvm_rq rqd;
        u64 paddr = line->emeta_ssec;
        dma_addr_t dma_ppa_list, dma_meta_list;
@@ -851,7 +856,7 @@ int pblk_line_emeta_read(struct pblk *pblk, struct pblk_line *line,
        if (!meta_list)
                return -ENOMEM;
 
-       ppa_list = meta_list + pblk_dma_meta_size(pblk);
+       ppa_list_buf = meta_list + pblk_dma_meta_size(pblk);
        dma_ppa_list = dma_meta_list + pblk_dma_meta_size(pblk);
 
 next_rq:
@@ -872,11 +877,12 @@ next_rq:
 
        rqd.bio = bio;
        rqd.meta_list = meta_list;
-       rqd.ppa_list = ppa_list;
+       rqd.ppa_list = ppa_list_buf;
        rqd.dma_meta_list = dma_meta_list;
        rqd.dma_ppa_list = dma_ppa_list;
        rqd.opcode = NVM_OP_PREAD;
        rqd.nr_ppas = rq_ppas;
+       ppa_list = nvm_rq_to_ppa_list(&rqd);
 
        for (i = 0; i < rqd.nr_ppas; ) {
                struct ppa_addr ppa = addr_to_gen_ppa(pblk, paddr, line_id);
@@ -904,7 +910,7 @@ next_rq:
                }
 
                for (j = 0; j < min; j++, i++, paddr++)
-                       rqd.ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line_id);
+                       ppa_list[i] = addr_to_gen_ppa(pblk, paddr, line_id);
        }
 
        ret = pblk_submit_io_sync(pblk, &rqd);
@@ -916,8 +922,11 @@ next_rq:
 
        atomic_dec(&pblk->inflight_io);
 
-       if (rqd.error)
+       if (rqd.error && rqd.error != NVM_RSP_WARN_HIGHECC) {
                pblk_log_read_err(pblk, &rqd);
+               ret = -EIO;
+               goto free_rqd_dma;
+       }
 
        emeta_buf += rq_len;
        left_ppas -= rq_ppas;
@@ -1162,7 +1171,6 @@ static int pblk_line_init_bb(struct pblk *pblk, struct pblk_line *line,
        off = bit * geo->ws_opt;
        bitmap_set(line->map_bitmap, off, lm->smeta_sec);
        line->sec_in_line -= lm->smeta_sec;
-       line->smeta_ssec = off;
        line->cur_sec = off + lm->smeta_sec;
 
        if (init && pblk_line_smeta_write(pblk, line, off)) {
@@ -1521,11 +1529,9 @@ void pblk_ppa_to_line_put(struct pblk *pblk, struct ppa_addr ppa)
 
 void pblk_rq_to_line_put(struct pblk *pblk, struct nvm_rq *rqd)
 {
-       struct ppa_addr *ppa_list;
+       struct ppa_addr *ppa_list = nvm_rq_to_ppa_list(rqd);
        int i;
 
-       ppa_list = (rqd->nr_ppas > 1) ? rqd->ppa_list : &rqd->ppa_addr;
-
        for (i = 0; i < rqd->nr_ppas; i++)
                pblk_ppa_to_line_put(pblk, ppa_list[i]);
 }
@@ -1699,6 +1705,14 @@ static void __pblk_line_put(struct pblk *pblk, struct pblk_line *line)
 
        spin_lock(&line->lock);
        WARN_ON(line->state != PBLK_LINESTATE_GC);
+       if (line->w_err_gc->has_gc_err) {
+               spin_unlock(&line->lock);
+               pblk_err(pblk, "line %d had errors during GC\n", line->id);
+               pblk_put_line_back(pblk, line);
+               line->w_err_gc->has_gc_err = 0;
+               return;
+       }
+
        line->state = PBLK_LINESTATE_FREE;
        trace_pblk_line_state(pblk_disk_name(pblk), line->id,
                                        line->state);
@@ -2023,7 +2037,7 @@ void pblk_update_map(struct pblk *pblk, sector_t lba, struct ppa_addr ppa)
        struct ppa_addr ppa_l2p;
 
        /* logic error: lba out-of-bounds. Ignore update */
-       if (!(lba < pblk->rl.nr_secs)) {
+       if (!(lba < pblk->capacity)) {
                WARN(1, "pblk: corrupted L2P map request\n");
                return;
        }
@@ -2063,7 +2077,7 @@ int pblk_update_map_gc(struct pblk *pblk, sector_t lba, struct ppa_addr ppa_new,
 #endif
 
        /* logic error: lba out-of-bounds. Ignore update */
-       if (!(lba < pblk->rl.nr_secs)) {
+       if (!(lba < pblk->capacity)) {
                WARN(1, "pblk: corrupted L2P map request\n");
                return 0;
        }
@@ -2109,7 +2123,7 @@ void pblk_update_map_dev(struct pblk *pblk, sector_t lba,
        }
 
        /* logic error: lba out-of-bounds. Ignore update */
-       if (!(lba < pblk->rl.nr_secs)) {
+       if (!(lba < pblk->capacity)) {
                WARN(1, "pblk: corrupted L2P map request\n");
                return;
        }
@@ -2135,8 +2149,8 @@ out:
        spin_unlock(&pblk->trans_lock);
 }
 
-void pblk_lookup_l2p_seq(struct pblk *pblk, struct ppa_addr *ppas,
-                        sector_t blba, int nr_secs)
+int pblk_lookup_l2p_seq(struct pblk *pblk, struct ppa_addr *ppas,
+                        sector_t blba, int nr_secs, bool *from_cache)
 {
        int i;
 
@@ -2150,10 +2164,19 @@ void pblk_lookup_l2p_seq(struct pblk *pblk, struct ppa_addr *ppas,
                if (!pblk_ppa_empty(ppa) && !pblk_addr_in_cache(ppa)) {
                        struct pblk_line *line = pblk_ppa_to_line(pblk, ppa);
 
+                       if (i > 0 && *from_cache)
+                               break;
+                       *from_cache = false;
+
                        kref_get(&line->ref);
+               } else {
+                       if (i > 0 && !*from_cache)
+                               break;
+                       *from_cache = true;
                }
        }
        spin_unlock(&pblk->trans_lock);
+       return i;
 }
 
 void pblk_lookup_l2p_rand(struct pblk *pblk, struct ppa_addr *ppas,
@@ -2167,7 +2190,7 @@ void pblk_lookup_l2p_rand(struct pblk *pblk, struct ppa_addr *ppas,
                lba = lba_list[i];
                if (lba != ADDR_EMPTY) {
                        /* logic error: lba out-of-bounds. Ignore update */
-                       if (!(lba < pblk->rl.nr_secs)) {
+                       if (!(lba < pblk->capacity)) {
                                WARN(1, "pblk: corrupted L2P map request\n");
                                continue;
                        }
index 26a52ea..63ee205 100644 (file)
@@ -59,24 +59,28 @@ static void pblk_gc_writer_kick(struct pblk_gc *gc)
        wake_up_process(gc->gc_writer_ts);
 }
 
-static void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line)
+void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line)
 {
        struct pblk_line_mgmt *l_mg = &pblk->l_mg;
        struct list_head *move_list;
 
+       spin_lock(&l_mg->gc_lock);
        spin_lock(&line->lock);
        WARN_ON(line->state != PBLK_LINESTATE_GC);
        line->state = PBLK_LINESTATE_CLOSED;
        trace_pblk_line_state(pblk_disk_name(pblk), line->id,
                                        line->state);
+
+       /* We need to reset gc_group in order to ensure that
+        * pblk_line_gc_list will return proper move_list
+        * since right now current line is not on any of the
+        * gc lists.
+        */
+       line->gc_group = PBLK_LINEGC_NONE;
        move_list = pblk_line_gc_list(pblk, line);
        spin_unlock(&line->lock);
-
-       if (move_list) {
-               spin_lock(&l_mg->gc_lock);
-               list_add_tail(&line->list, move_list);
-               spin_unlock(&l_mg->gc_lock);
-       }
+       list_add_tail(&line->list, move_list);
+       spin_unlock(&l_mg->gc_lock);
 }
 
 static void pblk_gc_line_ws(struct work_struct *work)
@@ -84,8 +88,6 @@ static void pblk_gc_line_ws(struct work_struct *work)
        struct pblk_line_ws *gc_rq_ws = container_of(work,
                                                struct pblk_line_ws, ws);
        struct pblk *pblk = gc_rq_ws->pblk;
-       struct nvm_tgt_dev *dev = pblk->dev;
-       struct nvm_geo *geo = &dev->geo;
        struct pblk_gc *gc = &pblk->gc;
        struct pblk_line *line = gc_rq_ws->line;
        struct pblk_gc_rq *gc_rq = gc_rq_ws->priv;
@@ -93,18 +95,10 @@ static void pblk_gc_line_ws(struct work_struct *work)
 
        up(&gc->gc_sem);
 
-       gc_rq->data = vmalloc(array_size(gc_rq->nr_secs, geo->csecs));
-       if (!gc_rq->data) {
-               pblk_err(pblk, "could not GC line:%d (%d/%d)\n",
-                                       line->id, *line->vsc, gc_rq->nr_secs);
-               goto out;
-       }
-
        /* Read from GC victim block */
        ret = pblk_submit_read_gc(pblk, gc_rq);
        if (ret) {
-               pblk_err(pblk, "failed GC read in line:%d (err:%d)\n",
-                                                               line->id, ret);
+               line->w_err_gc->has_gc_err = 1;
                goto out;
        }
 
@@ -189,6 +183,8 @@ static void pblk_gc_line_prepare_ws(struct work_struct *work)
        struct pblk_line *line = line_ws->line;
        struct pblk_line_mgmt *l_mg = &pblk->l_mg;
        struct pblk_line_meta *lm = &pblk->lm;
+       struct nvm_tgt_dev *dev = pblk->dev;
+       struct nvm_geo *geo = &dev->geo;
        struct pblk_gc *gc = &pblk->gc;
        struct pblk_line_ws *gc_rq_ws;
        struct pblk_gc_rq *gc_rq;
@@ -247,9 +243,13 @@ next_rq:
        gc_rq->nr_secs = nr_secs;
        gc_rq->line = line;
 
+       gc_rq->data = vmalloc(array_size(gc_rq->nr_secs, geo->csecs));
+       if (!gc_rq->data)
+               goto fail_free_gc_rq;
+
        gc_rq_ws = kmalloc(sizeof(struct pblk_line_ws), GFP_KERNEL);
        if (!gc_rq_ws)
-               goto fail_free_gc_rq;
+               goto fail_free_gc_data;
 
        gc_rq_ws->pblk = pblk;
        gc_rq_ws->line = line;
@@ -281,6 +281,8 @@ out:
 
        return;
 
+fail_free_gc_data:
+       vfree(gc_rq->data);
 fail_free_gc_rq:
        kfree(gc_rq);
 fail_free_lba_list:
@@ -290,8 +292,11 @@ fail_free_invalid_bitmap:
 fail_free_ws:
        kfree(line_ws);
 
+       /* Line goes back to closed state, so we cannot release additional
+        * reference for line, since we do that only when we want to do
+        * gc to free line state transition.
+        */
        pblk_put_line_back(pblk, line);
-       kref_put(&line->ref, pblk_line_put);
        atomic_dec(&gc->read_inflight_gc);
 
        pblk_err(pblk, "failed to GC line %d\n", line->id);
@@ -355,8 +360,13 @@ static int pblk_gc_read(struct pblk *pblk)
 
        pblk_gc_kick(pblk);
 
-       if (pblk_gc_line(pblk, line))
+       if (pblk_gc_line(pblk, line)) {
                pblk_err(pblk, "failed to GC line %d\n", line->id);
+               /* rollback */
+               spin_lock(&gc->r_lock);
+               list_add_tail(&line->list, &gc->r_list);
+               spin_unlock(&gc->r_lock);
+       }
 
        return 0;
 }
index 8b643d0..b351c7f 100644 (file)
@@ -47,33 +47,6 @@ static struct pblk_global_caches pblk_caches = {
 
 struct bio_set pblk_bio_set;
 
-static int pblk_rw_io(struct request_queue *q, struct pblk *pblk,
-                         struct bio *bio)
-{
-       int ret;
-
-       /* Read requests must be <= 256kb due to NVMe's 64 bit completion bitmap
-        * constraint. Writes can be of arbitrary size.
-        */
-       if (bio_data_dir(bio) == READ) {
-               blk_queue_split(q, &bio);
-               ret = pblk_submit_read(pblk, bio);
-               if (ret == NVM_IO_DONE && bio_flagged(bio, BIO_CLONED))
-                       bio_put(bio);
-
-               return ret;
-       }
-
-       /* Prevent deadlock in the case of a modest LUN configuration and large
-        * user I/Os. Unless stalled, the rate limiter leaves at least 256KB
-        * available for user I/O.
-        */
-       if (pblk_get_secs(bio) > pblk_rl_max_io(&pblk->rl))
-               blk_queue_split(q, &bio);
-
-       return pblk_write_to_cache(pblk, bio, PBLK_IOTYPE_USER);
-}
-
 static blk_qc_t pblk_make_rq(struct request_queue *q, struct bio *bio)
 {
        struct pblk *pblk = q->queuedata;
@@ -86,13 +59,21 @@ static blk_qc_t pblk_make_rq(struct request_queue *q, struct bio *bio)
                }
        }
 
-       switch (pblk_rw_io(q, pblk, bio)) {
-       case NVM_IO_ERR:
-               bio_io_error(bio);
-               break;
-       case NVM_IO_DONE:
-               bio_endio(bio);
-               break;
+       /* Read requests must be <= 256kb due to NVMe's 64 bit completion bitmap
+        * constraint. Writes can be of arbitrary size.
+        */
+       if (bio_data_dir(bio) == READ) {
+               blk_queue_split(q, &bio);
+               pblk_submit_read(pblk, bio);
+       } else {
+               /* Prevent deadlock in the case of a modest LUN configuration
+                * and large user I/Os. Unless stalled, the rate limiter
+                * leaves at least 256KB available for user I/O.
+                */
+               if (pblk_get_secs(bio) > pblk_rl_max_io(&pblk->rl))
+                       blk_queue_split(q, &bio);
+
+               pblk_write_to_cache(pblk, bio, PBLK_IOTYPE_USER);
        }
 
        return BLK_QC_T_NONE;
@@ -105,7 +86,7 @@ static size_t pblk_trans_map_size(struct pblk *pblk)
        if (pblk->addrf_len < 32)
                entry_size = 4;
 
-       return entry_size * pblk->rl.nr_secs;
+       return entry_size * pblk->capacity;
 }
 
 #ifdef CONFIG_NVM_PBLK_DEBUG
@@ -164,13 +145,18 @@ static int pblk_l2p_init(struct pblk *pblk, bool factory_init)
        int ret = 0;
 
        map_size = pblk_trans_map_size(pblk);
-       pblk->trans_map = vmalloc(map_size);
-       if (!pblk->trans_map)
+       pblk->trans_map = __vmalloc(map_size, GFP_KERNEL | __GFP_NOWARN
+                                       | __GFP_RETRY_MAYFAIL | __GFP_HIGHMEM,
+                                       PAGE_KERNEL);
+       if (!pblk->trans_map) {
+               pblk_err(pblk, "failed to allocate L2P (need %zu of memory)\n",
+                               map_size);
                return -ENOMEM;
+       }
 
        pblk_ppa_set_empty(&ppa);
 
-       for (i = 0; i < pblk->rl.nr_secs; i++)
+       for (i = 0; i < pblk->capacity; i++)
                pblk_trans_map_set(pblk, i, ppa);
 
        ret = pblk_l2p_recover(pblk, factory_init);
@@ -701,7 +687,6 @@ static int pblk_set_provision(struct pblk *pblk, int nr_free_chks)
         * on user capacity consider only provisioned blocks
         */
        pblk->rl.total_blocks = nr_free_chks;
-       pblk->rl.nr_secs = nr_free_chks * geo->clba;
 
        /* Consider sectors used for metadata */
        sec_meta = (lm->smeta_sec + lm->emeta_sec[0]) * l_mg->nr_free_lines;
@@ -1284,7 +1269,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
 
        pblk_info(pblk, "luns:%u, lines:%d, secs:%llu, buf entries:%u\n",
                        geo->all_luns, pblk->l_mg.nr_lines,
-                       (unsigned long long)pblk->rl.nr_secs,
+                       (unsigned long long)pblk->capacity,
                        pblk->rwb.nr_entries);
 
        wake_up_process(pblk->writer_ts);
index 7fbc99b..5408e32 100644 (file)
@@ -162,6 +162,7 @@ int pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd,
 
                        *erase_ppa = ppa_list[i];
                        erase_ppa->a.blk = e_line->id;
+                       erase_ppa->a.reserved = 0;
 
                        spin_unlock(&e_line->lock);
 
index 03c241b..5abb170 100644 (file)
@@ -642,7 +642,7 @@ try:
  * be directed to disk.
  */
 int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
-                       struct ppa_addr ppa, int bio_iter, bool advanced_bio)
+                       struct ppa_addr ppa)
 {
        struct pblk *pblk = container_of(rb, struct pblk, rwb);
        struct pblk_rb_entry *entry;
@@ -673,15 +673,6 @@ int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
                ret = 0;
                goto out;
        }
-
-       /* Only advance the bio if it hasn't been advanced already. If advanced,
-        * this bio is at least a partial bio (i.e., it has partially been
-        * filled with data from the cache). If part of the data resides on the
-        * media, we will read later on
-        */
-       if (unlikely(!advanced_bio))
-               bio_advance(bio, bio_iter * PBLK_EXPOSED_PAGE_SIZE);
-
        data = bio_data(bio);
        memcpy(data, entry->data, rb->seg_size);
 
@@ -799,8 +790,8 @@ int pblk_rb_tear_down_check(struct pblk_rb *rb)
        }
 
 out:
-       spin_unlock(&rb->w_lock);
        spin_unlock_irq(&rb->s_lock);
+       spin_unlock(&rb->w_lock);
 
        return ret;
 }
index 0b7d5fb..d98ea39 100644 (file)
@@ -26,8 +26,7 @@
  * issued.
  */
 static int pblk_read_from_cache(struct pblk *pblk, struct bio *bio,
-                               sector_t lba, struct ppa_addr ppa,
-                               int bio_iter, bool advanced_bio)
+                               sector_t lba, struct ppa_addr ppa)
 {
 #ifdef CONFIG_NVM_PBLK_DEBUG
        /* Callers must ensure that the ppa points to a cache address */
@@ -35,73 +34,75 @@ static int pblk_read_from_cache(struct pblk *pblk, struct bio *bio,
        BUG_ON(!pblk_addr_in_cache(ppa));
 #endif
 
-       return pblk_rb_copy_to_bio(&pblk->rwb, bio, lba, ppa,
-                                               bio_iter, advanced_bio);
+       return pblk_rb_copy_to_bio(&pblk->rwb, bio, lba, ppa);
 }
 
-static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
+static int pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
                                 struct bio *bio, sector_t blba,
-                                unsigned long *read_bitmap)
+                                bool *from_cache)
 {
        void *meta_list = rqd->meta_list;
-       struct ppa_addr ppas[NVM_MAX_VLBA];
-       int nr_secs = rqd->nr_ppas;
-       bool advanced_bio = false;
-       int i, j = 0;
+       int nr_secs, i;
 
-       pblk_lookup_l2p_seq(pblk, ppas, blba, nr_secs);
+retry:
+       nr_secs = pblk_lookup_l2p_seq(pblk, rqd->ppa_list, blba, rqd->nr_ppas,
+                                       from_cache);
+
+       if (!*from_cache)
+               goto end;
 
        for (i = 0; i < nr_secs; i++) {
-               struct ppa_addr p = ppas[i];
                struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i);
                sector_t lba = blba + i;
 
-retry:
-               if (pblk_ppa_empty(p)) {
+               if (pblk_ppa_empty(rqd->ppa_list[i])) {
                        __le64 addr_empty = cpu_to_le64(ADDR_EMPTY);
 
-                       WARN_ON(test_and_set_bit(i, read_bitmap));
                        meta->lba = addr_empty;
-
-                       if (unlikely(!advanced_bio)) {
-                               bio_advance(bio, (i) * PBLK_EXPOSED_PAGE_SIZE);
-                               advanced_bio = true;
+               } else if (pblk_addr_in_cache(rqd->ppa_list[i])) {
+                       /*
+                        * Try to read from write buffer. The address is later
+                        * checked on the write buffer to prevent retrieving
+                        * overwritten data.
+                        */
+                       if (!pblk_read_from_cache(pblk, bio, lba,
+                                                       rqd->ppa_list[i])) {
+                               if (i == 0) {
+                                       /*
+                                        * We didn't call with bio_advance()
+                                        * yet, so we can just retry.
+                                        */
+                                       goto retry;
+                               } else {
+                                       /*
+                                        * We already call bio_advance()
+                                        * so we cannot retry and we need
+                                        * to quit that function in order
+                                        * to allow caller to handle the bio
+                                        * splitting in the current sector
+                                        * position.
+                                        */
+                                       nr_secs = i;
+                                       goto end;
+                               }
                        }
-
-                       goto next;
-               }
-
-               /* Try to read from write buffer. The address is later checked
-                * on the write buffer to prevent retrieving overwritten data.
-                */
-               if (pblk_addr_in_cache(p)) {
-                       if (!pblk_read_from_cache(pblk, bio, lba, p, i,
-                                                               advanced_bio)) {
-                               pblk_lookup_l2p_seq(pblk, &p, lba, 1);
-                               goto retry;
-                       }
-                       WARN_ON(test_and_set_bit(i, read_bitmap));
                        meta->lba = cpu_to_le64(lba);
-                       advanced_bio = true;
 #ifdef CONFIG_NVM_PBLK_DEBUG
                        atomic_long_inc(&pblk->cache_reads);
 #endif
-               } else {
-                       /* Read from media non-cached sectors */
-                       rqd->ppa_list[j++] = p;
                }
-
-next:
-               if (advanced_bio)
-                       bio_advance(bio, PBLK_EXPOSED_PAGE_SIZE);
+               bio_advance(bio, PBLK_EXPOSED_PAGE_SIZE);
        }
 
+end:
        if (pblk_io_aligned(pblk, nr_secs))
                rqd->is_seq = 1;
 
 #ifdef CONFIG_NVM_PBLK_DEBUG
        atomic_long_add(nr_secs, &pblk->inflight_reads);
 #endif
+
+       return nr_secs;
 }
 
 
@@ -175,12 +176,12 @@ static void pblk_read_check_rand(struct pblk *pblk, struct nvm_rq *rqd,
        WARN_ONCE(j != rqd->nr_ppas, "pblk: corrupted random request\n");
 }
 
-static void pblk_end_user_read(struct bio *bio)
+static void pblk_end_user_read(struct bio *bio, int error)
 {
-#ifdef CONFIG_NVM_PBLK_DEBUG
-       WARN_ONCE(bio->bi_status, "pblk: corrupted read bio\n");
-#endif
-       bio_endio(bio);
+       if (error && error != NVM_RSP_WARN_HIGHECC)
+               bio_io_error(bio);
+       else
+               bio_endio(bio);
 }
 
 static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd,
@@ -197,9 +198,7 @@ static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd,
                pblk_log_read_err(pblk, rqd);
 
        pblk_read_check_seq(pblk, rqd, r_ctx->lba);
-
-       if (int_bio)
-               bio_put(int_bio);
+       bio_put(int_bio);
 
        if (put_line)
                pblk_rq_to_line_put(pblk, rqd);
@@ -219,188 +218,17 @@ static void pblk_end_io_read(struct nvm_rq *rqd)
        struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
        struct bio *bio = (struct bio *)r_ctx->private;
 
-       pblk_end_user_read(bio);
+       pblk_end_user_read(bio, rqd->error);
        __pblk_end_io_read(pblk, rqd, true);
 }
 
-static void pblk_end_partial_read(struct nvm_rq *rqd)
-{
-       struct pblk *pblk = rqd->private;
-       struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
-       struct pblk_pr_ctx *pr_ctx = r_ctx->private;
-       struct pblk_sec_meta *meta;
-       struct bio *new_bio = rqd->bio;
-       struct bio *bio = pr_ctx->orig_bio;
-       void *meta_list = rqd->meta_list;
-       unsigned long *read_bitmap = pr_ctx->bitmap;
-       struct bvec_iter orig_iter = BVEC_ITER_ALL_INIT;
-       struct bvec_iter new_iter = BVEC_ITER_ALL_INIT;
-       int nr_secs = pr_ctx->orig_nr_secs;
-       int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
-       void *src_p, *dst_p;
-       int bit, i;
-
-       if (unlikely(nr_holes == 1)) {
-               struct ppa_addr ppa;
-
-               ppa = rqd->ppa_addr;
-               rqd->ppa_list = pr_ctx->ppa_ptr;
-               rqd->dma_ppa_list = pr_ctx->dma_ppa_list;
-               rqd->ppa_list[0] = ppa;
-       }
-
-       for (i = 0; i < nr_secs; i++) {
-               meta = pblk_get_meta(pblk, meta_list, i);
-               pr_ctx->lba_list_media[i] = le64_to_cpu(meta->lba);
-               meta->lba = cpu_to_le64(pr_ctx->lba_list_mem[i]);
-       }
-
-       /* Fill the holes in the original bio */
-       i = 0;
-       for (bit = 0; bit < nr_secs; bit++) {
-               if (!test_bit(bit, read_bitmap)) {
-                       struct bio_vec dst_bv, src_bv;
-                       struct pblk_line *line;
-
-                       line = pblk_ppa_to_line(pblk, rqd->ppa_list[i]);
-                       kref_put(&line->ref, pblk_line_put);
-
-                       meta = pblk_get_meta(pblk, meta_list, bit);
-                       meta->lba = cpu_to_le64(pr_ctx->lba_list_media[i]);
-
-                       dst_bv = bio_iter_iovec(bio, orig_iter);
-                       src_bv = bio_iter_iovec(new_bio, new_iter);
-
-                       src_p = kmap_atomic(src_bv.bv_page);
-                       dst_p = kmap_atomic(dst_bv.bv_page);
-
-                       memcpy(dst_p + dst_bv.bv_offset,
-                               src_p + src_bv.bv_offset,
-                               PBLK_EXPOSED_PAGE_SIZE);
-
-                       kunmap_atomic(src_p);
-                       kunmap_atomic(dst_p);
-
-                       flush_dcache_page(dst_bv.bv_page);
-                       mempool_free(src_bv.bv_page, &pblk->page_bio_pool);
-
-                       bio_advance_iter(new_bio, &new_iter,
-                                       PBLK_EXPOSED_PAGE_SIZE);
-                       i++;
-               }
-               bio_advance_iter(bio, &orig_iter, PBLK_EXPOSED_PAGE_SIZE);
-       }
-
-       bio_put(new_bio);
-       kfree(pr_ctx);
-
-       /* restore original request */
-       rqd->bio = NULL;
-       rqd->nr_ppas = nr_secs;
-
-       bio_endio(bio);
-       __pblk_end_io_read(pblk, rqd, false);
-}
-
-static int pblk_setup_partial_read(struct pblk *pblk, struct nvm_rq *rqd,
-                           unsigned int bio_init_idx,
-                           unsigned long *read_bitmap,
-                           int nr_holes)
-{
-       void *meta_list = rqd->meta_list;
-       struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
-       struct pblk_pr_ctx *pr_ctx;
-       struct bio *new_bio, *bio = r_ctx->private;
-       int nr_secs = rqd->nr_ppas;
-       int i;
-
-       new_bio = bio_alloc(GFP_KERNEL, nr_holes);
-
-       if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
-               goto fail_bio_put;
-
-       if (nr_holes != new_bio->bi_vcnt) {
-               WARN_ONCE(1, "pblk: malformed bio\n");
-               goto fail_free_pages;
-       }
-
-       pr_ctx = kzalloc(sizeof(struct pblk_pr_ctx), GFP_KERNEL);
-       if (!pr_ctx)
-               goto fail_free_pages;
-
-       for (i = 0; i < nr_secs; i++) {
-               struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i);
-
-               pr_ctx->lba_list_mem[i] = le64_to_cpu(meta->lba);
-       }
-
-       new_bio->bi_iter.bi_sector = 0; /* internal bio */
-       bio_set_op_attrs(new_bio, REQ_OP_READ, 0);
-
-       rqd->bio = new_bio;
-       rqd->nr_ppas = nr_holes;
-
-       pr_ctx->orig_bio = bio;
-       bitmap_copy(pr_ctx->bitmap, read_bitmap, NVM_MAX_VLBA);
-       pr_ctx->bio_init_idx = bio_init_idx;
-       pr_ctx->orig_nr_secs = nr_secs;
-       r_ctx->private = pr_ctx;
-
-       if (unlikely(nr_holes == 1)) {
-               pr_ctx->ppa_ptr = rqd->ppa_list;
-               pr_ctx->dma_ppa_list = rqd->dma_ppa_list;
-               rqd->ppa_addr = rqd->ppa_list[0];
-       }
-       return 0;
-
-fail_free_pages:
-       pblk_bio_free_pages(pblk, new_bio, 0, new_bio->bi_vcnt);
-fail_bio_put:
-       bio_put(new_bio);
-
-       return -ENOMEM;
-}
-
-static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,
-                                unsigned int bio_init_idx,
-                                unsigned long *read_bitmap, int nr_secs)
-{
-       int nr_holes;
-       int ret;
-
-       nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
-
-       if (pblk_setup_partial_read(pblk, rqd, bio_init_idx, read_bitmap,
-                                   nr_holes))
-               return NVM_IO_ERR;
-
-       rqd->end_io = pblk_end_partial_read;
-
-       ret = pblk_submit_io(pblk, rqd);
-       if (ret) {
-               bio_put(rqd->bio);
-               pblk_err(pblk, "partial read IO submission failed\n");
-               goto err;
-       }
-
-       return NVM_IO_OK;
-
-err:
-       pblk_err(pblk, "failed to perform partial read\n");
-
-       /* Free allocated pages in new bio */
-       pblk_bio_free_pages(pblk, rqd->bio, 0, rqd->bio->bi_vcnt);
-       __pblk_end_io_read(pblk, rqd, false);
-       return NVM_IO_ERR;
-}
-
 static void pblk_read_rq(struct pblk *pblk, struct nvm_rq *rqd, struct bio *bio,
-                        sector_t lba, unsigned long *read_bitmap)
+                        sector_t lba, bool *from_cache)
 {
        struct pblk_sec_meta *meta = pblk_get_meta(pblk, rqd->meta_list, 0);
        struct ppa_addr ppa;
 
-       pblk_lookup_l2p_seq(pblk, &ppa, lba, 1);
+       pblk_lookup_l2p_seq(pblk, &ppa, lba, 1, from_cache);
 
 #ifdef CONFIG_NVM_PBLK_DEBUG
        atomic_long_inc(&pblk->inflight_reads);
@@ -410,7 +238,6 @@ retry:
        if (pblk_ppa_empty(ppa)) {
                __le64 addr_empty = cpu_to_le64(ADDR_EMPTY);
 
-               WARN_ON(test_and_set_bit(0, read_bitmap));
                meta->lba = addr_empty;
                return;
        }
@@ -419,12 +246,11 @@ retry:
         * write buffer to prevent retrieving overwritten data.
         */
        if (pblk_addr_in_cache(ppa)) {
-               if (!pblk_read_from_cache(pblk, bio, lba, ppa, 0, 1)) {
-                       pblk_lookup_l2p_seq(pblk, &ppa, lba, 1);
+               if (!pblk_read_from_cache(pblk, bio, lba, ppa)) {
+                       pblk_lookup_l2p_seq(pblk, &ppa, lba, 1, from_cache);
                        goto retry;
                }
 
-               WARN_ON(test_and_set_bit(0, read_bitmap));
                meta->lba = cpu_to_le64(lba);
 
 #ifdef CONFIG_NVM_PBLK_DEBUG
@@ -435,95 +261,92 @@ retry:
        }
 }
 
-int pblk_submit_read(struct pblk *pblk, struct bio *bio)
+void pblk_submit_read(struct pblk *pblk, struct bio *bio)
 {
        struct nvm_tgt_dev *dev = pblk->dev;
        struct request_queue *q = dev->q;
        sector_t blba = pblk_get_lba(bio);
        unsigned int nr_secs = pblk_get_secs(bio);
+       bool from_cache;
        struct pblk_g_ctx *r_ctx;
        struct nvm_rq *rqd;
-       unsigned int bio_init_idx;
-       DECLARE_BITMAP(read_bitmap, NVM_MAX_VLBA);
-       int ret = NVM_IO_ERR;
+       struct bio *int_bio, *split_bio;
 
        generic_start_io_acct(q, REQ_OP_READ, bio_sectors(bio),
                              &pblk->disk->part0);
 
-       bitmap_zero(read_bitmap, nr_secs);
-
        rqd = pblk_alloc_rqd(pblk, PBLK_READ);
 
        rqd->opcode = NVM_OP_PREAD;
        rqd->nr_ppas = nr_secs;
-       rqd->bio = NULL; /* cloned bio if needed */
        rqd->private = pblk;
        rqd->end_io = pblk_end_io_read;
 
        r_ctx = nvm_rq_to_pdu(rqd);
        r_ctx->start_time = jiffies;
        r_ctx->lba = blba;
-       r_ctx->private = bio; /* original bio */
 
-       /* Save the index for this bio's start. This is needed in case
-        * we need to fill a partial read.
-        */
-       bio_init_idx = pblk_get_bi_idx(bio);
+       if (pblk_alloc_rqd_meta(pblk, rqd)) {
+               bio_io_error(bio);
+               pblk_free_rqd(pblk, rqd, PBLK_READ);
+               return;
+       }
 
-       if (pblk_alloc_rqd_meta(pblk, rqd))
-               goto fail_rqd_free;
+       /* Clone read bio to deal internally with:
+        * -read errors when reading from drive
+        * -bio_advance() calls during cache reads
+        */
+       int_bio = bio_clone_fast(bio, GFP_KERNEL, &pblk_bio_set);
 
        if (nr_secs > 1)
-               pblk_read_ppalist_rq(pblk, rqd, bio, blba, read_bitmap);
+               nr_secs = pblk_read_ppalist_rq(pblk, rqd, int_bio, blba,
+                                               &from_cache);
        else
-               pblk_read_rq(pblk, rqd, bio, blba, read_bitmap);
+               pblk_read_rq(pblk, rqd, int_bio, blba, &from_cache);
 
-       if (bitmap_full(read_bitmap, nr_secs)) {
+split_retry:
+       r_ctx->private = bio; /* original bio */
+       rqd->bio = int_bio; /* internal bio */
+
+       if (from_cache && nr_secs == rqd->nr_ppas) {
+               /* All data was read from cache, we can complete the IO. */
+               pblk_end_user_read(bio, 0);
                atomic_inc(&pblk->inflight_io);
                __pblk_end_io_read(pblk, rqd, false);
-               return NVM_IO_DONE;
-       }
-
-       /* All sectors are to be read from the device */
-       if (bitmap_empty(read_bitmap, rqd->nr_ppas)) {
-               struct bio *int_bio = NULL;
+       } else if (nr_secs != rqd->nr_ppas) {
+               /* The read bio request could be partially filled by the write
+                * buffer, but there are some holes that need to be read from
+                * the drive. In order to handle this, we will use block layer
+                * mechanism to split this request in to smaller ones and make
+                * a chain of it.
+                */
+               split_bio = bio_split(bio, nr_secs * NR_PHY_IN_LOG, GFP_KERNEL,
+                                       &pblk_bio_set);
+               bio_chain(split_bio, bio);
+               generic_make_request(bio);
+
+               /* New bio contains first N sectors of the previous one, so
+                * we can continue to use existing rqd, but we need to shrink
+                * the number of PPAs in it. New bio is also guaranteed that
+                * it contains only either data from cache or from drive, newer
+                * mix of them.
+                */
+               bio = split_bio;
+               rqd->nr_ppas = nr_secs;
+               if (rqd->nr_ppas == 1)
+                       rqd->ppa_addr = rqd->ppa_list[0];
 
-               /* Clone read bio to deal with read errors internally */
+               /* Recreate int_bio - existing might have some needed internal
+                * fields modified already.
+                */
+               bio_put(int_bio);
                int_bio = bio_clone_fast(bio, GFP_KERNEL, &pblk_bio_set);
-               if (!int_bio) {
-                       pblk_err(pblk, "could not clone read bio\n");
-                       goto fail_end_io;
-               }
-
-               rqd->bio = int_bio;
-
-               if (pblk_submit_io(pblk, rqd)) {
-                       pblk_err(pblk, "read IO submission failed\n");
-                       ret = NVM_IO_ERR;
-                       goto fail_end_io;
-               }
-
-               return NVM_IO_OK;
+               goto split_retry;
+       } else if (pblk_submit_io(pblk, rqd)) {
+               /* Submitting IO to drive failed, let's report an error */
+               rqd->error = -ENODEV;
+               pblk_end_io_read(rqd);
        }
-
-       /* The read bio request could be partially filled by the write buffer,
-        * but there are some holes that need to be read from the drive.
-        */
-       ret = pblk_partial_read_bio(pblk, rqd, bio_init_idx, read_bitmap,
-                                   nr_secs);
-       if (ret)
-               goto fail_meta_free;
-
-       return NVM_IO_OK;
-
-fail_meta_free:
-       nvm_dev_dma_free(dev->parent, rqd->meta_list, rqd->dma_meta_list);
-fail_rqd_free:
-       pblk_free_rqd(pblk, rqd, PBLK_READ);
-       return ret;
-fail_end_io:
-       __pblk_end_io_read(pblk, rqd, false);
-       return ret;
 }
 
 static int read_ppalist_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
@@ -568,7 +391,7 @@ static int read_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
                goto out;
 
        /* logic error: lba out-of-bounds */
-       if (lba >= pblk->rl.nr_secs) {
+       if (lba >= pblk->capacity) {
                WARN(1, "pblk: read lba out of bounds\n");
                goto out;
        }
@@ -642,7 +465,6 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 
        if (pblk_submit_io_sync(pblk, &rqd)) {
                ret = -EIO;
-               pblk_err(pblk, "GC read request failed\n");
                goto err_free_bio;
        }
 
index d86f580..e6dda04 100644 (file)
@@ -93,10 +93,24 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line)
 static void pblk_update_line_wp(struct pblk *pblk, struct pblk_line *line,
                                u64 written_secs)
 {
+       struct pblk_line_mgmt *l_mg = &pblk->l_mg;
        int i;
 
        for (i = 0; i < written_secs; i += pblk->min_write_pgs)
-               pblk_alloc_page(pblk, line, pblk->min_write_pgs);
+               __pblk_alloc_page(pblk, line, pblk->min_write_pgs);
+
+       spin_lock(&l_mg->free_lock);
+       if (written_secs > line->left_msecs) {
+               /*
+                * We have all data sectors written
+                * and some emeta sectors written too.
+                */
+               line->left_msecs = 0;
+       } else {
+               /* We have only some data sectors written. */
+               line->left_msecs -= written_secs;
+       }
+       spin_unlock(&l_mg->free_lock);
 }
 
 static u64 pblk_sec_in_open_line(struct pblk *pblk, struct pblk_line *line)
@@ -165,6 +179,7 @@ static int pblk_recov_pad_line(struct pblk *pblk, struct pblk_line *line,
        struct pblk_pad_rq *pad_rq;
        struct nvm_rq *rqd;
        struct bio *bio;
+       struct ppa_addr *ppa_list;
        void *data;
        __le64 *lba_list = emeta_to_lbas(pblk, line->emeta->buf);
        u64 w_ptr = line->cur_sec;
@@ -194,7 +209,7 @@ next_pad_rq:
        rq_ppas = pblk_calc_secs(pblk, left_ppas, 0, false);
        if (rq_ppas < pblk->min_write_pgs) {
                pblk_err(pblk, "corrupted pad line %d\n", line->id);
-               goto fail_free_pad;
+               goto fail_complete;
        }
 
        rq_len = rq_ppas * geo->csecs;
@@ -203,7 +218,7 @@ next_pad_rq:
                                                PBLK_VMALLOC_META, GFP_KERNEL);
        if (IS_ERR(bio)) {
                ret = PTR_ERR(bio);
-               goto fail_free_pad;
+               goto fail_complete;
        }
 
        bio->bi_iter.bi_sector = 0; /* internal bio */
@@ -212,8 +227,11 @@ next_pad_rq:
        rqd = pblk_alloc_rqd(pblk, PBLK_WRITE_INT);
 
        ret = pblk_alloc_rqd_meta(pblk, rqd);
-       if (ret)
-               goto fail_free_rqd;
+       if (ret) {
+               pblk_free_rqd(pblk, rqd, PBLK_WRITE_INT);
+               bio_put(bio);
+               goto fail_complete;
+       }
 
        rqd->bio = bio;
        rqd->opcode = NVM_OP_PWRITE;
@@ -222,6 +240,7 @@ next_pad_rq:
        rqd->end_io = pblk_end_io_recov;
        rqd->private = pad_rq;
 
+       ppa_list = nvm_rq_to_ppa_list(rqd);
        meta_list = rqd->meta_list;
 
        for (i = 0; i < rqd->nr_ppas; ) {
@@ -249,18 +268,21 @@ next_pad_rq:
                        lba_list[w_ptr] = addr_empty;
                        meta = pblk_get_meta(pblk, meta_list, i);
                        meta->lba = addr_empty;
-                       rqd->ppa_list[i] = dev_ppa;
+                       ppa_list[i] = dev_ppa;
                }
        }
 
        kref_get(&pad_rq->ref);
-       pblk_down_chunk(pblk, rqd->ppa_list[0]);
+       pblk_down_chunk(pblk, ppa_list[0]);
 
        ret = pblk_submit_io(pblk, rqd);
        if (ret) {
                pblk_err(pblk, "I/O submission failed: %d\n", ret);
-               pblk_up_chunk(pblk, rqd->ppa_list[0]);
-               goto fail_free_rqd;
+               pblk_up_chunk(pblk, ppa_list[0]);
+               kref_put(&pad_rq->ref, pblk_recov_complete);
+               pblk_free_rqd(pblk, rqd, PBLK_WRITE_INT);
+               bio_put(bio);
+               goto fail_complete;
        }
 
        left_line_ppas -= rq_ppas;
@@ -268,13 +290,9 @@ next_pad_rq:
        if (left_ppas && left_line_ppas)
                goto next_pad_rq;
 
+fail_complete:
        kref_put(&pad_rq->ref, pblk_recov_complete);
-
-       if (!wait_for_completion_io_timeout(&pad_rq->wait,
-                               msecs_to_jiffies(PBLK_COMMAND_TIMEOUT_MS))) {
-               pblk_err(pblk, "pad write timed out\n");
-               ret = -ETIME;
-       }
+       wait_for_completion(&pad_rq->wait);
 
        if (!pblk_line_is_full(line))
                pblk_err(pblk, "corrupted padded line: %d\n", line->id);
@@ -283,14 +301,6 @@ next_pad_rq:
 free_rq:
        kfree(pad_rq);
        return ret;
-
-fail_free_rqd:
-       pblk_free_rqd(pblk, rqd, PBLK_WRITE_INT);
-       bio_put(bio);
-fail_free_pad:
-       kfree(pad_rq);
-       vfree(data);
-       return ret;
 }
 
 static int pblk_pad_distance(struct pblk *pblk, struct pblk_line *line)
@@ -412,6 +422,7 @@ retry_rq:
        rqd->ppa_list = ppa_list;
        rqd->dma_ppa_list = dma_ppa_list;
        rqd->dma_meta_list = dma_meta_list;
+       ppa_list = nvm_rq_to_ppa_list(rqd);
 
        if (pblk_io_aligned(pblk, rq_ppas))
                rqd->is_seq = 1;
@@ -430,7 +441,7 @@ retry_rq:
                }
 
                for (j = 0; j < pblk->min_write_pgs; j++, i++)
-                       rqd->ppa_list[i] =
+                       ppa_list[i] =
                                addr_to_gen_ppa(pblk, paddr + j, line->id);
        }
 
@@ -444,7 +455,7 @@ retry_rq:
        atomic_dec(&pblk->inflight_io);
 
        /* If a read fails, do a best effort by padding the line and retrying */
-       if (rqd->error) {
+       if (rqd->error && rqd->error != NVM_RSP_WARN_HIGHECC) {
                int pad_distance, ret;
 
                if (padded) {
@@ -474,11 +485,11 @@ retry_rq:
 
                lba_list[paddr++] = cpu_to_le64(lba);
 
-               if (lba == ADDR_EMPTY || lba > pblk->rl.nr_secs)
+               if (lba == ADDR_EMPTY || lba >= pblk->capacity)
                        continue;
 
                line->nr_valid_lbas++;
-               pblk_update_map(pblk, lba, rqd->ppa_list[i]);
+               pblk_update_map(pblk, lba, ppa_list[i]);
        }
 
        left_ppas -= rq_ppas;
@@ -647,10 +658,12 @@ static int pblk_line_was_written(struct pblk_line *line,
        bppa = pblk->luns[smeta_blk].bppa;
        chunk = &line->chks[pblk_ppa_to_pos(geo, bppa)];
 
-       if (chunk->state & NVM_CHK_ST_FREE)
-               return 0;
+       if (chunk->state & NVM_CHK_ST_CLOSED ||
+           (chunk->state & NVM_CHK_ST_OPEN
+            && chunk->wp >= lm->smeta_sec))
+               return 1;
 
-       return 1;
+       return 0;
 }
 
 static bool pblk_line_is_open(struct pblk *pblk, struct pblk_line *line)
@@ -844,6 +857,7 @@ next:
                spin_unlock(&l_mg->free_lock);
        } else {
                spin_lock(&l_mg->free_lock);
+               l_mg->data_line = data_line;
                /* Allocate next line for preparation */
                l_mg->data_next = pblk_line_get(pblk);
                if (l_mg->data_next) {
index 6593dea..4e63f9b 100644 (file)
@@ -228,6 +228,7 @@ static void pblk_submit_rec(struct work_struct *work)
        mempool_free(recovery, &pblk->rec_pool);
 
        atomic_dec(&pblk->inflight_io);
+       pblk_write_kick(pblk);
 }
 
 
index ac3ab77..a678553 100644 (file)
@@ -43,8 +43,6 @@
 
 #define PBLK_CACHE_NAME_LEN (DISK_NAME_LEN + 16)
 
-#define PBLK_COMMAND_TIMEOUT_MS 30000
-
 /* Max 512 LUNs per device */
 #define PBLK_MAX_LUNS_BITMAP (4)
 
@@ -123,18 +121,6 @@ struct pblk_g_ctx {
        u64 lba;
 };
 
-/* partial read context */
-struct pblk_pr_ctx {
-       struct bio *orig_bio;
-       DECLARE_BITMAP(bitmap, NVM_MAX_VLBA);
-       unsigned int orig_nr_secs;
-       unsigned int bio_init_idx;
-       void *ppa_ptr;
-       dma_addr_t dma_ppa_list;
-       u64 lba_list_mem[NVM_MAX_VLBA];
-       u64 lba_list_media[NVM_MAX_VLBA];
-};
-
 /* Pad context */
 struct pblk_pad_rq {
        struct pblk *pblk;
@@ -305,7 +291,6 @@ struct pblk_rl {
 
        struct timer_list u_timer;
 
-       unsigned long long nr_secs;
        unsigned long total_blocks;
 
        atomic_t free_blocks;           /* Total number of free blocks (+ OP) */
@@ -440,6 +425,7 @@ struct pblk_smeta {
 
 struct pblk_w_err_gc {
        int has_write_err;
+       int has_gc_err;
        __le64 *lba_list;
 };
 
@@ -465,7 +451,6 @@ struct pblk_line {
        int meta_line;                  /* Metadata line id */
        int meta_distance;              /* Distance between data and metadata */
 
-       u64 smeta_ssec;                 /* Sector where smeta starts */
        u64 emeta_ssec;                 /* Sector where emeta starts */
 
        unsigned int sec_in_line;       /* Number of usable secs in line */
@@ -762,7 +747,7 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd,
                                 unsigned int pos, unsigned int nr_entries,
                                 unsigned int count);
 int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
-                       struct ppa_addr ppa, int bio_iter, bool advanced_bio);
+                       struct ppa_addr ppa);
 unsigned int pblk_rb_read_commit(struct pblk_rb *rb, unsigned int entries);
 
 unsigned int pblk_rb_sync_init(struct pblk_rb *rb, unsigned long *flags);
@@ -862,15 +847,15 @@ int pblk_update_map_gc(struct pblk *pblk, sector_t lba, struct ppa_addr ppa,
                       struct pblk_line *gc_line, u64 paddr);
 void pblk_lookup_l2p_rand(struct pblk *pblk, struct ppa_addr *ppas,
                          u64 *lba_list, int nr_secs);
-void pblk_lookup_l2p_seq(struct pblk *pblk, struct ppa_addr *ppas,
-                        sector_t blba, int nr_secs);
+int pblk_lookup_l2p_seq(struct pblk *pblk, struct ppa_addr *ppas,
+                        sector_t blba, int nr_secs, bool *from_cache);
 void *pblk_get_meta_for_writes(struct pblk *pblk, struct nvm_rq *rqd);
 void pblk_get_packed_meta(struct pblk *pblk, struct nvm_rq *rqd);
 
 /*
  * pblk user I/O write path
  */
-int pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
+void pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
                        unsigned long flags);
 int pblk_write_gc_to_cache(struct pblk *pblk, struct pblk_gc_rq *gc_rq);
 
@@ -896,7 +881,7 @@ void pblk_write_kick(struct pblk *pblk);
  * pblk read path
  */
 extern struct bio_set pblk_bio_set;
-int pblk_submit_read(struct pblk *pblk, struct bio *bio);
+void pblk_submit_read(struct pblk *pblk, struct bio *bio);
 int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq);
 /*
  * pblk recovery
@@ -921,6 +906,7 @@ void pblk_gc_free_full_lines(struct pblk *pblk);
 void pblk_gc_sysfs_state_show(struct pblk *pblk, int *gc_enabled,
                              int *gc_active);
 int pblk_gc_sysfs_force(struct pblk *pblk, int force);
+void pblk_put_line_back(struct pblk *pblk, struct pblk_line *line);
 
 /*
  * pblk rate limiter
index 47c350c..574e122 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig MACINTOSH_DRIVERS
        bool "Macintosh device drivers"
index 41c95b2..3b58d02 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Apple Motion Sensor driver
 #
index 36a4fdd..01eeb23 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Apple Motion Sensor driver
  *
  * Copyright (C) 2005 Stelian Pop (stelian@popies.net)
  * Copyright (C) 2006 Michael Hanselmann (linux-kernel@hansmi.ch)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <linux/module.h>
index 80d30e8..7af0c53 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * drivers/macintosh/mac_hid.c
  *
index d7cd5af..8f7725d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Device driver for the i2c thermostat found on the iBook G4, Albook G4
  *
index 2626990..52fd5fc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
index 595542b..b709481 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MAILBOX
        bool "Mailbox Hardware Support"
        help
index 8f397da..de26079 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * APM X-Gene SLIMpro MailBox Driver
  *
  * Copyright (c) 2015, Applied Micro Circuits Corporation
  * Author: Feng Kan fkan@apm.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <linux/acpi.h>
 #include <linux/delay.h>
index 2281178..00d5219 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index 76d9c51..0a88348 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MEN Chameleon Bus (MCB) support
 #
index 7369bda..3b69e6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/slab.h>
index 2557f19..45254b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Block device driver configuration
 #
@@ -436,6 +437,15 @@ config DM_DELAY
 
        If unsure, say N.
 
+config DM_DUST
+       tristate "Bad sector simulation target"
+       depends on BLK_DEV_DM
+       ---help---
+       A target that simulates bad sector behavior.
+       Useful for testing.
+
+       If unsure, say N.
+
 config DM_INIT
        bool "DM \"dm-mod.create=\" parameter support"
        depends on BLK_DEV_DM=y
index a52b703..be7a6eb 100644 (file)
@@ -48,6 +48,7 @@ obj-$(CONFIG_DM_BUFIO)                += dm-bufio.o
 obj-$(CONFIG_DM_BIO_PRISON)    += dm-bio-prison.o
 obj-$(CONFIG_DM_CRYPT)         += dm-crypt.o
 obj-$(CONFIG_DM_DELAY)         += dm-delay.o
+obj-$(CONFIG_DM_DUST)          += dm-dust.o
 obj-$(CONFIG_DM_FLAKEY)                += dm-flakey.o
 obj-$(CONFIG_DM_MULTIPATH)     += dm-multipath.o dm-round-robin.o
 obj-$(CONFIG_DM_MULTIPATH_QL)  += dm-queue-length.o
index f6e0a8b..6dfa653 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config BCACHE
        tristate "Block device as cache"
index 6fc9383..151aa95 100644 (file)
@@ -1167,11 +1167,18 @@ static int __load_discards(struct dm_cache_metadata *cmd,
                if (r)
                        return r;
 
-               for (b = 0; b < from_dblock(cmd->discard_nr_blocks); b++) {
+               for (b = 0; ; b++) {
                        r = fn(context, cmd->discard_block_size, to_dblock(b),
                               dm_bitset_cursor_get_value(&c));
                        if (r)
                                break;
+
+                       if (b >= (from_dblock(cmd->discard_nr_blocks) - 1))
+                               break;
+
+                       r = dm_bitset_cursor_next(&c);
+                       if (r)
+                               break;
                }
 
                dm_bitset_cursor_end(&c);
index 7f6462f..1b16d34 100644 (file)
@@ -946,6 +946,7 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
 {
 #ifdef CONFIG_BLK_DEV_INTEGRITY
        struct blk_integrity *bi = blk_get_integrity(cc->dev->bdev->bd_disk);
+       struct mapped_device *md = dm_table_get_md(ti->table);
 
        /* From now we require underlying device with our integrity profile */
        if (!bi || strcasecmp(bi->profile->name, "DM-DIF-EXT-TAG")) {
@@ -965,7 +966,7 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
 
        if (crypt_integrity_aead(cc)) {
                cc->integrity_tag_size = cc->on_disk_tag_size - cc->integrity_iv_size;
-               DMINFO("Integrity AEAD, tag size %u, IV size %u.",
+               DMDEBUG("%s: Integrity AEAD, tag size %u, IV size %u.", dm_device_name(md),
                       cc->integrity_tag_size, cc->integrity_iv_size);
 
                if (crypto_aead_setauthsize(any_tfm_aead(cc), cc->integrity_tag_size)) {
@@ -973,7 +974,7 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
                        return -EINVAL;
                }
        } else if (cc->integrity_iv_size)
-               DMINFO("Additional per-sector space %u bytes for IV.",
+               DMDEBUG("%s: Additional per-sector space %u bytes for IV.", dm_device_name(md),
                       cc->integrity_iv_size);
 
        if ((cc->integrity_tag_size + cc->integrity_iv_size) != bi->tag_size) {
@@ -1031,11 +1032,11 @@ static u8 *org_iv_of_dmreq(struct crypt_config *cc,
        return iv_of_dmreq(cc, dmreq) + cc->iv_size;
 }
 
-static uint64_t *org_sector_of_dmreq(struct crypt_config *cc,
+static __le64 *org_sector_of_dmreq(struct crypt_config *cc,
                       struct dm_crypt_request *dmreq)
 {
        u8 *ptr = iv_of_dmreq(cc, dmreq) + cc->iv_size + cc->iv_size;
-       return (uint64_t*) ptr;
+       return (__le64 *) ptr;
 }
 
 static unsigned int *org_tag_of_dmreq(struct crypt_config *cc,
@@ -1071,7 +1072,7 @@ static int crypt_convert_block_aead(struct crypt_config *cc,
        struct bio_vec bv_out = bio_iter_iovec(ctx->bio_out, ctx->iter_out);
        struct dm_crypt_request *dmreq;
        u8 *iv, *org_iv, *tag_iv, *tag;
-       uint64_t *sector;
+       __le64 *sector;
        int r = 0;
 
        BUG_ON(cc->integrity_iv_size && cc->integrity_iv_size != cc->iv_size);
@@ -1143,9 +1144,11 @@ static int crypt_convert_block_aead(struct crypt_config *cc,
                r = crypto_aead_decrypt(req);
        }
 
-       if (r == -EBADMSG)
-               DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
+       if (r == -EBADMSG) {
+               char b[BDEVNAME_SIZE];
+               DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
                            (unsigned long long)le64_to_cpu(*sector));
+       }
 
        if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
                r = cc->iv_gen_ops->post(cc, org_iv, dmreq);
@@ -1166,7 +1169,7 @@ static int crypt_convert_block_skcipher(struct crypt_config *cc,
        struct scatterlist *sg_in, *sg_out;
        struct dm_crypt_request *dmreq;
        u8 *iv, *org_iv, *tag_iv;
-       uint64_t *sector;
+       __le64 *sector;
        int r = 0;
 
        /* Reject unexpected unaligned bio. */
@@ -1788,7 +1791,8 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
                error = cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq);
 
        if (error == -EBADMSG) {
-               DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
+               char b[BDEVNAME_SIZE];
+               DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
                            (unsigned long long)le64_to_cpu(*org_sector_of_dmreq(cc, dmreq)));
                io->error = BLK_STS_PROTECTION;
        } else if (error < 0)
@@ -1887,7 +1891,7 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
         * algorithm implementation is used.  Help people debug performance
         * problems by logging the ->cra_driver_name.
         */
-       DMINFO("%s using implementation \"%s\"", ciphermode,
+       DMDEBUG_LIMIT("%s using implementation \"%s\"", ciphermode,
               crypto_skcipher_alg(any_tfm(cc))->base.cra_driver_name);
        return 0;
 }
@@ -1907,7 +1911,7 @@ static int crypt_alloc_tfms_aead(struct crypt_config *cc, char *ciphermode)
                return err;
        }
 
-       DMINFO("%s using implementation \"%s\"", ciphermode,
+       DMDEBUG_LIMIT("%s using implementation \"%s\"", ciphermode,
               crypto_aead_alg(any_tfm_aead(cc))->base.cra_driver_name);
        return 0;
 }
index fddffe2..f496213 100644 (file)
@@ -121,7 +121,8 @@ static void delay_dtr(struct dm_target *ti)
 {
        struct delay_c *dc = ti->private;
 
-       destroy_workqueue(dc->kdelayd_wq);
+       if (dc->kdelayd_wq)
+               destroy_workqueue(dc->kdelayd_wq);
 
        if (dc->read.dev)
                dm_put_device(ti, dc->read.dev);
diff --git a/drivers/md/dm-dust.c b/drivers/md/dm-dust.c
new file mode 100644 (file)
index 0000000..845f376
--- /dev/null
@@ -0,0 +1,515 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018 Red Hat, Inc.
+ *
+ * This is a test "dust" device, which fails reads on specified
+ * sectors, emulating the behavior of a hard disk drive sending
+ * a "Read Medium Error" sense.
+ *
+ */
+
+#include <linux/device-mapper.h>
+#include <linux/module.h>
+#include <linux/rbtree.h>
+
+#define DM_MSG_PREFIX "dust"
+
+struct badblock {
+       struct rb_node node;
+       sector_t bb;
+};
+
+struct dust_device {
+       struct dm_dev *dev;
+       struct rb_root badblocklist;
+       unsigned long long badblock_count;
+       spinlock_t dust_lock;
+       unsigned int blksz;
+       unsigned int sect_per_block;
+       sector_t start;
+       bool fail_read_on_bb:1;
+       bool quiet_mode:1;
+};
+
+static struct badblock *dust_rb_search(struct rb_root *root, sector_t blk)
+{
+       struct rb_node *node = root->rb_node;
+
+       while (node) {
+               struct badblock *bblk = rb_entry(node, struct badblock, node);
+
+               if (bblk->bb > blk)
+                       node = node->rb_left;
+               else if (bblk->bb < blk)
+                       node = node->rb_right;
+               else
+                       return bblk;
+       }
+
+       return NULL;
+}
+
+static bool dust_rb_insert(struct rb_root *root, struct badblock *new)
+{
+       struct badblock *bblk;
+       struct rb_node **link = &root->rb_node, *parent = NULL;
+       sector_t value = new->bb;
+
+       while (*link) {
+               parent = *link;
+               bblk = rb_entry(parent, struct badblock, node);
+
+               if (bblk->bb > value)
+                       link = &(*link)->rb_left;
+               else if (bblk->bb < value)
+                       link = &(*link)->rb_right;
+               else
+                       return false;
+       }
+
+       rb_link_node(&new->node, parent, link);
+       rb_insert_color(&new->node, root);
+
+       return true;
+}
+
+static int dust_remove_block(struct dust_device *dd, unsigned long long block)
+{
+       struct badblock *bblock;
+       unsigned long flags;
+
+       spin_lock_irqsave(&dd->dust_lock, flags);
+       bblock = dust_rb_search(&dd->badblocklist, block * dd->sect_per_block);
+
+       if (bblock == NULL) {
+               if (!dd->quiet_mode) {
+                       DMERR("%s: block %llu not found in badblocklist",
+                             __func__, block);
+               }
+               spin_unlock_irqrestore(&dd->dust_lock, flags);
+               return -EINVAL;
+       }
+
+       rb_erase(&bblock->node, &dd->badblocklist);
+       dd->badblock_count--;
+       if (!dd->quiet_mode)
+               DMINFO("%s: badblock removed at block %llu", __func__, block);
+       kfree(bblock);
+       spin_unlock_irqrestore(&dd->dust_lock, flags);
+
+       return 0;
+}
+
+static int dust_add_block(struct dust_device *dd, unsigned long long block)
+{
+       struct badblock *bblock;
+       unsigned long flags;
+
+       bblock = kmalloc(sizeof(*bblock), GFP_KERNEL);
+       if (bblock == NULL) {
+               if (!dd->quiet_mode)
+                       DMERR("%s: badblock allocation failed", __func__);
+               return -ENOMEM;
+       }
+
+       spin_lock_irqsave(&dd->dust_lock, flags);
+       bblock->bb = block * dd->sect_per_block;
+       if (!dust_rb_insert(&dd->badblocklist, bblock)) {
+               if (!dd->quiet_mode) {
+                       DMERR("%s: block %llu already in badblocklist",
+                             __func__, block);
+               }
+               spin_unlock_irqrestore(&dd->dust_lock, flags);
+               kfree(bblock);
+               return -EINVAL;
+       }
+
+       dd->badblock_count++;
+       if (!dd->quiet_mode)
+               DMINFO("%s: badblock added at block %llu", __func__, block);
+       spin_unlock_irqrestore(&dd->dust_lock, flags);
+
+       return 0;
+}
+
+static int dust_query_block(struct dust_device *dd, unsigned long long block)
+{
+       struct badblock *bblock;
+       unsigned long flags;
+
+       spin_lock_irqsave(&dd->dust_lock, flags);
+       bblock = dust_rb_search(&dd->badblocklist, block * dd->sect_per_block);
+       if (bblock != NULL)
+               DMINFO("%s: block %llu found in badblocklist", __func__, block);
+       else
+               DMINFO("%s: block %llu not found in badblocklist", __func__, block);
+       spin_unlock_irqrestore(&dd->dust_lock, flags);
+
+       return 0;
+}
+
+static int __dust_map_read(struct dust_device *dd, sector_t thisblock)
+{
+       struct badblock *bblk = dust_rb_search(&dd->badblocklist, thisblock);
+
+       if (bblk)
+               return DM_MAPIO_KILL;
+
+       return DM_MAPIO_REMAPPED;
+}
+
+static int dust_map_read(struct dust_device *dd, sector_t thisblock,
+                        bool fail_read_on_bb)
+{
+       unsigned long flags;
+       int ret = DM_MAPIO_REMAPPED;
+
+       if (fail_read_on_bb) {
+               spin_lock_irqsave(&dd->dust_lock, flags);
+               ret = __dust_map_read(dd, thisblock);
+               spin_unlock_irqrestore(&dd->dust_lock, flags);
+       }
+
+       return ret;
+}
+
+static void __dust_map_write(struct dust_device *dd, sector_t thisblock)
+{
+       struct badblock *bblk = dust_rb_search(&dd->badblocklist, thisblock);
+
+       if (bblk) {
+               rb_erase(&bblk->node, &dd->badblocklist);
+               dd->badblock_count--;
+               kfree(bblk);
+               if (!dd->quiet_mode) {
+                       sector_div(thisblock, dd->sect_per_block);
+                       DMINFO("block %llu removed from badblocklist by write",
+                              (unsigned long long)thisblock);
+               }
+       }
+}
+
+static int dust_map_write(struct dust_device *dd, sector_t thisblock,
+                         bool fail_read_on_bb)
+{
+       unsigned long flags;
+
+       if (fail_read_on_bb) {
+               spin_lock_irqsave(&dd->dust_lock, flags);
+               __dust_map_write(dd, thisblock);
+               spin_unlock_irqrestore(&dd->dust_lock, flags);
+       }
+
+       return DM_MAPIO_REMAPPED;
+}
+
+static int dust_map(struct dm_target *ti, struct bio *bio)
+{
+       struct dust_device *dd = ti->private;
+       int ret;
+
+       bio_set_dev(bio, dd->dev->bdev);
+       bio->bi_iter.bi_sector = dd->start + dm_target_offset(ti, bio->bi_iter.bi_sector);
+
+       if (bio_data_dir(bio) == READ)
+               ret = dust_map_read(dd, bio->bi_iter.bi_sector, dd->fail_read_on_bb);
+       else
+               ret = dust_map_write(dd, bio->bi_iter.bi_sector, dd->fail_read_on_bb);
+
+       return ret;
+}
+
+static bool __dust_clear_badblocks(struct rb_root *tree,
+                                  unsigned long long count)
+{
+       struct rb_node *node = NULL, *nnode = NULL;
+
+       nnode = rb_first(tree);
+       if (nnode == NULL) {
+               BUG_ON(count != 0);
+               return false;
+       }
+
+       while (nnode) {
+               node = nnode;
+               nnode = rb_next(node);
+               rb_erase(node, tree);
+               count--;
+               kfree(node);
+       }
+       BUG_ON(count != 0);
+       BUG_ON(tree->rb_node != NULL);
+
+       return true;
+}
+
+static int dust_clear_badblocks(struct dust_device *dd)
+{
+       unsigned long flags;
+       struct rb_root badblocklist;
+       unsigned long long badblock_count;
+
+       spin_lock_irqsave(&dd->dust_lock, flags);
+       badblocklist = dd->badblocklist;
+       badblock_count = dd->badblock_count;
+       dd->badblocklist = RB_ROOT;
+       dd->badblock_count = 0;
+       spin_unlock_irqrestore(&dd->dust_lock, flags);
+
+       if (!__dust_clear_badblocks(&badblocklist, badblock_count))
+               DMINFO("%s: no badblocks found", __func__);
+       else
+               DMINFO("%s: badblocks cleared", __func__);
+
+       return 0;
+}
+
+/*
+ * Target parameters:
+ *
+ * <device_path> <offset> <blksz>
+ *
+ * device_path: path to the block device
+ * offset: offset to data area from start of device_path
+ * blksz: block size (minimum 512, maximum 1073741824, must be a power of 2)
+ */
+static int dust_ctr(struct dm_target *ti, unsigned int argc, char **argv)
+{
+       struct dust_device *dd;
+       unsigned long long tmp;
+       char dummy;
+       unsigned int blksz;
+       unsigned int sect_per_block;
+       sector_t DUST_MAX_BLKSZ_SECTORS = 2097152;
+       sector_t max_block_sectors = min(ti->len, DUST_MAX_BLKSZ_SECTORS);
+
+       if (argc != 3) {
+               ti->error = "Invalid argument count";
+               return -EINVAL;
+       }
+
+       if (kstrtouint(argv[2], 10, &blksz) || !blksz) {
+               ti->error = "Invalid block size parameter";
+               return -EINVAL;
+       }
+
+       if (blksz < 512) {
+               ti->error = "Block size must be at least 512";
+               return -EINVAL;
+       }
+
+       if (!is_power_of_2(blksz)) {
+               ti->error = "Block size must be a power of 2";
+               return -EINVAL;
+       }
+
+       if (to_sector(blksz) > max_block_sectors) {
+               ti->error = "Block size is too large";
+               return -EINVAL;
+       }
+
+       sect_per_block = (blksz >> SECTOR_SHIFT);
+
+       if (sscanf(argv[1], "%llu%c", &tmp, &dummy) != 1 || tmp != (sector_t)tmp) {
+               ti->error = "Invalid device offset sector";
+               return -EINVAL;
+       }
+
+       dd = kzalloc(sizeof(struct dust_device), GFP_KERNEL);
+       if (dd == NULL) {
+               ti->error = "Cannot allocate context";
+               return -ENOMEM;
+       }
+
+       if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &dd->dev)) {
+               ti->error = "Device lookup failed";
+               kfree(dd);
+               return -EINVAL;
+       }
+
+       dd->sect_per_block = sect_per_block;
+       dd->blksz = blksz;
+       dd->start = tmp;
+
+       /*
+        * Whether to fail a read on a "bad" block.
+        * Defaults to false; enabled later by message.
+        */
+       dd->fail_read_on_bb = false;
+
+       /*
+        * Initialize bad block list rbtree.
+        */
+       dd->badblocklist = RB_ROOT;
+       dd->badblock_count = 0;
+       spin_lock_init(&dd->dust_lock);
+
+       dd->quiet_mode = false;
+
+       BUG_ON(dm_set_target_max_io_len(ti, dd->sect_per_block) != 0);
+
+       ti->num_discard_bios = 1;
+       ti->num_flush_bios = 1;
+       ti->private = dd;
+
+       return 0;
+}
+
+static void dust_dtr(struct dm_target *ti)
+{
+       struct dust_device *dd = ti->private;
+
+       __dust_clear_badblocks(&dd->badblocklist, dd->badblock_count);
+       dm_put_device(ti, dd->dev);
+       kfree(dd);
+}
+
+static int dust_message(struct dm_target *ti, unsigned int argc, char **argv,
+                       char *result_buf, unsigned int maxlen)
+{
+       struct dust_device *dd = ti->private;
+       sector_t size = i_size_read(dd->dev->bdev->bd_inode) >> SECTOR_SHIFT;
+       bool invalid_msg = false;
+       int result = -EINVAL;
+       unsigned long long tmp, block;
+       unsigned long flags;
+       char dummy;
+
+       if (argc == 1) {
+               if (!strcasecmp(argv[0], "addbadblock") ||
+                   !strcasecmp(argv[0], "removebadblock") ||
+                   !strcasecmp(argv[0], "queryblock")) {
+                       DMERR("%s requires an additional argument", argv[0]);
+               } else if (!strcasecmp(argv[0], "disable")) {
+                       DMINFO("disabling read failures on bad sectors");
+                       dd->fail_read_on_bb = false;
+                       result = 0;
+               } else if (!strcasecmp(argv[0], "enable")) {
+                       DMINFO("enabling read failures on bad sectors");
+                       dd->fail_read_on_bb = true;
+                       result = 0;
+               } else if (!strcasecmp(argv[0], "countbadblocks")) {
+                       spin_lock_irqsave(&dd->dust_lock, flags);
+                       DMINFO("countbadblocks: %llu badblock(s) found",
+                              dd->badblock_count);
+                       spin_unlock_irqrestore(&dd->dust_lock, flags);
+                       result = 0;
+               } else if (!strcasecmp(argv[0], "clearbadblocks")) {
+                       result = dust_clear_badblocks(dd);
+               } else if (!strcasecmp(argv[0], "quiet")) {
+                       if (!dd->quiet_mode)
+                               dd->quiet_mode = true;
+                       else
+                               dd->quiet_mode = false;
+                       result = 0;
+               } else {
+                       invalid_msg = true;
+               }
+       } else if (argc == 2) {
+               if (sscanf(argv[1], "%llu%c", &tmp, &dummy) != 1)
+                       return result;
+
+               block = tmp;
+               sector_div(size, dd->sect_per_block);
+               if (block > size) {
+                       DMERR("selected block value out of range");
+                       return result;
+               }
+
+               if (!strcasecmp(argv[0], "addbadblock"))
+                       result = dust_add_block(dd, block);
+               else if (!strcasecmp(argv[0], "removebadblock"))
+                       result = dust_remove_block(dd, block);
+               else if (!strcasecmp(argv[0], "queryblock"))
+                       result = dust_query_block(dd, block);
+               else
+                       invalid_msg = true;
+
+       } else
+               DMERR("invalid number of arguments '%d'", argc);
+
+       if (invalid_msg)
+               DMERR("unrecognized message '%s' received", argv[0]);
+
+       return result;
+}
+
+static void dust_status(struct dm_target *ti, status_type_t type,
+                       unsigned int status_flags, char *result, unsigned int maxlen)
+{
+       struct dust_device *dd = ti->private;
+       unsigned int sz = 0;
+
+       switch (type) {
+       case STATUSTYPE_INFO:
+               DMEMIT("%s %s %s", dd->dev->name,
+                      dd->fail_read_on_bb ? "fail_read_on_bad_block" : "bypass",
+                      dd->quiet_mode ? "quiet" : "verbose");
+               break;
+
+       case STATUSTYPE_TABLE:
+               DMEMIT("%s %llu %u", dd->dev->name,
+                      (unsigned long long)dd->start, dd->blksz);
+               break;
+       }
+}
+
+static int dust_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
+{
+       struct dust_device *dd = ti->private;
+       struct dm_dev *dev = dd->dev;
+
+       *bdev = dev->bdev;
+
+       /*
+        * Only pass ioctls through if the device sizes match exactly.
+        */
+       if (dd->start ||
+           ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT)
+               return 1;
+
+       return 0;
+}
+
+static int dust_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn,
+                               void *data)
+{
+       struct dust_device *dd = ti->private;
+
+       return fn(ti, dd->dev, dd->start, ti->len, data);
+}
+
+static struct target_type dust_target = {
+       .name = "dust",
+       .version = {1, 0, 0},
+       .module = THIS_MODULE,
+       .ctr = dust_ctr,
+       .dtr = dust_dtr,
+       .iterate_devices = dust_iterate_devices,
+       .map = dust_map,
+       .message = dust_message,
+       .status = dust_status,
+       .prepare_ioctl = dust_prepare_ioctl,
+};
+
+static int __init dm_dust_init(void)
+{
+       int result = dm_register_target(&dust_target);
+
+       if (result < 0)
+               DMERR("dm_register_target failed %d", result);
+
+       return result;
+}
+
+static void __exit dm_dust_exit(void)
+{
+       dm_unregister_target(&dust_target);
+}
+
+module_init(dm_dust_init);
+module_exit(dm_dust_exit);
+
+MODULE_DESCRIPTION(DM_NAME " dust test target");
+MODULE_AUTHOR("Bryan Gurney <dm-devel@redhat.com>");
+MODULE_LICENSE("GPL");
index 8e48920..bdb84b8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "dm.h"
 #include "persistent-data/dm-transaction-manager.h"
 #include "persistent-data/dm-bitset.h"
index 721efc4..3f4139a 100644 (file)
@@ -11,6 +11,7 @@
 #define _LINUX_DM_EXCEPTION_STORE
 
 #include <linux/blkdev.h>
+#include <linux/list_bl.h>
 #include <linux/device-mapper.h>
 
 /*
@@ -27,7 +28,7 @@ typedef sector_t chunk_t;
  * chunk within the device.
  */
 struct dm_exception {
-       struct list_head hash_list;
+       struct hlist_bl_node hash_list;
 
        chunk_t old_chunk;
        chunk_t new_chunk;
index 4b76f84..352e803 100644 (file)
@@ -160,7 +160,7 @@ static int __init dm_parse_table(struct dm_device *dev, char *str)
 
        while (table_entry) {
                DMDEBUG("parsing table \"%s\"", str);
-               if (++dev->dmi.target_count >= DM_MAX_TARGETS) {
+               if (++dev->dmi.target_count > DM_MAX_TARGETS) {
                        DMERR("too many targets %u > %d",
                              dev->dmi.target_count, DM_MAX_TARGETS);
                        return -EINVAL;
@@ -242,9 +242,9 @@ static int __init dm_parse_devices(struct list_head *devices, char *str)
                        return -ENOMEM;
                list_add_tail(&dev->list, devices);
 
-               if (++ndev >= DM_MAX_DEVICES) {
-                       DMERR("too many targets %u > %d",
-                             dev->dmi.target_count, DM_MAX_TARGETS);
+               if (++ndev > DM_MAX_DEVICES) {
+                       DMERR("too many devices %lu > %d",
+                             ndev, DM_MAX_DEVICES);
                        return -EINVAL;
                }
 
index c27c32c..44e76cd 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/rbtree.h>
 #include <linux/delay.h>
 #include <linux/random.h>
+#include <linux/reboot.h>
 #include <crypto/hash.h>
 #include <crypto/skcipher.h>
 #include <linux/async_tx.h>
@@ -24,6 +25,7 @@
 
 #define DEFAULT_INTERLEAVE_SECTORS     32768
 #define DEFAULT_JOURNAL_SIZE_FACTOR    7
+#define DEFAULT_SECTORS_PER_BITMAP_BIT 32768
 #define DEFAULT_BUFFER_SECTORS         128
 #define DEFAULT_JOURNAL_WATERMARK      50
 #define DEFAULT_SYNC_MSEC              10000
@@ -33,6 +35,8 @@
 #define METADATA_WORKQUEUE_MAX_ACTIVE  16
 #define RECALC_SECTORS                 8192
 #define RECALC_WRITE_SUPER             16
+#define BITMAP_BLOCK_SIZE              4096    /* don't change it */
+#define BITMAP_FLUSH_INTERVAL          (10 * HZ)
 
 /*
  * Warning - DEBUG_PRINT prints security-sensitive data to the log,
@@ -48,6 +52,7 @@
 #define SB_MAGIC                       "integrt"
 #define SB_VERSION_1                   1
 #define SB_VERSION_2                   2
+#define SB_VERSION_3                   3
 #define SB_SECTORS                     8
 #define MAX_SECTORS_PER_BLOCK          8
 
@@ -60,12 +65,14 @@ struct superblock {
        __u64 provided_data_sectors;    /* userspace uses this value */
        __u32 flags;
        __u8 log2_sectors_per_block;
-       __u8 pad[3];
+       __u8 log2_blocks_per_bitmap_bit;
+       __u8 pad[2];
        __u64 recalc_sector;
 };
 
 #define SB_FLAG_HAVE_JOURNAL_MAC       0x1
 #define SB_FLAG_RECALCULATING          0x2
+#define SB_FLAG_DIRTY_BITMAP           0x4
 
 #define        JOURNAL_ENTRY_ROUNDUP           8
 
@@ -151,9 +158,18 @@ struct dm_integrity_c {
        struct workqueue_struct *metadata_wq;
        struct superblock *sb;
        unsigned journal_pages;
+       unsigned n_bitmap_blocks;
+
        struct page_list *journal;
        struct page_list *journal_io;
        struct page_list *journal_xor;
+       struct page_list *recalc_bitmap;
+       struct page_list *may_write_bitmap;
+       struct bitmap_block_status *bbs;
+       unsigned bitmap_flush_interval;
+       int synchronous_mode;
+       struct bio_list synchronous_bios;
+       struct delayed_work bitmap_flush_work;
 
        struct crypto_skcipher *journal_crypt;
        struct scatterlist **journal_scatterlist;
@@ -180,6 +196,7 @@ struct dm_integrity_c {
        __s8 log2_metadata_run;
        __u8 log2_buffer_sectors;
        __u8 sectors_per_block;
+       __u8 log2_blocks_per_bitmap_bit;
 
        unsigned char mode;
        int suspending;
@@ -232,17 +249,20 @@ struct dm_integrity_c {
 
        bool journal_uptodate;
        bool just_formatted;
+       bool recalculate_flag;
 
        struct alg_spec internal_hash_alg;
        struct alg_spec journal_crypt_alg;
        struct alg_spec journal_mac_alg;
 
        atomic64_t number_of_mismatches;
+
+       struct notifier_block reboot_notifier;
 };
 
 struct dm_integrity_range {
        sector_t logical_sector;
-       unsigned n_sectors;
+       sector_t n_sectors;
        bool waiting;
        union {
                struct rb_node node;
@@ -288,6 +308,16 @@ struct journal_io {
        struct journal_completion *comp;
 };
 
+struct bitmap_block_status {
+       struct work_struct work;
+       struct dm_integrity_c *ic;
+       unsigned idx;
+       unsigned long *bitmap;
+       struct bio_list bio_queue;
+       spinlock_t bio_queue_lock;
+
+};
+
 static struct kmem_cache *journal_io_cache;
 
 #define JOURNAL_IO_MEMPOOL     32
@@ -423,7 +453,9 @@ static void wraparound_section(struct dm_integrity_c *ic, unsigned *sec_ptr)
 
 static void sb_set_version(struct dm_integrity_c *ic)
 {
-       if (ic->meta_dev || ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
+       if (ic->mode == 'B' || ic->sb->flags & cpu_to_le32(SB_FLAG_DIRTY_BITMAP))
+               ic->sb->version = SB_VERSION_3;
+       else if (ic->meta_dev || ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
                ic->sb->version = SB_VERSION_2;
        else
                ic->sb->version = SB_VERSION_1;
@@ -447,6 +479,137 @@ static int sync_rw_sb(struct dm_integrity_c *ic, int op, int op_flags)
        return dm_io(&io_req, 1, &io_loc, NULL);
 }
 
+#define BITMAP_OP_TEST_ALL_SET         0
+#define BITMAP_OP_TEST_ALL_CLEAR       1
+#define BITMAP_OP_SET                  2
+#define BITMAP_OP_CLEAR                        3
+
+static bool block_bitmap_op(struct dm_integrity_c *ic, struct page_list *bitmap,
+                           sector_t sector, sector_t n_sectors, int mode)
+{
+       unsigned long bit, end_bit, this_end_bit, page, end_page;
+       unsigned long *data;
+
+       if (unlikely(((sector | n_sectors) & ((1 << ic->sb->log2_sectors_per_block) - 1)) != 0)) {
+               DMCRIT("invalid bitmap access (%llx,%llx,%d,%d,%d)",
+                       (unsigned long long)sector,
+                       (unsigned long long)n_sectors,
+                       ic->sb->log2_sectors_per_block,
+                       ic->log2_blocks_per_bitmap_bit,
+                       mode);
+               BUG();
+       }
+
+       if (unlikely(!n_sectors))
+               return true;
+
+       bit = sector >> (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+       end_bit = (sector + n_sectors - 1) >>
+               (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+
+       page = bit / (PAGE_SIZE * 8);
+       bit %= PAGE_SIZE * 8;
+
+       end_page = end_bit / (PAGE_SIZE * 8);
+       end_bit %= PAGE_SIZE * 8;
+
+repeat:
+       if (page < end_page) {
+               this_end_bit = PAGE_SIZE * 8 - 1;
+       } else {
+               this_end_bit = end_bit;
+       }
+
+       data = lowmem_page_address(bitmap[page].page);
+
+       if (mode == BITMAP_OP_TEST_ALL_SET) {
+               while (bit <= this_end_bit) {
+                       if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
+                               do {
+                                       if (data[bit / BITS_PER_LONG] != -1)
+                                               return false;
+                                       bit += BITS_PER_LONG;
+                               } while (this_end_bit >= bit + BITS_PER_LONG - 1);
+                               continue;
+                       }
+                       if (!test_bit(bit, data))
+                               return false;
+                       bit++;
+               }
+       } else if (mode == BITMAP_OP_TEST_ALL_CLEAR) {
+               while (bit <= this_end_bit) {
+                       if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
+                               do {
+                                       if (data[bit / BITS_PER_LONG] != 0)
+                                               return false;
+                                       bit += BITS_PER_LONG;
+                               } while (this_end_bit >= bit + BITS_PER_LONG - 1);
+                               continue;
+                       }
+                       if (test_bit(bit, data))
+                               return false;
+                       bit++;
+               }
+       } else if (mode == BITMAP_OP_SET) {
+               while (bit <= this_end_bit) {
+                       if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
+                               do {
+                                       data[bit / BITS_PER_LONG] = -1;
+                                       bit += BITS_PER_LONG;
+                               } while (this_end_bit >= bit + BITS_PER_LONG - 1);
+                               continue;
+                       }
+                       __set_bit(bit, data);
+                       bit++;
+               }
+       } else if (mode == BITMAP_OP_CLEAR) {
+               if (!bit && this_end_bit == PAGE_SIZE * 8 - 1)
+                       clear_page(data);
+               else while (bit <= this_end_bit) {
+                       if (!(bit % BITS_PER_LONG) && this_end_bit >= bit + BITS_PER_LONG - 1) {
+                               do {
+                                       data[bit / BITS_PER_LONG] = 0;
+                                       bit += BITS_PER_LONG;
+                               } while (this_end_bit >= bit + BITS_PER_LONG - 1);
+                               continue;
+                       }
+                       __clear_bit(bit, data);
+                       bit++;
+               }
+       } else {
+               BUG();
+       }
+
+       if (unlikely(page < end_page)) {
+               bit = 0;
+               page++;
+               goto repeat;
+       }
+
+       return true;
+}
+
+static void block_bitmap_copy(struct dm_integrity_c *ic, struct page_list *dst, struct page_list *src)
+{
+       unsigned n_bitmap_pages = DIV_ROUND_UP(ic->n_bitmap_blocks, PAGE_SIZE / BITMAP_BLOCK_SIZE);
+       unsigned i;
+
+       for (i = 0; i < n_bitmap_pages; i++) {
+               unsigned long *dst_data = lowmem_page_address(dst[i].page);
+               unsigned long *src_data = lowmem_page_address(src[i].page);
+               copy_page(dst_data, src_data);
+       }
+}
+
+static struct bitmap_block_status *sector_to_bitmap_block(struct dm_integrity_c *ic, sector_t sector)
+{
+       unsigned bit = sector >> (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+       unsigned bitmap_block = bit / (BITMAP_BLOCK_SIZE * 8);
+
+       BUG_ON(bitmap_block >= ic->n_bitmap_blocks);
+       return &ic->bbs[bitmap_block];
+}
+
 static void access_journal_check(struct dm_integrity_c *ic, unsigned section, unsigned offset,
                                 bool e, const char *function)
 {
@@ -455,8 +618,8 @@ static void access_journal_check(struct dm_integrity_c *ic, unsigned section, un
 
        if (unlikely(section >= ic->journal_sections) ||
            unlikely(offset >= limit)) {
-               printk(KERN_CRIT "%s: invalid access at (%u,%u), limit (%u,%u)\n",
-                       function, section, offset, ic->journal_sections, limit);
+               DMCRIT("%s: invalid access at (%u,%u), limit (%u,%u)",
+                      function, section, offset, ic->journal_sections, limit);
                BUG();
        }
 #endif
@@ -756,12 +919,12 @@ static void complete_journal_io(unsigned long error, void *context)
        complete_journal_op(comp);
 }
 
-static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned section,
-                      unsigned n_sections, struct journal_completion *comp)
+static void rw_journal_sectors(struct dm_integrity_c *ic, int op, int op_flags,
+                              unsigned sector, unsigned n_sectors, struct journal_completion *comp)
 {
        struct dm_io_request io_req;
        struct dm_io_region io_loc;
-       unsigned sector, n_sectors, pl_index, pl_offset;
+       unsigned pl_index, pl_offset;
        int r;
 
        if (unlikely(dm_integrity_failed(ic))) {
@@ -770,9 +933,6 @@ static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned
                return;
        }
 
-       sector = section * ic->journal_section_sectors;
-       n_sectors = n_sections * ic->journal_section_sectors;
-
        pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT);
        pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1);
 
@@ -805,6 +965,17 @@ static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned
        }
 }
 
+static void rw_journal(struct dm_integrity_c *ic, int op, int op_flags, unsigned section,
+                      unsigned n_sections, struct journal_completion *comp)
+{
+       unsigned sector, n_sectors;
+
+       sector = section * ic->journal_section_sectors;
+       n_sectors = n_sections * ic->journal_section_sectors;
+
+       rw_journal_sectors(ic, op, op_flags, sector, n_sectors, comp);
+}
+
 static void write_journal(struct dm_integrity_c *ic, unsigned commit_start, unsigned commit_sections)
 {
        struct journal_completion io_comp;
@@ -988,6 +1159,12 @@ static void wait_and_add_new_range(struct dm_integrity_c *ic, struct dm_integrit
        } while (unlikely(new_range->waiting));
 }
 
+static void add_new_range_and_wait(struct dm_integrity_c *ic, struct dm_integrity_range *new_range)
+{
+       if (unlikely(!add_new_range(ic, new_range, true)))
+               wait_and_add_new_range(ic, new_range);
+}
+
 static void init_journal_node(struct journal_node *node)
 {
        RB_CLEAR_NODE(&node->node);
@@ -1204,6 +1381,14 @@ static void do_endio(struct dm_integrity_c *ic, struct bio *bio)
        int r = dm_integrity_failed(ic);
        if (unlikely(r) && !bio->bi_status)
                bio->bi_status = errno_to_blk_status(r);
+       if (unlikely(ic->synchronous_mode) && bio_op(bio) == REQ_OP_WRITE) {
+               unsigned long flags;
+               spin_lock_irqsave(&ic->endio_wait.lock, flags);
+               bio_list_add(&ic->synchronous_bios, bio);
+               queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
+               spin_unlock_irqrestore(&ic->endio_wait.lock, flags);
+               return;
+       }
        bio_endio(bio);
 }
 
@@ -1477,7 +1662,8 @@ static int dm_integrity_map(struct dm_target *ti, struct bio *bio)
                        else
                                wanted_tag_size *= ic->tag_size;
                        if (unlikely(wanted_tag_size != bip->bip_iter.bi_size)) {
-                               DMERR("Invalid integrity data size %u, expected %u", bip->bip_iter.bi_size, wanted_tag_size);
+                               DMERR("Invalid integrity data size %u, expected %u",
+                                     bip->bip_iter.bi_size, wanted_tag_size);
                                return DM_MAPIO_KILL;
                        }
                }
@@ -1681,7 +1867,7 @@ retry:
                        unsigned ws, we, range_sectors;
 
                        dio->range.n_sectors = min(dio->range.n_sectors,
-                                                  ic->free_sectors << ic->sb->log2_sectors_per_block);
+                                                  (sector_t)ic->free_sectors << ic->sb->log2_sectors_per_block);
                        if (unlikely(!dio->range.n_sectors)) {
                                if (from_map)
                                        goto offload_to_thread;
@@ -1764,6 +1950,20 @@ offload_to_thread:
                goto journal_read_write;
        }
 
+       if (ic->mode == 'B' && dio->write) {
+               if (!block_bitmap_op(ic, ic->may_write_bitmap, dio->range.logical_sector,
+                                    dio->range.n_sectors, BITMAP_OP_TEST_ALL_SET)) {
+                       struct bitmap_block_status *bbs;
+
+                       bbs = sector_to_bitmap_block(ic, dio->range.logical_sector);
+                       spin_lock(&bbs->bio_queue_lock);
+                       bio_list_add(&bbs->bio_queue, bio);
+                       spin_unlock(&bbs->bio_queue_lock);
+                       queue_work(ic->writer_wq, &bbs->work);
+                       return;
+               }
+       }
+
        dio->in_flight = (atomic_t)ATOMIC_INIT(2);
 
        if (need_sync_io) {
@@ -1790,10 +1990,15 @@ offload_to_thread:
 
        if (need_sync_io) {
                wait_for_completion_io(&read_comp);
-               if (unlikely(ic->recalc_wq != NULL) &&
-                   ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) &&
+               if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) &&
                    dio->range.logical_sector + dio->range.n_sectors > le64_to_cpu(ic->sb->recalc_sector))
                        goto skip_check;
+               if (ic->mode == 'B') {
+                       if (!block_bitmap_op(ic, ic->recalc_bitmap, dio->range.logical_sector,
+                                            dio->range.n_sectors, BITMAP_OP_TEST_ALL_CLEAR))
+                               goto skip_check;
+               }
+
                if (likely(!bio->bi_status))
                        integrity_metadata(&dio->work);
                else
@@ -1831,8 +2036,16 @@ static void pad_uncommitted(struct dm_integrity_c *ic)
                wraparound_section(ic, &ic->free_section);
                ic->n_uncommitted_sections++;
        }
-       WARN_ON(ic->journal_sections * ic->journal_section_entries !=
-               (ic->n_uncommitted_sections + ic->n_committed_sections) * ic->journal_section_entries + ic->free_sectors);
+       if (WARN_ON(ic->journal_sections * ic->journal_section_entries !=
+                   (ic->n_uncommitted_sections + ic->n_committed_sections) *
+                   ic->journal_section_entries + ic->free_sectors)) {
+               DMCRIT("journal_sections %u, journal_section_entries %u, "
+                      "n_uncommitted_sections %u, n_committed_sections %u, "
+                      "journal_section_entries %u, free_sectors %u",
+                      ic->journal_sections, ic->journal_section_entries,
+                      ic->n_uncommitted_sections, ic->n_committed_sections,
+                      ic->journal_section_entries, ic->free_sectors);
+       }
 }
 
 static void integrity_commit(struct work_struct *w)
@@ -1981,8 +2194,7 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start,
                        io->range.n_sectors = (k - j) << ic->sb->log2_sectors_per_block;
 
                        spin_lock_irq(&ic->endio_wait.lock);
-                       if (unlikely(!add_new_range(ic, &io->range, true)))
-                               wait_and_add_new_range(ic, &io->range);
+                       add_new_range_and_wait(ic, &io->range);
 
                        if (likely(!from_replay)) {
                                struct journal_node *section_node = &ic->journal_tree[i * ic->journal_section_entries];
@@ -2120,11 +2332,14 @@ static void integrity_recalc(struct work_struct *w)
        sector_t area, offset;
        sector_t metadata_block;
        unsigned metadata_offset;
+       sector_t logical_sector, n_sectors;
        __u8 *t;
        unsigned i;
        int r;
        unsigned super_counter = 0;
 
+       DEBUG_print("start recalculation... (position %llx)\n", le64_to_cpu(ic->sb->recalc_sector));
+
        spin_lock_irq(&ic->endio_wait.lock);
 
 next_chunk:
@@ -2133,21 +2348,49 @@ next_chunk:
                goto unlock_ret;
 
        range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
-       if (unlikely(range.logical_sector >= ic->provided_data_sectors))
+       if (unlikely(range.logical_sector >= ic->provided_data_sectors)) {
+               if (ic->mode == 'B') {
+                       DEBUG_print("queue_delayed_work: bitmap_flush_work\n");
+                       queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
+               }
                goto unlock_ret;
+       }
 
        get_area_and_offset(ic, range.logical_sector, &area, &offset);
        range.n_sectors = min((sector_t)RECALC_SECTORS, ic->provided_data_sectors - range.logical_sector);
        if (!ic->meta_dev)
-               range.n_sectors = min(range.n_sectors, (1U << ic->sb->log2_interleave_sectors) - (unsigned)offset);
-
-       if (unlikely(!add_new_range(ic, &range, true)))
-               wait_and_add_new_range(ic, &range);
+               range.n_sectors = min(range.n_sectors, ((sector_t)1U << ic->sb->log2_interleave_sectors) - (unsigned)offset);
 
+       add_new_range_and_wait(ic, &range);
        spin_unlock_irq(&ic->endio_wait.lock);
+       logical_sector = range.logical_sector;
+       n_sectors = range.n_sectors;
+
+       if (ic->mode == 'B') {
+               if (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector, n_sectors, BITMAP_OP_TEST_ALL_CLEAR)) {
+                       goto advance_and_next;
+               }
+               while (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector,
+                                      ic->sectors_per_block, BITMAP_OP_TEST_ALL_CLEAR)) {
+                       logical_sector += ic->sectors_per_block;
+                       n_sectors -= ic->sectors_per_block;
+                       cond_resched();
+               }
+               while (block_bitmap_op(ic, ic->recalc_bitmap, logical_sector + n_sectors - ic->sectors_per_block,
+                                      ic->sectors_per_block, BITMAP_OP_TEST_ALL_CLEAR)) {
+                       n_sectors -= ic->sectors_per_block;
+                       cond_resched();
+               }
+               get_area_and_offset(ic, logical_sector, &area, &offset);
+       }
+
+       DEBUG_print("recalculating: %lx, %lx\n", logical_sector, n_sectors);
 
        if (unlikely(++super_counter == RECALC_WRITE_SUPER)) {
                recalc_write_super(ic);
+               if (ic->mode == 'B') {
+                       queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
+               }
                super_counter = 0;
        }
 
@@ -2162,7 +2405,7 @@ next_chunk:
        io_req.client = ic->io;
        io_loc.bdev = ic->dev->bdev;
        io_loc.sector = get_data_sector(ic, area, offset);
-       io_loc.count = range.n_sectors;
+       io_loc.count = n_sectors;
 
        r = dm_io(&io_req, 1, &io_loc, NULL);
        if (unlikely(r)) {
@@ -2171,8 +2414,8 @@ next_chunk:
        }
 
        t = ic->recalc_tags;
-       for (i = 0; i < range.n_sectors; i += ic->sectors_per_block) {
-               integrity_sector_checksum(ic, range.logical_sector + i, ic->recalc_buffer + (i << SECTOR_SHIFT), t);
+       for (i = 0; i < n_sectors; i += ic->sectors_per_block) {
+               integrity_sector_checksum(ic, logical_sector + i, ic->recalc_buffer + (i << SECTOR_SHIFT), t);
                t += ic->tag_size;
        }
 
@@ -2184,6 +2427,9 @@ next_chunk:
                goto err;
        }
 
+advance_and_next:
+       cond_resched();
+
        spin_lock_irq(&ic->endio_wait.lock);
        remove_range_unlocked(ic, &range);
        ic->sb->recalc_sector = cpu_to_le64(range.logical_sector + range.n_sectors);
@@ -2199,6 +2445,103 @@ unlock_ret:
        recalc_write_super(ic);
 }
 
+static void bitmap_block_work(struct work_struct *w)
+{
+       struct bitmap_block_status *bbs = container_of(w, struct bitmap_block_status, work);
+       struct dm_integrity_c *ic = bbs->ic;
+       struct bio *bio;
+       struct bio_list bio_queue;
+       struct bio_list waiting;
+
+       bio_list_init(&waiting);
+
+       spin_lock(&bbs->bio_queue_lock);
+       bio_queue = bbs->bio_queue;
+       bio_list_init(&bbs->bio_queue);
+       spin_unlock(&bbs->bio_queue_lock);
+
+       while ((bio = bio_list_pop(&bio_queue))) {
+               struct dm_integrity_io *dio;
+
+               dio = dm_per_bio_data(bio, sizeof(struct dm_integrity_io));
+
+               if (block_bitmap_op(ic, ic->may_write_bitmap, dio->range.logical_sector,
+                                   dio->range.n_sectors, BITMAP_OP_TEST_ALL_SET)) {
+                       remove_range(ic, &dio->range);
+                       INIT_WORK(&dio->work, integrity_bio_wait);
+                       queue_work(ic->wait_wq, &dio->work);
+               } else {
+                       block_bitmap_op(ic, ic->journal, dio->range.logical_sector,
+                                       dio->range.n_sectors, BITMAP_OP_SET);
+                       bio_list_add(&waiting, bio);
+               }
+       }
+
+       if (bio_list_empty(&waiting))
+               return;
+
+       rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC,
+                          bbs->idx * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT),
+                          BITMAP_BLOCK_SIZE >> SECTOR_SHIFT, NULL);
+
+       while ((bio = bio_list_pop(&waiting))) {
+               struct dm_integrity_io *dio = dm_per_bio_data(bio, sizeof(struct dm_integrity_io));
+
+               block_bitmap_op(ic, ic->may_write_bitmap, dio->range.logical_sector,
+                               dio->range.n_sectors, BITMAP_OP_SET);
+
+               remove_range(ic, &dio->range);
+               INIT_WORK(&dio->work, integrity_bio_wait);
+               queue_work(ic->wait_wq, &dio->work);
+       }
+
+       queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
+}
+
+static void bitmap_flush_work(struct work_struct *work)
+{
+       struct dm_integrity_c *ic = container_of(work, struct dm_integrity_c, bitmap_flush_work.work);
+       struct dm_integrity_range range;
+       unsigned long limit;
+       struct bio *bio;
+
+       dm_integrity_flush_buffers(ic);
+
+       range.logical_sector = 0;
+       range.n_sectors = ic->provided_data_sectors;
+
+       spin_lock_irq(&ic->endio_wait.lock);
+       add_new_range_and_wait(ic, &range);
+       spin_unlock_irq(&ic->endio_wait.lock);
+
+       dm_integrity_flush_buffers(ic);
+       if (ic->meta_dev)
+               blkdev_issue_flush(ic->dev->bdev, GFP_NOIO, NULL);
+
+       limit = ic->provided_data_sectors;
+       if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) {
+               limit = le64_to_cpu(ic->sb->recalc_sector)
+                       >> (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)
+                       << (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+       }
+       /*DEBUG_print("zeroing journal\n");*/
+       block_bitmap_op(ic, ic->journal, 0, limit, BITMAP_OP_CLEAR);
+       block_bitmap_op(ic, ic->may_write_bitmap, 0, limit, BITMAP_OP_CLEAR);
+
+       rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0,
+                          ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
+
+       spin_lock_irq(&ic->endio_wait.lock);
+       remove_range_unlocked(ic, &range);
+       while (unlikely((bio = bio_list_pop(&ic->synchronous_bios)) != NULL)) {
+               bio_endio(bio);
+               spin_unlock_irq(&ic->endio_wait.lock);
+               spin_lock_irq(&ic->endio_wait.lock);
+       }
+       spin_unlock_irq(&ic->endio_wait.lock);
+}
+
+
 static void init_journal(struct dm_integrity_c *ic, unsigned start_section,
                         unsigned n_sections, unsigned char commit_seq)
 {
@@ -2395,9 +2738,37 @@ clear_journal:
                init_journal_node(&ic->journal_tree[i]);
 }
 
+static void dm_integrity_enter_synchronous_mode(struct dm_integrity_c *ic)
+{
+       DEBUG_print("dm_integrity_enter_synchronous_mode\n");
+
+       if (ic->mode == 'B') {
+               ic->bitmap_flush_interval = msecs_to_jiffies(10) + 1;
+               ic->synchronous_mode = 1;
+
+               cancel_delayed_work_sync(&ic->bitmap_flush_work);
+               queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
+               flush_workqueue(ic->commit_wq);
+       }
+}
+
+static int dm_integrity_reboot(struct notifier_block *n, unsigned long code, void *x)
+{
+       struct dm_integrity_c *ic = container_of(n, struct dm_integrity_c, reboot_notifier);
+
+       DEBUG_print("dm_integrity_reboot\n");
+
+       dm_integrity_enter_synchronous_mode(ic);
+
+       return NOTIFY_DONE;
+}
+
 static void dm_integrity_postsuspend(struct dm_target *ti)
 {
        struct dm_integrity_c *ic = (struct dm_integrity_c *)ti->private;
+       int r;
+
+       WARN_ON(unregister_reboot_notifier(&ic->reboot_notifier));
 
        del_timer_sync(&ic->autocommit_timer);
 
@@ -2406,6 +2777,9 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
        if (ic->recalc_wq)
                drain_workqueue(ic->recalc_wq);
 
+       if (ic->mode == 'B')
+               cancel_delayed_work_sync(&ic->bitmap_flush_work);
+
        queue_work(ic->commit_wq, &ic->commit_work);
        drain_workqueue(ic->commit_wq);
 
@@ -2416,6 +2790,18 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
                dm_integrity_flush_buffers(ic);
        }
 
+       if (ic->mode == 'B') {
+               dm_integrity_flush_buffers(ic);
+#if 1
+               /* set to 0 to test bitmap replay code */
+               init_journal(ic, 0, ic->journal_sections, 0);
+               ic->sb->flags &= ~cpu_to_le32(SB_FLAG_DIRTY_BITMAP);
+               r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA);
+               if (unlikely(r))
+                       dm_integrity_io_error(ic, "writing superblock", r);
+#endif
+       }
+
        WRITE_ONCE(ic->suspending, 0);
 
        BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
@@ -2426,11 +2812,70 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
 static void dm_integrity_resume(struct dm_target *ti)
 {
        struct dm_integrity_c *ic = (struct dm_integrity_c *)ti->private;
+       int r;
+       DEBUG_print("resume\n");
+
+       if (ic->sb->flags & cpu_to_le32(SB_FLAG_DIRTY_BITMAP)) {
+               DEBUG_print("resume dirty_bitmap\n");
+               rw_journal_sectors(ic, REQ_OP_READ, 0, 0,
+                                  ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
+               if (ic->mode == 'B') {
+                       if (ic->sb->log2_blocks_per_bitmap_bit == ic->log2_blocks_per_bitmap_bit) {
+                               block_bitmap_copy(ic, ic->recalc_bitmap, ic->journal);
+                               block_bitmap_copy(ic, ic->may_write_bitmap, ic->journal);
+                               if (!block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors,
+                                                    BITMAP_OP_TEST_ALL_CLEAR)) {
+                                       ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
+                                       ic->sb->recalc_sector = cpu_to_le64(0);
+                               }
+                       } else {
+                               DEBUG_print("non-matching blocks_per_bitmap_bit: %u, %u\n",
+                                           ic->sb->log2_blocks_per_bitmap_bit, ic->log2_blocks_per_bitmap_bit);
+                               ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit;
+                               block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_SET);
+                               block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_SET);
+                               block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_SET);
+                               rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0,
+                                                  ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
+                               ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
+                               ic->sb->recalc_sector = cpu_to_le64(0);
+                       }
+               } else {
+                       if (!(ic->sb->log2_blocks_per_bitmap_bit == ic->log2_blocks_per_bitmap_bit &&
+                             block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_TEST_ALL_CLEAR))) {
+                               ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
+                               ic->sb->recalc_sector = cpu_to_le64(0);
+                       }
+                       init_journal(ic, 0, ic->journal_sections, 0);
+                       replay_journal(ic);
+                       ic->sb->flags &= ~cpu_to_le32(SB_FLAG_DIRTY_BITMAP);
+               }
+               r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA);
+               if (unlikely(r))
+                       dm_integrity_io_error(ic, "writing superblock", r);
+       } else {
+               replay_journal(ic);
+               if (ic->mode == 'B') {
+                       int mode;
+                       ic->sb->flags |= cpu_to_le32(SB_FLAG_DIRTY_BITMAP);
+                       ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit;
+                       r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA);
+                       if (unlikely(r))
+                               dm_integrity_io_error(ic, "writing superblock", r);
+
+                       mode = ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR;
+                       block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, mode);
+                       block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, mode);
+                       block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, mode);
+                       rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0,
+                                          ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
+               }
+       }
 
-       replay_journal(ic);
-
-       if (ic->recalc_wq && ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) {
+       DEBUG_print("testing recalc: %x\n", ic->sb->flags);
+       if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) {
                __u64 recalc_pos = le64_to_cpu(ic->sb->recalc_sector);
+               DEBUG_print("recalc pos: %lx / %lx\n", (long)recalc_pos, ic->provided_data_sectors);
                if (recalc_pos < ic->provided_data_sectors) {
                        queue_work(ic->recalc_wq, &ic->recalc_work);
                } else if (recalc_pos > ic->provided_data_sectors) {
@@ -2438,6 +2883,16 @@ static void dm_integrity_resume(struct dm_target *ti)
                        recalc_write_super(ic);
                }
        }
+
+       ic->reboot_notifier.notifier_call = dm_integrity_reboot;
+       ic->reboot_notifier.next = NULL;
+       ic->reboot_notifier.priority = INT_MAX - 1;     /* be notified after md and before hardware drivers */
+       WARN_ON(register_reboot_notifier(&ic->reboot_notifier));
+
+#if 0
+       /* set to 1 to stress test synchronous mode */
+       dm_integrity_enter_synchronous_mode(ic);
+#endif
 }
 
 static void dm_integrity_status(struct dm_target *ti, status_type_t type,
@@ -2462,10 +2917,14 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
                __u64 watermark_percentage = (__u64)(ic->journal_entries - ic->free_sectors_threshold) * 100;
                watermark_percentage += ic->journal_entries / 2;
                do_div(watermark_percentage, ic->journal_entries);
-               arg_count = 5;
+               arg_count = 3;
                arg_count += !!ic->meta_dev;
                arg_count += ic->sectors_per_block != 1;
                arg_count += !!(ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING));
+               arg_count += ic->mode == 'J';
+               arg_count += ic->mode == 'J';
+               arg_count += ic->mode == 'B';
+               arg_count += ic->mode == 'B';
                arg_count += !!ic->internal_hash_alg.alg_string;
                arg_count += !!ic->journal_crypt_alg.alg_string;
                arg_count += !!ic->journal_mac_alg.alg_string;
@@ -2475,13 +2934,19 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
                        DMEMIT(" meta_device:%s", ic->meta_dev->name);
                if (ic->sectors_per_block != 1)
                        DMEMIT(" block_size:%u", ic->sectors_per_block << SECTOR_SHIFT);
-               if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
+               if (ic->recalculate_flag)
                        DMEMIT(" recalculate");
                DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
                DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);
                DMEMIT(" buffer_sectors:%u", 1U << ic->log2_buffer_sectors);
-               DMEMIT(" journal_watermark:%u", (unsigned)watermark_percentage);
-               DMEMIT(" commit_time:%u", ic->autocommit_msec);
+               if (ic->mode == 'J') {
+                       DMEMIT(" journal_watermark:%u", (unsigned)watermark_percentage);
+                       DMEMIT(" commit_time:%u", ic->autocommit_msec);
+               }
+               if (ic->mode == 'B') {
+                       DMEMIT(" sectors_per_bit:%llu", (unsigned long long)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit);
+                       DMEMIT(" bitmap_flush_interval:%u", jiffies_to_msecs(ic->bitmap_flush_interval));
+               }
 
 #define EMIT_ALG(a, n)                                                 \
                do {                                                    \
@@ -2562,7 +3027,7 @@ static int calculate_device_limits(struct dm_integrity_c *ic)
                if (last_sector < ic->start || last_sector >= ic->meta_device_sectors)
                        return -EINVAL;
        } else {
-               __u64 meta_size = ic->provided_data_sectors * ic->tag_size;
+               __u64 meta_size = (ic->provided_data_sectors >> ic->sb->log2_sectors_per_block) * ic->tag_size;
                meta_size = (meta_size + ((1U << (ic->log2_buffer_sectors + SECTOR_SHIFT)) - 1))
                                >> (ic->log2_buffer_sectors + SECTOR_SHIFT);
                meta_size <<= ic->log2_buffer_sectors;
@@ -2659,37 +3124,37 @@ static void dm_integrity_set(struct dm_target *ti, struct dm_integrity_c *ic)
        blk_queue_max_integrity_segments(disk->queue, UINT_MAX);
 }
 
-static void dm_integrity_free_page_list(struct dm_integrity_c *ic, struct page_list *pl)
+static void dm_integrity_free_page_list(struct page_list *pl)
 {
        unsigned i;
 
        if (!pl)
                return;
-       for (i = 0; i < ic->journal_pages; i++)
-               if (pl[i].page)
-                       __free_page(pl[i].page);
+       for (i = 0; pl[i].page; i++)
+               __free_page(pl[i].page);
        kvfree(pl);
 }
 
-static struct page_list *dm_integrity_alloc_page_list(struct dm_integrity_c *ic)
+static struct page_list *dm_integrity_alloc_page_list(unsigned n_pages)
 {
-       size_t page_list_desc_size = ic->journal_pages * sizeof(struct page_list);
        struct page_list *pl;
        unsigned i;
 
-       pl = kvmalloc(page_list_desc_size, GFP_KERNEL | __GFP_ZERO);
+       pl = kvmalloc_array(n_pages + 1, sizeof(struct page_list), GFP_KERNEL | __GFP_ZERO);
        if (!pl)
                return NULL;
 
-       for (i = 0; i < ic->journal_pages; i++) {
+       for (i = 0; i < n_pages; i++) {
                pl[i].page = alloc_page(GFP_KERNEL);
                if (!pl[i].page) {
-                       dm_integrity_free_page_list(ic, pl);
+                       dm_integrity_free_page_list(pl);
                        return NULL;
                }
                if (i)
                        pl[i - 1].next = &pl[i];
        }
+       pl[i].page = NULL;
+       pl[i].next = NULL;
 
        return pl;
 }
@@ -2702,7 +3167,8 @@ static void dm_integrity_free_journal_scatterlist(struct dm_integrity_c *ic, str
        kvfree(sl);
 }
 
-static struct scatterlist **dm_integrity_alloc_journal_scatterlist(struct dm_integrity_c *ic, struct page_list *pl)
+static struct scatterlist **dm_integrity_alloc_journal_scatterlist(struct dm_integrity_c *ic,
+                                                                  struct page_list *pl)
 {
        struct scatterlist **sl;
        unsigned i;
@@ -2721,7 +3187,8 @@ static struct scatterlist **dm_integrity_alloc_journal_scatterlist(struct dm_int
                unsigned idx;
 
                page_list_location(ic, i, 0, &start_index, &start_offset);
-               page_list_location(ic, i, ic->journal_section_sectors - 1, &end_index, &end_offset);
+               page_list_location(ic, i, ic->journal_section_sectors - 1,
+                                  &end_index, &end_offset);
 
                n_pages = (end_index - start_index + 1);
 
@@ -2842,7 +3309,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
        }
        ic->journal_pages = journal_pages;
 
-       ic->journal = dm_integrity_alloc_page_list(ic);
+       ic->journal = dm_integrity_alloc_page_list(ic->journal_pages);
        if (!ic->journal) {
                *error = "Could not allocate memory for journal";
                r = -ENOMEM;
@@ -2874,7 +3341,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
                DEBUG_print("cipher %s, block size %u iv size %u\n",
                            ic->journal_crypt_alg.alg_string, blocksize, ivsize);
 
-               ic->journal_io = dm_integrity_alloc_page_list(ic);
+               ic->journal_io = dm_integrity_alloc_page_list(ic->journal_pages);
                if (!ic->journal_io) {
                        *error = "Could not allocate memory for journal io";
                        r = -ENOMEM;
@@ -2898,7 +3365,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
                                goto bad;
                        }
 
-                       ic->journal_xor = dm_integrity_alloc_page_list(ic);
+                       ic->journal_xor = dm_integrity_alloc_page_list(ic->journal_pages);
                        if (!ic->journal_xor) {
                                *error = "Could not allocate memory for journal xor";
                                r = -ENOMEM;
@@ -2922,7 +3389,8 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
                        sg_set_buf(&sg[i], &ic->commit_ids, sizeof ic->commit_ids);
                        memset(crypt_iv, 0x00, ivsize);
 
-                       skcipher_request_set_crypt(req, sg, sg, PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv);
+                       skcipher_request_set_crypt(req, sg, sg,
+                                                  PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv);
                        init_completion(&comp.comp);
                        comp.in_flight = (atomic_t)ATOMIC_INIT(1);
                        if (do_crypt(true, req, &comp))
@@ -3063,7 +3531,7 @@ bad:
  *     device
  *     offset from the start of the device
  *     tag size
- *     D - direct writes, J - journal writes, R - recovery mode
+ *     D - direct writes, J - journal writes, B - bitmap mode, R - recovery mode
  *     number of optional arguments
  *     optional arguments:
  *             journal_sectors
@@ -3071,10 +3539,14 @@ bad:
  *             buffer_sectors
  *             journal_watermark
  *             commit_time
+ *             meta_device
+ *             block_size
+ *             sectors_per_bit
+ *             bitmap_flush_interval
  *             internal_hash
  *             journal_crypt
  *             journal_mac
- *             block_size
+ *             recalculate
  */
 static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 {
@@ -3087,10 +3559,13 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                {0, 9, "Invalid number of feature args"},
        };
        unsigned journal_sectors, interleave_sectors, buffer_sectors, journal_watermark, sync_msec;
-       bool recalculate;
        bool should_write_sb;
        __u64 threshold;
        unsigned long long start;
+       __s8 log2_sectors_per_bitmap_bit = -1;
+       __s8 log2_blocks_per_bitmap_bit;
+       __u64 bits_in_journal;
+       __u64 n_bitmap_bits;
 
 #define DIRECT_ARGUMENTS       4
 
@@ -3114,6 +3589,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        init_waitqueue_head(&ic->copy_to_journal_wait);
        init_completion(&ic->crypto_backoff);
        atomic64_set(&ic->number_of_mismatches, 0);
+       ic->bitmap_flush_interval = BITMAP_FLUSH_INTERVAL;
 
        r = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &ic->dev);
        if (r) {
@@ -3136,10 +3612,11 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                }
        }
 
-       if (!strcmp(argv[3], "J") || !strcmp(argv[3], "D") || !strcmp(argv[3], "R"))
+       if (!strcmp(argv[3], "J") || !strcmp(argv[3], "B") ||
+           !strcmp(argv[3], "D") || !strcmp(argv[3], "R")) {
                ic->mode = argv[3][0];
-       else {
-               ti->error = "Invalid mode (expecting J, D, R)";
+       else {
+               ti->error = "Invalid mode (expecting J, B, D, R)";
                r = -EINVAL;
                goto bad;
        }
@@ -3149,7 +3626,6 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        buffer_sectors = DEFAULT_BUFFER_SECTORS;
        journal_watermark = DEFAULT_JOURNAL_WATERMARK;
        sync_msec = DEFAULT_SYNC_MSEC;
-       recalculate = false;
        ic->sectors_per_block = 1;
 
        as.argc = argc - DIRECT_ARGUMENTS;
@@ -3161,6 +3637,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        while (extra_args--) {
                const char *opt_string;
                unsigned val;
+               unsigned long long llval;
                opt_string = dm_shift_arg(&as);
                if (!opt_string) {
                        r = -EINVAL;
@@ -3182,7 +3659,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                                dm_put_device(ti, ic->meta_dev);
                                ic->meta_dev = NULL;
                        }
-                       r = dm_get_device(ti, strchr(opt_string, ':') + 1, dm_table_get_mode(ti->table), &ic->meta_dev);
+                       r = dm_get_device(ti, strchr(opt_string, ':') + 1,
+                                         dm_table_get_mode(ti->table), &ic->meta_dev);
                        if (r) {
                                ti->error = "Device lookup failed";
                                goto bad;
@@ -3196,6 +3674,14 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                                goto bad;
                        }
                        ic->sectors_per_block = val >> SECTOR_SHIFT;
+               } else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) == 1) {
+                       log2_sectors_per_bitmap_bit = !llval ? 0 : __ilog2_u64(llval);
+               } else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy) == 1) {
+                       if (val >= (uint64_t)UINT_MAX * 1000 / HZ) {
+                               r = -EINVAL;
+                               ti->error = "Invalid bitmap_flush_interval argument";
+                       }
+                       ic->bitmap_flush_interval = msecs_to_jiffies(val);
                } else if (!strncmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {
                        r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error,
                                            "Invalid internal_hash argument");
@@ -3212,7 +3698,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                        if (r)
                                goto bad;
                } else if (!strcmp(opt_string, "recalculate")) {
-                       recalculate = true;
+                       ic->recalculate_flag = true;
                } else {
                        r = -EINVAL;
                        ti->error = "Invalid argument";
@@ -3228,7 +3714,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 
        if (!journal_sectors) {
                journal_sectors = min((sector_t)DEFAULT_MAX_JOURNAL_SECTORS,
-                       ic->data_device_sectors >> DEFAULT_JOURNAL_SIZE_FACTOR);
+                                     ic->data_device_sectors >> DEFAULT_JOURNAL_SIZE_FACTOR);
        }
 
        if (!buffer_sectors)
@@ -3263,6 +3749,12 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        else
                ic->log2_tag_size = -1;
 
+       if (ic->mode == 'B' && !ic->internal_hash) {
+               r = -EINVAL;
+               ti->error = "Bitmap mode can be only used with internal hash";
+               goto bad;
+       }
+
        ic->autocommit_jiffies = msecs_to_jiffies(sync_msec);
        ic->autocommit_msec = sync_msec;
        timer_setup(&ic->autocommit_timer, autocommit_fn, 0);
@@ -3308,7 +3800,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        }
        INIT_WORK(&ic->commit_work, integrity_commit);
 
-       if (ic->mode == 'J') {
+       if (ic->mode == 'J' || ic->mode == 'B') {
                ic->writer_wq = alloc_workqueue("dm-integrity-writer", WQ_MEM_RECLAIM, 1);
                if (!ic->writer_wq) {
                        ti->error = "Cannot allocate workqueue";
@@ -3349,7 +3841,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                        should_write_sb = true;
        }
 
-       if (!ic->sb->version || ic->sb->version > SB_VERSION_2) {
+       if (!ic->sb->version || ic->sb->version > SB_VERSION_3) {
                r = -EINVAL;
                ti->error = "Unknown version";
                goto bad;
@@ -3409,6 +3901,27 @@ try_smaller_buffer:
                ti->error = "The device is too small";
                goto bad;
        }
+
+       if (log2_sectors_per_bitmap_bit < 0)
+               log2_sectors_per_bitmap_bit = __fls(DEFAULT_SECTORS_PER_BITMAP_BIT);
+       if (log2_sectors_per_bitmap_bit < ic->sb->log2_sectors_per_block)
+               log2_sectors_per_bitmap_bit = ic->sb->log2_sectors_per_block;
+
+       bits_in_journal = ((__u64)ic->journal_section_sectors * ic->journal_sections) << (SECTOR_SHIFT + 3);
+       if (bits_in_journal > UINT_MAX)
+               bits_in_journal = UINT_MAX;
+       while (bits_in_journal < (ic->provided_data_sectors + ((sector_t)1 << log2_sectors_per_bitmap_bit) - 1) >> log2_sectors_per_bitmap_bit)
+               log2_sectors_per_bitmap_bit++;
+
+       log2_blocks_per_bitmap_bit = log2_sectors_per_bitmap_bit - ic->sb->log2_sectors_per_block;
+       ic->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
+       if (should_write_sb) {
+               ic->sb->log2_blocks_per_bitmap_bit = log2_blocks_per_bitmap_bit;
+       }
+       n_bitmap_bits = ((ic->provided_data_sectors >> ic->sb->log2_sectors_per_block)
+                               + (((sector_t)1 << log2_blocks_per_bitmap_bit) - 1)) >> log2_blocks_per_bitmap_bit;
+       ic->n_bitmap_blocks = DIV_ROUND_UP(n_bitmap_bits, BITMAP_BLOCK_SIZE * 8);
+
        if (!ic->meta_dev)
                ic->log2_buffer_sectors = min(ic->log2_buffer_sectors, (__u8)__ffs(ic->metadata_run));
 
@@ -3433,25 +3946,21 @@ try_smaller_buffer:
        DEBUG_print("   journal_sections %u\n", (unsigned)le32_to_cpu(ic->sb->journal_sections));
        DEBUG_print("   journal_entries %u\n", ic->journal_entries);
        DEBUG_print("   log2_interleave_sectors %d\n", ic->sb->log2_interleave_sectors);
-       DEBUG_print("   device_sectors 0x%llx\n", (unsigned long long)ic->device_sectors);
+       DEBUG_print("   data_device_sectors 0x%llx\n", i_size_read(ic->dev->bdev->bd_inode) >> SECTOR_SHIFT);
        DEBUG_print("   initial_sectors 0x%x\n", ic->initial_sectors);
        DEBUG_print("   metadata_run 0x%x\n", ic->metadata_run);
        DEBUG_print("   log2_metadata_run %d\n", ic->log2_metadata_run);
        DEBUG_print("   provided_data_sectors 0x%llx (%llu)\n", (unsigned long long)ic->provided_data_sectors,
                    (unsigned long long)ic->provided_data_sectors);
        DEBUG_print("   log2_buffer_sectors %u\n", ic->log2_buffer_sectors);
+       DEBUG_print("   bits_in_journal %llu\n", (unsigned long long)bits_in_journal);
 
-       if (recalculate && !(ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))) {
+       if (ic->recalculate_flag && !(ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))) {
                ic->sb->flags |= cpu_to_le32(SB_FLAG_RECALCULATING);
                ic->sb->recalc_sector = cpu_to_le64(0);
        }
 
-       if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) {
-               if (!ic->internal_hash) {
-                       r = -EINVAL;
-                       ti->error = "Recalculate is only valid with internal hash";
-                       goto bad;
-               }
+       if (ic->internal_hash) {
                ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", WQ_MEM_RECLAIM, 1);
                if (!ic->recalc_wq ) {
                        ti->error = "Cannot allocate workqueue";
@@ -3488,6 +3997,45 @@ try_smaller_buffer:
                r = create_journal(ic, &ti->error);
                if (r)
                        goto bad;
+
+       }
+
+       if (ic->mode == 'B') {
+               unsigned i;
+               unsigned n_bitmap_pages = DIV_ROUND_UP(ic->n_bitmap_blocks, PAGE_SIZE / BITMAP_BLOCK_SIZE);
+
+               ic->recalc_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages);
+               if (!ic->recalc_bitmap) {
+                       r = -ENOMEM;
+                       goto bad;
+               }
+               ic->may_write_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages);
+               if (!ic->may_write_bitmap) {
+                       r = -ENOMEM;
+                       goto bad;
+               }
+               ic->bbs = kvmalloc_array(ic->n_bitmap_blocks, sizeof(struct bitmap_block_status), GFP_KERNEL);
+               if (!ic->bbs) {
+                       r = -ENOMEM;
+                       goto bad;
+               }
+               INIT_DELAYED_WORK(&ic->bitmap_flush_work, bitmap_flush_work);
+               for (i = 0; i < ic->n_bitmap_blocks; i++) {
+                       struct bitmap_block_status *bbs = &ic->bbs[i];
+                       unsigned sector, pl_index, pl_offset;
+
+                       INIT_WORK(&bbs->work, bitmap_block_work);
+                       bbs->ic = ic;
+                       bbs->idx = i;
+                       bio_list_init(&bbs->bio_queue);
+                       spin_lock_init(&bbs->bio_queue_lock);
+
+                       sector = i * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT);
+                       pl_index = sector >> (PAGE_SHIFT - SECTOR_SHIFT);
+                       pl_offset = (sector << SECTOR_SHIFT) & (PAGE_SIZE - 1);
+
+                       bbs->bitmap = lowmem_page_address(ic->journal[pl_index].page) + pl_offset;
+               }
        }
 
        if (should_write_sb) {
@@ -3512,6 +4060,17 @@ try_smaller_buffer:
                if (r)
                        goto bad;
        }
+       if (ic->mode == 'B') {
+               unsigned max_io_len = ((sector_t)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit) * (BITMAP_BLOCK_SIZE * 8);
+               if (!max_io_len)
+                       max_io_len = 1U << 31;
+               DEBUG_print("max_io_len: old %u, new %u\n", ti->max_io_len, max_io_len);
+               if (!ti->max_io_len || ti->max_io_len > max_io_len) {
+                       r = dm_set_target_max_io_len(ti, max_io_len);
+                       if (r)
+                               goto bad;
+               }
+       }
 
        if (!ic->internal_hash)
                dm_integrity_set(ti, ic);
@@ -3520,6 +4079,7 @@ try_smaller_buffer:
        ti->flush_supported = true;
 
        return 0;
+
 bad:
        dm_integrity_dtr(ti);
        return r;
@@ -3542,10 +4102,9 @@ static void dm_integrity_dtr(struct dm_target *ti)
                destroy_workqueue(ic->writer_wq);
        if (ic->recalc_wq)
                destroy_workqueue(ic->recalc_wq);
-       if (ic->recalc_buffer)
-               vfree(ic->recalc_buffer);
-       if (ic->recalc_tags)
-               kvfree(ic->recalc_tags);
+       vfree(ic->recalc_buffer);
+       kvfree(ic->recalc_tags);
+       kvfree(ic->bbs);
        if (ic->bufio)
                dm_bufio_client_destroy(ic->bufio);
        mempool_exit(&ic->journal_io_mempool);
@@ -3555,9 +4114,11 @@ static void dm_integrity_dtr(struct dm_target *ti)
                dm_put_device(ti, ic->dev);
        if (ic->meta_dev)
                dm_put_device(ti, ic->meta_dev);
-       dm_integrity_free_page_list(ic, ic->journal);
-       dm_integrity_free_page_list(ic, ic->journal_io);
-       dm_integrity_free_page_list(ic, ic->journal_xor);
+       dm_integrity_free_page_list(ic->journal);
+       dm_integrity_free_page_list(ic->journal_io);
+       dm_integrity_free_page_list(ic->journal_xor);
+       dm_integrity_free_page_list(ic->recalc_bitmap);
+       dm_integrity_free_page_list(ic->may_write_bitmap);
        if (ic->journal_scatterlist)
                dm_integrity_free_journal_scatterlist(ic, ic->journal_scatterlist);
        if (ic->journal_io_scatterlist)
@@ -3595,7 +4156,7 @@ static void dm_integrity_dtr(struct dm_target *ti)
 
 static struct target_type integrity_target = {
        .name                   = "integrity",
-       .version                = {1, 2, 0},
+       .version                = {1, 3, 0},
        .module                 = THIS_MODULE,
        .features               = DM_TARGET_SINGLETON | DM_TARGET_INTEGRITY,
        .ctr                    = dm_integrity_ctr,
index c740153..1e03bc8 100644 (file)
@@ -2069,7 +2069,7 @@ int __init dm_early_create(struct dm_ioctl *dmi,
        /* alloc table */
        r = dm_table_create(&t, get_mode(dmi), dmi->target_count, md);
        if (r)
-               goto err_destroy_dm;
+               goto err_hash_remove;
 
        /* add targets */
        for (i = 0; i < dmi->target_count; i++) {
@@ -2116,6 +2116,10 @@ int __init dm_early_create(struct dm_ioctl *dmi,
 
 err_destroy_table:
        dm_table_destroy(t);
+err_hash_remove:
+       (void) __hash_remove(__get_name_cell(dmi->name));
+       /* release reference from __get_name_cell */
+       dm_put(md);
 err_destroy_dm:
        dm_put(md);
        dm_destroy(md);
index 2ee5e35..dbcc1e4 100644 (file)
@@ -544,8 +544,23 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
        return DM_MAPIO_REMAPPED;
 }
 
-static void multipath_release_clone(struct request *clone)
+static void multipath_release_clone(struct request *clone,
+                                   union map_info *map_context)
 {
+       if (unlikely(map_context)) {
+               /*
+                * non-NULL map_context means caller is still map
+                * method; must undo multipath_clone_and_map()
+                */
+               struct dm_mpath_io *mpio = get_mpio(map_context);
+               struct pgpath *pgpath = mpio->pgpath;
+
+               if (pgpath && pgpath->pg->ps.type->end_io)
+                       pgpath->pg->ps.type->end_io(&pgpath->pg->ps,
+                                                   &pgpath->path,
+                                                   mpio->nr_bytes);
+       }
+
        blk_put_request(clone);
 }
 
@@ -882,6 +897,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
        if (attached_handler_name || m->hw_handler_name) {
                INIT_DELAYED_WORK(&p->activate_path, activate_path_work);
                r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error);
+               kfree(attached_handler_name);
                if (r) {
                        dm_put_device(ti, p->path.dev);
                        goto bad;
@@ -896,7 +912,6 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
 
        return p;
  bad:
-       kfree(attached_handler_name);
        free_pgpath(p);
        return ERR_PTR(r);
 }
index b66745b..5f7063f 100644 (file)
@@ -168,7 +168,7 @@ static void dm_end_request(struct request *clone, blk_status_t error)
        struct request *rq = tio->orig;
 
        blk_rq_unprep_clone(clone);
-       tio->ti->type->release_clone_rq(clone);
+       tio->ti->type->release_clone_rq(clone, NULL);
 
        rq_end_stats(md, rq);
        blk_mq_end_request(rq, error);
@@ -201,7 +201,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_
        rq_end_stats(md, rq);
        if (tio->clone) {
                blk_rq_unprep_clone(tio->clone);
-               tio->ti->type->release_clone_rq(tio->clone);
+               tio->ti->type->release_clone_rq(tio->clone, NULL);
        }
 
        dm_mq_delay_requeue_request(rq, delay_ms);
@@ -398,7 +398,7 @@ static int map_request(struct dm_rq_target_io *tio)
        case DM_MAPIO_REMAPPED:
                if (setup_clone(clone, rq, tio, GFP_ATOMIC)) {
                        /* -ENOMEM */
-                       ti->type->release_clone_rq(clone);
+                       ti->type->release_clone_rq(clone, &tio->info);
                        return DM_MAPIO_REQUEUE;
                }
 
@@ -408,7 +408,7 @@ static int map_request(struct dm_rq_target_io *tio)
                ret = dm_dispatch_clone_request(clone, rq);
                if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) {
                        blk_rq_unprep_clone(clone);
-                       tio->ti->type->release_clone_rq(clone);
+                       tio->ti->type->release_clone_rq(clone, &tio->info);
                        tio->clone = NULL;
                        return DM_MAPIO_REQUEUE;
                }
index a168963..3107f2b 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/kdev_t.h>
 #include <linux/list.h>
+#include <linux/list_bl.h>
 #include <linux/mempool.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -44,11 +45,11 @@ static const char dm_snapshot_merge_target_name[] = "snapshot-merge";
 struct dm_exception_table {
        uint32_t hash_mask;
        unsigned hash_shift;
-       struct list_head *table;
+       struct hlist_bl_head *table;
 };
 
 struct dm_snapshot {
-       struct mutex lock;
+       struct rw_semaphore lock;
 
        struct dm_dev *origin;
        struct dm_dev *cow;
@@ -76,7 +77,9 @@ struct dm_snapshot {
 
        atomic_t pending_exceptions_count;
 
-       /* Protected by "lock" */
+       spinlock_t pe_allocation_lock;
+
+       /* Protected by "pe_allocation_lock" */
        sector_t exception_start_sequence;
 
        /* Protected by kcopyd single-threaded callback */
@@ -457,9 +460,9 @@ static int __find_snapshots_sharing_cow(struct dm_snapshot *snap,
                if (!bdev_equal(s->cow->bdev, snap->cow->bdev))
                        continue;
 
-               mutex_lock(&s->lock);
+               down_read(&s->lock);
                active = s->active;
-               mutex_unlock(&s->lock);
+               up_read(&s->lock);
 
                if (active) {
                        if (snap_src)
@@ -618,6 +621,36 @@ static void unregister_snapshot(struct dm_snapshot *s)
  * The lowest hash_shift bits of the chunk number are ignored, allowing
  * some consecutive chunks to be grouped together.
  */
+static uint32_t exception_hash(struct dm_exception_table *et, chunk_t chunk);
+
+/* Lock to protect access to the completed and pending exception hash tables. */
+struct dm_exception_table_lock {
+       struct hlist_bl_head *complete_slot;
+       struct hlist_bl_head *pending_slot;
+};
+
+static void dm_exception_table_lock_init(struct dm_snapshot *s, chunk_t chunk,
+                                        struct dm_exception_table_lock *lock)
+{
+       struct dm_exception_table *complete = &s->complete;
+       struct dm_exception_table *pending = &s->pending;
+
+       lock->complete_slot = &complete->table[exception_hash(complete, chunk)];
+       lock->pending_slot = &pending->table[exception_hash(pending, chunk)];
+}
+
+static void dm_exception_table_lock(struct dm_exception_table_lock *lock)
+{
+       hlist_bl_lock(lock->complete_slot);
+       hlist_bl_lock(lock->pending_slot);
+}
+
+static void dm_exception_table_unlock(struct dm_exception_table_lock *lock)
+{
+       hlist_bl_unlock(lock->pending_slot);
+       hlist_bl_unlock(lock->complete_slot);
+}
+
 static int dm_exception_table_init(struct dm_exception_table *et,
                                   uint32_t size, unsigned hash_shift)
 {
@@ -625,12 +658,12 @@ static int dm_exception_table_init(struct dm_exception_table *et,
 
        et->hash_shift = hash_shift;
        et->hash_mask = size - 1;
-       et->table = dm_vcalloc(size, sizeof(struct list_head));
+       et->table = dm_vcalloc(size, sizeof(struct hlist_bl_head));
        if (!et->table)
                return -ENOMEM;
 
        for (i = 0; i < size; i++)
-               INIT_LIST_HEAD(et->table + i);
+               INIT_HLIST_BL_HEAD(et->table + i);
 
        return 0;
 }
@@ -638,15 +671,16 @@ static int dm_exception_table_init(struct dm_exception_table *et,
 static void dm_exception_table_exit(struct dm_exception_table *et,
                                    struct kmem_cache *mem)
 {
-       struct list_head *slot;
-       struct dm_exception *ex, *next;
+       struct hlist_bl_head *slot;
+       struct dm_exception *ex;
+       struct hlist_bl_node *pos, *n;
        int i, size;
 
        size = et->hash_mask + 1;
        for (i = 0; i < size; i++) {
                slot = et->table + i;
 
-               list_for_each_entry_safe (ex, next, slot, hash_list)
+               hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list)
                        kmem_cache_free(mem, ex);
        }
 
@@ -660,7 +694,7 @@ static uint32_t exception_hash(struct dm_exception_table *et, chunk_t chunk)
 
 static void dm_remove_exception(struct dm_exception *e)
 {
-       list_del(&e->hash_list);
+       hlist_bl_del(&e->hash_list);
 }
 
 /*
@@ -670,11 +704,12 @@ static void dm_remove_exception(struct dm_exception *e)
 static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et,
                                                chunk_t chunk)
 {
-       struct list_head *slot;
+       struct hlist_bl_head *slot;
+       struct hlist_bl_node *pos;
        struct dm_exception *e;
 
        slot = &et->table[exception_hash(et, chunk)];
-       list_for_each_entry (e, slot, hash_list)
+       hlist_bl_for_each_entry(e, pos, slot, hash_list)
                if (chunk >= e->old_chunk &&
                    chunk <= e->old_chunk + dm_consecutive_chunk_count(e))
                        return e;
@@ -721,7 +756,8 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
 static void dm_insert_exception(struct dm_exception_table *eh,
                                struct dm_exception *new_e)
 {
-       struct list_head *l;
+       struct hlist_bl_head *l;
+       struct hlist_bl_node *pos;
        struct dm_exception *e = NULL;
 
        l = &eh->table[exception_hash(eh, new_e->old_chunk)];
@@ -731,7 +767,7 @@ static void dm_insert_exception(struct dm_exception_table *eh,
                goto out;
 
        /* List is ordered by old_chunk */
-       list_for_each_entry_reverse(e, l, hash_list) {
+       hlist_bl_for_each_entry(e, pos, l, hash_list) {
                /* Insert after an existing chunk? */
                if (new_e->old_chunk == (e->old_chunk +
                                         dm_consecutive_chunk_count(e) + 1) &&
@@ -752,12 +788,24 @@ static void dm_insert_exception(struct dm_exception_table *eh,
                        return;
                }
 
-               if (new_e->old_chunk > e->old_chunk)
+               if (new_e->old_chunk < e->old_chunk)
                        break;
        }
 
 out:
-       list_add(&new_e->hash_list, e ? &e->hash_list : l);
+       if (!e) {
+               /*
+                * Either the table doesn't support consecutive chunks or slot
+                * l is empty.
+                */
+               hlist_bl_add_head(&new_e->hash_list, l);
+       } else if (new_e->old_chunk < e->old_chunk) {
+               /* Add before an existing exception */
+               hlist_bl_add_before(&new_e->hash_list, &e->hash_list);
+       } else {
+               /* Add to l's tail: e is the last exception in this slot */
+               hlist_bl_add_behind(&new_e->hash_list, &e->hash_list);
+       }
 }
 
 /*
@@ -766,6 +814,7 @@ out:
  */
 static int dm_add_exception(void *context, chunk_t old, chunk_t new)
 {
+       struct dm_exception_table_lock lock;
        struct dm_snapshot *s = context;
        struct dm_exception *e;
 
@@ -778,7 +827,17 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new)
        /* Consecutive_count is implicitly initialised to zero */
        e->new_chunk = new;
 
+       /*
+        * Although there is no need to lock access to the exception tables
+        * here, if we don't then hlist_bl_add_head(), called by
+        * dm_insert_exception(), will complain about accessing the
+        * corresponding list without locking it first.
+        */
+       dm_exception_table_lock_init(s, old, &lock);
+
+       dm_exception_table_lock(&lock);
        dm_insert_exception(&s->complete, e);
+       dm_exception_table_unlock(&lock);
 
        return 0;
 }
@@ -807,7 +866,7 @@ static int calc_max_buckets(void)
 {
        /* use a fixed size of 2MB */
        unsigned long mem = 2 * 1024 * 1024;
-       mem /= sizeof(struct list_head);
+       mem /= sizeof(struct hlist_bl_head);
 
        return mem;
 }
@@ -927,7 +986,7 @@ static int remove_single_exception_chunk(struct dm_snapshot *s)
        int r;
        chunk_t old_chunk = s->first_merging_chunk + s->num_merging_chunks - 1;
 
-       mutex_lock(&s->lock);
+       down_write(&s->lock);
 
        /*
         * Process chunks (and associated exceptions) in reverse order
@@ -942,7 +1001,7 @@ static int remove_single_exception_chunk(struct dm_snapshot *s)
        b = __release_queued_bios_after_merge(s);
 
 out:
-       mutex_unlock(&s->lock);
+       up_write(&s->lock);
        if (b)
                flush_bios(b);
 
@@ -1001,9 +1060,9 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s)
                if (linear_chunks < 0) {
                        DMERR("Read error in exception store: "
                              "shutting down merge");
-                       mutex_lock(&s->lock);
+                       down_write(&s->lock);
                        s->merge_failed = 1;
-                       mutex_unlock(&s->lock);
+                       up_write(&s->lock);
                }
                goto shut;
        }
@@ -1044,10 +1103,10 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s)
                previous_count = read_pending_exceptions_done_count();
        }
 
-       mutex_lock(&s->lock);
+       down_write(&s->lock);
        s->first_merging_chunk = old_chunk;
        s->num_merging_chunks = linear_chunks;
-       mutex_unlock(&s->lock);
+       up_write(&s->lock);
 
        /* Wait until writes to all 'linear_chunks' drain */
        for (i = 0; i < linear_chunks; i++)
@@ -1089,10 +1148,10 @@ static void merge_callback(int read_err, unsigned long write_err, void *context)
        return;
 
 shut:
-       mutex_lock(&s->lock);
+       down_write(&s->lock);
        s->merge_failed = 1;
        b = __release_queued_bios_after_merge(s);
-       mutex_unlock(&s->lock);
+       up_write(&s->lock);
        error_bios(b);
 
        merge_shutdown(s);
@@ -1188,10 +1247,11 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        s->snapshot_overflowed = 0;
        s->active = 0;
        atomic_set(&s->pending_exceptions_count, 0);
+       spin_lock_init(&s->pe_allocation_lock);
        s->exception_start_sequence = 0;
        s->exception_complete_sequence = 0;
        s->out_of_order_tree = RB_ROOT;
-       mutex_init(&s->lock);
+       init_rwsem(&s->lock);
        INIT_LIST_HEAD(&s->list);
        spin_lock_init(&s->pe_lock);
        s->state_bits = 0;
@@ -1357,9 +1417,9 @@ static void snapshot_dtr(struct dm_target *ti)
        /* Check whether exception handover must be cancelled */
        (void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL);
        if (snap_src && snap_dest && (s == snap_src)) {
-               mutex_lock(&snap_dest->lock);
+               down_write(&snap_dest->lock);
                snap_dest->valid = 0;
-               mutex_unlock(&snap_dest->lock);
+               up_write(&snap_dest->lock);
                DMERR("Cancelling snapshot handover.");
        }
        up_read(&_origins_lock);
@@ -1390,8 +1450,6 @@ static void snapshot_dtr(struct dm_target *ti)
 
        dm_exception_store_destroy(s->store);
 
-       mutex_destroy(&s->lock);
-
        dm_put_device(ti, s->cow);
 
        dm_put_device(ti, s->origin);
@@ -1467,6 +1525,13 @@ static void __invalidate_snapshot(struct dm_snapshot *s, int err)
        dm_table_event(s->ti->table);
 }
 
+static void invalidate_snapshot(struct dm_snapshot *s, int err)
+{
+       down_write(&s->lock);
+       __invalidate_snapshot(s, err);
+       up_write(&s->lock);
+}
+
 static void pending_complete(void *context, int success)
 {
        struct dm_snap_pending_exception *pe = context;
@@ -1475,43 +1540,63 @@ static void pending_complete(void *context, int success)
        struct bio *origin_bios = NULL;
        struct bio *snapshot_bios = NULL;
        struct bio *full_bio = NULL;
+       struct dm_exception_table_lock lock;
        int error = 0;
 
+       dm_exception_table_lock_init(s, pe->e.old_chunk, &lock);
+
        if (!success) {
                /* Read/write error - snapshot is unusable */
-               mutex_lock(&s->lock);
-               __invalidate_snapshot(s, -EIO);
+               invalidate_snapshot(s, -EIO);
                error = 1;
+
+               dm_exception_table_lock(&lock);
                goto out;
        }
 
        e = alloc_completed_exception(GFP_NOIO);
        if (!e) {
-               mutex_lock(&s->lock);
-               __invalidate_snapshot(s, -ENOMEM);
+               invalidate_snapshot(s, -ENOMEM);
                error = 1;
+
+               dm_exception_table_lock(&lock);
                goto out;
        }
        *e = pe->e;
 
-       mutex_lock(&s->lock);
+       down_read(&s->lock);
+       dm_exception_table_lock(&lock);
        if (!s->valid) {
+               up_read(&s->lock);
                free_completed_exception(e);
                error = 1;
+
                goto out;
        }
 
-       /* Check for conflicting reads */
-       __check_for_conflicting_io(s, pe->e.old_chunk);
-
        /*
-        * Add a proper exception, and remove the
-        * in-flight exception from the list.
+        * Add a proper exception. After inserting the completed exception all
+        * subsequent snapshot reads to this chunk will be redirected to the
+        * COW device.  This ensures that we do not starve. Moreover, as long
+        * as the pending exception exists, neither origin writes nor snapshot
+        * merging can overwrite the chunk in origin.
         */
        dm_insert_exception(&s->complete, e);
+       up_read(&s->lock);
+
+       /* Wait for conflicting reads to drain */
+       if (__chunk_is_tracked(s, pe->e.old_chunk)) {
+               dm_exception_table_unlock(&lock);
+               __check_for_conflicting_io(s, pe->e.old_chunk);
+               dm_exception_table_lock(&lock);
+       }
 
 out:
+       /* Remove the in-flight exception from the list */
        dm_remove_exception(&pe->e);
+
+       dm_exception_table_unlock(&lock);
+
        snapshot_bios = bio_list_get(&pe->snapshot_bios);
        origin_bios = bio_list_get(&pe->origin_bios);
        full_bio = pe->full_bio;
@@ -1519,8 +1604,6 @@ out:
                full_bio->bi_end_io = pe->full_bio_end_io;
        increment_pending_exceptions_done_count();
 
-       mutex_unlock(&s->lock);
-
        /* Submit any pending write bios */
        if (error) {
                if (full_bio)
@@ -1660,43 +1743,59 @@ __lookup_pending_exception(struct dm_snapshot *s, chunk_t chunk)
 }
 
 /*
- * Looks to see if this snapshot already has a pending exception
- * for this chunk, otherwise it allocates a new one and inserts
- * it into the pending table.
+ * Inserts a pending exception into the pending table.
  *
- * NOTE: a write lock must be held on snap->lock before calling
- * this.
+ * NOTE: a write lock must be held on the chunk's pending exception table slot
+ * before calling this.
  */
 static struct dm_snap_pending_exception *
-__find_pending_exception(struct dm_snapshot *s,
-                        struct dm_snap_pending_exception *pe, chunk_t chunk)
+__insert_pending_exception(struct dm_snapshot *s,
+                          struct dm_snap_pending_exception *pe, chunk_t chunk)
 {
-       struct dm_snap_pending_exception *pe2;
-
-       pe2 = __lookup_pending_exception(s, chunk);
-       if (pe2) {
-               free_pending_exception(pe);
-               return pe2;
-       }
-
        pe->e.old_chunk = chunk;
        bio_list_init(&pe->origin_bios);
        bio_list_init(&pe->snapshot_bios);
        pe->started = 0;
        pe->full_bio = NULL;
 
+       spin_lock(&s->pe_allocation_lock);
        if (s->store->type->prepare_exception(s->store, &pe->e)) {
+               spin_unlock(&s->pe_allocation_lock);
                free_pending_exception(pe);
                return NULL;
        }
 
        pe->exception_sequence = s->exception_start_sequence++;
+       spin_unlock(&s->pe_allocation_lock);
 
        dm_insert_exception(&s->pending, &pe->e);
 
        return pe;
 }
 
+/*
+ * Looks to see if this snapshot already has a pending exception
+ * for this chunk, otherwise it allocates a new one and inserts
+ * it into the pending table.
+ *
+ * NOTE: a write lock must be held on the chunk's pending exception table slot
+ * before calling this.
+ */
+static struct dm_snap_pending_exception *
+__find_pending_exception(struct dm_snapshot *s,
+                        struct dm_snap_pending_exception *pe, chunk_t chunk)
+{
+       struct dm_snap_pending_exception *pe2;
+
+       pe2 = __lookup_pending_exception(s, chunk);
+       if (pe2) {
+               free_pending_exception(pe);
+               return pe2;
+       }
+
+       return __insert_pending_exception(s, pe, chunk);
+}
+
 static void remap_exception(struct dm_snapshot *s, struct dm_exception *e,
                            struct bio *bio, chunk_t chunk)
 {
@@ -1714,6 +1813,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
        int r = DM_MAPIO_REMAPPED;
        chunk_t chunk;
        struct dm_snap_pending_exception *pe = NULL;
+       struct dm_exception_table_lock lock;
 
        init_tracked_chunk(bio);
 
@@ -1723,13 +1823,15 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
        }
 
        chunk = sector_to_chunk(s->store, bio->bi_iter.bi_sector);
+       dm_exception_table_lock_init(s, chunk, &lock);
 
        /* Full snapshots are not usable */
        /* To get here the table must be live so s->active is always set. */
        if (!s->valid)
                return DM_MAPIO_KILL;
 
-       mutex_lock(&s->lock);
+       down_read(&s->lock);
+       dm_exception_table_lock(&lock);
 
        if (!s->valid || (unlikely(s->snapshot_overflowed) &&
            bio_data_dir(bio) == WRITE)) {
@@ -1752,15 +1854,9 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
        if (bio_data_dir(bio) == WRITE) {
                pe = __lookup_pending_exception(s, chunk);
                if (!pe) {
-                       mutex_unlock(&s->lock);
+                       dm_exception_table_unlock(&lock);
                        pe = alloc_pending_exception(s);
-                       mutex_lock(&s->lock);
-
-                       if (!s->valid || s->snapshot_overflowed) {
-                               free_pending_exception(pe);
-                               r = DM_MAPIO_KILL;
-                               goto out_unlock;
-                       }
+                       dm_exception_table_lock(&lock);
 
                        e = dm_lookup_exception(&s->complete, chunk);
                        if (e) {
@@ -1771,13 +1867,22 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
 
                        pe = __find_pending_exception(s, pe, chunk);
                        if (!pe) {
+                               dm_exception_table_unlock(&lock);
+                               up_read(&s->lock);
+
+                               down_write(&s->lock);
+
                                if (s->store->userspace_supports_overflow) {
-                                       s->snapshot_overflowed = 1;
-                                       DMERR("Snapshot overflowed: Unable to allocate exception.");
+                                       if (s->valid && !s->snapshot_overflowed) {
+                                               s->snapshot_overflowed = 1;
+                                               DMERR("Snapshot overflowed: Unable to allocate exception.");
+                                       }
                                } else
                                        __invalidate_snapshot(s, -ENOMEM);
+                               up_write(&s->lock);
+
                                r = DM_MAPIO_KILL;
-                               goto out_unlock;
+                               goto out;
                        }
                }
 
@@ -1789,7 +1894,10 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
                    bio->bi_iter.bi_size ==
                    (s->store->chunk_size << SECTOR_SHIFT)) {
                        pe->started = 1;
-                       mutex_unlock(&s->lock);
+
+                       dm_exception_table_unlock(&lock);
+                       up_read(&s->lock);
+
                        start_full_bio(pe, bio);
                        goto out;
                }
@@ -1797,9 +1905,12 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
                bio_list_add(&pe->snapshot_bios, bio);
 
                if (!pe->started) {
-                       /* this is protected by snap->lock */
+                       /* this is protected by the exception table lock */
                        pe->started = 1;
-                       mutex_unlock(&s->lock);
+
+                       dm_exception_table_unlock(&lock);
+                       up_read(&s->lock);
+
                        start_copy(pe);
                        goto out;
                }
@@ -1809,7 +1920,8 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
        }
 
 out_unlock:
-       mutex_unlock(&s->lock);
+       dm_exception_table_unlock(&lock);
+       up_read(&s->lock);
 out:
        return r;
 }
@@ -1845,7 +1957,7 @@ static int snapshot_merge_map(struct dm_target *ti, struct bio *bio)
 
        chunk = sector_to_chunk(s->store, bio->bi_iter.bi_sector);
 
-       mutex_lock(&s->lock);
+       down_write(&s->lock);
 
        /* Full merging snapshots are redirected to the origin */
        if (!s->valid)
@@ -1876,12 +1988,12 @@ redirect_to_origin:
        bio_set_dev(bio, s->origin->bdev);
 
        if (bio_data_dir(bio) == WRITE) {
-               mutex_unlock(&s->lock);
+               up_write(&s->lock);
                return do_origin(s->origin, bio);
        }
 
 out_unlock:
-       mutex_unlock(&s->lock);
+       up_write(&s->lock);
 
        return r;
 }
@@ -1913,7 +2025,7 @@ static int snapshot_preresume(struct dm_target *ti)
        down_read(&_origins_lock);
        (void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL);
        if (snap_src && snap_dest) {
-               mutex_lock(&snap_src->lock);
+               down_read(&snap_src->lock);
                if (s == snap_src) {
                        DMERR("Unable to resume snapshot source until "
                              "handover completes.");
@@ -1923,7 +2035,7 @@ static int snapshot_preresume(struct dm_target *ti)
                              "source is suspended.");
                        r = -EINVAL;
                }
-               mutex_unlock(&snap_src->lock);
+               up_read(&snap_src->lock);
        }
        up_read(&_origins_lock);
 
@@ -1969,11 +2081,11 @@ static void snapshot_resume(struct dm_target *ti)
 
        (void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL);
        if (snap_src && snap_dest) {
-               mutex_lock(&snap_src->lock);
-               mutex_lock_nested(&snap_dest->lock, SINGLE_DEPTH_NESTING);
+               down_write(&snap_src->lock);
+               down_write_nested(&snap_dest->lock, SINGLE_DEPTH_NESTING);
                __handover_exceptions(snap_src, snap_dest);
-               mutex_unlock(&snap_dest->lock);
-               mutex_unlock(&snap_src->lock);
+               up_write(&snap_dest->lock);
+               up_write(&snap_src->lock);
        }
 
        up_read(&_origins_lock);
@@ -1988,9 +2100,9 @@ static void snapshot_resume(struct dm_target *ti)
        /* Now we have correct chunk size, reregister */
        reregister_snapshot(s);
 
-       mutex_lock(&s->lock);
+       down_write(&s->lock);
        s->active = 1;
-       mutex_unlock(&s->lock);
+       up_write(&s->lock);
 }
 
 static uint32_t get_origin_minimum_chunksize(struct block_device *bdev)
@@ -2030,7 +2142,7 @@ static void snapshot_status(struct dm_target *ti, status_type_t type,
        switch (type) {
        case STATUSTYPE_INFO:
 
-               mutex_lock(&snap->lock);
+               down_write(&snap->lock);
 
                if (!snap->valid)
                        DMEMIT("Invalid");
@@ -2055,7 +2167,7 @@ static void snapshot_status(struct dm_target *ti, status_type_t type,
                                DMEMIT("Unknown");
                }
 
-               mutex_unlock(&snap->lock);
+               up_write(&snap->lock);
 
                break;
 
@@ -2107,9 +2219,10 @@ static int __origin_write(struct list_head *snapshots, sector_t sector,
        int r = DM_MAPIO_REMAPPED;
        struct dm_snapshot *snap;
        struct dm_exception *e;
-       struct dm_snap_pending_exception *pe;
+       struct dm_snap_pending_exception *pe, *pe2;
        struct dm_snap_pending_exception *pe_to_start_now = NULL;
        struct dm_snap_pending_exception *pe_to_start_last = NULL;
+       struct dm_exception_table_lock lock;
        chunk_t chunk;
 
        /* Do all the snapshots on this origin */
@@ -2121,52 +2234,59 @@ static int __origin_write(struct list_head *snapshots, sector_t sector,
                if (dm_target_is_snapshot_merge(snap->ti))
                        continue;
 
-               mutex_lock(&snap->lock);
-
-               /* Only deal with valid and active snapshots */
-               if (!snap->valid || !snap->active)
-                       goto next_snapshot;
-
                /* Nothing to do if writing beyond end of snapshot */
                if (sector >= dm_table_get_size(snap->ti->table))
-                       goto next_snapshot;
+                       continue;
 
                /*
                 * Remember, different snapshots can have
                 * different chunk sizes.
                 */
                chunk = sector_to_chunk(snap->store, sector);
+               dm_exception_table_lock_init(snap, chunk, &lock);
 
-               /*
-                * Check exception table to see if block
-                * is already remapped in this snapshot
-                * and trigger an exception if not.
-                */
-               e = dm_lookup_exception(&snap->complete, chunk);
-               if (e)
+               down_read(&snap->lock);
+               dm_exception_table_lock(&lock);
+
+               /* Only deal with valid and active snapshots */
+               if (!snap->valid || !snap->active)
                        goto next_snapshot;
 
                pe = __lookup_pending_exception(snap, chunk);
                if (!pe) {
-                       mutex_unlock(&snap->lock);
-                       pe = alloc_pending_exception(snap);
-                       mutex_lock(&snap->lock);
-
-                       if (!snap->valid) {
-                               free_pending_exception(pe);
-                               goto next_snapshot;
-                       }
-
+                       /*
+                        * Check exception table to see if block is already
+                        * remapped in this snapshot and trigger an exception
+                        * if not.
+                        */
                        e = dm_lookup_exception(&snap->complete, chunk);
-                       if (e) {
-                               free_pending_exception(pe);
+                       if (e)
                                goto next_snapshot;
-                       }
 
-                       pe = __find_pending_exception(snap, pe, chunk);
-                       if (!pe) {
-                               __invalidate_snapshot(snap, -ENOMEM);
-                               goto next_snapshot;
+                       dm_exception_table_unlock(&lock);
+                       pe = alloc_pending_exception(snap);
+                       dm_exception_table_lock(&lock);
+
+                       pe2 = __lookup_pending_exception(snap, chunk);
+
+                       if (!pe2) {
+                               e = dm_lookup_exception(&snap->complete, chunk);
+                               if (e) {
+                                       free_pending_exception(pe);
+                                       goto next_snapshot;
+                               }
+
+                               pe = __insert_pending_exception(snap, pe, chunk);
+                               if (!pe) {
+                                       dm_exception_table_unlock(&lock);
+                                       up_read(&snap->lock);
+
+                                       invalidate_snapshot(snap, -ENOMEM);
+                                       continue;
+                               }
+                       } else {
+                               free_pending_exception(pe);
+                               pe = pe2;
                        }
                }
 
@@ -2193,7 +2313,8 @@ static int __origin_write(struct list_head *snapshots, sector_t sector,
                }
 
 next_snapshot:
-               mutex_unlock(&snap->lock);
+               dm_exception_table_unlock(&lock);
+               up_read(&snap->lock);
 
                if (pe_to_start_now) {
                        start_copy(pe_to_start_now);
index 314d17c..64dd0b3 100644 (file)
@@ -136,7 +136,8 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq,
        return DM_MAPIO_KILL;
 }
 
-static void io_err_release_clone_rq(struct request *clone)
+static void io_err_release_clone_rq(struct request *clone,
+                                   union map_info *map_context)
 {
 }
 
index ed3cace..7f08406 100644 (file)
@@ -202,6 +202,13 @@ struct dm_pool_metadata {
        bool fail_io:1;
 
        /*
+        * Set once a thin-pool has been accessed through one of the interfaces
+        * that imply the pool is in-service (e.g. thin devices created/deleted,
+        * thin-pool message, metadata snapshots, etc).
+        */
+       bool in_service:1;
+
+       /*
         * Reading the space map roots can fail, so we read it into these
         * buffers before the superblock is locked and updated.
         */
@@ -367,6 +374,32 @@ static int subtree_equal(void *context, const void *value1_le, const void *value
 
 /*----------------------------------------------------------------*/
 
+/*
+ * Variant that is used for in-core only changes or code that
+ * shouldn't put the pool in service on its own (e.g. commit).
+ */
+static inline void __pmd_write_lock(struct dm_pool_metadata *pmd)
+       __acquires(pmd->root_lock)
+{
+       down_write(&pmd->root_lock);
+}
+#define pmd_write_lock_in_core(pmd) __pmd_write_lock((pmd))
+
+static inline void pmd_write_lock(struct dm_pool_metadata *pmd)
+{
+       __pmd_write_lock(pmd);
+       if (unlikely(!pmd->in_service))
+               pmd->in_service = true;
+}
+
+static inline void pmd_write_unlock(struct dm_pool_metadata *pmd)
+       __releases(pmd->root_lock)
+{
+       up_write(&pmd->root_lock);
+}
+
+/*----------------------------------------------------------------*/
+
 static int superblock_lock_zero(struct dm_pool_metadata *pmd,
                                struct dm_block **sblock)
 {
@@ -790,6 +823,9 @@ static int __commit_transaction(struct dm_pool_metadata *pmd)
         */
        BUILD_BUG_ON(sizeof(struct thin_disk_superblock) > 512);
 
+       if (unlikely(!pmd->in_service))
+               return 0;
+
        r = __write_changed_details(pmd);
        if (r < 0)
                return r;
@@ -853,6 +889,7 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
        pmd->time = 0;
        INIT_LIST_HEAD(&pmd->thin_devices);
        pmd->fail_io = false;
+       pmd->in_service = false;
        pmd->bdev = bdev;
        pmd->data_block_size = data_block_size;
 
@@ -903,7 +940,6 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd)
                        DMWARN("%s: __commit_transaction() failed, error = %d",
                               __func__, r);
        }
-
        if (!pmd->fail_io)
                __destroy_persistent_data_objects(pmd);
 
@@ -1032,10 +1068,10 @@ int dm_pool_create_thin(struct dm_pool_metadata *pmd, dm_thin_id dev)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __create_thin(pmd, dev);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1123,10 +1159,10 @@ int dm_pool_create_snap(struct dm_pool_metadata *pmd,
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __create_snap(pmd, dev, origin);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1166,10 +1202,10 @@ int dm_pool_delete_thin_device(struct dm_pool_metadata *pmd,
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __delete_device(pmd, dev);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1180,7 +1216,7 @@ int dm_pool_set_metadata_transaction_id(struct dm_pool_metadata *pmd,
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
 
        if (pmd->fail_io)
                goto out;
@@ -1194,7 +1230,7 @@ int dm_pool_set_metadata_transaction_id(struct dm_pool_metadata *pmd,
        r = 0;
 
 out:
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1225,7 +1261,12 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd)
         * We commit to ensure the btree roots which we increment in a
         * moment are up to date.
         */
-       __commit_transaction(pmd);
+       r = __commit_transaction(pmd);
+       if (r < 0) {
+               DMWARN("%s: __commit_transaction() failed, error = %d",
+                      __func__, r);
+               return r;
+       }
 
        /*
         * Copy the superblock.
@@ -1283,10 +1324,10 @@ int dm_pool_reserve_metadata_snap(struct dm_pool_metadata *pmd)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __reserve_metadata_snap(pmd);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1331,10 +1372,10 @@ int dm_pool_release_metadata_snap(struct dm_pool_metadata *pmd)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __release_metadata_snap(pmd);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1377,19 +1418,19 @@ int dm_pool_open_thin_device(struct dm_pool_metadata *pmd, dm_thin_id dev,
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock_in_core(pmd);
        if (!pmd->fail_io)
                r = __open_device(pmd, dev, 0, td);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
 
 int dm_pool_close_thin_device(struct dm_thin_device *td)
 {
-       down_write(&td->pmd->root_lock);
+       pmd_write_lock_in_core(td->pmd);
        __close_device(td);
-       up_write(&td->pmd->root_lock);
+       pmd_write_unlock(td->pmd);
 
        return 0;
 }
@@ -1570,10 +1611,10 @@ int dm_thin_insert_block(struct dm_thin_device *td, dm_block_t block,
 {
        int r = -EINVAL;
 
-       down_write(&td->pmd->root_lock);
+       pmd_write_lock(td->pmd);
        if (!td->pmd->fail_io)
                r = __insert(td, block, data_block);
-       up_write(&td->pmd->root_lock);
+       pmd_write_unlock(td->pmd);
 
        return r;
 }
@@ -1657,10 +1698,10 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block)
 {
        int r = -EINVAL;
 
-       down_write(&td->pmd->root_lock);
+       pmd_write_lock(td->pmd);
        if (!td->pmd->fail_io)
                r = __remove(td, block);
-       up_write(&td->pmd->root_lock);
+       pmd_write_unlock(td->pmd);
 
        return r;
 }
@@ -1670,10 +1711,10 @@ int dm_thin_remove_range(struct dm_thin_device *td,
 {
        int r = -EINVAL;
 
-       down_write(&td->pmd->root_lock);
+       pmd_write_lock(td->pmd);
        if (!td->pmd->fail_io)
                r = __remove_range(td, begin, end);
-       up_write(&td->pmd->root_lock);
+       pmd_write_unlock(td->pmd);
 
        return r;
 }
@@ -1696,13 +1737,13 @@ int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_
 {
        int r = 0;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        for (; b != e; b++) {
                r = dm_sm_inc_block(pmd->data_sm, b);
                if (r)
                        break;
        }
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1711,13 +1752,13 @@ int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_
 {
        int r = 0;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        for (; b != e; b++) {
                r = dm_sm_dec_block(pmd->data_sm, b);
                if (r)
                        break;
        }
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1765,10 +1806,10 @@ int dm_pool_alloc_data_block(struct dm_pool_metadata *pmd, dm_block_t *result)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = dm_sm_new_block(pmd->data_sm, result);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1777,12 +1818,16 @@ int dm_pool_commit_metadata(struct dm_pool_metadata *pmd)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       /*
+        * Care is taken to not have commit be what
+        * triggers putting the thin-pool in-service.
+        */
+       __pmd_write_lock(pmd);
        if (pmd->fail_io)
                goto out;
 
        r = __commit_transaction(pmd);
-       if (r <= 0)
+       if (r < 0)
                goto out;
 
        /*
@@ -1790,7 +1835,7 @@ int dm_pool_commit_metadata(struct dm_pool_metadata *pmd)
         */
        r = __begin_transaction(pmd);
 out:
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
        return r;
 }
 
@@ -1806,7 +1851,7 @@ int dm_pool_abort_metadata(struct dm_pool_metadata *pmd)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (pmd->fail_io)
                goto out;
 
@@ -1817,7 +1862,7 @@ int dm_pool_abort_metadata(struct dm_pool_metadata *pmd)
                pmd->fail_io = true;
 
 out:
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1948,10 +1993,10 @@ int dm_pool_resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io)
                r = __resize_space_map(pmd->data_sm, new_count);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -1960,29 +2005,29 @@ int dm_pool_resize_metadata_dev(struct dm_pool_metadata *pmd, dm_block_t new_cou
 {
        int r = -EINVAL;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        if (!pmd->fail_io) {
                r = __resize_space_map(pmd->metadata_sm, new_count);
                if (!r)
                        __set_metadata_reserve(pmd);
        }
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
 
 void dm_pool_metadata_read_only(struct dm_pool_metadata *pmd)
 {
-       down_write(&pmd->root_lock);
+       pmd_write_lock_in_core(pmd);
        dm_bm_set_read_only(pmd->bm);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 }
 
 void dm_pool_metadata_read_write(struct dm_pool_metadata *pmd)
 {
-       down_write(&pmd->root_lock);
+       pmd_write_lock_in_core(pmd);
        dm_bm_set_read_write(pmd->bm);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 }
 
 int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd,
@@ -1992,9 +2037,9 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd,
 {
        int r;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock_in_core(pmd);
        r = dm_sm_register_threshold_callback(pmd->metadata_sm, threshold, fn, context);
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
 
        return r;
 }
@@ -2005,7 +2050,7 @@ int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd)
        struct dm_block *sblock;
        struct thin_disk_superblock *disk_super;
 
-       down_write(&pmd->root_lock);
+       pmd_write_lock(pmd);
        pmd->flags |= THIN_METADATA_NEEDS_CHECK_FLAG;
 
        r = superblock_lock(pmd, &sblock);
@@ -2019,7 +2064,7 @@ int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd)
 
        dm_bm_unlock(sblock);
 out:
-       up_write(&pmd->root_lock);
+       pmd_write_unlock(pmd);
        return r;
 }
 
index f782287..1cb137f 100644 (file)
@@ -190,7 +190,6 @@ struct writeback_struct {
        struct dm_writecache *wc;
        struct wc_entry **wc_list;
        unsigned wc_list_n;
-       unsigned page_offset;
        struct page *page;
        struct wc_entry *wc_list_inline[WB_LIST_INLINE];
        struct bio bio;
@@ -546,21 +545,20 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
                e = container_of(node, struct wc_entry, rb_node);
                if (read_original_sector(wc, e) == block)
                        break;
+
                node = (read_original_sector(wc, e) >= block ?
                        e->rb_node.rb_left : e->rb_node.rb_right);
                if (unlikely(!node)) {
-                       if (!(flags & WFE_RETURN_FOLLOWING)) {
+                       if (!(flags & WFE_RETURN_FOLLOWING))
                                return NULL;
-                       }
                        if (read_original_sector(wc, e) >= block) {
-                               break;
+                               return e;
                        } else {
                                node = rb_next(&e->rb_node);
-                               if (unlikely(!node)) {
+                               if (unlikely(!node))
                                        return NULL;
-                               }
                                e = container_of(node, struct wc_entry, rb_node);
-                               break;
+                               return e;
                        }
                }
        }
@@ -571,7 +569,7 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
                        node = rb_prev(&e->rb_node);
                else
                        node = rb_next(&e->rb_node);
-               if (!node)
+               if (unlikely(!node))
                        return e;
                e2 = container_of(node, struct wc_entry, rb_node);
                if (read_original_sector(wc, e2) != block)
@@ -804,7 +802,7 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
                        writecache_free_entry(wc, e);
                }
 
-               if (!node)
+               if (unlikely(!node))
                        break;
 
                e = container_of(node, struct wc_entry, rb_node);
@@ -1478,10 +1476,9 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba
                bio = bio_alloc_bioset(GFP_NOIO, max_pages, &wc->bio_set);
                wb = container_of(bio, struct writeback_struct, bio);
                wb->wc = wc;
-               wb->bio.bi_end_io = writecache_writeback_endio;
-               bio_set_dev(&wb->bio, wc->dev->bdev);
-               wb->bio.bi_iter.bi_sector = read_original_sector(wc, e);
-               wb->page_offset = PAGE_SIZE;
+               bio->bi_end_io = writecache_writeback_endio;
+               bio_set_dev(bio, wc->dev->bdev);
+               bio->bi_iter.bi_sector = read_original_sector(wc, e);
                if (max_pages <= WB_LIST_INLINE ||
                    unlikely(!(wb->wc_list = kmalloc_array(max_pages, sizeof(struct wc_entry *),
                                                           GFP_NOIO | __GFP_NORETRY |
@@ -1507,12 +1504,12 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba
                        wb->wc_list[wb->wc_list_n++] = f;
                        e = f;
                }
-               bio_set_op_attrs(&wb->bio, REQ_OP_WRITE, WC_MODE_FUA(wc) * REQ_FUA);
+               bio_set_op_attrs(bio, REQ_OP_WRITE, WC_MODE_FUA(wc) * REQ_FUA);
                if (writecache_has_error(wc)) {
                        bio->bi_status = BLK_STS_IOERR;
-                       bio_endio(&wb->bio);
+                       bio_endio(bio);
                } else {
-                       submit_bio(&wb->bio);
+                       submit_bio(bio);
                }
 
                __writeback_throttle(wc, wbl);
index fa68336..d8334cd 100644 (file)
@@ -1169,6 +1169,9 @@ static int dmz_init_zones(struct dmz_metadata *zmd)
                        goto out;
                }
 
+               if (!nr_blkz)
+                       break;
+
                /* Process report */
                for (i = 0; i < nr_blkz; i++) {
                        ret = dmz_init_zone(zmd, zone, &blkz[i]);
@@ -1204,6 +1207,8 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
        /* Get zone information from disk */
        ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone),
                                  &blkz, &nr_blkz, GFP_NOIO);
+       if (!nr_blkz)
+               ret = -EIO;
        if (ret) {
                dmz_dev_err(zmd->dev, "Get zone %u report failed",
                            dmz_id(zmd, zone));
index 8865c17..51d029b 100644 (file)
@@ -643,7 +643,8 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path)
 
        q = bdev_get_queue(dev->bdev);
        dev->capacity = i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT;
-       aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
+       aligned_capacity = dev->capacity &
+                               ~((sector_t)blk_queue_zone_sectors(q) - 1);
        if (ti->begin ||
            ((ti->len != dev->capacity) && (ti->len != aligned_capacity))) {
                ti->error = "Partial mapping not supported";
index 043f076..997385c 100644 (file)
@@ -781,7 +781,8 @@ static void close_table_device(struct table_device *td, struct mapped_device *md
 }
 
 static struct table_device *find_table_device(struct list_head *l, dev_t dev,
-                                             fmode_t mode) {
+                                             fmode_t mode)
+{
        struct table_device *td;
 
        list_for_each_entry(td, l, list)
@@ -792,7 +793,8 @@ static struct table_device *find_table_device(struct list_head *l, dev_t dev,
 }
 
 int dm_get_table_device(struct mapped_device *md, dev_t dev, fmode_t mode,
-                       struct dm_dev **result) {
+                       struct dm_dev **result)
+{
        int r;
        struct table_device *td;
 
@@ -1467,7 +1469,7 @@ static unsigned get_num_write_zeroes_bios(struct dm_target *ti)
 static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti,
                                       unsigned num_bios)
 {
-       unsigned len = ci->sector_count;
+       unsigned len;
 
        /*
         * Even though the device advertised support for this type of
@@ -1478,6 +1480,8 @@ static int __send_changing_extent_only(struct clone_info *ci, struct dm_target *
        if (!num_bios)
                return -EOPNOTSUPP;
 
+       len = min((sector_t)ci->sector_count, max_io_len_target_boundary(ci->sector, ti));
+
        __send_duplicate_bios(ci, ti, num_bios, &len);
 
        ci->sector += len;
@@ -1906,7 +1910,6 @@ static void cleanup_mapped_device(struct mapped_device *md)
 static struct mapped_device *alloc_dev(int minor)
 {
        int r, numa_node_id = dm_get_numa_node();
-       struct dax_device *dax_dev = NULL;
        struct mapped_device *md;
        void *old_md;
 
@@ -1969,11 +1972,10 @@ static struct mapped_device *alloc_dev(int minor)
        sprintf(md->disk->disk_name, "dm-%d", minor);
 
        if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
-               dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
-               if (!dax_dev)
+               md->dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
+               if (!md->dax_dev)
                        goto bad;
        }
-       md->dax_dev = dax_dev;
 
        add_disk_no_queue_reg(md->disk);
        format_dev_t(md->name, MKDEV(_major, minor));
index 3a62a46..c01d411 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * bitmap.c two-level bitmap (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
  *
index a53cbc9..baaec1a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DM_PERSISTENT_DATA
        tristate
        depends on BLK_DEV_DM
index 0a3b8ae..b8a6218 100644 (file)
@@ -190,6 +190,8 @@ static int sm_find_free(void *addr, unsigned begin, unsigned end,
 
 static int sm_ll_init(struct ll_disk *ll, struct dm_transaction_manager *tm)
 {
+       memset(ll, 0, sizeof(struct ll_disk));
+
        ll->tm = tm;
 
        ll->bitmap_info.tm = tm;
index 8efaf99..092e750 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multimedia device configuration
 #
index b5aadac..c019197 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MEDIA_CEC_RC
        bool "HDMI CEC RC integration"
        depends on CEC_CORE && RC_CORE
index 0cb7d81..1990b7f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Used by common drivers, when they need to ask questions
 config MEDIA_COMMON_OPTIONS
        bool
index e7bc17a..b71e4b6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += b2c2/ saa7146/ siano/ v4l2-tpg/ videobuf2/
 obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
 obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
index e593638..2728479 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_B2C2_FLEXCOP
        tristate
        depends on DVB_CORE && I2C
index aa2dc24..0e32b77 100644 (file)
@@ -4,5 +4,5 @@ b2c2-flexcop-objs += flexcop-sram.o flexcop-eeprom.o flexcop-misc.o
 b2c2-flexcop-objs += flexcop-hw-filter.o
 obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
-ccflags-y += -Idrivers/media/tuners/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/tuners/
index 8895158..cdc7050 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*  cypress_firmware.c is part of the DVB USB library.
  *
  * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de)
index 769c6f8..3e85c0c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SAA7146
        tristate
        depends on I2C && PCI
index 3219b00..2a6337f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 saa7146-objs    := saa7146_i2c.o saa7146_core.o
 saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o
 
index be4355a..be4f80a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <media/drv-intf/saa7146_vv.h>
index 6ebcbc6..6c9946a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
index 577880b..37fa659 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Siano Mobile Silicon Digital TV device configuration
 #
index 476fa7a..a2f95f4 100644 (file)
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /****************************************************************
 
 Siano Mobile Silicon, Inc.
 MDTV receiver kernel modules.
 Copyright (C) 2006-2008, Uri Shkolnik, Anatoly Greenblat
 
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
- This 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.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 ****************************************************************/
 
index 43cfd1d..88f90df 100644 (file)
@@ -1,21 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /****************************************************************
 
 Siano Mobile Silicon, Inc.
 MDTV receiver kernel modules.
 Copyright (C) 2006-2008, Uri Shkolnik
 
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
- This 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.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 ****************************************************************/
 
index befeb98..b43cbb5 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /***********************************************************************
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
-
- *  This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  ***********************************************************************/
 
 struct smsdvb_debugfs;
index b95a631..8cb8853 100644 (file)
@@ -1,21 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /****************************************************************
 
  Siano Mobile Silicon, Inc.
  MDTV receiver kernel modules.
  Copyright (C) 2006-2009, Uri Shkolnik
 
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This 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.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
  ****************************************************************/
 
index 1624d6f..f64215c 100644 (file)
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /****************************************************************
 
 Siano Mobile Silicon, Inc.
 MDTV receiver kernel modules.
 Copyright (C) 2006-2009, Uri Shkolnik
 
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
- This 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.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 ****************************************************************/
 
index 7456fc1..7ec4efd 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_V4L2_TPG
        tristate
index f588df4..f6278ca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 v4l2-tpg-objs := v4l2-tpg-core.o v4l2-tpg-colors.o
 
 obj-$(CONFIG_VIDEO_V4L2_TPG) += v4l2-tpg.o
index 4ed11b4..edbc99e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Used by drivers that need Videobuf2 modules
 config VIDEOBUF2_CORE
        select DMA_SHARED_BUFFER
index f004aea..aac4beb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DVB device configuration
 #
index a49400c..a28b875 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index d75b077..6f7eedb 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index 0f0acf9..1f006f8 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index 61adde4..7baf016 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index eb1d747..d56c6f7 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index f330ec1..f924a80 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sony CXD2820R demodulator driver
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index c6baa4c..646598b 100644 (file)
@@ -14,5 +14,3 @@ cxd2880-objs := cxd2880_common.o \
                cxd2880_top.o
 
 obj-$(CONFIG_DVB_CXD2880) += cxd2880.o
-
-ccflags-y += -Idrivers/media/dvb-frontends
index dc80a84..63a4c6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/i2c.h>
index 6c2ccb6..e29c835 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_DRX39XYJ
        tristate "Micronas DRX-J demodulator"
        depends on DVB_CORE && I2C
index 87f6edd..e97ab61 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 drx39xyj-objs := drxj.o
 
 obj-$(CONFIG_DVB_DRX39XYJ) += drx39xyj.o
index 2f1f5cb..6ec2774 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Realtek RTL2832 DVB-T demodulator driver
  *
  * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com>
  * Copyright (C) 2012-2014 Antti Palosaari <crope@iki.fi>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License along
- *     with this program; if not, write to the Free Software Foundation, Inc.,
- *     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "rtl2832_priv.h"
index 6a124ff..85a8064 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Realtek RTL2832 DVB-T demodulator driver
  *
  * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com>
  * Copyright (C) 2012-2014 Antti Palosaari <crope@iki.fi>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License along
- *     with this program; if not, write to the Free Software Foundation, Inc.,
- *     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef RTL2832_H
index bd13d9a..5f79f95 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Realtek RTL2832 DVB-T demodulator driver
  *
  * Copyright (C) 2012 Thomas Mair <thomas.mair86@gmail.com>
  * Copyright (C) 2012-2014 Antti Palosaari <crope@iki.fi>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License along
- *     with this program; if not, write to the Free Software Foundation, Inc.,
- *     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef RTL2832_PRIV_H
index 57fb05b..cf1a8f7 100644 (file)
@@ -1,25 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Realtek RTL2832U SDR driver
  *
  * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
  *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  * GNU Radio plugin "gr-kernel" for device usage will be on:
  * http://git.linuxtv.org/anttip/gr-kernel.git
- *
  */
 
 #include "rtl2832_sdr.h"
index d28735c..26ad709 100644 (file)
@@ -1,25 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Realtek RTL2832U SDR driver
  *
  * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
  *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  * GNU Radio plugin "gr-kernel" for device usage will be on:
  * http://git.linuxtv.org/anttip/gr-kernel.git
- *
  */
 
 #ifndef RTL2832_SDR_H
index c02f509..c89a91a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
    Driver for the Spase sp887x demodulator
 */
index 097c42d..1953b00 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
  *
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "tda10071_priv.h"
index da1a87b..c282c83 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
  *
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef TDA10071_H
index 67c46e8..2d86508 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
  *
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef TDA10071_PRIV
index f3e9448..e7837da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_FIREDTV
        tristate "FireDTV and FloppyDTV"
        depends on DVB_CORE && FIREWIRE
index f96049f..3670c85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DVB_FIREDTV) += firedtv.o
 
 firedtv-y += firedtv-avc.o firedtv-ci.o firedtv-dvb.o firedtv-fe.o firedtv-fw.o
index 92f4112..9714473 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * FireDTV driver -- firewire I/O backend
  */
index 7793358..cb8db94 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multimedia Video device configuration
 #
index c0711e0..93844f1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 adv748x-objs   := \
                adv748x-afe.o \
                adv748x-core.o \
index f4b31d7..e392f8e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX25840
        tristate "Conexant CX2584x audio/video decoders"
        depends on VIDEO_V4L2 && I2C
index ac54581..3681df2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 cx25840-objs    := cx25840-core.o cx25840-audio.o cx25840-firmware.o \
                   cx25840-vbi.o cx25840-ir.o
 
index ab23b41..1c69098 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_ET8EK8
        tristate "ET8EK8 camera sensor support"
        depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
index 66d1b7d..5e06c30 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 et8ek8-objs                    += et8ek8_mode.o et8ek8_driver.o
 obj-$(CONFIG_VIDEO_ET8EK8)     += et8ek8.o
index be0bb3f..e573482 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_M5MOLS
        tristate "Fujitsu M-5MOLS 8MP sensor support"
        depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
index 0a44e02..13fa8ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 m5mols-objs    := m5mols_core.o m5mols_controls.o m5mols_capture.o
 
 obj-$(CONFIG_VIDEO_M5MOLS)             += m5mols.o
index fa4df34..ddb9dc6 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 s5c73m3-objs                   := s5c73m3-core.o s5c73m3-spi.o s5c73m3-ctrls.o
 obj-$(CONFIG_VIDEO_S5C73M3)    += s5c73m3.o
index 26b54f2..fcaa7f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SMIAPP
        tristate "SMIA++/SMIA sensor support"
        depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK
index f45a003..86f57a4 100644 (file)
@@ -1,5 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 smiapp-objs                    += smiapp-core.o smiapp-regs.o \
                                   smiapp-quirk.o smiapp-limits.o
 obj-$(CONFIG_VIDEO_SMIAPP)     += smiapp.o
 
-ccflags-y += -Idrivers/media/i2c
+ccflags-y += -I $(srctree)/drivers/media/i2c
index 8c30ada..de0528c 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 comment "Supported MMC/SDIO adapters"
 source "drivers/media/mmc/siano/Kconfig"
index 3941ee8..1919f6f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Siano Mobile Silicon Digital TV device configuration
 #
index 5fc3456..88cb8be 100644 (file)
@@ -1,4 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMS_SDIO_DRV) += smssdio.o
 
-ccflags-y += -Idrivers/media/common/siano
-
+ccflags-y += -I $(srctree)/drivers/media/common/siano
index 1f09123..dcb3719 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if PCI && MEDIA_SUPPORT
 
 menuconfig MEDIA_PCI_SUPPORT
index 7b818d4..0a7d1e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_B2C2_FLEXCOP_PCI
        tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI"
        depends on DVB_CORE && I2C
index b43b916..14ed6e4 100644 (file)
@@ -6,4 +6,4 @@ endif
 b2c2-flexcop-pci-objs += flexcop-pci.o
 obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o
 
-ccflags-y += -Idrivers/media/common/b2c2/
+ccflags-y += -I $(srctree)/drivers/media/common/b2c2/
index cc6527e..a9d9520 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
  * flexcop-pci.c - covers the PCI part including DMA transfers
index 0f46db7..75d172a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_BT848
        tristate "BT848 Video For Linux"
        depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2
index 7f1c3be..69bc0d9 100644 (file)
@@ -6,6 +6,5 @@ bttv-objs      :=      bttv-driver.o bttv-cards.o bttv-if.o \
 obj-$(CONFIG_VIDEO_BT848) += bttv.o
 obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/common
-ccflags-y += -Idrivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
index 9a544ba..6c6c60a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_COBALT
        tristate "Cisco Cobalt support"
        depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
index 96477bb..7074a10 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX18
        tristate "Conexant cx23418 MPEG encoder support"
        depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C
index 9c82c2d..df00ef8 100644 (file)
@@ -9,5 +9,5 @@ cx18-alsa-objs := cx18-alsa-main.o cx18-alsa-pcm.o
 obj-$(CONFIG_VIDEO_CX18) += cx18.o
 obj-$(CONFIG_VIDEO_CX18_ALSA) += cx18-alsa.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
index 1bba9e4..926da88 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX23885
        tristate "Conexant cx23885 (2388x successor) support"
        depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT && SND
index 130f0aa..a785169 100644 (file)
@@ -8,7 +8,7 @@ cx23885-objs    := cx23885-cards.o cx23885-video.o cx23885-vbi.o \
 obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
 obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
 
 ccflags-y += $(extra-cflags-y) $(extra-cflags-m)
index a64fa9a..b26615f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX25821
        tristate "Conexant cx25821 support"
        depends on VIDEO_DEV && PCI && I2C
index fbb17dd..24e1e7c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX88
        tristate "Conexant 2388x (bt878 successor) support"
        depends on VIDEO_DEV && PCI && I2C && RC_CORE
index d0f45d6..c2a0158 100644 (file)
@@ -10,5 +10,5 @@ obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
 obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o
 obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
 obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index fc98b6d..eaac91d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_DDBRIDGE
        tristate "Digital Devices bridge support"
        depends on DVB_CORE && PCI && I2C
index 5b6d5bb..2b77c8d 100644 (file)
@@ -9,5 +9,5 @@ ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-ci.o \
 
 obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
-ccflags-y += -Idrivers/media/tuners/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/tuners/
index 14fa7e4..e0e3af6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_DM1105
        tristate "SDMC DM1105 based PCI cards"
        depends on DVB_CORE && PCI && I2C && I2C_ALGOBIT
index d22c254..bf80409 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DVB_DM1105) += dm1105.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index d770eec..d678ced 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_DT3155
        tristate "DT3155 frame grabber"
        depends on PCI && VIDEO_DEV && VIDEO_V4L2
index 89fa637..6bdd071 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_DT3155)     += dt3155.o
index 745c8b2..0b4236c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the IPU3 cio2 and ImGU drivers
 #
index bd518bd..f35bba1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_IPU3_CIO2
        tristate "Intel ipu3-cio2 driver"
        depends on VIDEO_V4L2 && PCI
index 20186e3..98ddd5b 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_IPU3_CIO2) += ipu3-cio2.o
index e96b3c1..0795699 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_IVTV
        tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
        depends on VIDEO_V4L2 && PCI && I2C
index d3cc216..9dfaf2c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MANTIS_CORE
        tristate "Mantis/Hopper PCI bridge based devices"
        depends on PCI && I2C && INPUT && RC_CORE
index b5ef396..49e8224 100644 (file)
@@ -26,4 +26,4 @@ obj-$(CONFIG_MANTIS_CORE)     += mantis_core.o
 obj-$(CONFIG_DVB_MANTIS)       += mantis.o
 obj-$(CONFIG_DVB_HOPPER)       += hopper.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
index ce0463c..b0ba78a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_MEYE
        tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
        depends on PCI && VIDEO_V4L2
index 4938851..36f1f86 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_MEYE) += meye.o
index 6005758..a1a46bd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_NETUP_UNIDVB
        tristate "NetUP Universal DVB card support"
        depends on DVB_CORE && VIDEO_DEV && PCI && I2C && SPI_MASTER
index 944c3e1..215bdaf 100644 (file)
@@ -6,4 +6,4 @@ netup-unidvb-objs += netup_unidvb_spi.o
 
 obj-$(CONFIG_DVB_NETUP_UNIDVB) += netup-unidvb.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 8a80a5b..3964087 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_NGENE
        tristate "Micronas nGene support"
        depends on DVB_CORE && PCI && I2C
index ec450ad..5d16090 100644 (file)
@@ -7,5 +7,5 @@ ngene-objs := ngene-core.o ngene-i2c.o ngene-cards.o ngene-dvb.o
 
 obj-$(CONFIG_DVB_NGENE) += ngene.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
-ccflags-y += -Idrivers/media/tuners/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/tuners/
index 7d8e6e8..de83169 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_PLUTO2
        tristate "Pluto2 cards"
        depends on DVB_CORE && PCI && I2C
index 3c2aea1..0553479 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DVB_PLUTO2) += pluto2.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
index 2718b4c..5c52472 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_PT1
        tristate "PT1 cards"
        depends on DVB_CORE && PCI && I2C
index bc491e0..45b21a9 100644 (file)
@@ -1,6 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
 earth-pt1-objs := pt1.o
 
 obj-$(CONFIG_DVB_PT1) += earth-pt1.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
index 16c208a..af193d8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_PT3
        tristate "Earthsoft PT3 cards"
        depends on DVB_CORE && PCI && I2C
index 8698d5d..da6b265 100644 (file)
@@ -4,5 +4,5 @@ earth-pt3-objs += pt3.o pt3_i2c.o pt3_dma.o
 
 obj-$(CONFIG_DVB_PT3) += earth-pt3.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
index 8b28783..30c1759 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SAA7134
        tristate "Philips SAA7134 support"
        depends on VIDEO_DEV && PCI && I2C
index 60d9862..8e83cd0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_HEXIUM_GEMINI
        tristate "Hexium Gemini frame grabber"
        depends on PCI && VIDEO_V4L2 && I2C
index f3566a9..37c9336 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_MXB) += mxb.o
 obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o
 obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
index 265c5a4..6655c3e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SAA7164
        tristate "NXP SAA7164 support"
        depends on DVB_CORE && VIDEO_DEV && PCI && I2C
index c11c772..407711c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_SMIPCIE
        tristate "SMI PCIe DVBSky cards"
        depends on DVB_CORE && PCI && I2C
index 214ebfe..2426b75 100644 (file)
@@ -4,6 +4,5 @@ smipcie-objs    := smipcie-main.o smipcie-ir.o
 
 obj-$(CONFIG_DVB_SMIPCIE) += smipcie.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
-
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 2061d02..adb2478 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SOLO6X10
        tristate "Bluecherry / Softlogic 6x10 capture cards (MPEG-4/H.264)"
        depends on PCI && VIDEO_DEV && SND && I2C
index f474226..308387c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 solo6x10-y := solo6x10-core.o solo6x10-i2c.o solo6x10-p2m.o solo6x10-v4l2.o \
                solo6x10-tw28.o solo6x10-gpio.o solo6x10-disp.o solo6x10-enc.o \
                solo6x10-v4l2-enc.o solo6x10-g723.o solo6x10-eeprom.o
index 4407b9f..011b766 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config STA2X11_VIP
        tristate "STA2X11 VIP Video For Linux"
        depends on STA2X11 || COMPILE_TEST
index d6c471d..bb684a7 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_STA2X11_VIP) += sta2x11_vip.o
index dfba74d..d96d4fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_AV7110_IR
        bool
 
index 58ca127..9b44c47 100644 (file)
@@ -18,5 +18,5 @@ obj-$(CONFIG_DVB_BUDGET_CI) += budget-ci.o
 obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-patch.o
 obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o
 
-ccflags-y += -Idrivers/media/dvb-frontends/
-ccflags-y += -Idrivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/tuners
index e5d52f0..d376d4e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_TW5864
        tristate "Techwell TW5864 video/audio grabber and encoder"
        depends on VIDEO_DEV && PCI && VIDEO_V4L2
index 4fc8b3b..69dbcea 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tw5864-objs := tw5864-core.o tw5864-video.o tw5864-h264.o tw5864-util.o
 
 obj-$(CONFIG_VIDEO_TW5864) += tw5864.o
index 4bfc4fa..af0cb60 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_TW68
        tristate "Techwell tw68x Video For Linux"
        depends on VIDEO_DEV && PCI && VIDEO_V4L2
index 3d02f28..d1aec25 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tw68-objs := tw68-core.o tw68-video.o tw68-risc.o
 
 obj-$(CONFIG_VIDEO_TW68) += tw68.o
index da8bfee..631c908 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_TW686X
        tristate "Intersil/Techwell TW686x video capture cards"
        depends on PCI && VIDEO_DEV && VIDEO_V4L2 && SND
index 9981954..1795dff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tw686x-objs := tw686x-core.o tw686x-video.o tw686x-audio.o
 
 obj-$(CONFIG_VIDEO_TW686X) += tw686x.o
index 011c1c2..f2b5f27 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Platform drivers
 #      Most drivers here are currently for webcam support
index f4ce117..d6f2e3d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_AM437X_VPFE
        tristate "TI AM437x VPFE video capture driver"
        depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
index d11fff1..5410434 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for AM437x VPFE driver
 
 obj-$(CONFIG_VIDEO_AM437X_VPFE) += am437x-vpfe.o
index c3f6a47..5ae3f60 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_ATMEL_ISC
        tristate "ATMEL Image Sensor Controller (ISC) support"
        depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API
index 27000d0..4849366 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
 obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o
index d730693..8f7f8ef 100644 (file)
 #define ISC_PFG_CFG0_BPS_TWELVE (0x0 << 28)
 #define ISC_PFE_CFG0_BPS_MASK   GENMASK(30, 28)
 
+#define ISC_PFE_CFG0_COLEN     BIT(12)
+#define ISC_PFE_CFG0_ROWEN     BIT(13)
+
+/* ISC Parallel Front End Configuration 1 Register */
+#define ISC_PFE_CFG1    0x00000010
+
+#define ISC_PFE_CFG1_COLMIN(v)         ((v))
+#define ISC_PFE_CFG1_COLMIN_MASK       GENMASK(15, 0)
+#define ISC_PFE_CFG1_COLMAX(v)         ((v) << 16)
+#define ISC_PFE_CFG1_COLMAX_MASK       GENMASK(31, 16)
+
+/* ISC Parallel Front End Configuration 2 Register */
+#define ISC_PFE_CFG2    0x00000014
+
+#define ISC_PFE_CFG2_ROWMIN(v)         ((v))
+#define ISC_PFE_CFG2_ROWMIN_MASK       GENMASK(15, 0)
+#define ISC_PFE_CFG2_ROWMAX(v)         ((v) << 16)
+#define ISC_PFE_CFG2_ROWMAX_MASK       GENMASK(31, 16)
+
 /* ISC Clock Enable Register */
 #define ISC_CLKEN               0x00000018
 
index 4bba9da..94cb309 100644 (file)
@@ -721,6 +721,40 @@ static void isc_start_dma(struct isc_device *isc)
        u32 sizeimage = isc->fmt.fmt.pix.sizeimage;
        u32 dctrl_dview;
        dma_addr_t addr0;
+       u32 h, w;
+
+       h = isc->fmt.fmt.pix.height;
+       w = isc->fmt.fmt.pix.width;
+
+       /*
+        * In case the sensor is not RAW, it will output a pixel (12-16 bits)
+        * with two samples on the ISC Data bus (which is 8-12)
+        * ISC will count each sample, so, we need to multiply these values
+        * by two, to get the real number of samples for the required pixels.
+        */
+       if (!ISC_IS_FORMAT_RAW(isc->config.sd_format->mbus_code)) {
+               h <<= 1;
+               w <<= 1;
+       }
+
+       /*
+        * We limit the column/row count that the ISC will output according
+        * to the configured resolution that we want.
+        * This will avoid the situation where the sensor is misconfigured,
+        * sending more data, and the ISC will just take it and DMA to memory,
+        * causing corruption.
+        */
+       regmap_write(regmap, ISC_PFE_CFG1,
+                    (ISC_PFE_CFG1_COLMIN(0) & ISC_PFE_CFG1_COLMIN_MASK) |
+                    (ISC_PFE_CFG1_COLMAX(w - 1) & ISC_PFE_CFG1_COLMAX_MASK));
+
+       regmap_write(regmap, ISC_PFE_CFG2,
+                    (ISC_PFE_CFG2_ROWMIN(0) & ISC_PFE_CFG2_ROWMIN_MASK) |
+                    (ISC_PFE_CFG2_ROWMAX(h - 1) & ISC_PFE_CFG2_ROWMAX_MASK));
+
+       regmap_update_bits(regmap, ISC_PFE_CFG0,
+                          ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN,
+                          ISC_PFE_CFG0_COLEN | ISC_PFE_CFG0_ROWEN);
 
        addr0 = vb2_dma_contig_plane_dma_addr(&isc->cur_frm->vb.vb2_buf, 0);
        regmap_write(regmap, ISC_DAD0, addr0);
@@ -1965,6 +1999,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
        struct vb2_queue *q = &isc->vb2_vidq;
        int ret;
 
+       INIT_WORK(&isc->awb_work, isc_awb_work);
+
        ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
        if (ret < 0) {
                v4l2_err(&isc->v4l2_dev, "Failed to register subdev nodes\n");
@@ -2018,8 +2054,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
                return ret;
        }
 
-       INIT_WORK(&isc->awb_work, isc_awb_work);
-
        /* Register video device */
        strscpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name));
        vdev->release           = video_device_release_empty;
@@ -2135,8 +2169,11 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
                        break;
                }
 
-               subdev_entity->asd = devm_kzalloc(dev,
-                                    sizeof(*subdev_entity->asd), GFP_KERNEL);
+               /* asd will be freed by the subsystem once it's added to the
+                * notifier list
+                */
+               subdev_entity->asd = kzalloc(sizeof(*subdev_entity->asd),
+                                            GFP_KERNEL);
                if (!subdev_entity->asd) {
                        of_node_put(rem);
                        ret = -ENOMEM;
@@ -2284,6 +2321,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
                                                     subdev_entity->asd);
                if (ret) {
                        fwnode_handle_put(subdev_entity->asd->match.fwnode);
+                       kfree(subdev_entity->asd);
                        goto cleanup_subdev;
                }
 
index cf6124d..c154e36 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CADENCE
        bool "Cadence Video Devices"
        help
index e82b258..a40c621 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CEC_GPIO) += cec-gpio.o
index 8582843..f13adac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -I$(src)
 
 coda-objs := coda-common.o coda-bit.o coda-gdi.o coda-h264.o coda-jpeg.o
index 3ce58de..1d96cca 100644 (file)
@@ -1515,10 +1515,20 @@ static int coda_queue_setup(struct vb2_queue *vq,
 
 static int coda_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
        struct coda_q_data *q_data;
 
        q_data = get_q_data(ctx, vb->vb2_queue->type);
+       if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
+               if (vbuf->field == V4L2_FIELD_ANY)
+                       vbuf->field = V4L2_FIELD_NONE;
+               if (vbuf->field != V4L2_FIELD_NONE) {
+                       v4l2_warn(&ctx->dev->v4l2_dev,
+                                 "%s field isn't supported\n", __func__);
+                       return -EINVAL;
+               }
+       }
 
        if (vb2_plane_size(vb, 0) < q_data->sizeimage) {
                v4l2_warn(&ctx->dev->v4l2_dev,
index 9ce97f9..2615cdc 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_CROS_EC_CEC) += cros-ec-cec.o
index 06b5e58..9d2a9ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_DAVINCI_VPIF_DISPLAY
        tristate "TI DaVinci VPIF V4L2-Display driver"
        depends on VIDEO_V4L2
index 8339163..4e24f5d 100644 (file)
@@ -104,7 +104,7 @@ static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev,
                             struct v4l2_output *output)
 {
        struct vpbe_config *cfg = vpbe_dev->cfg;
-       int temp_index = output->index;
+       unsigned int temp_index = output->index;
 
        if (temp_index >= cfg->num_outputs)
                return -EINVAL;
index 6d1411c..bcefbad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 exynos-gsc-objs := gsc-core.o gsc-m2m.o gsc-regs.o
 
 obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc.o
index c8e5ad8..989cb34 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config VIDEO_SAMSUNG_EXYNOS4_IS
        tristate "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver"
index cd88e2e..86b8447 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CAFE_CCIC
        tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support"
        depends on PCI && I2C && VIDEO_V4L2
index b3a4d0c..90c3c2b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o mcam-core.o
 cafe_ccic-y := cafe-driver.o
 
index f611c23..6bf728a 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_MESON_AO_CEC)       += ao-cec.o
 obj-$(CONFIG_VIDEO_MESON_G12A_AO_CEC)  += ao-cec-g12a.o
index b2e6069..92a4fc0 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 mtk_jpeg-objs := mtk_jpeg_core.o mtk_jpeg_hw.o mtk_jpeg_parse.o
 obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk_jpeg.o
index 58cc1b4..ecd2d39 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 mtk-vpu-y += mtk_vpu.o
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU) += mtk-vpu.o
index 30ce2ba..08a606a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_OMAP2_VOUT_VRFB
        bool
        default y
index d80df41..b17a0ac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the omap video device drivers.
 #
index 37f0d71..cb6a9e3 100644 (file)
@@ -1527,23 +1527,20 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
        unsigned long size;
        struct videobuf_buffer *vb;
 
-       vb = q->bufs[b->index];
-
        if (!vout->streaming)
                return -EINVAL;
 
-       if (file->f_flags & O_NONBLOCK)
-               /* Call videobuf_dqbuf for non blocking mode */
-               ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 1);
-       else
-               /* Call videobuf_dqbuf for  blocking mode */
-               ret = videobuf_dqbuf(q, (struct v4l2_buffer *)b, 0);
+       ret = videobuf_dqbuf(q, b, !!(file->f_flags & O_NONBLOCK));
+       if (ret)
+               return ret;
+
+       vb = q->bufs[b->index];
 
        addr = (unsigned long) vout->buf_phy_addr[vb->i];
        size = (unsigned long) vb->size;
        dma_unmap_single(vout->vid_dev->v4l2_dev.dev,  addr,
                                size, DMA_TO_DEVICE);
-       return ret;
+       return 0;
 }
 
 static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
index f5e6e25..63c1b1b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for Qualcomm CAMSS driver
 
 qcom-camss-objs += \
index 799e526..8f097e5 100644 (file)
@@ -68,6 +68,7 @@ struct rcar_csi2;
 /* Field Detection Control */
 #define FLD_REG                                0x1c
 #define FLD_FLD_NUM(n)                 (((n) & 0xff) << 16)
+#define FLD_DET_SEL(n)                 (((n) & 0x3) << 4)
 #define FLD_FLD_EN4                    BIT(3)
 #define FLD_FLD_EN3                    BIT(2)
 #define FLD_FLD_EN2                    BIT(1)
@@ -84,6 +85,9 @@ struct rcar_csi2;
 
 /* Interrupt Enable */
 #define INTEN_REG                      0x30
+#define INTEN_INT_AFIFO_OF             BIT(27)
+#define INTEN_INT_ERRSOTHS             BIT(4)
+#define INTEN_INT_ERRSOTSYNCHS         BIT(3)
 
 /* Interrupt Source Mask */
 #define INTCLOSE_REG                   0x34
@@ -475,7 +479,7 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp)
 static int rcsi2_start_receiver(struct rcar_csi2 *priv)
 {
        const struct rcar_csi2_format *format;
-       u32 phycnt, vcdt = 0, vcdt2 = 0;
+       u32 phycnt, vcdt = 0, vcdt2 = 0, fld = 0;
        unsigned int i;
        int mbps, ret;
 
@@ -507,6 +511,16 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)
                        vcdt2 |= vcdt_part << ((i % 2) * 16);
        }
 
+       if (priv->mf.field == V4L2_FIELD_ALTERNATE) {
+               fld = FLD_DET_SEL(1) | FLD_FLD_EN4 | FLD_FLD_EN3 | FLD_FLD_EN2
+                       | FLD_FLD_EN;
+
+               if (priv->mf.height == 240)
+                       fld |= FLD_FLD_NUM(0);
+               else
+                       fld |= FLD_FLD_NUM(1);
+       }
+
        phycnt = PHYCNT_ENABLECLK;
        phycnt |= (1 << priv->lanes) - 1;
 
@@ -514,6 +528,10 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)
        if (mbps < 0)
                return mbps;
 
+       /* Enable interrupts. */
+       rcsi2_write(priv, INTEN_REG, INTEN_INT_AFIFO_OF | INTEN_INT_ERRSOTHS
+                   | INTEN_INT_ERRSOTSYNCHS);
+
        /* Init */
        rcsi2_write(priv, TREF_REG, TREF_TREF);
        rcsi2_write(priv, PHTC_REG, 0);
@@ -549,8 +567,7 @@ static int rcsi2_start_receiver(struct rcar_csi2 *priv)
        rcsi2_write(priv, PHYCNT_REG, phycnt);
        rcsi2_write(priv, LINKCNT_REG, LINKCNT_MONITOR_EN |
                    LINKCNT_REG_MONI_PACT_EN | LINKCNT_ICLK_NONSTOP);
-       rcsi2_write(priv, FLD_REG, FLD_FLD_NUM(2) | FLD_FLD_EN4 |
-                   FLD_FLD_EN3 | FLD_FLD_EN2 | FLD_FLD_EN);
+       rcsi2_write(priv, FLD_REG, fld);
        rcsi2_write(priv, PHYCNT_REG, phycnt | PHYCNT_SHUTDOWNZ);
        rcsi2_write(priv, PHYCNT_REG, phycnt | PHYCNT_SHUTDOWNZ | PHYCNT_RSTZ);
 
@@ -675,6 +692,43 @@ static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
        .pad    = &rcar_csi2_pad_ops,
 };
 
+static irqreturn_t rcsi2_irq(int irq, void *data)
+{
+       struct rcar_csi2 *priv = data;
+       u32 status, err_status;
+
+       status = rcsi2_read(priv, INTSTATE_REG);
+       err_status = rcsi2_read(priv, INTERRSTATE_REG);
+
+       if (!status)
+               return IRQ_HANDLED;
+
+       rcsi2_write(priv, INTSTATE_REG, status);
+
+       if (!err_status)
+               return IRQ_HANDLED;
+
+       rcsi2_write(priv, INTERRSTATE_REG, err_status);
+
+       dev_info(priv->dev, "Transfer error, restarting CSI-2 receiver\n");
+
+       return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t rcsi2_irq_thread(int irq, void *data)
+{
+       struct rcar_csi2 *priv = data;
+
+       mutex_lock(&priv->lock);
+       rcsi2_stop(priv);
+       usleep_range(1000, 2000);
+       if (rcsi2_start(priv))
+               dev_warn(priv->dev, "Failed to restart CSI-2 receiver\n");
+       mutex_unlock(&priv->lock);
+
+       return IRQ_HANDLED;
+}
+
 /* -----------------------------------------------------------------------------
  * Async handling and registration of subdevices and links.
  */
@@ -947,7 +1001,7 @@ static int rcsi2_probe_resources(struct rcar_csi2 *priv,
                                 struct platform_device *pdev)
 {
        struct resource *res;
-       int irq;
+       int irq, ret;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        priv->base = devm_ioremap_resource(&pdev->dev, res);
@@ -958,6 +1012,12 @@ static int rcsi2_probe_resources(struct rcar_csi2 *priv,
        if (irq < 0)
                return irq;
 
+       ret = devm_request_threaded_irq(&pdev->dev, irq, rcsi2_irq,
+                                       rcsi2_irq_thread, IRQF_SHARED,
+                                       KBUILD_MODNAME, priv);
+       if (ret)
+               return ret;
+
        priv->rstc = devm_reset_control_get(&pdev->dev, NULL);
        if (IS_ERR(priv->rstc))
                return PTR_ERR(priv->rstc);
index 92fe254..1bbecdc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 rockchip-rga-objs := rga.o rga-hw.o rga-buf.o
 
 obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip-rga.o
index 50bf8c5..70ee042 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for s3c244x/s3c64xx CAMIF driver
 
 s3c-camif-objs := camif-core.o camif-capture.o camif-regs.o
index 0e2cf45..bd0103b 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_CEC)    += s5p-cec.o
 s5p-cec-y += s5p_cec.o exynos_hdmi_cecctrl.o
index 2c48c41..ad2c5bf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 s5p-g2d-objs := g2d.o g2d-hw.o
 
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D)    += s5p-g2d.o
index 9e5f214..8b0f92e 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 s5p-jpeg-objs := jpeg-core.o jpeg-hw-exynos3250.o jpeg-hw-exynos4.o jpeg-hw-s5p.o
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o
index a3f2c6b..79fde69 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_SECO_CEC) += seco-cec.o
index bc53496..caf7ccd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STI_BDISP) := bdisp.o
 
 bdisp-objs := bdisp-v4l2.o bdisp-hw.o bdisp-debug.o
index 93eaabf..369509e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_C8SECTPFE
        tristate "STMicroelectronics C8SECTPFE DVB support"
        depends on PINCTRL && DVB_CORE && I2C
index 34d6947..aedfc72 100644 (file)
@@ -4,6 +4,5 @@ c8sectpfe-y += c8sectpfe-core.o c8sectpfe-common.o c8sectpfe-dvb.o \
 
 obj-$(CONFIG_DVB_C8SECTPFE) += c8sectpfe.o
 
-ccflags-y += -Idrivers/media/common
-ccflags-y += -Idrivers/media/dvb-frontends/
-ccflags-y += -Idrivers/media/tuners/
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/
+ccflags-y += -I $(srctree)/drivers/media/tuners/
index f07905e..d0c6b4a 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += stih-cec.o
index 8d03250..92b37e2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STI_DELTA_DRIVER) := st-delta.o
 st-delta-y := delta-v4l2.o delta-mem.o delta-ipc.o delta-debug.o
 
index e3ebe96..74b41ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STI_HVA) := st-hva.o
 st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o hva-h264.o
 st-hva-$(CONFIG_VIDEO_STI_HVA_DEBUGFS) += hva-debugfs.o
index 0735509..5ed7359 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STM32_DCMI) += stm32-dcmi.o
 obj-$(CONFIG_VIDEO_STM32_HDMI_CEC) += stm32-cec.o
index 018e3ec..269b3eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_SUN6I_CSI
        tristate "Allwinner V3s Camera Sensor Interface driver"
        depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API && HAS_DMA
index 213cb6b..e7e3153 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 sun6i-csi-y += sun6i_video.o sun6i_csi.o
 
 obj-$(CONFIG_VIDEO_SUN6I_CSI) += sun6i-csi.o
index f3d8112..97e57c7 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_TEGRA_HDMI_CEC)     += tegra_cec.o
index 7fb3a4f..447bdfb 100644 (file)
@@ -334,8 +334,8 @@ static int tegra_cec_probe(struct platform_device *pdev)
 
        hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev);
 
-       if (!hdmi_dev)
-               return -ENODEV;
+       if (IS_ERR(hdmi_dev))
+               return PTR_ERR(hdmi_dev);
 
        cec = devm_kzalloc(&pdev->dev, sizeof(struct tegra_cec), GFP_KERNEL);
 
index ad13329..36bb0e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_VICODEC
        tristate "Virtual Codec Driver"
        depends on VIDEO_DEV && VIDEO_V4L2
index 1de9bc9..beba6ac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_VIMC
        tristate "Virtual Media Controller Driver (VIMC)"
        depends on VIDEO_DEV && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
index 4b51d4d..b172bcc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_VIVID
        tristate "Virtual Video Test Driver"
        depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 && FB
index 9cd00f6..4b41687 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multimedia Video device configuration
 #
index 37e6e82..53c7ae1 100644 (file)
@@ -36,5 +36,3 @@ obj-$(CONFIG_RADIO_TEA575X) += tea575x.o
 obj-$(CONFIG_USB_RAREMONO) += radio-raremono.o
 
 shark2-objs := radio-shark2.o radio-tea5777.o
-
-ccflags-y += -Isound
index 4c52ac6..0e9a378 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * AimsLab RadioTrack (aka RadioVeveal) driver
  *
index 840b7d6..4909c33 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * radio-aztech.c - Aztech radio card driver
  *
index d12e07e..1216089 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
  *
  * by Fred Gleason <fredg@wava.com>
index f051f86..0640011 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * GemTek radio card driver
  *
index 1b97ad2..ad488ec 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Guillemot Maxi Radio FM 2000 PCI radio card driver for Linux
  * (C) 2001 Dimitromanolakis Apostolos <apdim@grecian.net>
index b626567..95d12cb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Miro PCM20 radio driver for Linux radio support
  * (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
index 5a1470e..73d2c18 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * RadioTrack II driver
  * Copyright 1998 Ben Pfaff
index a8fedc9..434c033 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* SF16-FMI, SF16-FMP and SF16-FMD radio driver for Linux radio support
  * heavily based on rtrack driver...
  * (c) 1997 M. Kirkwood
index ca8a1c2..bd323e6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* SF16-FMR2 and SF16-FMD2 radio driver for Linux
  * Copyright (c) 2011 Ondrej Zary
  *
index 1af8f29..8b8ce2b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Terratec ActiveRadio ISA Standalone card driver for Linux radio support
  * (c) 1999 R. Offermanns (rolf@offermanns.de)
  * based on the aimslab radio driver from M. Kirkwood
index a4bad32..2fc0095 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* radio-trust.c - Trust FM Radio card driver for Linux 2.2
  * by Eric Lammerts <eric@scintilla.utwente.nl>
  *
index d0d67ad..1aa856d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Typhoon Radio Card driver for radio support
  * (c) 1999 Dr. Henrik Seidel <Henrik.Seidel@gmx.de>
  *
index 6007cd0..f3dc57c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Zoltrix Radio Plus driver
  * Copyright 1998 C. van Schaik <carl@leg.uct.ac.za>
index 2102648..537f8e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config RADIO_SI470X
         tristate "Silicon Labs Si470x FM Radio Receiver support"
         depends on VIDEO_V4L2
index 682b314..e392126 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for radios with Silicon Labs Si470x FM Radio Receivers
 #
index 17567c9..490bc6f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_SI4713
        tristate "Silicon Labs Si4713 FM Radio Transmitter support with USB"
        depends on USB && I2C && RADIO_SI4713
index ddaaf92..3411514 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for radios with Silicon Labs Si4713 FM Radio Transmitters
 #
index 64b66bb..1dee727 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TI's wl128x FM driver based on TI's ST driver.
 #
index 32a0ead..4396ca4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for TI's shared transport driver based wl128x
 # FM radio.
index 3fc6ac1..c18dee6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig RC_CORE
        tristate "Remote Controller support"
index d2c6617..5c0508f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IR_IMG
        tristate "ImgTec IR Decoder"
        depends on RC_CORE
index f459096..d31cd36 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config RC_MAP
        tristate "Compile Remote Controller keymap modules"
        depends on RC_CORE
index 3818c33..530af33 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * A-Link DTU(m) remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index e75e51b..9d1eee1 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Anysee remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 11f1eb6..2f800dd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ATI X10 RF remote keytable
  *
@@ -7,20 +8,6 @@
  * ati_remote.c, which is
  * Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net>
  * Copyright (c) 2002 Vladimir Dergachev
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 5d92d36..6134889 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * AverMedia RM-KS remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 18d7dcb..8e7e953 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * TwinHan AzureWave AD-TU700(704J) remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 01ca8b3..f4d0799 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DigitalNow TinyTwin remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index a54b1d6..6849f1a 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Digittrade DVB-T USB Stick remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index e534a56..afee942 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * LeadTek Y04G0051 remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index c997334..407706b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Medion X10 RF remote keytable (Digitainer variant)
  *
@@ -7,20 +8,6 @@
  * up/down buttons (tested with P/N 40009936 / 20018268), reportedly
  * originally shipped with Medion Digitainer but now sold separately simply as
  * an "X10" remote.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 103ad88..2ff5c45 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Medion X10 OR22/OR24 RF remote keytable
  *
@@ -7,20 +8,6 @@
  * button. This has been tested with a "RF VISTA Remote Control", OR24V,
  * P/N 20035335, but should work with other variants that have the same
  * buttons, such as OR22V and OR24E.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index bbffa5d..66b962d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Medion X10 RF remote keytable
  *
@@ -5,20 +6,6 @@
  *
  * This file is based on a keytable provided by
  * Jan Losinski <losinski@wh2.tu-dresden.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 94aa12d..d361554 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * MSI DIGIVOX mini II remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index d50e741..31d4156 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * MSI DIGIVOX mini III remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index b73223e..a680033 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * MSI DIGIVOX mini III remote controller keytable
  *
  * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 30630a6..8d55b4c 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SnapStream Firefly X10 RF remote keytable
  *
  * Copyright (C) 2011 Anssi Hannula <anssi.hannula@?ki.fi>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index df57e0a..bd1c176 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * TerraTec remote controller keytable
  *
  * Copyright (C) 2011 Martin Groszhauser <mgroszhauser@gmail.com>
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 58a2098..b449426 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * TerraTec remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index eeeca14..7dfaf05 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Total Media In Hand_02 remote controller keytable for Mygica X8507
  *
  * Copyright (C) 2012 Alfredo J. Delaiti <alfredodelaiti@netscape.net>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index c34e8f5..a125694 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Total Media In Hand remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 63f9662..8576831 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * TrekStor remote controller keytable
  *
  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <media/rc-map.h>
index 78bb314..3ee28bc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <media/rc-map.h>
 #include <linux/module.h>
 
index df169ec..ba464ef 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if VIDEO_V4L2
 
 menu "SPI helper chips"
index 9e53677..9f45787 100644 (file)
@@ -1,6 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_GS1662) += gs1662.o
 obj-$(CONFIG_CXD2880_SPI_DRV) += cxd2880-spi.o
 
-ccflags-y += -Idrivers/media/dvb-core
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/dvb-frontends/cxd2880
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends/cxd2880
index 147f3cd..72805e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Analog TV tuners, auto-loaded via tuner.ko
 config MEDIA_TUNER
        tristate
index 91956fb..3f1f9af 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Elonics E4000 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "e4000_priv.h"
index 9a65208..b8f12c2 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Elonics E4000 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef E4000_H
index d6d5d11..60bac18 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Elonics E4000 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef E4000_PRIV_H
index dd88cf7..7639a30 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * FCI FC2580 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "fc2580_priv.h"
index a04fba6..1df62ae 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * FCI FC2580 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef FC2580_H
index 031a43d..8fa88a3 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * FCI FC2580 silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef FC2580_PRIV_H
index 8b4ce84..baf708f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * i2c tv tuner chip device driver
  * controls microtune tuners, mt2032 + mt2050 at the moment.
index 4f91dbb..6709a0d 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Elonics R820T silicon tuner driver
  *
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef R820T_H
index 8326106..bf48f1c 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NXP TDA18212HN silicon tuner driver
  *
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "tda18212.h"
index 9ed4367..08d6f57 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NXP TDA18212HN silicon tuner driver
  *
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef TDA18212_H
index 9777da0..dca2fc7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
index d2169bb..b6e70fa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * i2c tv tuner chip device driver
  * controls all those simple 4-control-bytes style tuners.
index 98bc15a..01f61eb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * i2c tv tuner chip device type database.
index b24e753..03c2944 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if USB && MEDIA_SUPPORT
 
 menuconfig MEDIA_USB_SUPPORT
index 6757851..4583452 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_AIRSPY
        tristate "AirSpy"
        depends on VIDEO_V4L2
index 8d8e61c..d2ba2ca 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_AIRSPY)              += airspy.o
index 28aba00..5a859c1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_AS102
        tristate "Abilis AS102 DVB receiver"
        depends on DVB_CORE && USB && I2C && INPUT
index b0b3196..de671ae 100644 (file)
@@ -4,4 +4,4 @@ dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o \
 
 obj-$(CONFIG_DVB_AS102) += dvb-as102.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 0ad9855..05cc6c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config VIDEO_AU0828
        tristate "Auvitek AU0828 support"
index 5691881..4347812 100644 (file)
@@ -11,7 +11,7 @@ endif
 
 obj-$(CONFIG_VIDEO_AU0828) += au0828.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
 
 ccflags-y += $(extra-cflags-y) $(extra-cflags-m)
index 9dd6bdb..97f5e87 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
    au0828-vbi.c - VBI driver for au0828
 
@@ -5,20 +6,6 @@
 
    This work was sponsored by GetWellNetwork Inc.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This 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.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
  */
 
 #include "au0828.h"
index a620ae4..b3ffdf1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_B2C2_FLEXCOP_USB
        tristate "Technisat/B2C2 Air/Sky/Cable2PC USB"
        depends on DVB_CORE && I2C
index f3cef05..6ae0e43 100644 (file)
@@ -1,4 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
 b2c2-flexcop-usb-objs := flexcop-usb.o
 obj-$(CONFIG_DVB_B2C2_FLEXCOP_USB) += b2c2-flexcop-usb.o
 
-ccflags-y += -Idrivers/media/common/b2c2/
+ccflags-y += -I $(srctree)/drivers/media/common/b2c2/
index a8f3169..1826ff8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
  * flexcop-usb.c - covers the USB part
index 7029a04..e2c18ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CPIA2
        tristate "CPiA2 Video For Linux"
        depends on VIDEO_DEV && USB && VIDEO_V4L2
index 828cf1b..0566414 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 cpia2-objs     := cpia2_v4l.o cpia2_usb.o cpia2_core.o
 
 obj-$(CONFIG_VIDEO_CPIA2) += cpia2.o
index 9262d0d..74f3b29 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_CX231XX
        tristate "Conexant cx231xx USB video capture support"
        depends on VIDEO_DEV && I2C && I2C_MUX
index c023d97..8acbbcb 100644 (file)
@@ -9,6 +9,5 @@ obj-$(CONFIG_VIDEO_CX231XX) += cx231xx.o
 obj-$(CONFIG_VIDEO_CX231XX_ALSA) += cx231xx-alsa.o
 obj-$(CONFIG_VIDEO_CX231XX_DVB) += cx231xx-dvb.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
-ccflags-y += -Idrivers/media/usb/dvb-usb
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 511e3f2..b21a4d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_USB_V2
        tristate "Support for various USB DVB devices v2"
        depends on DVB_CORE && USB && I2C && (RC_CORE || RC_CORE=n)
index 1b7f1af..de52309 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Afatech AF9035 DVB USB driver
  *
  * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "af9035.h"
index bc41c16..1533cf3 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Afatech AF9035 DVB USB driver
  *
  * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef AF9035_H
index 728ef5f..b874a49 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * DVB USB framework
  *
  * Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@posteo.de>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DVB_USB_H
index a1622bd..864c2fc 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * DVB USB framework
  *
  * Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@posteo.de>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef DVB_USB_COMMON_H
index d55ef01..e5e056b 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DVB USB framework
  *
  * Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@posteo.de>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "dvb_usb_common.h"
index 5bafeb6..91729a3 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DVB USB framework
  *
  * Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@posteo.de>
  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "dvb_usb_common.h"
index d0075cb..1a36bda 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Realtek RTL28xxU DVB USB driver
  *
  * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
  * Copyright (C) 2012 Thomas Mair <thomas.mair86@googlemail.com>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "rtl28xxu.h"
index 197f4e3..d5e207b 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Realtek RTL28xxU DVB USB driver
  *
  * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This 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.
- *
- *    You should have received a copy of the GNU General Public License along
- *    with this program; if not, write to the Free Software Foundation, Inc.,
- *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef RTL28XXU_H
index 513df95..87dbae8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_USB
        tristate "Support for various USB DVB devices"
        depends on DVB_CORE && USB && I2C && RC_CORE
index 639da7e..f2031a9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_EM28XX
        tristate "Empia EM28xx USB devices support"
        depends on VIDEO_DEV && I2C
index 8a22400..8c2fc31 100644 (file)
@@ -11,5 +11,5 @@ obj-$(CONFIG_VIDEO_EM28XX_ALSA) += em28xx-alsa.o
 obj-$(CONFIG_VIDEO_EM28XX_DVB) += em28xx-dvb.o
 obj-$(CONFIG_VIDEO_EM28XX_RC) += em28xx-rc.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index beab257..4ff7994 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_GO7007
        tristate "WIS GO7007 MPEG encoder support"
        depends on VIDEO_DEV && I2C
index 3d95bbc..712a350 100644 (file)
@@ -9,4 +9,4 @@ go7007-y := go7007-v4l2.o go7007-driver.o go7007-i2c.o go7007-fw.o \
 
 s2250-y := s2250-board.o
 
-ccflags-$(CONFIG_VIDEO_GO7007_LOADER:m=y) += -Idrivers/media/common
+ccflags-$(CONFIG_VIDEO_GO7007_LOADER:m=y) += -I $(srctree)/drivers/media/common
index 0e6f36c..77a3609 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig USB_GSPCA
        tristate "GSPCA based webcams"
        depends on VIDEO_V4L2
index 1744591..25c40fb 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Benq DC E300 subdriver
  *
  * Copyright (C) 2009 Jean-Francois Moine (http://moinejf.free.fr)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 6df4e20..8b26912 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *             Connexant Cx11646 library
  *             Copyright (C) 2004 Michel Xhaard mxhaard@magic.fr
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 7654c8c..671b205 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Subdriver for Scopium astro-camera (DTCS033, 0547:7303)
  *
  * Copyright (C) 2014 Robert Butora (robert.butora.fi@gmail.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 1ef1239..66c8e51 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Fujifilm Finepix subdriver
  *
  * Copyright (C) 2008 Frank Zago
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 22772f5..2dfd270 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_GL860
        tristate "GL860 USB Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
index 86d0a0a..20b2468 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Jeilinj subdriver
  *
@@ -8,16 +9,6 @@
  *
  * Sportscam DV15 support and control settings are
  * Copyright (C) 2011 Patrice Chotard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index c402459..80ce744 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Jeilin JL2005B/C/D library
  *
  * Copyright (C) 2011 Theodore Kilgore <kilgota@auburn.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define MODULE_NAME "jl2005bcd"
index d5ad7c9..660081d 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #ifndef JPEG_H
 #define JPEG_H 1
 /*
@@ -7,17 +8,6 @@
  * A special case is done for Conexant webcams.
  *
  * Copyright (C) Jean-Francois Moine (http://moinejf.free.fr)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 /*
index f993f62..57ea658 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * kinect sensor device camera, gspca driver
  *
@@ -8,16 +9,6 @@
  *
  * Special thanks to Steven Toth and kernellabs.com for sponsoring a Kinect
  * sensor device which I tested the driver on.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 989ae99..d8e4013 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for USB webcams based on Konica chipset. This
  * chipset is used in Intel YC76 camera.
  * taken from the benq gspca subdriver which is:
  *
  * Copyright (C) 2009 Jean-Francois Moine (http://moinejf.free.fr)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 13a0039..0a25065 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_M5602
        tristate "ALi USB m5602 Camera Driver"
        depends on VIDEO_V4L2 && USB_GSPCA
index a537cb1..eb9342e 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *             Mars-Semi MR97311A library
  *             Copyright (C) 2005 <bradlch@hotmail.com>
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index af45466..502fc2e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Mars MR97310A library
  *
  *
  * The MR97311A support in gspca/mars.c has been helpful in understanding some
  * of the registers in these cameras.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index bedc04a..5964970 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DivIO nw80x subdriver
  *
  * Copyright (C) 2011 Jean-François Moine (http://moinejf.free.fr)
  * Copyright (C) 2003 Sylvain Munaut <tnt@246tNt.com>
  *                     Kjell Claesson <keyson@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index f2799e8..cfb1f53 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * OV519 driver
  *
  *
  * Copyright (c) 2004-2007 Romain Beauxis <toots@rastageeks.org>
  * Support for OV7670 sensors was contributed by Sam Skipsey <aoanla@yahoo.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 02c90ad..56521c9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ov534-ov7xxx gspca driver
  *
  *                  added by Max Thrun <bear24rw@gmail.com>
  * PS3 Eye camera - FPS range extended by Joseph Howse
  *                  <josephhowse@nummist.com> http://nummist.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 3d1364d..867f860 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ov534-ov9xxx gspca driver
  *
@@ -8,16 +9,6 @@
  * Based on a prototype written by Mark Ferrell <majortrips@gmail.com>
  * USB protocol reverse engineered by Jim Paris <jim@jtan.com>
  * https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index b8ff201..2e8c3ef 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Pixart PAC7302 driver
  *
@@ -7,16 +8,6 @@
  * Separated from Pixart PAC7311 library by Márton Németh
  * Camera button input handling by Márton Németh <nm127@freemail.hu>
  * Copyright (C) 2009-2010 Márton Németh <nm127@freemail.hu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 /*
index 44db4f4..f6addb2 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *             Pixart PAC7311 library
  *             Copyright (C) 2005 Thomas Kaiser thomas@kaiser-linux.li
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 /* Some documentation about various registers as determined by trial and error.
index a1f7189..aff01b7 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SN9C2028 library
  *
  * Copyright (C) 2009 Theodore Kilgore <kilgota@auburn.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index ab91290..b43f89f 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Sonix sn9c201 sn9c202 library
  *
  * Copyright (C) 2012 Jean-Francois Moine <http://moinejf.free.fr>
  *     Copyright (C) 2008-2009 microdia project <microdia@googlegroups.com>
  *     Copyright (C) 2009 Brian Johnson <brijohn@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 583c9f1..046fc2c 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *             sonix sn9c102 (bayer) library
  *
  * Copyright (C) 2009-2011 Jean-François Moine <http://moinejf.free.fr>
  * Copyright (C) 2003 2004 Michel Xhaard mxhaard@magic.fr
  * Add Pas106 Stefano Mozzi (C) 2004
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 /* Some documentation on known sonixb registers:
index a63f155..50a6c84 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sonix sn9c102p sn9c105 sn9c120 (jpeg) subdriver
  *
  * Copyright (C) 2009-2011 Jean-François Moine <http://moinejf.free.fr>
  * Copyright (C) 2005 Michel Xhaard mxhaard@magic.fr
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index d25924e..2ae03b6 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * spca1528 subdriver
  *
  * Copyright (C) 2010-2011 Jean-Francois Moine (http://moinejf.free.fr)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index e90d2f3..b9ce5e3 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPCA500 chip based cameras initialization data
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 3d21595..ecc97f8 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPCA501 chip based cameras initialization data
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 07aae9c..0e8cccb 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPCA505 chip based cameras initialization data
  *
  * V4L2 by Jean-Francis Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 6332b3f..0886587 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPCA506 chip based cameras function
  * M Xhaard 15/04/2004 based on different work Mark Taylor and others
@@ -5,16 +6,6 @@
  *                "Firma Frank Gmbh" from  Saarbruecken
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define MODULE_NAME "spca506"
index d80fd39..754ab1d 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPCA508 chip based cameras subdriver
  *
  * Copyright (C) 2009 Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index f389a8d..d608a51 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Sunplus spca561 subdriver
  *
  * Copyright (C) 2004 Michel Xhaard mxhaard@magic.fr
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index d5c4821..863c485 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SQ905 subdriver
  *
  * Copyright (C) 2008, 2009 Adam Baker and Theodore Kilgore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 /*
index 274921c..3d7f6dc 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SQ905C subdriver
  *
  * Copyright (C) 2009 Theodore Kilgore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 /*
index e15b45f..d1ba088 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SQ930x subdriver
  *
  * Copyright (C) 2010 Jean-François Moine <http://moinejf.free.fr>
  * Copyright (C) 2006 -2008 Gerard Klaver <gerard at gkall dot hobby dot nl>
  * Copyright (C) 2007 Sam Revitch <samr7@cs.washington.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 0d8f489..aa9e921 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Syntek DV4000 (STK014) subdriver
  *
  * Copyright (C) 2008 Jean-Francois Moine (http://moinejf.free.fr)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 6f52a48..1a602af 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Syntek STK1135 subdriver
  *
@@ -5,16 +6,6 @@
  *
  * Based on Syntekdriver (stk11xx) by Nicolas VIVIEN:
  *   http://syntekdriver.sourceforge.net
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index bd14401..9a77500 100644 (file)
@@ -1,17 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * STK1135 registers
  *
  * Copyright (c) 2013 Ondrej Zary
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define STK1135_REG_GCTRL      0x000   /* GPIO control */
index 634ad38..5937365 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_STV06XX
        tristate "STV06XX USB Camera Driver"
        depends on USB_GSPCA
index e1e2a60..d0ddfa9 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *             Sunplus spca504(abc) spca533 spca536 library
  *             Copyright (C) 2005 Michel Xhaard mxhaard@magic.fr
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index ed9b925..33b37cc 100644 (file)
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * T613 subdriver
  *
  * Copyright (C) 2010 Jean-Francois Moine (http://moinejf.free.fr)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  *Notes: * t613  + tas5130A
  *     * Focus to light do not balance well as in win.
  *       Quality in win is not good, but its kinda better.
index 6f3ec03..aee4440 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Topro TP6800/6810 webcam driver.
  *
  * Copyright (C) 2011 Jean-François Moine (http://moinejf.free.fr)
  * Copyright (C) 2009 Anders Blomdell (anders.blomdell@control.lth.se)
  * Copyright (C) 2008 Thomas Champagne (lafeuil@gmail.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 6c056a4..dde311c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ToupTek UCMOS / AmScope MU series camera driver
  * TODO: contrast with ScopeTek / AmScope MDC cameras
@@ -7,16 +8,6 @@
  * Special thanks to Bushing for helping with the decrypt algorithm and
  * Sean O'Sullivan / the Rensselaer Center for Open Source
  * Software (RCOS) for helping me learn kernel development
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #include "gspca.h"
index bc2720e..c31baa7 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Quickcam cameras initialization data
  *
  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 #define MODULE_NAME "tv8532"
 
index 52d0716..588a847 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Z-star vc0321 library
  *
  * Copyright (C) 2009-2010 Jean-François Moine <http://moinejf.free.fr>
  * Copyright (C) 2006 Koninski Artur takeshi87@o2.pl
  * Copyright (C) 2006 Michel Xhaard
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 8562bda..179b2ec 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * gspca ViCam subdriver
  *
  *                    Pavel Machek (pavel@ucw.cz),
  *                    John Tyner (jtyner@cs.ucr.edu),
  *                    Monroe Williams (monroe@pobox.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 36cc5a5..16b679c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /**
  *
  * GSPCA sub driver for W996[78]CF JPEG USB Dual Mode Camera Chip.
@@ -7,17 +8,6 @@
  * This module is adapted from the in kernel v4l1 w9968cf driver:
  *
  * Copyright (C) 2002-2004 by Luca Risolia <luca.risolia@studio.unibo.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  */
 
 /* Note this is not a stand alone driver, it gets included in ov519.c, this
index 072e186..2267ceb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_HACKRF
        tristate "HackRF"
        depends on VIDEO_V4L2
index 73064a2..0ac96d0 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_HACKRF)              += hackrf.o
index 9e78c0c..617400b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config VIDEO_HDPVR
        tristate "Hauppauge HD PVR support"
index 644dd99..d1d57e3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 hdpvr-objs     := hdpvr-control.o hdpvr-core.o hdpvr-video.o hdpvr-i2c.o
 
 obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o
index 9eff8a7..b403603 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_MSI2500
        tristate "Mirics MSi2500"
        depends on VIDEO_V4L2 && SPI
index b3bc2e5..be14390 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_MSI2500)             += msi2500.o
index 11f1b75..e802d30 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_PULSE8_CEC
        tristate "Pulse Eight HDMI CEC"
        depends on USB_ACM
index 9800690..7816c68 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec.o
index ac6612c..64f9df0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_PVRUSB2
        tristate "Hauppauge WinTV-PVR USB2 support"
        depends on VIDEO_V4L2 && I2C
index 9facf68..2e71afc 100644 (file)
@@ -17,5 +17,5 @@ pvrusb2-objs  := pvrusb2-i2c-core.o \
 
 obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 5f6d91e..7cebf63 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_PWC
        tristate "USB Philips Cameras"
        depends on VIDEO_V4L2
index d7fdbcb..ebc53e7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 pwc-objs       += pwc-if.o pwc-misc.o pwc-ctrl.o pwc-v4l.o pwc-uncompress.o
 pwc-objs       += pwc-dec1.o pwc-dec23.o pwc-kiara.o pwc-timon.o
 
index 6b00be6..b481c51 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_RAINSHADOW_CEC
        tristate "RainShadow Tech HDMI CEC"
        depends on USB_ACM
index a79fbc7..47b33c5 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
index 8c3fcee..e0e3c0b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_S2255
        tristate "USB Sensoray 2255 video capture device"
        depends on VIDEO_V4L2
index 197d0bb..cfc4e73 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_S2255)                += s2255drv.o
 
index cc5e5aa..19d6269 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Siano Mobile Silicon Digital TV device configuration
 #
index 7d48864..758c868 100644 (file)
@@ -1,5 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMS_USB_DRV) += smsusb.o
 
-ccflags-y += -Idrivers/media/common/siano
+ccflags-y += -I $(srctree)/drivers/media/common/siano
 ccflags-y += $(extra-cflags-y) $(extra-cflags-m)
 
index 4fc03ec..e13d77b 100644 (file)
@@ -1,21 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /****************************************************************
 
 Siano Mobile Silicon, Inc.
 MDTV receiver kernel modules.
 Copyright (C) 2005-2009, Uri Shkolnik, Anatoly Greenblat
 
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
- This 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.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 ****************************************************************/
 
index 03426e4..4f50fb7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_STK1160_COMMON
        tristate "STK1160 USB video capture support"
        depends on VIDEO_DEV && I2C
index ea9e04b..775a515 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_STKWEBCAM
        tristate "USB Syntek DC1125 Camera support"
        depends on VIDEO_V4L2
index 20ef8a4..daa9ae6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 stkwebcam-objs :=      stk-webcam.o stk-sensor.o
 
 obj-$(CONFIG_USB_STKWEBCAM)     += stkwebcam.o
index 8f54586..cb7d645 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * stk-webcam.c : Driver for Syntek 1125 USB webcam controller
  *
@@ -6,16 +7,6 @@
  *
  * Some parts are inspired from cafe_ccic.c
  * Copyright 2006-2007 Jonathan Corbet
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 5cecbdc..14519e5 100644 (file)
@@ -1,18 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * stk-webcam.h : Driver for Syntek 1125 USB webcam controller
  *
  * Copyright (C) 2006 Nicolas VIVIEN
  * Copyright 2007-2008 Jaime Velasco Juan <jsagarribay@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
  */
 
 #ifndef STKWEBCAM_H
index 321ae69..56e977d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_TM6000
        tristate "TV Master TM5600/6000/6010 driver"
        depends on VIDEO_DEV && I2C && INPUT && RC_CORE && USB
index 744c039..75247a0 100644 (file)
@@ -10,5 +10,5 @@ obj-$(CONFIG_VIDEO_TM6000) += tm6000.o
 obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o
 obj-$(CONFIG_VIDEO_TM6000_DVB) += tm6000-dvb.o
 
-ccflags-y += -Idrivers/media/tuners
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/tuners
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index 97bad7d..af2b8fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_TTUSB_BUDGET
        tristate "Technotrend/Hauppauge Nova-USB devices"
        depends on DVB_CORE && USB && I2C && PCI
index fe4372d..09e42bf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DVB_TTUSB_BUDGET) += dvb-ttusb-budget.o
 
-ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -I $(srctree)/drivers/media/dvb-frontends
index b205903..ed5cf84 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DVB_TTUSB_DEC
        tristate "Technotrend/Hauppauge USB DEC devices"
        depends on DVB_CORE && USB && INPUT && PCI
index dde9168..d1abb67 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DVB_TTUSB_DEC) += ttusb_dec.o ttusbdecfe.o
index 2b4ac08..84799c7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_USBTV
        tristate "USBTV007 video capture support"
        depends on VIDEO_V4L2 && SND
index f555cf8..78705bc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 usbtv-y := usbtv-core.o \
        usbtv-video.o \
        usbtv-audio.o
index 7aa080c..e1039fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIDEO_USBVISION
        tristate "USB video devices based on Nogatech NT1003/1004/1005"
        depends on I2C && VIDEO_V4L2
index 494d030..4d8541b 100644 (file)
@@ -1,5 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 usbvision-objs  := usbvision-core.o usbvision-video.o usbvision-i2c.o usbvision-cards.o
 
 obj-$(CONFIG_VIDEO_USBVISION) += usbvision.o
-
-ccflags-y += -Idrivers/media/tuners
index 94937d0..4c2f4a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_VIDEO_CLASS
        tristate "USB Video Class (UVC)"
        depends on VIDEO_V4L2
index 979b1d4..55b06c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config USB_ZR364XX
        tristate "USB ZR364XX Camera support"
        depends on VIDEO_V4L2
index a577788..edab017 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USB_ZR364XX)       += zr364xx.o
 
index 8402096..8b9d4b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Generic video config states
 #
index 03a340c..12d1e0c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * i2c tv tuner chip device driver
  * core core, i.e. kernel interfaces, registering and so on
index 73dac1d..e1eaf11 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
  *     Separated from fs stuff by Arnd Bergmann <arnd@arndb.de>
index 2d91b00..392ad4f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Memory devices
 #
index 9e9f803..6b71fad 100644 (file)
 #define MCONNID_SHIFT                                  0
 #define MCONNID_MASK                                   (0xff << 0)
 
+/* READ_WRITE_LEVELING_CONTROL */
+#define RDWRLVLFULL_START                              0x80000000
+
 /* DDR_PHY_CTRL_1 - EMIF4D */
 #define DLL_SLAVE_DLY_CTRL_SHIFT_4D                    4
 #define DLL_SLAVE_DLY_CTRL_MASK_4D                     (0xFF << 4)
@@ -598,6 +601,7 @@ extern struct emif_regs_amx3 ti_emif_regs_amx3;
 
 void ti_emif_save_context(void);
 void ti_emif_restore_context(void);
+void ti_emif_run_hw_leveling(void);
 void ti_emif_enter_sr(void);
 void ti_emif_exit_sr(void);
 void ti_emif_abort_sr(void);
index 34e0b70..4680124 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TEGRA_MC
        bool "NVIDIA Tegra Memory Controller support"
        default y
index 0a53598..163b6c6 100644 (file)
@@ -51,6 +51,9 @@
 #define MC_EMEM_ADR_CFG 0x54
 #define MC_EMEM_ADR_CFG_EMEM_NUMDEV BIT(0)
 
+#define MC_TIMING_CONTROL              0xfc
+#define MC_TIMING_UPDATE               BIT(0)
+
 static const struct of_device_id tegra_mc_of_match[] = {
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
        { .compatible = "nvidia,tegra20-mc-gart", .data = &tegra20_mc_soc },
@@ -74,7 +77,7 @@ static const struct of_device_id tegra_mc_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra_mc_of_match);
 
-static int terga_mc_block_dma_common(struct tegra_mc *mc,
+static int tegra_mc_block_dma_common(struct tegra_mc *mc,
                                     const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -90,13 +93,13 @@ static int terga_mc_block_dma_common(struct tegra_mc *mc,
        return 0;
 }
 
-static bool terga_mc_dma_idling_common(struct tegra_mc *mc,
+static bool tegra_mc_dma_idling_common(struct tegra_mc *mc,
                                       const struct tegra_mc_reset *rst)
 {
        return (mc_readl(mc, rst->status) & BIT(rst->bit)) != 0;
 }
 
-static int terga_mc_unblock_dma_common(struct tegra_mc *mc,
+static int tegra_mc_unblock_dma_common(struct tegra_mc *mc,
                                       const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -112,17 +115,17 @@ static int terga_mc_unblock_dma_common(struct tegra_mc *mc,
        return 0;
 }
 
-static int terga_mc_reset_status_common(struct tegra_mc *mc,
+static int tegra_mc_reset_status_common(struct tegra_mc *mc,
                                        const struct tegra_mc_reset *rst)
 {
        return (mc_readl(mc, rst->control) & BIT(rst->bit)) != 0;
 }
 
-const struct tegra_mc_reset_ops terga_mc_reset_ops_common = {
-       .block_dma = terga_mc_block_dma_common,
-       .dma_idling = terga_mc_dma_idling_common,
-       .unblock_dma = terga_mc_unblock_dma_common,
-       .reset_status = terga_mc_reset_status_common,
+const struct tegra_mc_reset_ops tegra_mc_reset_ops_common = {
+       .block_dma = tegra_mc_block_dma_common,
+       .dma_idling = tegra_mc_dma_idling_common,
+       .unblock_dma = tegra_mc_unblock_dma_common,
+       .reset_status = tegra_mc_reset_status_common,
 };
 
 static inline struct tegra_mc *reset_to_mc(struct reset_controller_dev *rcdev)
@@ -282,25 +285,28 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
        u32 value;
 
        /* compute the number of MC clock cycles per tick */
-       tick = mc->tick * clk_get_rate(mc->clk);
+       tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk);
        do_div(tick, NSEC_PER_SEC);
 
-       value = readl(mc->regs + MC_EMEM_ARB_CFG);
+       value = mc_readl(mc, MC_EMEM_ARB_CFG);
        value &= ~MC_EMEM_ARB_CFG_CYCLES_PER_UPDATE_MASK;
        value |= MC_EMEM_ARB_CFG_CYCLES_PER_UPDATE(tick);
-       writel(value, mc->regs + MC_EMEM_ARB_CFG);
+       mc_writel(mc, value, MC_EMEM_ARB_CFG);
 
        /* write latency allowance defaults */
        for (i = 0; i < mc->soc->num_clients; i++) {
                const struct tegra_mc_la *la = &mc->soc->clients[i].la;
                u32 value;
 
-               value = readl(mc->regs + la->reg);
+               value = mc_readl(mc, la->reg);
                value &= ~(la->mask << la->shift);
                value |= (la->def & la->mask) << la->shift;
-               writel(value, mc->regs + la->reg);
+               mc_writel(mc, value, la->reg);
        }
 
+       /* latch new values */
+       mc_writel(mc, MC_TIMING_UPDATE, MC_TIMING_CONTROL);
+
        return 0;
 }
 
index 887a3b0..3929939 100644 (file)
@@ -35,7 +35,7 @@ static inline void mc_writel(struct tegra_mc *mc, u32 value,
        writel_relaxed(value, mc->regs + offset);
 }
 
-extern const struct tegra_mc_reset_ops terga_mc_reset_ops_common;
+extern const struct tegra_mc_reset_ops tegra_mc_reset_ops_common;
 
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
 extern const struct tegra_mc_soc tegra20_mc_soc;
index 6560a51..62305fa 100644 (file)
@@ -572,7 +572,7 @@ static const struct tegra_mc_client tegra114_mc_clients[] = {
                },
        }, {
                .id = 0x34,
-               .name = "fdcwr2",
+               .name = "fdcdwr2",
                .swgroup = TEGRA_SWGROUP_NV,
                .smmu = {
                        .reg = 0x22c,
@@ -975,7 +975,7 @@ const struct tegra_mc_soc tegra114_mc_soc = {
        .smmu = &tegra114_smmu_soc,
        .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
                   MC_INT_DECERR_EMEM,
-       .reset_ops = &terga_mc_reset_ops_common,
+       .reset_ops = &tegra_mc_reset_ops_common,
        .resets = tegra114_mc_resets,
        .num_resets = ARRAY_SIZE(tegra114_mc_resets),
 };
index eedb7d4..772716a 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/clkdev.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
index b561a1f..8f8487b 100644 (file)
@@ -1074,7 +1074,7 @@ const struct tegra_mc_soc tegra124_mc_soc = {
        .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
                   MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
                   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
-       .reset_ops = &terga_mc_reset_ops_common,
+       .reset_ops = &tegra_mc_reset_ops_common,
        .resets = tegra124_mc_resets,
        .num_resets = ARRAY_SIZE(tegra124_mc_resets),
 };
@@ -1104,7 +1104,7 @@ const struct tegra_mc_soc tegra132_mc_soc = {
        .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
                   MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
                   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
-       .reset_ops = &terga_mc_reset_ops_common,
+       .reset_ops = &tegra_mc_reset_ops_common,
        .resets = tegra124_mc_resets,
        .num_resets = ARRAY_SIZE(tegra124_mc_resets),
 };
index 7119e53..121237b 100644 (file)
@@ -198,7 +198,7 @@ static const struct tegra_mc_reset tegra20_mc_resets[] = {
        TEGRA20_MC_RESET(VI,     0x100, 0x178, 0x104, 14),
 };
 
-static int terga20_mc_hotreset_assert(struct tegra_mc *mc,
+static int tegra20_mc_hotreset_assert(struct tegra_mc *mc,
                                      const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -214,7 +214,7 @@ static int terga20_mc_hotreset_assert(struct tegra_mc *mc,
        return 0;
 }
 
-static int terga20_mc_hotreset_deassert(struct tegra_mc *mc,
+static int tegra20_mc_hotreset_deassert(struct tegra_mc *mc,
                                        const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -230,7 +230,7 @@ static int terga20_mc_hotreset_deassert(struct tegra_mc *mc,
        return 0;
 }
 
-static int terga20_mc_block_dma(struct tegra_mc *mc,
+static int tegra20_mc_block_dma(struct tegra_mc *mc,
                                const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -246,19 +246,19 @@ static int terga20_mc_block_dma(struct tegra_mc *mc,
        return 0;
 }
 
-static bool terga20_mc_dma_idling(struct tegra_mc *mc,
+static bool tegra20_mc_dma_idling(struct tegra_mc *mc,
                                  const struct tegra_mc_reset *rst)
 {
        return mc_readl(mc, rst->status) == 0;
 }
 
-static int terga20_mc_reset_status(struct tegra_mc *mc,
+static int tegra20_mc_reset_status(struct tegra_mc *mc,
                                   const struct tegra_mc_reset *rst)
 {
        return (mc_readl(mc, rst->reset) & BIT(rst->bit)) == 0;
 }
 
-static int terga20_mc_unblock_dma(struct tegra_mc *mc,
+static int tegra20_mc_unblock_dma(struct tegra_mc *mc,
                                  const struct tegra_mc_reset *rst)
 {
        unsigned long flags;
@@ -274,13 +274,13 @@ static int terga20_mc_unblock_dma(struct tegra_mc *mc,
        return 0;
 }
 
-const struct tegra_mc_reset_ops terga20_mc_reset_ops = {
-       .hotreset_assert = terga20_mc_hotreset_assert,
-       .hotreset_deassert = terga20_mc_hotreset_deassert,
-       .block_dma = terga20_mc_block_dma,
-       .dma_idling = terga20_mc_dma_idling,
-       .unblock_dma = terga20_mc_unblock_dma,
-       .reset_status = terga20_mc_reset_status,
+static const struct tegra_mc_reset_ops tegra20_mc_reset_ops = {
+       .hotreset_assert = tegra20_mc_hotreset_assert,
+       .hotreset_deassert = tegra20_mc_hotreset_deassert,
+       .block_dma = tegra20_mc_block_dma,
+       .dma_idling = tegra20_mc_dma_idling,
+       .unblock_dma = tegra20_mc_unblock_dma,
+       .reset_status = tegra20_mc_reset_status,
 };
 
 const struct tegra_mc_soc tegra20_mc_soc = {
@@ -290,7 +290,7 @@ const struct tegra_mc_soc tegra20_mc_soc = {
        .client_id_mask = 0x3f,
        .intmask = MC_INT_SECURITY_VIOLATION | MC_INT_INVALID_GART_PAGE |
                   MC_INT_DECERR_EMEM,
-       .reset_ops = &terga20_mc_reset_ops,
+       .reset_ops = &tegra20_mc_reset_ops,
        .resets = tegra20_mc_resets,
        .num_resets = ARRAY_SIZE(tegra20_mc_resets),
 };
index d00a771..aa22cda 100644 (file)
@@ -1132,7 +1132,7 @@ const struct tegra_mc_soc tegra210_mc_soc = {
        .intmask = MC_INT_DECERR_MTS | MC_INT_SECERR_SEC | MC_INT_DECERR_VPR |
                   MC_INT_INVALID_APB_ASID_UPDATE | MC_INT_INVALID_SMMU_PAGE |
                   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
-       .reset_ops = &terga_mc_reset_ops_common,
+       .reset_ops = &tegra_mc_reset_ops_common,
        .resets = tegra210_mc_resets,
        .num_resets = ARRAY_SIZE(tegra210_mc_resets),
 };
index bee5314..c9af0f6 100644 (file)
@@ -726,7 +726,7 @@ static const struct tegra_mc_client tegra30_mc_clients[] = {
                },
        }, {
                .id = 0x34,
-               .name = "fdcwr2",
+               .name = "fdcdwr2",
                .swgroup = TEGRA_SWGROUP_NV2,
                .smmu = {
                        .reg = 0x22c,
@@ -999,7 +999,7 @@ const struct tegra_mc_soc tegra30_mc_soc = {
        .smmu = &tegra30_smmu_soc,
        .intmask = MC_INT_INVALID_SMMU_PAGE | MC_INT_SECURITY_VIOLATION |
                   MC_INT_DECERR_EMEM,
-       .reset_ops = &terga_mc_reset_ops_common,
+       .reset_ops = &tegra_mc_reset_ops_common,
        .resets = tegra30_mc_resets,
        .num_resets = ARRAY_SIZE(tegra30_mc_resets),
 };
index 2250d03..ab07aa1 100644 (file)
@@ -138,6 +138,9 @@ static int ti_emif_alloc_sram(struct device *dev,
        emif_data->pm_functions.exit_sr =
                sram_resume_address(emif_data,
                                    (unsigned long)ti_emif_exit_sr);
+       emif_data->pm_functions.run_hw_leveling =
+               sram_resume_address(emif_data,
+                                   (unsigned long)ti_emif_run_hw_leveling);
 
        emif_data->pm_data.regs_virt =
                (struct emif_regs_amx3 *)emif_data->ti_emif_sram_data_virt;
index a536918..d75ae18 100644 (file)
@@ -27,6 +27,7 @@
 #define EMIF_POWER_MGMT_SELF_REFRESH_MODE_MASK         0x0700
 
 #define EMIF_SDCFG_TYPE_DDR2                           0x2 << SDRAM_TYPE_SHIFT
+#define EMIF_SDCFG_TYPE_DDR3                           0x3 << SDRAM_TYPE_SHIFT
 #define EMIF_STATUS_READY                              0x4
 
 #define AM43XX_EMIF_PHY_CTRL_REG_COUNT                  0x120
@@ -245,6 +246,46 @@ emif_skip_restore_extra_regs:
 ENDPROC(ti_emif_restore_context)
 
 /*
+ * void ti_emif_run_hw_leveling(void)
+ *
+ * Used during resume to run hardware leveling again and restore the
+ * configuration of the EMIF PHY, only for DDR3.
+ */
+ENTRY(ti_emif_run_hw_leveling)
+       adr     r4, ti_emif_pm_sram_data
+       ldr     r0, [r4, #EMIF_PM_BASE_ADDR_PHYS_OFFSET]
+
+       ldr     r3, [r0, #EMIF_READ_WRITE_LEVELING_CONTROL]
+       orr     r3, r3, #RDWRLVLFULL_START
+       ldr     r2, [r0, #EMIF_SDRAM_CONFIG]
+       and     r2, r2, #SDRAM_TYPE_MASK
+       cmp     r2, #EMIF_SDCFG_TYPE_DDR3
+       bne     skip_hwlvl
+
+       str     r3, [r0, #EMIF_READ_WRITE_LEVELING_CONTROL]
+
+       /*
+        * If EMIF registers are touched during initial stage of HW
+        * leveling sequence there will be an L3 NOC timeout error issued
+        * as the EMIF will not respond, which is not fatal, but it is
+        * avoidable. This small wait loop is enough time for this condition
+        * to clear, even at worst case of CPU running at max speed of 1Ghz.
+        */
+       mov     r2, #0x2000
+1:
+       subs    r2, r2, #0x1
+       bne     1b
+
+       /* Bit clears when operation is complete */
+2:     ldr     r1, [r0, #EMIF_READ_WRITE_LEVELING_CONTROL]
+       tst     r1, #RDWRLVLFULL_START
+       bne     2b
+
+skip_hwlvl:
+       mov     pc, lr
+ENDPROC(ti_emif_run_hw_leveling)
+
+/*
  * void ti_emif_enter_sr(void)
  *
  * Programs the EMIF to tell the SDRAM to enter into self-refresh
index 1314605..e618013 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MemoryStick subsystem configuration
 #
index 9862359..61ea1d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel MemoryStick device drivers.
 #
index 1d38949..516f454 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MemoryStick core configuration
 #
index 0d7f90c..6b9b9ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel MemoryStick core.
 #
index aa2b078..446c93e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MemoryStick host controller drivers
 #
index a44b457..15720a4 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Realtek PCI-Express Memstick Card Interface driver
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 755676d..5fe5ecf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for MPT based block devices
 #
index 63ca984..ba770c5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig FUSION
        bool "Fusion MPT device support"
index 294d956..a17d275 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Multifunction miscellaneous devices
 #
index 54a58df..a5391f9 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * cros_ec_dev - expose the Chrome OS Embedded Controller to user-space
  *
  * Copyright (C) 2014 Google, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/fs.h>
index ec75043..7a42c3e 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * cros_ec_dev - expose the Chrome OS Embedded Controller to userspace
  *
  * Copyright (C) 2014 Google, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _CROS_EC_DEV_H_
index 7e425ff..fc6aa4c 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/clk-provider.h>
 #include <linux/debugfs.h>
 #include <linux/idr.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index 3209ee0..85fc771 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Misc strange devices
 #
@@ -59,30 +60,6 @@ config ATMEL_TCLIB
          blocks found on many Atmel processors.  This facilitates using
          these blocks by different drivers despite processor differences.
 
-config ATMEL_TCB_CLKSRC
-       bool "TC Block Clocksource"
-       depends on ATMEL_TCLIB
-       default y
-       help
-         Select this to get a high precision clocksource based on a
-         TC block with a 5+ MHz base clock rate.  Two timer channels
-         are combined to make a single 32-bit timer.
-
-         When GENERIC_CLOCKEVENTS is defined, the third timer channel
-         may be used as a clock event device supporting oneshot mode
-         (delays of up to two seconds) based on the 32 KiHz clock.
-
-config ATMEL_TCB_CLKSRC_BLOCK
-       int
-       depends on ATMEL_TCB_CLKSRC
-       default 0
-       range 0 1
-       help
-         Some chips provide more than one TC block, so you have the
-         choice of which one to use for the clock framework.  The other
-         TC can be used for other purposes, such as PWM generation and
-         interval timing.
-
 config DUMMY_IRQ
        tristate "Dummy IRQ handler"
        default n
@@ -496,30 +473,6 @@ config VEXPRESS_SYSCFG
          bus. System Configuration interface is one of the possible means
          of generating transactions on this bus.
 
-config ASPEED_P2A_CTRL
-       depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
-       tristate "Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC bridge control"
-       help
-         Control Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC mappings through
-         ioctl()s, the driver also provides an interface for userspace mappings to
-         a pre-defined region.
-
-config ASPEED_LPC_CTRL
-       depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
-       tristate "Aspeed ast2400/2500 HOST LPC to BMC bridge control"
-       ---help---
-         Control Aspeed ast2400/2500 HOST LPC to BMC mappings through
-         ioctl()s, the driver also provides a read/write interface to a BMC ram
-         region where the host LPC read/write region can be buffered.
-
-config ASPEED_LPC_SNOOP
-       tristate "Aspeed ast2500 HOST LPC snoop support"
-       depends on (ARCH_ASPEED || COMPILE_TEST) && REGMAP && MFD_SYSCON
-       help
-         Provides a driver to control the LPC snoop interface which
-         allows the BMC to listen on and save the data written by
-         the host to an arbitrary LPC I/O port.
-
 config PCI_ENDPOINT_TEST
        depends on PCI
        select CRC32
index c362395..b9affcd 100644 (file)
@@ -54,9 +54,6 @@ obj-$(CONFIG_GENWQE)          += genwqe/
 obj-$(CONFIG_ECHO)             += echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)  += vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)         += cxl/
-obj-$(CONFIG_ASPEED_LPC_CTRL)  += aspeed-lpc-ctrl.o
-obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
-obj-$(CONFIG_ASPEED_P2A_CTRL)  += aspeed-p2a-ctrl.o
 obj-$(CONFIG_PCI_ENDPOINT_TEST)        += pci_endpoint_test.o
 obj-$(CONFIG_OCXL)             += ocxl/
 obj-y                          += cardreader/
index 8a828fe..b348635 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 comment "Altera FPGA firmware download module (requires I2C)"
        depends on !I2C
 
index 055f61e..dd0f818 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o
 
 obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o
index ac24a4b..08b5b63 100644 (file)
@@ -1,4 +1,4 @@
-#include <linux/atmel_tc.h>
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/of.h>
+#include <soc/at91/atmel_tcb.h>
 
 /*
  * This is a thin library to solve the problem of how to portably allocate
@@ -111,6 +112,9 @@ static int __init tc_probe(struct platform_device *pdev)
        struct resource *r;
        unsigned int    i;
 
+       if (of_get_child_count(pdev->dev.of_node))
+               return -EBUSY;
+
        irq = platform_get_irq(pdev, 0);
        if (irq < 0)
                return -EINVAL;
index 0dd690e..192e250 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # C2 port devices
 #
index 3b2cf43..1dfe6ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_C2PORT)           += core.o
 
 obj-$(CONFIG_C2PORT_DURAMAR_2150)      += c2port-duramar2150.o
index ed8993b..022322d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MISC_ALCOR_PCI
        tristate "Alcor Micro/Alcor Link PCI-E card reader"
        depends on PCI
index 9882d2a..d9bff5a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MISC_ALCOR_PCI)   += alcor_pci.o
 obj-$(CONFIG_MISC_RTSX_PCI)    += rtsx_pci.o
 rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o rts5260.o
index 434fd07..489ebe9 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  *   Roger Tseng <rogerable@realtek.com>
index ce68c48..6590561 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 5c98e22..4feed29 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  *   Roger Tseng <rogerable@realtek.com>
index 9119261..9f080a3 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 0f72a7e..db936e4 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 4e285ad..40a6d19 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2016-2017 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Steven FENG <steven_feng@realsil.com.cn>
  *   Rui FENG <rui_feng@realsil.com.cn>
index 0d320e0..b4a66b6 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 300fc31..98f7292 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index 22429b8..3c7356d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CB710_CORE
        tristate "ENE CB710/720 Flash memory card reader support"
        depends on PCI
index 467c8e9..8a38c66 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-$(CONFIG_CB710_DEBUG)  := -DDEBUG
 
 obj-$(CONFIG_CB710_CORE)       += cb710.o
index 3ce9337..f1d9a84 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IBM Coherent Accelerator (CXL) compatible devices
 #
index f1d41ea..3965641 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ECHO
        tristate "Line Echo Canceller support"
        default n
index 7d4caac..5b97467 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ECHO) += echo.o
index a846fae..f880947 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "EEPROM support"
 
 config EEPROM_AT24
index 4c0a033..a8a6087 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IBM Accelerator Family 'GenWQE'
 #
index 98a2b4f..d9811ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for GenWQE driver
 #
index 99db2b8..8eb5d38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HabanaLabs AI accelerators driver
 #
index f8e8524..482f622 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for HabanaLabs AI accelerators driver
 #
index 131432f..bd76908 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 subdir-ccflags-y += -I$(src)
 
 HL_GOYA_FILES :=  goya/goya.o goya/goya_security.o goya/goya_hwmgr.o \
index 8f474e6..4cfad45 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STMicroelectonics LIS3LV02D and similar accelerometers
 #
index 4bf58b1..137e702 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STMicroelectonics LIS3LV02D and similar accelerometers
 #
index 6736f72..948f45b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Intel MIC & related support"
 
 comment "Intel MIC Bus Driver"
index 8758a7d..0a6aa21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile - Intel MIC Linux driver.
 # Copyright(c) 2014, Intel Corporation.
index 6f751a5..5b62270 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile - Intel MIC COSM Client Driver
 # Copyright(c) 2015, Intel Corporation.
index 78819c8..579da38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile - Intel MIC Linux driver.
 # Copyright(c) 2016, Intel Corporation.
index 4bbdb0d..7fb6d39 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Open Coherent Accelerator (OCXL) compatible devices
 #
index 0003a1d..8132116 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-$(CONFIG_SGI_GRU_DEBUG)        := -DDEBUG
 
 obj-$(CONFIG_SGI_GRU) := gru.o
index 80d8cbe..f30448b 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Generic on-chip SRAM allocation driver
  *
  * Copyright (C) 2012 Philipp Zabel, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/clk.h>
index 5bb9269..1503a64 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TI's shared transport line discipline and the protocol
 # drivers (BT, FM and GPS)
index 78d7ebb..9339310 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for TI's shared transport line discipline
 # and its protocol drivers (BT, FM, GPS)
index 39c2eca..605794a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # VMware VMCI device
 #
index 4da9893..475fa31 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci.o
 vmw_vmci-y += vmci_context.o vmci_datagram.o vmci_doorbell.o \
        vmci_driver.o vmci_event.o vmci_guest.o vmci_handle_array.o \
index ec21388..2436eb4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MMC subsystem configuration
 #
index 26ab7af..3ea0126 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel mmc device drivers.
 #
index 2f38a7a..c12fe13 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MMC core configuration
 #
index 0e86340..931770f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MMC/SD host controller drivers
 #
index ec980bd..b61de36 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/of_platform.h>
index e22bbff..9cb93e1 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/unaligned.h>
 
 #include "mvsdio.h"
index c021d43..b334e81 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Portions copyright (C) 2003 Russell King, PXA MMCI Driver
  * Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver
  *
  * Copyright 2008 Embedded Alley Solutions, Inc.
  * Copyright 2009-2011 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/kernel.h>
index c1d3f0e..e7d80c8 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <mach/hardware.h>
 #include <linux/platform_data/mmc-pxamci.h>
index 30bd808..bd50935 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Realtek PCI-Express SD/MMC Card Interface driver
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index a611217..18638fb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/mmc/sdhci-pci-data.h>
 
index 5eada6f..e431432 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SDHCI support for SiRF primaII and marco SoCs
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/delay.h>
index 39ec32a..a7e47e0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "RAM/ROM/Flash chip drivers"
        depends on MTD!=n
 
index 0bbc61b..ff86373 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Registration for chip drivers
  *
index f7a5bca..fc68557 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common code to handle absent "placeholder" devices
  * Copyright 2001 Resilience Corporation <ebrower@resilience.com>
index f9258d6..ef0e476 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Self-contained MTD device drivers"
        depends on MTD!=n
        depends on HAS_IOMEM
index 9baa81b..eccf2e5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
index 8a8627c..c467286 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /**
  * Copyright (c) ????          Jochen Schäuble <psionic@psionic.de>
  * Copyright (c) 2003-2004     Joern Engel <joern@wh.fh-wedel.de>
index 10183ee..28131a1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*======================================================================
 
   This driver provides a method to access memory not used by the kernel
index a5a332f..0395aa6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "LPDDR & LPDDR2 PCM memory drivers"
        depends on MTD
 
index 881d440..b217b82 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # linux/drivers/mtd/lpddr/Makefile
 #
index 76a4c73..1efc643 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * LPDDR flash memory device operations. This module provides read, write,
  * erase, lock/unlock support for LPDDR flash memories
@@ -5,20 +6,6 @@
  * (C) 2008 Vasiliy Leonenko <vasiliy.leonenko@gmail.com>
  * Many thanks to Roman Borisov for initial enabling
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  * TODO:
  * Implement VPP management
  * Implement XIP support
index 175bdc3..137ae5f 100644 (file)
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Probing flash chips with QINFO records.
  * (C) 2008 Korolev Alexey <akorolev@infradead.org>
  * (C) 2008 Vasiliy Leonenko <vasiliy.leonenko@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 #include <linux/module.h>
 #include <linux/types.h>
index 544ed19..bc82305 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Mapping drivers for chip access"
        depends on MTD!=n
        depends on HAS_IOMEM
index 26de0a1..462fadb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * amd76xrom.c
  *
index 584962e..c9b7b4d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ck804xrom.c
  *
index da9f6d7..5c27c69 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * esb2rom.c
  *
index 1888c5b..6b989f3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ichxrom.c
  *
index e3180d5..d854320 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * drivers/mtd/maps/ixp4xx.c
  *
index 74bd98e..876f12f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * BIOS Flash chip on Intel 440GX board.
  *
index 3f26837..5b684c1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS
  * is enabled.
index 729579f..50046d4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /****************************************************************************/
 
 /*
index fd5fe12..895510d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Flash memory access on SA11x0 based devices
  *
@@ -20,7 +21,7 @@
 #include <linux/mtd/concat.h>
 
 #include <mach/hardware.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/mach/flash.h>
 
 struct sa_subdev_info {
index b7a22a6..2afb253 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * MTD map driver for BIOS Flash on Intel SCB2 boards
  * Copyright (C) 2002 Sun Microsystems, Inc.
index 7f1a0e6..8462662 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* linux/drivers/mtd/maps/scx200_docflash.c
 
    Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
index 1e73bba..eb72582 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* sun_uflash.c - Driver for user-programmable flash on
  *                Sun Microsystems SME boardsets.
  *
index 495751e..a5d8a21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MTD_NAND_CORE
        tristate
 
index 9dc1574..ae0b8fe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MTD_ONENAND
        tristate "OneNAND Device Support"
        depends on MTD
index 0500c42..5a711d8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MTD_NAND_ECC_SW_HAMMING
        tristate
 
index 288db4f..27c2dd5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTD_NAND_ATMEL)   += atmel-nand-controller.o atmel-pmecc.o
 
 atmel-nand-controller-objs     := nand-controller.o
index f05b119..b531a63 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 bcm47xxnflash-y                                += main.o
 bcm47xxnflash-y                                += ops_bcm4706.o
 
index b1c0cd6..2d1c22d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for One Laptop Per Child ‘CAFÉ’ controller, aka Marvell 88ALP01
  *
index f430c4b..c0e1a8e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * (C) 2003 Red Hat, Inc.
  * (C) 2004 Dan Brown <dan_brown@ieee.org>
index 3a46248..30ceee9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTD_NAND_GPMI_NAND) += gpmi_nand.o
 gpmi_nand-objs += gpmi-nand.o
 gpmi_nand-objs += gpmi-lib.o
index 05bb91f..a22b8a5 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Freescale GPMI NAND Flash Driver
  *
  * Copyright 2008-2011 Freescale Semiconductor, Inc.
  * Copyright 2008 Embedded Alley Solutions, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #ifndef __GPMI_NAND_BCH_REGS_H
 #define __GPMI_NAND_BCH_REGS_H
index d92bf32..f5e4f26 100644 (file)
@@ -1,22 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Freescale GPMI NAND Flash Driver
  *
  * Copyright 2008-2011 Freescale Semiconductor, Inc.
  * Copyright 2008 Embedded Alley Solutions, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #ifndef __GPMI_NAND_GPMI_REGS_H
 #define __GPMI_NAND_GPMI_REGS_H
index 7cfc770..19a96ce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MTD_NAND_JZ4740
        tristate "JZ4740 NAND controller"
        depends on MACH_JZ4740 || COMPILE_TEST
index ab2c5f4..1ac4f45 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
 obj-$(CONFIG_MTD_NAND_JZ4780) += ingenic_nand.o
 
index 062cd1e..8b90def 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2004-2008 Freescale Semiconductor, Inc.
  * Copyright 2009 Semihalf.
@@ -8,20 +9,6 @@
  * Based on original driver from Freescale Semiconductor
  * written by John Rigby <jrigby@freescale.com> on basis of mxc_nand.c.
  * Reworked and extended by Piotr Ziecik <kosmo@semihalf.com>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/module.h>
index 6d43ddb..e4fe8c4 100644 (file)
@@ -364,7 +364,7 @@ static int vf610_nfc_cmd(struct nand_chip *chip,
 {
        const struct nand_op_instr *instr;
        struct vf610_nfc *nfc = chip_to_nfc(chip);
-       int op_id = -1, trfr_sz = 0, offset;
+       int op_id = -1, trfr_sz = 0, offset = 0;
        u32 col = 0, row = 0, cmd1 = 0, cmd2 = 0, code = 0;
        bool force8bit = false;
 
index 7c37d29..da89b25 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MTD_SPI_NAND
        tristate "SPI NAND device Support"
        select MTD_NAND_CORE
index bc20132..176b75a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MTD_PARSER_IMAGETAG
        tristate "Parser for BCM963XX Image Tag format partitions"
        depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST
index cddc8f3..dd566bd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTD_PARSER_IMAGETAG)      += parser_imagetag.o
 obj-$(CONFIG_MTD_AFS_PARTS)            += afs.o
 obj-$(CONFIG_MTD_PARSER_TRX)           += parser_trx.o
index 94720f2..3d1df82 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * rfd_ftl.c -- resident flash disk (flash translation layer)
  *
index dab9866..8e14248 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MTD_SPI_NOR
        tristate "SPI-NOR device support"
        depends on MTD
index dea7b0c..dea43ea 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * HiSilicon SPI Nor Flash Controller Driver
  *
  * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/bitops.h>
 #include <linux/clk.h>
index 73b0630..13bca9e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt)    KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
index 43d131f..2ed77b7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MTD_UBI
        tristate "Enable UBI - Unsorted block images"
        select CRC32
index bc42f13..48e209e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Network device configuration
 #
index dc6b78e..af509b0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Appletalk driver configuration
 #
index 6cfc705..903da33 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for drivers/net/appletalk
 #
index 39bd16f..faeb441 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Arcnet configuration
 #
index 6f4e808..30e8ae3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Ethernet Bonding driver
 #
index 9431127..790e41c 100644 (file)
@@ -1,22 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
  */
 
 #include <linux/skbuff.h>
index 3584725..94214ea 100644 (file)
@@ -1,22 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright(c) 2004-2005 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index f81df91..2b9a2f1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # CAIF physical drivers
 #
index e0f0ad7..ab58590 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "CAN Device Drivers"
 
 config CAN_VCAN
index 61ffc12..b0f206d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig CAN_C_CAN
        tristate "Bosch C_CAN/D_CAN devices"
        depends on HAS_IOMEM
index 9fdc678..e6a94c9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Makefile for the Bosch C_CAN controller drivers.
 #
index 6a9a5ba..13a4593 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig CAN_CC770
        tristate "Bosch CC770 and Intel AN82527 devices"
        depends on HAS_IOMEM
index 8657f87..65e8549 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Makefile for the Bosch CC770 CAN controller drivers.
 #
index 9e8934f..ce01976 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAN_IFI_CANFD
        depends on HAS_IOMEM
        tristate "IFI CAN_FD IP"
index b229960..0cd724f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Makefile for the IFI CANFD controller driver.
 #
index 04f20dd..ec4b2e1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAN_M_CAN
        depends on HAS_IOMEM
        tristate "Bosch M_CAN devices"
index 8bbd7f2..599ae69 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Makefile for the Bosch M_CAN controller driver.
 #
index 81c7117..3a57a51 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAN_MSCAN
        depends on PPC
        tristate "Support for Freescale MSCAN based chips"
index 58903b4..6c114be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_CAN_MPC5XXX)      += mscan-mpc5xxx.o
 mscan-mpc5xxx-objs             := mscan.o mpc5xxx_can.o
index 84b3097..c29ab21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAN_PEAK_PCIEFD
        depends on PCI
        tristate "PEAK-System PCAN-PCIe FD cards"
index 3dc7a6a..14719b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the PEAK-System CAN-FD IP module drivers
 #
index f6dc899..6b72da2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig CAN_SJA1000
        tristate "Philips/NXP SJA1000 devices"
        depends on HAS_IOMEM
index 7957245..6ea802c 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * tscan1.c: driver for Technologic Systems TS-CAN1 PC104 boards
  *
  * Copyright 2010 Andre B. Oliveira
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 96b6fe1..0f1708f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CAN_SOFTING
        tristate "Softing Gmbh CAN generic support"
        depends on HAS_IOMEM
index a23da49..c511540 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 softing-y := softing_main.o softing_fw.o
 obj-$(CONFIG_CAN_SOFTING) += softing.o
index 8f2e0dd..2e7e535 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "CAN SPI interfaces"
        depends on SPI
 
index f59fa37..f115b2c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Makefile for the Linux Controller Area Network SPI drivers.
 #
index 750d04d..ac3522b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "CAN USB interfaces"
        depends on USB
 
index 9f41dda..cf26004 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb.o
 kvaser_usb-y = kvaser_usb_core.o kvaser_usb_leaf.o kvaser_usb_hydra.o
index 1839e9c..80789f9 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CAN_PEAK_USB) += peak_usb.o
 peak_usb-y = pcan_usb_core.o pcan_usb.o pcan_usb_pro.o pcan_usb_fd.o
index c6c5ecd..b91e78e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Distributed Switch Architecture drivers"
        depends on HAVE_NET_DSA
 
index d324692..f9891a8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig B53
        tristate "Broadcom BCM53xx managed switch support"
        depends on NET_DSA
index fb8d5dc..237066d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/phy.h>
index bea29fd..2c3a675 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_DSA_MICROCHIP_KSZ_COMMON
        tristate
 
index 3142c18..68451b0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON)     += ksz_common.o
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477)                += ksz9477.o
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477_SPI)    += ksz9477_spi.o
index ae9e7f7..6435020 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_DSA_MV88E6XXX
        tristate "Marvell 88E6xxx Ethernet switch fabric support"
        depends on NET_DSA
index 757751a..1144fc5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_DSA_SJA1105
 tristate "NXP SJA1105 Ethernet switch family support"
        depends on NET_DSA && SPI
index 1c2b55f..941848d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NET_DSA_SJA1105) += sja1105.o
 
 sja1105-objs := \
index 3568129..54e4d8b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* dummy.c: a dummy net driver
 
        The purpose of this driver is to provide a device to point a
index 0ac44ef..3a6fc99 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 3Com Ethernet device configuration
 #
index a43544a..78f3e53 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 8390 core for usual drivers */
 
 static const char version[] =
index 46d2257..6cf3699 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 8390 core for ISA devices needing bus delays */
 
 static const char version[] =
index f2f0264..bb09319 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 8390 device configuration
 #
index 885e00d..fe115b7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Ethernet LAN device configuration
 #
index 822cffb..86e02da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Adaptec network device configuration
 #
index 6c07b75..d84138c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Adaptec network device drivers.
 #
index 4f4a8d7..2fa0a31 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Aeroflex Gaisler network device configuration
 #
index 6e62a67..1b18ef0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Aeroflex Gaisler network device drivers.
 #
index b6fe920..084c719 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Agere device configuration
 #
index 027ff94..8dbdf66 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Agere ET-131x ethernet driver
 #
index 09496e1..212f92c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_VENDOR_ALACRITECH
        bool "Alacritech devices"
        default y
index 8790e9e..4378aad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Alacritech Slicoss driver
 #
index 47da7e7..a5e2bcb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Allwinner device configuration
 #
index 03129f7..ddd5a50 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Allwinner device drivers.
 #
index e06ccab..c3f7067 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Alteon network device configuration
 #
index a2ca173..be52255 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Alteon network device drivers.
 #
index fdddba5..2690c39 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ALTERA_TSE
        tristate "Altera Triple-Speed Ethernet MAC support"
        depends on HAS_DMA
index d4a187e..a52db80 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Altera device drivers.
 #
index 9e87d7b..69ca99d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Amazon network device configuration
 #
index 8e0b73f..f614f23 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Amazon network device drivers.
 #
index eaeeae0..f1f752a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Elastic Network Adapter (ENA) device drivers.
 #
index dc57f27..ab30761 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * 7990.c -- LANCE ethernet IC generic routines.
  * This is an attempt to separate out the bits of various ethernet
index 9e5cf55..de4950d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # AMD network device configuration
 #
index 145fe71..573e88f 100644 (file)
@@ -1,8 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /* Advanced  Micro Devices Inc. AMD8111E Linux Network Driver
  * Copyright (C) 2004 Advanced Micro Devices
  *
- *
  * Copyright 2001,2002 Jeff Garzik <jgarzik@mandrakesoft.com> [ 8139cp.c,tg3.c ]
  * Copyright (C) 2001, 2002 David S. Miller (davem@redhat.com)[ tg3.c]
  * Copyright 1996-1999 Thomas Bogendoerfer [ pcnet32.c ]
  * Carsten Langgaard, carstenl@mips.com [ pcnet32.c ]
  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
  *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 Module Name:
 
index 2a57b46..493f154 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Advanced  Micro Devices Inc. AMD8111E Linux Network Driver
  * Copyright (C) 2003 Advanced Micro Devices
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 Module Name:
 
index 9f23703..dac4a2f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *    Lance ethernet driver for the MIPS processor based
  *      DECstation family
index c3dbf1c..1381a47 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* hplance.c  : the  Linux/hp300/lance ethernet driver
  *
  * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk>
index 0a92044..72abd3f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* mvme147.c  : the  Linux/mvme147/lance ethernet driver
  *
  * Copyright (C) 05/1998 Peter Maydell <pmaydell@chiark.greenend.org.uk>
index bd6589d..ebcbf8c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* $Id: sunlance.c,v 1.112 2002/01/15 06:48:55 davem Exp $
  * lance.c: Linux/Sparc/Lance driver
  *
index 59efe5b..a893ef0 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 source "drivers/net/ethernet/apm/xgene/Kconfig"
 source "drivers/net/ethernet/apm/xgene-v2/Kconfig"
index 946b2a4..cc8af97 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for APM X-GENE Ethernet driver.
 #
index eedd3f3..2274af9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_XGENE_V2
        tristate "APM X-Gene SoC Ethernet-v2 Driver"
        depends on ARCH_XGENE || COMPILE_TEST
index f16a2b3..fdde3b6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for APM X-Gene Ethernet v2 driver
 #
index 5998da0..a8c6b37 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index 3fd36dc..15cbd0c 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_V2_ENET_H__
index d31ad82..a58250c 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index 54b48d5..8263b4a 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_V2_ETHTOOL_H__
index ee431e3..2da979e 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index 3c83fa6..7392f60 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_V2_MAC_H__
index 87b142a..79048cc 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index 969b258..d41439d 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_V2_MAIN_H__
index 53529cd..eba0683 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index 3881082..fbea4bc 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
index abc8c9a..2fd2555 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Applied Micro X-Gene SoC Ethernet v2 Driver
  *
  * Copyright (c) 2017, Applied Micro Circuits Corporation
  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  *           Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_V2_RING_H__
index e4e33c9..7bdfe78 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_XGENE
        tristate "APM X-Gene SoC Ethernet Driver"
        depends on ARCH_XGENE || COMPILE_TEST
index f46321f..6d13147 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for APM X-Gene Ethernet Driver.
 #
index e1a51d8..de54643 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Classifier structures
  *
  * Copyright (c) 2016, Applied Micro Circuits Corporation
  * Authors: Khuong Dinh <kdinh@apm.com>
  *          Tanmay Inamdar <tinamdar@apm.com>
  *          Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "xgene_enet_main.h"
index 18fe8d5..bc05cbc 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Classifier structures
  *
  * Copyright (c) 2016, Applied Micro Circuits Corporation
  * Authors: Khuong Dinh <kdinh@apm.com>
  *          Tanmay Inamdar <tinamdar@apm.com>
  *          Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_CLE_H__
index 78dd09b..246dec2 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/ethtool.h>
index e356031..61a4650 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Ravi Patel <rapatel@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "xgene_enet_main.h"
index 5d3e18d..2f534f9 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Ravi Patel <rapatel@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_HW_H__
index 50dd6bf..10b1c05 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Ravi Patel <rapatel@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/gpio.h>
index 9857685..18f4923 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Ravi Patel <rapatel@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_MAIN_H__
index 4ff4055..02892ef 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2015, Applied Micro Circuits Corporation
  * Author: Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "xgene_enet_main.h"
index 8b235db..4e2edee 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2015, Applied Micro Circuits Corporation
  * Author: Iyappan Subramanian <isubramanian@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_RING2_H__
index b1a83fd..6453fc2 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "xgene_enet_main.h"
index 3d0ba37..3bba0ce 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_SGMAC_H__
index b7d75d0..133eb91 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/of_gpio.h>
index a3b4551..98622dc 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Applied Micro X-Gene SoC Ethernet Driver
  *
  * Copyright (c) 2014, Applied Micro Circuits Corporation
  * Authors: Iyappan Subramanian <isubramanian@apm.com>
  *         Keyur Chudgar <kchudgar@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __XGENE_ENET_XGMAC_H__
index 3107129..fde7ae3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Apple device configuration
 #
index 86eaa17..3224570 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Apple network device drivers.
 #
index 4d3855c..c40daad 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Network device driver for the BMAC ethernet controller on
  * Apple Powermacs.  Assumes it's under a DBDMA controller.
index 4d9819d..b8ba2ab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Network device driver for the MACE ethernet controller on
  * Apple Powermacs.  Assumes it's under a DBDMA controller.
index 12472c5..350a48e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # aQuantia device configuration
 #
index 4f4897b..c4e7d01 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the aQuantia device drivers.
 #
index 5d0ab8e..45c663d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ARC EMAC network device configuration
 #
index 79108af..d63ada5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the ARC network device drivers.
 #
index e05b256..953ff1f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Atheros device configuration
 #
index ed4a605..fec7885 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ALX) += alx.o
 alx-objs := main.o ethtool.o hw.o
index c37d966..02d0250 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ATL1C) += atl1c.o
 atl1c-objs := atl1c_main.o atl1c_hw.o atl1c_ethtool.o
index bc11be8..8506694 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ATL1E)    += atl1e.o
 atl1e-objs             += atl1e_main.o atl1e_hw.o atl1e_ethtool.o atl1e_param.o
index e4f6022..df030e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ATL1)     += atl1.o
 obj-$(CONFIG_ATL2)     += atl2.o
 
index 392f564..9ee30ea 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_VENDOR_AURORA
        bool "Aurora VLSI devices"
        default y
index 6cb528a..f3d5998 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AURORA_NB8800) += nb8800.o
index 461b2c0..b123509 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Broadcom device configuration
 #
index 116762d..9fdfaa2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Broadcom 10-Gigabit ethernet driver
 #
index 5a779b1..cb97ec5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BNXT) += bnxt_en.o
 
 bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o bnxt_dcb.o bnxt_ulp.o bnxt_xdp.o bnxt_vfr.o bnxt_devlink.o bnxt_dim.o
index 8314c00..f758b2e 100644 (file)
@@ -1642,6 +1642,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
                skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
                bnxt_reuse_rx_data(rxr, cons, data);
                if (!skb) {
+                       if (agg_bufs)
+                               bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
                        rc = -ENOMEM;
                        goto next_rx;
                }
@@ -6377,7 +6379,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp)
        if (!ctx || (ctx->flags & BNXT_CTX_FLAG_INITED))
                return 0;
 
-       if (bp->flags & BNXT_FLAG_ROCE_CAP) {
+       if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) {
                pg_lvl = 2;
                extra_qps = 65536;
                extra_srqs = 8192;
@@ -7616,22 +7618,23 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
        bp->flags &= ~BNXT_FLAG_USING_MSIX;
 }
 
-int bnxt_reserve_rings(struct bnxt *bp)
+int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
 {
        int tcs = netdev_get_num_tc(bp->dev);
-       bool reinit_irq = false;
+       bool irq_cleared = false;
        int rc;
 
        if (!bnxt_need_reserve_rings(bp))
                return 0;
 
-       if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) {
+       if (irq_re_init && BNXT_NEW_RM(bp) &&
+           bnxt_get_num_msix(bp) != bp->total_irqs) {
                bnxt_ulp_irq_stop(bp);
                bnxt_clear_int_mode(bp);
-               reinit_irq = true;
+               irq_cleared = true;
        }
        rc = __bnxt_reserve_rings(bp);
-       if (reinit_irq) {
+       if (irq_cleared) {
                if (!rc)
                        rc = bnxt_init_int_mode(bp);
                bnxt_ulp_irq_restart(bp, rc);
@@ -8530,7 +8533,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
                        return rc;
                }
        }
-       rc = bnxt_reserve_rings(bp);
+       rc = bnxt_reserve_rings(bp, irq_re_init);
        if (rc)
                return rc;
        if ((bp->flags & BNXT_FLAG_RFS) &&
@@ -10434,7 +10437,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
 
        if (sh)
                bp->flags |= BNXT_FLAG_SHARED_RINGS;
-       dflt_rings = netif_get_num_default_rss_queues();
+       dflt_rings = is_kdump_kernel() ? 1 : netif_get_num_default_rss_queues();
        /* Reduce default rings on multi-port cards so that total default
         * rings do not exceed CPU count.
         */
@@ -10722,11 +10725,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto init_err_pci_clean;
        }
 
-       /* Read the adapter's DSN to use as the eswitch switch_id */
-       rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
-       if (rc)
-               goto init_err_pci_clean;
-
+       if (BNXT_PF(bp)) {
+               /* Read the adapter's DSN to use as the eswitch switch_id */
+               rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
+               if (rc)
+                       goto init_err_pci_clean;
+       }
        bnxt_hwrm_func_qcfg(bp);
        bnxt_hwrm_vnic_qcaps(bp);
        bnxt_hwrm_port_led_qcaps(bp);
index eca36dd..be438d8 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/interrupt.h>
 #include <linux/rhashtable.h>
+#include <linux/crash_dump.h>
 #include <net/devlink.h>
 #include <net/dst_metadata.h>
 #include <net/xdp.h>
@@ -1369,7 +1370,8 @@ struct bnxt {
 #define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
 #define BNXT_RX_PAGE_MODE(bp)  ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
 #define BNXT_SUPPORTS_TPA(bp)  (!BNXT_CHIP_TYPE_NITRO_A0(bp) &&        \
-                                !(bp->flags & BNXT_FLAG_CHIP_P5))
+                                !(bp->flags & BNXT_FLAG_CHIP_P5) &&    \
+                                !is_kdump_kernel())
 
 /* Chip class phase 5 */
 #define BNXT_CHIP_P5(bp)                       \
@@ -1790,7 +1792,7 @@ unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp);
 unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp);
 unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp);
 int bnxt_get_avail_msix(struct bnxt *bp, int num);
-int bnxt_reserve_rings(struct bnxt *bp);
+int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init);
 void bnxt_tx_disable(struct bnxt *bp);
 void bnxt_tx_enable(struct bnxt *bp);
 int bnxt_hwrm_set_pause(struct bnxt *);
index b126382..a6c7baf 100644 (file)
@@ -831,7 +831,7 @@ static int bnxt_set_channels(struct net_device *dev,
                         */
                }
        } else {
-               rc = bnxt_reserve_rings(bp);
+               rc = bnxt_reserve_rings(bp, true);
        }
 
        return rc;
index cf47587..bfa342a 100644 (file)
@@ -147,7 +147,7 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,
                        bnxt_close_nic(bp, true, false);
                        rc = bnxt_open_nic(bp, true, false);
                } else {
-                       rc = bnxt_reserve_rings(bp);
+                       rc = bnxt_reserve_rings(bp, true);
                }
        }
        if (rc) {
index 9b6885e..edfc26a 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCMGENET) += genet.o
 genet-objs := bcmgenet.o bcmmii.o bcmgenet_wol.o
index 134ae28..1604ad3 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2001,2002,2003,2004 Broadcom Corporation
  * Copyright (c) 2006, 2007  Maciej W. Rozycki
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- *
  * This driver is designed for the Broadcom SiByte SOC built-in
  * Ethernet controllers. Written by Mitch Lichtenberg at Broadcom Corp.
  *
index c4bbe54..d4564c7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # QLogic BR-series device configuration
 #
index fec10f9..88b2f40 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the QLogic BR-series device drivers.
 #
index fe01279..b124a62 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # QLogic BR-series network device configuration
 #
index 8584abc..d804b30 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
 # Copyright (c) 2014-2015 QLogic Corporation.
index b998401..1766697 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Atmel device configuration
 #
index acc66a7..00ee5e8 100644 (file)
@@ -1080,6 +1080,11 @@ struct macb_ptp_info {
                         struct ifreq *ifr, int cmd);
 };
 
+struct macb_pm_data {
+       u32 scrt2;
+       u32 usrio;
+};
+
 struct macb_config {
        u32                     caps;
        unsigned int            dma_burst_length;
@@ -1220,6 +1225,8 @@ struct macb {
        int     tx_bd_rd_prefetch;
 
        u32     rx_intr_mask;
+
+       struct macb_pm_data pm_data;
 };
 
 #ifdef CONFIG_MACB_USE_HWSTAMP
index bebd9b1..f825e39 100644 (file)
@@ -2849,10 +2849,14 @@ static int macb_get_ts_info(struct net_device *netdev,
 
 static void gem_enable_flow_filters(struct macb *bp, bool enable)
 {
+       struct net_device *netdev = bp->dev;
        struct ethtool_rx_fs_item *item;
        u32 t2_scr;
        int num_t2_scr;
 
+       if (!(netdev->features & NETIF_F_NTUPLE))
+               return;
+
        num_t2_scr = GEM_BFEXT(T2SCR, gem_readl(bp, DCFG8));
 
        list_for_each_entry(item, &bp->rx_fs_list.list, list) {
@@ -3012,8 +3016,7 @@ static int gem_add_flow_filter(struct net_device *netdev,
        gem_prog_cmp_regs(bp, fs);
        bp->rx_fs_list.count++;
        /* enable filtering if NTUPLE on */
-       if (netdev->features & NETIF_F_NTUPLE)
-               gem_enable_flow_filters(bp, 1);
+       gem_enable_flow_filters(bp, 1);
 
        spin_unlock_irqrestore(&bp->rx_fs_lock, flags);
        return 0;
@@ -3201,6 +3204,50 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        }
 }
 
+static inline void macb_set_txcsum_feature(struct macb *bp,
+                                          netdev_features_t features)
+{
+       u32 val;
+
+       if (!macb_is_gem(bp))
+               return;
+
+       val = gem_readl(bp, DMACFG);
+       if (features & NETIF_F_HW_CSUM)
+               val |= GEM_BIT(TXCOEN);
+       else
+               val &= ~GEM_BIT(TXCOEN);
+
+       gem_writel(bp, DMACFG, val);
+}
+
+static inline void macb_set_rxcsum_feature(struct macb *bp,
+                                          netdev_features_t features)
+{
+       struct net_device *netdev = bp->dev;
+       u32 val;
+
+       if (!macb_is_gem(bp))
+               return;
+
+       val = gem_readl(bp, NCFGR);
+       if ((features & NETIF_F_RXCSUM) && !(netdev->flags & IFF_PROMISC))
+               val |= GEM_BIT(RXCOEN);
+       else
+               val &= ~GEM_BIT(RXCOEN);
+
+       gem_writel(bp, NCFGR, val);
+}
+
+static inline void macb_set_rxflow_feature(struct macb *bp,
+                                          netdev_features_t features)
+{
+       if (!macb_is_gem(bp))
+               return;
+
+       gem_enable_flow_filters(bp, !!(features & NETIF_F_NTUPLE));
+}
+
 static int macb_set_features(struct net_device *netdev,
                             netdev_features_t features)
 {
@@ -3208,39 +3255,35 @@ static int macb_set_features(struct net_device *netdev,
        netdev_features_t changed = features ^ netdev->features;
 
        /* TX checksum offload */
-       if ((changed & NETIF_F_HW_CSUM) && macb_is_gem(bp)) {
-               u32 dmacfg;
-
-               dmacfg = gem_readl(bp, DMACFG);
-               if (features & NETIF_F_HW_CSUM)
-                       dmacfg |= GEM_BIT(TXCOEN);
-               else
-                       dmacfg &= ~GEM_BIT(TXCOEN);
-               gem_writel(bp, DMACFG, dmacfg);
-       }
+       if (changed & NETIF_F_HW_CSUM)
+               macb_set_txcsum_feature(bp, features);
 
        /* RX checksum offload */
-       if ((changed & NETIF_F_RXCSUM) && macb_is_gem(bp)) {
-               u32 netcfg;
-
-               netcfg = gem_readl(bp, NCFGR);
-               if (features & NETIF_F_RXCSUM &&
-                   !(netdev->flags & IFF_PROMISC))
-                       netcfg |= GEM_BIT(RXCOEN);
-               else
-                       netcfg &= ~GEM_BIT(RXCOEN);
-               gem_writel(bp, NCFGR, netcfg);
-       }
+       if (changed & NETIF_F_RXCSUM)
+               macb_set_rxcsum_feature(bp, features);
 
        /* RX Flow Filters */
-       if ((changed & NETIF_F_NTUPLE) && macb_is_gem(bp)) {
-               bool turn_on = features & NETIF_F_NTUPLE;
+       if (changed & NETIF_F_NTUPLE)
+               macb_set_rxflow_feature(bp, features);
 
-               gem_enable_flow_filters(bp, turn_on);
-       }
        return 0;
 }
 
+static void macb_restore_features(struct macb *bp)
+{
+       struct net_device *netdev = bp->dev;
+       netdev_features_t features = netdev->features;
+
+       /* TX checksum offload */
+       macb_set_txcsum_feature(bp, features);
+
+       /* RX checksum offload */
+       macb_set_rxcsum_feature(bp, features);
+
+       /* RX Flow Filters */
+       macb_set_rxflow_feature(bp, features);
+}
+
 static const struct net_device_ops macb_netdev_ops = {
        .ndo_open               = macb_open,
        .ndo_stop               = macb_close,
@@ -4273,6 +4316,12 @@ static int __maybe_unused macb_suspend(struct device *dev)
                spin_lock_irqsave(&bp->lock, flags);
                macb_reset_hw(bp);
                spin_unlock_irqrestore(&bp->lock, flags);
+
+               if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
+                       bp->pm_data.usrio = macb_or_gem_readl(bp, USRIO);
+
+               if (netdev->hw_features & NETIF_F_NTUPLE)
+                       bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
        }
 
        netif_carrier_off(netdev);
@@ -4301,6 +4350,13 @@ static int __maybe_unused macb_resume(struct device *dev)
                disable_irq_wake(bp->queues[0].irq);
        } else {
                macb_writel(bp, NCR, MACB_BIT(MPE));
+
+               if (netdev->hw_features & NETIF_F_NTUPLE)
+                       gem_writel_n(bp, ETHT, SCRT2_ETHT, bp->pm_data.scrt2);
+
+               if (!(bp->caps & MACB_CAPS_USRIO_DISABLED))
+                       macb_or_gem_writel(bp, USRIO, bp->pm_data.usrio);
+
                for (q = 0, queue = bp->queues; q < bp->num_queues;
                     ++q, ++queue)
                        napi_enable(&queue->napi);
@@ -4312,6 +4368,7 @@ static int __maybe_unused macb_resume(struct device *dev)
        bp->macbgem_ops.mog_init_rings(bp);
        macb_init_hw(bp);
        macb_set_rx_mode(netdev);
+       macb_restore_features(bp);
        netif_device_attach(netdev);
        if (bp->ptp_info)
                bp->ptp_info->ptp_init(netdev);
index 9fdd496..ce42157 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_CALXEDA_XGMAC
        tristate "Calxeda 1G/10G XGMAC Ethernet driver"
        depends on HAS_IOMEM
index f0ef080..641e5b6 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NET_CALXEDA_XGMAC) += xgmac.o
index 7612ab6..6a700d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cavium ethernet device configuration
 #
index 946bba8..5d32808 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Cavium ethernet device drivers.
 #
index dd8561b..e3f87bd 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CAVIUM_PTP) += cavium_ptp.o
index efa41c1..4f5098f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Cavium network device drivers.
 #
index e8001e9..9909bfd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chelsio device configuration
 #
index 57a4b26..8008282 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chelsio T1 driver
 #
index 29aff78..f65f0d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chelsio T3 driver
 #
index 6e2d800..cfaf8f6 100644 (file)
@@ -197,6 +197,9 @@ static void cxgb4_process_flow_match(struct net_device *dev,
                fs->val.ivlan = vlan_tci;
                fs->mask.ivlan = vlan_tci_mask;
 
+               fs->val.ivlan_vld = 1;
+               fs->mask.ivlan_vld = 1;
+
                /* Chelsio adapters use ivlan_vld bit to match vlan packets
                 * as 802.1Q. Also, when vlan tag is present in packets,
                 * ethtype match is used then to match on ethtype of inner
@@ -207,8 +210,6 @@ static void cxgb4_process_flow_match(struct net_device *dev,
                 * ethtype value with ethtype of inner header.
                 */
                if (fs->val.ethtype == ETH_P_8021Q) {
-                       fs->val.ivlan_vld = 1;
-                       fs->mask.ivlan_vld = 1;
                        fs->val.ethtype = 0;
                        fs->mask.ethtype = 0;
                }
index d72ee26..f527ab1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Chelsio T4 SR-IOV Virtual Function Driver
 #
index 2534e30..aa79264 100644 (file)
@@ -1,4 +1,5 @@
-ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4
+# SPDX-License-Identifier: GPL-2.0-only
+ccflags-y := -I $(srctree)/$(src)/../cxgb4
 
 obj-$(CONFIG_CHELSIO_LIB) += libcxgb.o
 
index e9a0213..48f3198 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cirrus network device configuration
 #
@@ -41,7 +42,7 @@ config CS89x0_PLATFORM
 
 config EP93XX_ETH
        tristate "EP93xx Ethernet support"
-       depends on ARM && ARCH_EP93XX
+       depends on (ARM && ARCH_EP93XX) || COMPILE_TEST
        select MII
        help
          This is a driver for the ethernet hardware included in EP93xx CPUs.
index ca245e2..84865e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Cirrus network device drivers.
 #
index 13dfdfc..a6da987 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 
-#include <mach/hardware.h>
+#include <linux/platform_data/eth-ep93xx.h>
 
 #define DRV_MODULE_NAME                "ep93xx-eth"
 #define DRV_MODULE_VERSION     "0.1"
index 15b713a..ee5b7b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cisco device configuration
 #
index 6c7437b..074635b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Cisco device drivers.
 #
index b63f8d8..edaae70 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Cisco device configuration
 #
index aadcaf7..c3b6feb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ENIC) := enic.o
 
 enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \
index 680a6d9..a321a71 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Davicom device configuration
 #
index 74b31f0..173c87d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Davicom device drivers.
 #
index 740bbad..df1eeb0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Digital Equipment Inc network device configuration
 #
index 32993fc..e8aa12c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Digital Equipment Inc. network device drivers.
 #
index 264e9b4..8ce6888 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Tulip family network device configuration
 #
index ebdc832..1362658 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # D-Link device configuration
 #
index 40085f6..3ff503c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the D-Link network device drivers.
 #
index fdbb27c..22c143f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Emulex driver configuration
 #
index ea8ec57..1a7c5ae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Emulex device drivers.
 #
index 8cf794e..e8c7eb8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BE2NET
        tristate "ServerEngines' 10Gbps NIC - BladeEngine"
        depends on PCI
index 1a91b27..1a238ec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile to build the network driver for ServerEngine's BladeEngine.
 #
index b423ad3..6db75fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # EZchip network device configuration
 #
index e490176..444570f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_EZCHIP_NPS_MANAGEMENT_ENET) += nps_enet.o
index 0fb8df6..a9b1058 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Faraday device configuration
 #
index 408b539..f16f584 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Faraday device drivers.
 #
index 71793e0..6a7e899 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Freescale device configuration
 #
index a654736..3b32573 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig FSL_DPAA_ETH
        tristate "DPAA Ethernet"
        depends on FSL_DPAA && FSL_FMAN
index f6d244c..8bd3847 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FSL_DPAA2_ETH
        tristate "Freescale DPAA2 Ethernet"
        depends on FSL_MC_BUS && FSL_MC_DPIO
index dc0850b..0139cb9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FSL_FMAN
        tristate "FMan support"
        depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST
index be92229..245d9a6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FS_ENET
        tristate "Freescale Ethernet Driver"
        depends on NET_VENDOR_FREESCALE && (CPM1 || CPM2 || PPC_MPC512x)
index faee34e..cee99f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Fujitsu Network device configuration
 #
index 21561fd..74feebb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Fujitsu network device drivers.
 #
index fee4664..a0d780c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HISILICON device configuration
 #
index 96c32ae..d2e019d 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hisilicon Fast Ethernet MAC Driver
  *
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/circ_buf.h>
index d4df78c..fb395cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HP network device configuration
 #
index 20b6918..5ed723b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the HP network device drivers.
 #
index c1a95ae..bdcbfac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Huawei driver configuration
 #
index 5c37cc8..2549ad5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Huawei device drivers.
 #
index e4e8b24..cabc2f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Huawei driver configuration
 #
index 289ce88..99de5b6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HINIC) += hinic.o
 
 hinic-y := hinic_main.o hinic_tx.o hinic_rx.o hinic_port.o hinic_hw_dev.o \
index e8d61f6..33faff9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Intel 82596/82593/82596 network device configuration
 #
index b2c04a7..6eb6c2f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sni_82596.c -- driver for intel 82596 ethernet controller, as
  *               used in older SNI RM machines
index 37dceab..a95d941 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IBM device configuration.
 #
index 447865c..1d17d0c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for th IBM network device drivers.
 #
index cd473e2..9e1e5c7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the eHEA ethernet device driver for IBM eServer System p
 #
index eacf7e1..c8e5de5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IBM_EMAC
        tristate "IBM EMAC Ethernet support"
        depends on PPC_DCR
index aa070c0..1e798cc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * drivers/net/ethernet/ibm/emac/phy.c
  *
index d86b0e5..d654c23 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * IBM Power Virtual Ethernet Device Driver
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Copyright (C) IBM Corporation, 2003, 2010
  *
  * Authors: Dave Larson <larson1@us.ibm.com>
index 01c587f..4e9bf34 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * IBM Power Virtual Ethernet Device Driver
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Copyright (C) IBM Corporation, 2003, 2010
  *
  * Authors: Dave Larson <larson1@us.ibm.com>
index a1246e8..154e2e8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Intel network device configuration
 #
index 3238aa7..fb94216 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Marvell device configuration
 #
index 409b69f..88ea5ac 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for Marvell Discovery (MV643XX) and Marvell Orion ethernet ports
  * Copyright (C) 2002 Matthew Dharm <mdharm@momenco.com>
  *                        Lennert Buytenhek <buytenh@marvell.com>
  *
  * Copyright (C) 2013 Michael Stapelberg <michael@stapelberg.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index d046f7a..a57d17a 100644 (file)
@@ -1271,6 +1271,9 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *port,
        if (ret)
                goto clean_eth_rule;
 
+       ethtool_rx_flow_rule_destroy(ethtool_rule);
+       efs->rule.flow = NULL;
+
        memcpy(&efs->rxnfc, info, sizeof(*info));
        port->rfs_rules[efs->rule.loc] = efs;
        port->n_rfs_rules++;
index 35827bd..711ada7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Marvell OcteonTX2 drivers configuration
 #
index ce037e8..3aa9987 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * PXA168 ethernet driver.
  * Most of the code is derived from mv643xx ethernet driver.
@@ -7,19 +8,6 @@
  *             Zhangfei Gao <zgao6@marvell.com>
  *             Philip Rakity <prakity@marvell.com>
  *             Mark Brown <markb@marvell.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/bitops.h>
index 43656f9..263cd09 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_VENDOR_MEDIATEK
        bool "MediaTek ethernet driver"
        depends on ARCH_MEDIATEK || SOC_MT7621
index aa3f1c8..d41a241 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Mediatek SoCs built-in ethernet macs
 #
index 872548c..23cf791 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mellanox driver configuration
 #
index 016aa26..79773ac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Mellanox device drivers.
 #
index 8491db5..e69c3c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mellanox driver configuration
 #
index d290f07..94c5993 100644 (file)
@@ -2010,6 +2010,8 @@ static int mlx4_en_set_tunable(struct net_device *dev,
        return ret;
 }
 
+#define MLX4_EEPROM_PAGE_LEN 256
+
 static int mlx4_en_get_module_info(struct net_device *dev,
                                   struct ethtool_modinfo *modinfo)
 {
@@ -2044,7 +2046,7 @@ static int mlx4_en_get_module_info(struct net_device *dev,
                break;
        case MLX4_MODULE_ID_SFP:
                modinfo->type = ETH_MODULE_SFF_8472;
-               modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+               modinfo->eeprom_len = MLX4_EEPROM_PAGE_LEN;
                break;
        default:
                return -EINVAL;
index 10fcc22..ba6ac31 100644 (file)
@@ -2077,11 +2077,6 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port,
                size -= offset + size - I2C_PAGE_SIZE;
 
        i2c_addr = I2C_ADDR_LOW;
-       if (offset >= I2C_PAGE_SIZE) {
-               /* Reset offset to high page */
-               i2c_addr = I2C_ADDR_HIGH;
-               offset -= I2C_PAGE_SIZE;
-       }
 
        cable_info = (struct mlx4_cable_info *)inmad->data;
        cable_info->dev_mem_address = cpu_to_be16(offset);
index 88ccfcf..2391e3c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mellanox driver configuration
 #
index 5aac978..23883d1 100644 (file)
@@ -291,6 +291,9 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, const char *name,
        mlx5_fill_page_array(&eq->buf, pas);
 
        MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ);
+       if (!param->mask && MLX5_CAP_GEN(dev, log_max_uctx))
+               MLX5_SET(create_eq_in, in, uid, MLX5_SHARED_RESOURCE_UID);
+
        MLX5_SET64(create_eq_in, in, event_bitmask, param->mask);
 
        eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry);
index 186ebe7..0367f83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mellanox firmware flash library configuration
 #
index 7448b30..36007cd 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MLXFW)    += mlxfw.o
 mlxfw-objs             := mlxfw_fsm.o mlxfw_mfa2_tlv_multi.o mlxfw_mfa2.o
index b6b3ff0..11ded0b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Mellanox switch drivers configuration
 #
@@ -22,7 +23,6 @@ config MLXSW_CORE_HWMON
 config MLXSW_CORE_THERMAL
        bool "Thermal zone support for Mellanox Technologies Switch ASICs"
        depends on MLXSW_CORE && THERMAL
-       depends on !(MLXSW_CORE=y && THERMAL=m)
        default y
        ---help---
         Say Y here if you want to automatically control fans speed according
index b7e2f49..90a8c6b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Micrel device configuration
 #
index cf1d491..45fe41f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Microchip network device configuration
 #
index 538926d..da60354 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Microchip network device drivers.
 #
index 5b531da..1a7cacb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MOXART device configuration
 #
index aa3c73e..864e179 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the MOXART network device drivers.
 #
index d715ef4..02ad11e 100644 (file)
@@ -593,45 +593,25 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        return NETDEV_TX_OK;
 }
 
-static void ocelot_mact_mc_reset(struct ocelot_port *port)
+static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
 {
-       struct ocelot *ocelot = port->ocelot;
-       struct netdev_hw_addr *ha, *n;
+       struct ocelot_port *port = netdev_priv(dev);
 
-       /* Free and forget all the MAC addresses stored in the port private mc
-        * list. These are mc addresses that were previously added by calling
-        * ocelot_mact_mc_add().
-        */
-       list_for_each_entry_safe(ha, n, &port->mc, list) {
-               ocelot_mact_forget(ocelot, ha->addr, port->pvid);
-               list_del(&ha->list);
-               kfree(ha);
-       }
+       return ocelot_mact_forget(port->ocelot, addr, port->pvid);
 }
 
-static int ocelot_mact_mc_add(struct ocelot_port *port,
-                             struct netdev_hw_addr *hw_addr)
+static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
 {
-       struct ocelot *ocelot = port->ocelot;
-       struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC);
-
-       if (!ha)
-               return -ENOMEM;
-
-       memcpy(ha, hw_addr, sizeof(*ha));
-       list_add_tail(&ha->list, &port->mc);
-
-       ocelot_mact_learn(ocelot, PGID_CPU, ha->addr, port->pvid,
-                         ENTRYTYPE_LOCKED);
+       struct ocelot_port *port = netdev_priv(dev);
 
-       return 0;
+       return ocelot_mact_learn(port->ocelot, PGID_CPU, addr, port->pvid,
+                                ENTRYTYPE_LOCKED);
 }
 
 static void ocelot_set_rx_mode(struct net_device *dev)
 {
        struct ocelot_port *port = netdev_priv(dev);
        struct ocelot *ocelot = port->ocelot;
-       struct netdev_hw_addr *ha;
        int i;
        u32 val;
 
@@ -643,13 +623,7 @@ static void ocelot_set_rx_mode(struct net_device *dev)
        for (i = ocelot->num_phys_ports + 1; i < PGID_CPU; i++)
                ocelot_write_rix(ocelot, val, ANA_PGID_PGID, i);
 
-       /* Handle the device multicast addresses. First remove all the
-        * previously installed addresses and then add the latest ones to the
-        * mac table.
-        */
-       ocelot_mact_mc_reset(port);
-       netdev_for_each_mc_addr(ha, dev)
-               ocelot_mact_mc_add(port, ha);
+       __dev_mc_sync(dev, ocelot_mc_sync, ocelot_mc_unsync);
 }
 
 static int ocelot_port_get_phys_port_name(struct net_device *dev,
@@ -1657,7 +1631,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
        ocelot_port->regs = regs;
        ocelot_port->chip_port = port;
        ocelot_port->phy = phy;
-       INIT_LIST_HEAD(&ocelot_port->mc);
        ocelot->ports[port] = ocelot_port;
 
        dev->netdev_ops = &ocelot_port_netdev_ops;
index ba3b338..541fe41 100644 (file)
@@ -441,10 +441,6 @@ struct ocelot_port {
        struct phy_device *phy;
        void __iomem *regs;
        u8 chip_port;
-       /* Keep a track of the mc addresses added to the mac table, so that they
-        * can be removed when needed.
-        */
-       struct list_head mc;
 
        /* Ingress default VLAN (pvid) */
        u16 pvid;
index 9645c72..6bc993e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Myricom device configuration
 #
index 296c0a1..122fbd9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Myricom network device drivers.
 #
index 5df8916..8d9585c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Myricom Myri-10G ethernet driver
 #
index 017fb23..c519c1f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # National Semiconductor device configuration
 #
index 9098ee7..6af9a7e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 #define VERSION "0.23"
 /* ns83820.c by Benjamin LaHaise with contributions.
  *
  *
  * Mmmm, chocolate vanilla mocha...
  *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- *
  * ChangeLog
  * =========
  *     20010414        0.1 - created
index aaec009..d0a01e8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sonic.c
  *
index 7df2056..5e630f3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Exar device configuration
 #
index 70c8058..87ede8a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Exar network device drivers.
 #
index b625e2c..0820e81 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Exar Corp's X3100 Series 10 GbE PCIe I/O
 # Virtualized Server Adapter linux driver
index f0d0e09..4ad5109 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Netronome device configuration
 #
index 7fb3b84..d9a3948 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Netronome network device drivers
 #
index c739784..70b1a03 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # National Instuments network device configuration
 #
index 99c6646..b31bbea 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NI_XGE_MANAGEMENT_ENET) += nixge.o
index 71c973f..325e26c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Nuvoton network device configuration
 #
index 171aa04..66f6e72 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Nuvoton network device drivers.
 #
index 4efc9fe..faacbd1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # NVIDIA network device configuration
 #
index e079ae5..8935699 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the NVIDIA network device drivers.
 #
index 1d9b0d4..b327b29 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * forcedeth: Ethernet driver for NVIDIA nForce media access controllers.
  *
  *             IRQ rate fixes, bigendian fixes, cleanups, verification)
  * Copyright (c) 2004,2005,2006,2007,2008,2009 NVIDIA Corporation
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Known bugs:
  * We suspect that on some hardware no TX done interrupts are generated.
  * This means recovery from netif_stop_queue only happens if the hw timer
index 0d9baf9..261f107 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LPC_ENET
         tristate "NXP ethernet MAC on LPC devices"
         depends on ARCH_LPC32XX
index a128114..cba6ddc 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_LPC_ENET) += lpc_eth.o
index 5a975af..1c455c6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # OKI Semiconductor device configuration
 #
index b6780c8..b97baf9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the OKI Semiconductor device drivers.
 #
index 5f7a352..69e11d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # OKI Semiconductor device configuration
 #
index 862de0f..c4762b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PCH_GBE) += pch_gbe.o
 
 pch_gbe-y := pch_gbe_phy.o pch_gbe_ethtool.o pch_gbe_param.o
index 1df28f2..8161e30 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Packet engine device configuration
 #
index 995ccd0..1553c9c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Packet Engine network device drivers.
 #
index 7c92e83..f456224 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PA Semi network device configuration
 #
index 90497ff..f51e614 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the A Semi network device drivers.
 #
index 0ee2490..fdbb3ce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # QLogic network device configuration
 #
index e14e60c..d6e80b3 100644 (file)
@@ -1,23 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2003 - 2009 NetXen, Inc.
 # Copyright (C) 2009 - QLogic Corporation.
 # All rights reserved.
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#                            
-# This 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.
-#                                   
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-# 
-# The full GNU General Public License is included in this distribution
-# in the file called "COPYING".
-# 
 #
 
 
index 0a5e204..3dce769 100644 (file)
@@ -1,24 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #ifndef _NETXEN_NIC_H_
index 7503aa2..433052f 100644 (file)
@@ -1,24 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #include "netxen_nic_hw.h"
index 3c1be87..6a2d91d 100644 (file)
@@ -1,24 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #include <linux/types.h>
index a310c2f..09b33e1 100644 (file)
@@ -1,24 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #ifndef __NETXEN_NIC_HDR_H_
index 52ad806..6e12cd2 100644 (file)
@@ -1,24 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #include <linux/io-64-nonatomic-lo-hi.h>
index 7433c4d..de73766 100644 (file)
@@ -1,24 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #ifndef __NETXEN_NIC_HW_H_
index 6547a9d..94546ed 100644 (file)
@@ -1,24 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #include <linux/netdevice.h>
index 7d9819d..84cb624 100644 (file)
@@ -1,24 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2003 - 2009 NetXen, Inc.
  * Copyright (C) 2009 - QLogic Corporation.
  * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called "COPYING".
- *
  */
 
 #include <linux/slab.h>
index 75408fb..3fc91d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QEDE) := qede.o
 
 qede-y := qede_main.o qede_fp.o qede_filter.o qede_ethtool.o qede_ptp.o
index 8a19765..1dc2568 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Qlogic 10GbE PCI Express ethernet driver
 #
index f520071..09a678a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Qualcomm network device configuration
 #
index fc57ced..61d15e0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Qualcomm Technologies, Inc. EMAC Gigabit Ethernet driver
 #
index 9bb06d2..9f92795 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RMNET MAP driver
 #
index 01bddf2..8252e40 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the RMNET module
 #
index a9c4e99..76df60c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RDC network device configuration
 #
index 8d51fd2..8074654 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the RDC network device drivers.
 #
index ad335bc..274e5b4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * RDC R6040 Fast Ethernet MAC support
  *
@@ -5,21 +6,6 @@
  * Copyright (C) 2007
  *     Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
  * Copyright (C) 2007-2012 Florian Fainelli <f.fainelli@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301, USA.
 */
 
 #include <linux/kernel.h>
index 96d1b9c..b18e7a9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Realtek device configuration
 #
index 71b1da3..33be8c5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Realtek network device drivers.
 #
index 2e20334..8e40418 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * r8169.c: RealTek 8169/8168/8101 ethernet driver.
  *
index b9952ef..1083de9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Rocker device configuration
 #
index faa36ac..6e0a363 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Rocker network device drivers.
 #
index fbd5e06..0279380 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Samsung Ethernet device configuration
 #
index 1773c29..f94faec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Samsung Ethernet device drivers.
 #
index 31e9685..b7e29d0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SXGBE_ETH) += samsung-sxgbe.o
 samsung-sxgbe-objs:= sxgbe_platform.o sxgbe_main.o sxgbe_desc.o \
                sxgbe_dma.o sxgbe_core.o sxgbe_mtl.o  sxgbe_mdio.o \
index 69c62d8..f3ac9cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SEEQ device configuration
 #
index 0488e99..02aad78 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SEEQ network device drivers
 #
index 696037d..7a5e6c5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sgiseeq.c: Seeq8003 ethernet driver for SGI machines.
  *
index 2c03262..5f36774 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Solarflare device configuration
 #
index 6248e96..20e3619 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SFC_FALCON
        tristate "Solarflare SFC4000 support"
        depends on PCI
index fbbb21c..37f048e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SGI device configuration
 #
index e5bedd2..68eefbc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SGI device drivers.
 #
index ac982be..71929d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Silan device configuration
 #
index 4ad3523..86f716f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Silan network device drivers.
 #
index 02b3962..c7641a2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*  Silan SC92031 PCI Fast Ethernet Adapter driver
  *
  *  Based on vendor drivers:
index 22ec98e..d848ab0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Silicon Integrated Systems (SiS) device configuration
 #
index 58d3ac1..853407b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Silicon Integrated Systems (SiS) network device drivers.
 #
index 7961206..d1b6a78 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Western Digital/SMC network device configuration
 #
index b550e62..bd14803 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * smc911x.c
  * This is a driver for SMSC's LAN911{5,6,7,8} single-chip Ethernet devices.
@@ -6,19 +7,6 @@
  *        Derived from the unified SMC91x driver by Nicolas Pitre
  *        and the smsc911x.c reference driver by SMSC
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Arguments:
  *      watchdog  = TX watchdog timeout
  *      tx_fifo_kb = Size of TX FIFO in KB
index fa528ea..d4edcc0 100644 (file)
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*------------------------------------------------------------------------
  . smc911x.h - macros for SMSC's LAN911{5,6,7,8} single-chip Ethernet device.
  .
  . Copyright (C) 2005 Sensoria Corp.
  . Derived from the unified SMC91x driver by Nicolas Pitre
  .
- . This program is free software; you can redistribute it and/or modify
- . it under the terms of the GNU General Public License as published by
- . the Free Software Foundation; either version 2 of the License, or
- . (at your option) any later version.
- .
- . This 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.
- .
- . You should have received a copy of the GNU General Public License
- . along with this program; if not, see <http://www.gnu.org/licenses/>.
  .
  . Information contained in this file was obtained from the LAN9118
  . manual from SMC.  To get a copy, if you really want one, you can find
index 4823b6a..601e76a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * smc91x.c
  * This is a driver for SMSC's 91C9x/91C1xx single-chip Ethernet devices.
@@ -8,19 +9,6 @@
  * Copyright (C) 2003 Monta Vista Software, Inc.
  *     Unified SMC91x driver by Nicolas Pitre
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Arguments:
  *     io      = for the base address
  *     irq     = for the IRQ
index a273522..387539a 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*------------------------------------------------------------------------
  . smc91x.h - macros for SMSC's 91C9x/91C1xx single-chip Ethernet device.
  .
@@ -7,18 +8,6 @@
  . Copyright (C) 2003 Monta Vista Software, Inc.
  .     Unified SMC91x driver by Nicolas Pitre
  .
- . This program is free software; you can redistribute it and/or modify
- . it under the terms of the GNU General Public License as published by
- . the Free Software Foundation; either version 2 of the License, or
- . (at your option) any later version.
- .
- . This 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.
- .
- . You should have received a copy of the GNU General Public License
- . along with this program; if not, see <http://www.gnu.org/licenses/>.
  .
  . Information contained in this file was obtained from the LAN91C111
  . manual from SMC.  To get a copy, if you really want one, you can find
index 99a5a8a..38068fc 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /***************************************************************************
  *
  * Copyright (C) 2004-2008 SMSC
  * Copyright (C) 2005-2008 ARM
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  ***************************************************************************
  * Rewritten, heavily based on smsc911x simple driver by SMSC.
  * Partly uses io macros from smc91x.c by Nicolas Pitre
@@ -26,7 +14,6 @@
  *   LAN9210, LAN9211
  *   LAN9220, LAN9221
  *   LAN89218,LAN9250
- *
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 51b2fc1..09b4638 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /***************************************************************************
  *
  * Copyright (C) 2004-2008 SMSC
  * Copyright (C) 2005-2008 ARM
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  ***************************************************************************/
 #ifndef __SMSC911X_H__
 #define __SMSC911X_H__
index 9b6366b..a6962a4 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /***************************************************************************
  *
  * Copyright (C) 2007,2008  SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  ***************************************************************************
  */
 
index c63c763..409e82b 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
  /***************************************************************************
  *
  * Copyright (C) 2007,2008  SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  ***************************************************************************
  */
 
index b80048c..25f18be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NET_VENDOR_SOCIONEXT
        bool "Socionext ethernet drivers"
        default y
index ecd7a5e..39ef863 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STMicroelectronics device configuration
 #
index 9b3bfdd..72fd1f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the STMicroelectronics device drivers.
 #
index f194235..06545d7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config STMMAC_ETH
        tristate "STMicroelectronics 10/100/1000/EQOS Ethernet driver"
        depends on HAS_IOMEM && HAS_DMA
index 3c749c3..e09522c 100644 (file)
@@ -460,7 +460,7 @@ stmmac_get_pauseparam(struct net_device *netdev,
        } else {
                if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
                                       netdev->phydev->supported) ||
-                   linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
+                   !linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
                                      netdev->phydev->supported))
                        return;
        }
@@ -491,7 +491,7 @@ stmmac_set_pauseparam(struct net_device *netdev,
        } else {
                if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
                                       phy->supported) ||
-                   linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
+                   !linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
                                      phy->supported))
                        return -EOPNOTSUPP;
        }
index 5678b86..2a10527 100644 (file)
@@ -2208,6 +2208,10 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
        if (priv->plat->axi)
                stmmac_axi(priv, priv->ioaddr, priv->plat->axi);
 
+       /* DMA CSR Channel configuration */
+       for (chan = 0; chan < dma_csr_ch; chan++)
+               stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan);
+
        /* DMA RX Channel Configuration */
        for (chan = 0; chan < rx_channels_count; chan++) {
                rx_q = &priv->rx_queue[chan];
@@ -2233,10 +2237,6 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
                                       tx_q->tx_tail_addr, chan);
        }
 
-       /* DMA CSR Channel configuration */
-       for (chan = 0; chan < dma_csr_ch; chan++)
-               stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan);
-
        return ret;
 }
 
index bdd3515..093a223 100644 (file)
@@ -267,7 +267,8 @@ int stmmac_mdio_reset(struct mii_bus *bus)
                        of_property_read_u32_array(np,
                                "snps,reset-delays-us", data->delays, 3);
 
-                       if (gpio_request(data->reset_gpio, "mdio-reset"))
+                       if (devm_gpio_request(priv->device, data->reset_gpio,
+                                             "mdio-reset"))
                                return 0;
                }
 
index a950388..9e19977 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Synopsys network device configuration
 #
index b17f0ca..8ad1526 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Tehuti network device configuration
 #
index f995421..13a0ddd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Tehuti network device drivers.
 #
index afbdc97..bd05a97 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TI device configuration
 #
index 6f1d5b6..9ccdf03 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Toshiba network device configuration
 #
index 81d845e..5c909df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Tundra network device configuration
 #
index 439f693..78fee6b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Tundra network device drivers.
 #
index 4a03c59..00980fd 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * (C) Copyright 2005 Tundra Semiconductor Corp.
  * Kong Lai, <kong.lai@tundra.com).
  *
  * See file CREDITS for list of people who contributed to this
  * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index d3d0947..a962097 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # VIA device configuration
 #
index 46c5d4a..4ca40f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the VIA device drivers.
 #
index 27f6cf1..346e441 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * This code is derived from the VIA reference driver (copyright message
  * below) provided to Red Hat by VIA Networking Technologies, Inc. for
  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  * All rights reserved.
  *
- * This software may be redistributed and/or modified under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  * Author: Chuang Liang-Shing, AJ Jiang
  *
  * Date: Jan 24, 2003
  *
  * MODULE_LICENSE("GPL");
- *
  */
 
 #include <linux/module.h>
index 9453bfa..c0ecc6c 100644 (file)
@@ -1,17 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  * All rights reserved.
  *
- * This software may be redistributed and/or modified under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * 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.
- *
  * File: via-velocity.h
  *
  * Purpose: Header file to define driver's private structures.
index 1981e88..0422775 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # WIZnet devices configuration
 #
index 1e05e1a..78104f0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_WIZNET_W5100) += w5100.o
 obj-$(CONFIG_WIZNET_W5100_SPI) += w5100-spi.o
 obj-$(CONFIG_WIZNET_W5300) += w5300.o
index db448fa..af96e05 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Xilink device configuration
 #
index 47c4515..14870d6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for Xilinx TEMAC Ethernet device
  *
index c337400..011adae 100644 (file)
@@ -484,6 +484,11 @@ static inline u32 axienet_ior(struct axienet_local *lp, off_t offset)
        return in_be32(lp->regs + offset);
 }
 
+static inline u32 axinet_ior_read_mcr(struct axienet_local *lp)
+{
+       return axienet_ior(lp, XAE_MDIO_MCR_OFFSET);
+}
+
 /**
  * axienet_iow - Memory mapped Axi Ethernet register write
  * @lp:         Pointer to axienet local structure
index 108fbc7..831967f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Xilinx Axi Ethernet device driver
  *
index 757a3b3..704babd 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/of_address.h>
 #include <linux/of_mdio.h>
 #include <linux/jiffies.h>
+#include <linux/iopoll.h>
 
 #include "xilinx_axienet.h"
 
 /* Wait till MDIO interface is ready to accept a new transaction.*/
 int axienet_mdio_wait_until_ready(struct axienet_local *lp)
 {
-       unsigned long end = jiffies + 2;
-       while (!(axienet_ior(lp, XAE_MDIO_MCR_OFFSET) &
-                XAE_MDIO_MCR_READY_MASK)) {
-               if (time_before_eq(end, jiffies)) {
-                       WARN_ON(1);
-                       return -ETIMEDOUT;
-               }
-               udelay(1);
-       }
-       return 0;
+       u32 val;
+
+       return readx_poll_timeout(axinet_ior_read_mcr, lp,
+                                 val, val & XAE_MDIO_MCR_READY_MASK,
+                                 1, 20000);
 }
 
 /**
index 6886270..c409bab 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/of_net.h>
 #include <linux/phy.h>
 #include <linux/interrupt.h>
+#include <linux/iopoll.h>
 
 #define DRIVER_NAME "xilinx_emaclite"
 
@@ -714,20 +715,15 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
 
 static int xemaclite_mdio_wait(struct net_local *lp)
 {
-       unsigned long end = jiffies + 2;
+       u32 val;
 
        /* wait for the MDIO interface to not be busy or timeout
         * after some time.
         */
-       while (xemaclite_readl(lp->base_addr + XEL_MDIOCTRL_OFFSET) &
-                       XEL_MDIOCTRL_MDIOSTS_MASK) {
-               if (time_before_eq(end, jiffies)) {
-                       WARN_ON(1);
-                       return -ETIMEDOUT;
-               }
-               msleep(1);
-       }
-       return 0;
+       return readx_poll_timeout(xemaclite_readl,
+                                 lp->base_addr + XEL_MDIOCTRL_OFFSET,
+                                 val, !(val & XEL_MDIOCTRL_MDIOSTS_MASK),
+                                 1000, 20000);
 }
 
 /**
index d6208a4..ad53900 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Xircom network device configuration
 #
index 3b7aebd..07667fe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Xircom network device drivers.
 #
index af3432f..2f354ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Intel XScale IXP device configuration
 #
index abc3b03..794a519 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Intel XScale IXP device drivers.
 #
index ed6623a..319db3e 100644 (file)
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/net_tstamp.h>
+#include <linux/of.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/ptp_classify.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <mach/ixp46x_ts.h>
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define DEBUG_DESC             0
 #define DEBUG_RX               0
@@ -1497,6 +1498,15 @@ static struct platform_driver ixp4xx_eth_driver = {
 static int __init eth_init_module(void)
 {
        int err;
+
+       /*
+        * FIXME: we bail out on device tree boot but this really needs
+        * to be fixed in a nicer way: this registers the MDIO bus before
+        * even matching the driver infrastructure, we should only probe
+        * detected hardware.
+        */
+       if (of_have_populated_dt())
+               return -ENODEV;
        if ((err = ixp4xx_mdio_register()))
                return err;
        return platform_driver_register(&ixp4xx_eth_driver);
index d62e8c6..3b412a5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # FDDI network device configuration
 #
index 194b52c..fa4a3b5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux FDDI network device drivers.
 #
index abbe309..3d0f417 100644 (file)
@@ -1206,7 +1206,7 @@ void process_receive(struct s_smc *smc)
                }
                /*
                 * SUPERNET 3 Bug: FORMAC delivers status words
-                * of aborded frames to the BMU
+                * of aborted frames to the BMU
                 */
                if (len <= 4) {
                        DB_RX(2, "Frame length = 0");
@@ -1343,7 +1343,7 @@ void process_receive(struct s_smc *smc)
                                break ;
                        default :
                                /*
-                                * unknown FC abord the frame
+                                * unknown FC abort the frame
                                 */
                                DB_RX(2, "unknown FC error");
                                smt_free_mbuf(smc,mb) ;
index a19868c..331c16d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * 6pack.c     This module implements the 6pack protocol for kernel-based
  *             devices like TTY. It interfaces between a raw TTY and the
index bf5e596..8e05b5c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MKISS
        tristate "Serial port KISS driver"
        depends on AX25 && TTY
index f71515d..de78504 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # HIPPI network device configuration
 #
index b95d629..409dd47 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the HIPPI network device drivers.
 #
index 0765d5f..ca7bf7f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HYPERV_NET
        tristate "Microsoft Hyper-V virtual network driver"
        depends on HYPERV
index 3f25b9c..3a2aa07 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HYPERV_NET) += hv_netvsc.o
 
 hv_netvsc-y := netvsc_drv.o netvsc.o rndis_filter.o netvsc_trace.o
index 0e372f3..8af5b7e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig IEEE802154_DRIVERS
        tristate "IEEE 802.15.4 drivers"
        depends on NETDEVICES && IEEE802154
index b2ff903..b188fce 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/ieee802154.h>
+#include <linux/io.h>
 #include <linux/kfifo.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
index 3ee9536..2020e9d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Ethernet Ipvlan driver
 #
index 0bcc07f..1cedb63 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/etherdevice.h>
 #include "ipvlan.h"
 #include <linux/if_vlan.h>
index 92efa93..6155012 100644 (file)
@@ -838,6 +838,7 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
+               /* fall through */
        case SIOCGHWTSTAMP:
                if (netif_device_present(real_dev) && ops->ndo_do_ioctl)
                        err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd);
index 9a10029..694e2f5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/etherdevice.h>
 #include <linux/if_macvlan.h>
 #include <linux/if_tap.h>
index dd0db75..68771b2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
index d629971..f99f278 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PHY Layer Configuration
 #
index abe13df..b9d4145 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Clause 45 PHY support
  */
index 89750c7..7498359 100644 (file)
@@ -422,28 +422,21 @@ static void phylink_resolve(struct work_struct *w)
 
                case MLO_AN_INBAND:
                        phylink_get_mac_state(pl, &link_state);
-                       if (pl->phydev) {
-                               bool changed = false;
-
-                               link_state.link = link_state.link &&
-                                                 pl->phy_state.link;
-
-                               if (pl->phy_state.interface !=
-                                   link_state.interface) {
-                                       link_state.interface = pl->phy_state.interface;
-                                       changed = true;
-                               }
-
-                               /* Propagate the flow control from the PHY
-                                * to the MAC. Also propagate the interface
-                                * if changed.
-                                */
-                               if (pl->phy_state.link || changed) {
-                                       link_state.pause |= pl->phy_state.pause;
-                                       phylink_resolve_flow(pl, &link_state);
-
-                                       phylink_mac_config(pl, &link_state);
-                               }
+
+                       /* If we have a phy, the "up" state is the union of
+                        * both the PHY and the MAC */
+                       if (pl->phydev)
+                               link_state.link &= pl->phy_state.link;
+
+                       /* Only update if the PHY link is up */
+                       if (pl->phydev && pl->phy_state.link) {
+                               link_state.interface = pl->phy_state.interface;
+
+                               /* If we have a PHY, we need to update with
+                                * the pause mode bits. */
+                               link_state.pause |= pl->phy_state.pause;
+                               phylink_resolve_flow(pl, &link_state);
+                               phylink_mac_config(pl, &link_state);
                        }
                        break;
                }
index fef701b..e9c1879 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/kref.h>
 #include <linux/list.h>
index 80c4a33..b41035b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Parallel Line Internet Protocol (PLIP) network device configuration
 #
index ed95879..8d4df72 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the PLIP network device drivers.
 #
index 1373c6d..bf395df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PPP network device configuration
 #
index 48e6871..30bbafb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SLIP network device configuration
 #
index e3ebc59..668c1af 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SLIP network device drivers.
 #
index 9757f1f..cac64b9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * slip.c      This module implements the SLIP protocol for kernel-based
  *             devices like TTY.  It interfaces between a raw TTY, and the
index 63a8ff8..291fa44 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PHY drivers for the sungem ethernet driver.
  *
index 2ea9b49..8e01390 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/etherdevice.h>
 #include <linux/if_tap.h>
 #include <linux/if_vlan.h>
index c853d84..2aa9fd7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig NET_TEAM
        tristate "Ethernet team driver support"
        ---help---
index 860352a..05bdcc5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # USB Network devices configuration
 #
index 9a4171b..3b53685 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * ASIX AX8817X based USB 2.0 Ethernet Devices
  * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
  * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
  * Copyright (c) 2002-2003 TiVo Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ASIX_H
index 023b8d0..b39ee71 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ASIX AX8817X based USB 2.0 Ethernet Devices
  * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
  * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
  * Copyright (c) 2002-2003 TiVo Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "asix.h"
index 3d93993..c9bc963 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ASIX AX8817X based USB 2.0 Ethernet Devices
  * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
  * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
  * Copyright (c) 2002-2003 TiVo Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "asix.h"
index 501576f..011bd4c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ASIX AX88172A based USB 2.0 Ethernet Devices
  * Copyright (C) 2012 OMICRON electronics GmbH
@@ -9,19 +10,6 @@
  * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
  * Copyright (c) 2002-2003 TiVo Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "asix.h"
index 2207f7a..0bc457b 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices
  *
  * Copyright (C) 2011-2013 ASIX
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 424053b..1e58702 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (c) 2001 Vojtech Pavlik
  *
  */
 
 /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
- * (at your option) any later version.
- * 
- * This 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.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  * 
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
index 61ea4ea..0eeec80 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * USB CDC EEM network interface driver
  * Copyright (C) 2009 Oberthur Technologies
  * by Omar Laazimani, Olivier Condemine
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 3e9b2c3..8458e88 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * CDC Ethernet based networking peripherals
  * Copyright (C) 2003-2005 by David Brownell
  * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 // #define     DEBUG                   // error path messages, extra info
index 6ea98cf..32637df 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Simple "CDC Subset" USB Networking Links
  * Copyright (C) 2000-2005 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index 947bea8..5519248 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for USB ethernet port of Conexant CX82310-based ADSL routers
  * Copyright (C) 2010 by Ondrej Zary
  * some parts inspired by the cxacru driver
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index ba1ce10..13a9a83 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * GeneSys GL620USB-A based links
  * Copyright (C) 2001 by Jiun-Jie Huang <huangjj@genesyslogic.com.tw>
  * Copyright (C) 2001 by Stanislav Brabec <utx@penguin.cz>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 // #define     DEBUG                   // error path messages, extra info
index ae2b256..cb5bc1a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2009 Peter Holik
  *
@@ -9,18 +10,6 @@
  */
 
 /*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or.
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index c247aed..8c01fbf 100644 (file)
@@ -383,17 +383,18 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net)
                          dev);
        dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
+       netif_stop_queue(net);
        retval = usb_submit_urb(dev->tx_urb, GFP_ATOMIC);
        if (retval) {
                dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n",
                        __func__, retval);
                dev->net->stats.tx_errors++;
                dev_kfree_skb_any(skb);
+               netif_wake_queue(net);
        } else {
                dev->net->stats.tx_packets++;
                dev->net->stats.tx_bytes += skb->len;
                dev_consume_skb_any(skb);
-               netif_stop_queue(net);
        }
 
        return NETDEV_TX_OK;
index 913e50b..8e210ba 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /****************************************************************
  *
  *     kaweth.c - driver for KL5KUSB101 based USB->Ethernet
  *     Also many thanks to Joel Silverman and Ed Surprenant at Kawasaki
  *     for providing the firmware and driver resources.
  *
- *     This program is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License as
- *     published by the Free Software Foundation; either version 2, or
- *     (at your option) any later version.
- *
- *     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.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  ****************************************************************/
 
 /* TODO:
index 257916f..6c2b3e3 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Ethernet interface part of the LG VL600 LTE modem (4G dongle)
  *
  * Copyright (C) 2011 Intel Corporation
  * Author: Andrzej Zaborowski <balrogg@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
index 5a47e55..09bfa6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices
  *
  * - mcs7830_get_regs() handling is weird: for rev 2 we return 32 regs,
  *   can access only ~ 24, remaining user buffer is uninitialized garbage
  * - anything else?
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/crc32.h>
index 18a13aa..1f04f17 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Net1080 based USB host-to-host cables
  * Copyright (C) 2000-2005 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 // #define     DEBUG                   // error path messages, extra info
index 6fe5937..17c9c63 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * PL-2301/2302 USB host-to-host link cables
  * Copyright (C) 2000-2005 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 // #define     DEBUG                   // error path messages, extra info
index b807c91..bd9c078 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Host Side support for RNDIS Networking Links
  * Copyright (C) 2005 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/module.h>
 #include <linux/netdevice.h>
index c43087e..34c1eab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * USB-to-WWAN Driver for Sierra Wireless modems
  *
@@ -9,19 +10,6 @@
  *
  * IMPORTANT DISCLAIMER: This driver is not commercially supported by
  * Sierra Wireless. Use at your own risk.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define DRIVER_VERSION "v.2.0"
index e4c2f3a..1417a22 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /***************************************************************************
  *
  * Copyright (C) 2007-2010 SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  *****************************************************************************/
 
 #include <linux/module.h>
index 2c7ea8f..49738ca 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
  /***************************************************************************
  *
  * Copyright (C) 2007-2010 SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  *****************************************************************************/
 
 #ifndef _SMSC75XX_H
index a0e1199..355be77 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /***************************************************************************
  *
  * Copyright (C) 2007-2008 SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  *****************************************************************************/
 
 #include <linux/module.h>
index cfc704f..013bf42 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
  /***************************************************************************
  *
  * Copyright (C) 2007-2008 SMSC
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  *****************************************************************************/
 
 #ifndef _SMSC95XX_H
index 504282a..72514c4 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * USB Network driver infrastructure
  * Copyright (C) 2000-2005 by David Brownell
  * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -506,6 +494,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 
        if (netif_running (dev->net) &&
            netif_device_present (dev->net) &&
+           test_bit(EVENT_DEV_OPEN, &dev->flags) &&
            !test_bit (EVENT_RX_HALT, &dev->flags) &&
            !test_bit (EVENT_DEV_ASLEEP, &dev->flags)) {
                switch (retval = usb_submit_urb (urb, GFP_ATOMIC)) {
@@ -1431,6 +1420,11 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
                spin_unlock_irqrestore(&dev->txq.lock, flags);
                goto drop;
        }
+       if (netif_queue_stopped(net)) {
+               usb_autopm_put_interface_async(dev->intf);
+               spin_unlock_irqrestore(&dev->txq.lock, flags);
+               goto drop;
+       }
 
 #ifdef CONFIG_PM
        /* if this triggers the device is still a sleep */
index 9c2196c..8e717a0 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2002 Pavel Machek <pavel@ucw.cz>
  * Copyright (C) 2002-2005 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 // #define     DEBUG                   // error path messages, extra info
index 09a1433..52110e5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  drivers/net/veth.c
  *
index 559c48e..0d4115c 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* A network driver using virtio.
  *
  * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 //#define DEBUG
 #include <linux/netdevice.h>
index 7bad5c9..14e324b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/if_arp.h>
index 4e9fe75..09fdd61 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # wan devices configuration
 #
index 4de0737..6c05c4c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Comtrol SV11 card driver
  *
index 5c60dc6..46a05b6 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/platform_device.h>
 #include <linux/poll.h>
 #include <linux/slab.h>
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define DEBUG_DESC             0
 #define DEBUG_RX               0
index 247f60c..f00fe44 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Lan Media 21140 based WAN cards
 # Specifically the 1000,1200,5200,5245
index 46c3d98..d78bc83 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     Things to sort out:
  *
index 565018e..2249e3d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # WiMAX LAN device drivers configuration
 #
index 692184d..b4575ba 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_WIMAX_I2400M)     += i2400m/
index 71453db..843b905 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config WIMAX_I2400M
        tristate
index 8c456a6..1c98d78 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Wireless LAN device configuration
 #
index 9317367..a91cc14 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_ADMTEK
        bool "ADMtek devices"
        default y
index 9cca7e5..709c2bc 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ADM8211)  += adm8211.o
index 82ab7c3..af2049e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ATH_COMMON
        tristate
 
index 0d320cc..75fc669 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config AR5523
        tristate "Atheros AR5523 wireless driver support"
        depends on MAC80211 && USB
index ebf7f3b..84fc88a 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AR5523)   := ar5523.o
index a7fb544..3522f25 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ATH10K
        tristate "Atheros 802.11ac wireless cards support"
        depends on MAC80211 && HAS_DMA
index b1278f9..c587146 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ATH5K
        tristate "Atheros 5xxx wireless cards support"
        depends on (PCI || ATH25) && MAC80211
index 9c125ff..2b27a87 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ATH6KL
        tristate "Atheros mobile chipsets support"
        depends on CFG80211
index ceca23a..a1ef876 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ATH9K_HW
        tristate
 config ATH9K_COMMON
index 2e34bae..757eb76 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CARL9170
        tristate "Linux Community AR9170 802.11n USB support"
        depends on USB && MAC80211
index f64ed76..1a81868 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 carl9170-objs := main.o usb.o cmd.o mac.o phy.o led.o fw.o tx.o rx.o
 carl9170-$(CONFIG_CARL9170_DEBUGFS) += debug.o
 
index 20bf967..4ab2d59 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WCN36XX
        tristate "Qualcomm Atheros WCN3660/3680 support"
        depends on MAC80211 && HAS_DMA
index 3548e8d..b1a3398 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WIL6210
        tristate "Wilocity 60g WiFi card wil6210 support"
        select WANT_DEV_COREDUMP
index 3e684f8..809bdf3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_ATMEL
        bool "Atmel devices"
        default y
index e62e345..17e6280 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ATMEL)             += atmel.o
 obj-$(CONFIG_PCI_ATMEL)         += atmel_pci.o 
 obj-$(CONFIG_PCMCIA_ATMEL)      += atmel_cs.o
index eebe286..bb1cb40 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_BROADCOM
        bool "Broadcom devices"
        default y
index 9d5ac95..1a8384d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_B43)              += b43/
 obj-$(CONFIG_B43LEGACY)                += b43legacy/
 
index 3e41457..3b582e7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config B43
        tristate "Broadcom 43xx wireless support (mac80211 stack)"
        depends on (BCMA_POSSIBLE || SSB_POSSIBLE) && MAC80211 && HAS_DMA
index 17d16a3..fdb1c82 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 976c8ec..1325727 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index b34e519..806406a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
   Copyright (C) 2002 David S. Miller
   Copyright (C) Pekka Pietikainen
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 87131f6..982a772 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -9,20 +10,6 @@
   Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index a335f94..5d97cf0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
   Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 4c7980f..20815a7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index c46430c..d94ab86 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
 
   Broadcom B43 wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 98c4fa5..923d4cb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -9,20 +10,6 @@
   Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index f59c021..1e022ec 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -9,20 +10,6 @@
   Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index c3158d0..6033df1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 6b7f023..cfb953d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
   Copyright (c) 2008-2009 Michael Buesch <m@bues.ch>
   Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 77d7cd5..d3c001f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
   Copyright (c) 2008 Michael Buesch <m@bues.ch>
   Copyright (c) 2010-2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index a4ff5e2..69f8b46 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2005-2008 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 5289a18..be841f8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
   Copyright (c) 2008 Michael Buesch <m@bues.ch>
   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 2ce2560..575c696 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index ff1e026..bd7dafb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index a3cf9ef..d82fc9b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 70c2fce..f0c9687 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2007 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 93d03b6..0679d13 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2006 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index ea288df..25c891e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -8,20 +9,6 @@
   Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index ce01e16..71a7cd8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
   Copyright (c) 2009 Michael Buesch <m@bues.ch>
   Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 44e0957..dad405a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -6,20 +7,6 @@
   Copyright (c) 2008 Michael Buesch <m@bues.ch>
   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 176c49d..1acf2df 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 704ef1b..c7b7722 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 0e96c08..f9209b8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -7,20 +8,6 @@
   Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
   Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 1b9c191..0587452 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
   Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 1ffa288..bfac341 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config B43LEGACY
        tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)"
        depends on SSB_POSSIBLE && MAC80211 && HAS_DMA
index 8150ade..082aab8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 2ce1537..1cc25f4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
   Copyright (C) 2002 David S. Miller
   Copyright (C) Pekka Pietikainen
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 6d15fb4..f62d688 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
@@ -8,20 +9,6 @@
                     Danny van Dyk <kugelfang@gentoo.org>
                     Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index bc92211..38b5be3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -9,20 +10,6 @@
   Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index c777efc..4325e91 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
  *  Broadcom B43legacy wireless driver
  *  Some parts of the code in this file are derived from the ipw2200
  *  driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
  */
 
 #include <linux/delay.h>
index b74a058..85edbc8 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
 
   Broadcom B43legacy wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index f949766..add7a0f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 831a7a4..bb2c492 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
 
   Broadcom B43legacy wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 282eede..cbb7613 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2005 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index c6db444..da40d1c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index dd2976d..ee8b2c8 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
 
   Broadcom B43legacy wireless driver
   Some parts of the code in this file are derived from the ipw2200
   driver  Copyright(c) 2003 - 2004 Intel Corporation.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 7c1bdbc..1f53210 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43 wireless driver
@@ -5,20 +6,6 @@
 
   Copyright (c) 2007 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 2db83ee..9312c1d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
@@ -6,20 +7,6 @@
 
   Copyright (c) 2006 Michael Buesch <m@bues.ch>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 35ccf40..e9b23c2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Broadcom B43legacy wireless driver
   Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
   Copyright (C) 2007 Larry Finger <Larry.Finger@lwfinger.net>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 6acba67..1df56d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BRCMUTIL
        tristate
 
index e210ee8..7329830 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_CISCO
        bool "Cisco devices"
        default y
index d4110b1..506a19c 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AIRO)             += airo.o
 obj-$(CONFIG_AIRO_CS)          += airo_cs.o airo.o
index 6fdc14b..6ec42f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_INTEL
        bool "Intel devices"
        default y
index c9cbcc8..1364b00 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_IPW2100) += ipw2x00/
 obj-$(CONFIG_IPW2200) += ipw2x00/
 
index 5623955..5d2878a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Intel Centrino wireless drivers
 #
index fb91972..aa01c83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IWLEGACY
        tristate
        select FW_LOADER
index 83d5bce..e552818 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IWLWIFI
        tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) "
        depends on PCI && HAS_IOMEM && CFG80211
index e89fce1..4e96891 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_INTERSIL
        bool "Intersil devices"
        default y
index 9a8cbfe..aa630e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HOSTAP)           += hostap/
 obj-$(CONFIG_HERMES)           += orinoco/
 obj-$(CONFIG_P54_COMMON)       += p54/
index 287d827..c70dc16 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HOSTAP
        tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)"
        select WIRELESS_EXT
index 74f63b7..1a74867 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define PRISM2_PCCARD
 
 #include <linux/module.h>
index c864ef4..0c2aa88 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define PRISM2_PCI
 
 /* Host AP driver's support for Intersil Prism2.5 PCI cards is based on
index 4901a99..943070d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define PRISM2_PLX
 
 /* Host AP driver's support for PC Cards on PCI adapters using PLX9052 is
index f6fa3f4..c430d7a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HERMES
        tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
        depends on (PPC_PMAC || PCI || PCMCIA)
index cdafb8c..26cd807 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config P54_COMMON
        tristate "Softmac Prism54 support"
        depends on MAC80211
index fad305c..4f5572d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # $Id: Makefile.k26,v 1.7 2004/01/30 16:24:00 ajfa Exp $
 
 prism54-objs := islpci_eth.o islpci_mgt.o \
index 2703890..dff82fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_MARVELL
        bool "Marvell devices"
        default y
index 1b0a7d2..25f6d5d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_LIBERTAS)         += libertas/
 
 obj-$(CONFIG_LIBERTAS_THINFIRM)        += libertas_tf/
index e6268ce..b9fe598 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LIBERTAS
        tristate "Marvell 8xxx Libertas WLAN driver support"
        depends on CFG80211
index c1f4229..a4d9dd7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file contains the handling of command.
  * It prepares command and sends it to firmware when it is ready.
index 51b92b5..69029c5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Firmware loading and handling functions.
  */
index cebf03c..4103f15 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 
   Driver for the Marvell 8385 based compact flash WLAN cards.
 
   (C) 2007 by Holger Schurig <hs4233@mail.mn-solutions.de>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
 
 */
 
index 220dcde..f1622f0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file contains functions used in USB interface module.
  */
index f7db60b..5968852 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file contains the major functions in WLAN
  * driver. It includes init, exit, open, close and main
index 7586ff6..58a1fc4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file contains the handling of RX in wlan driver.
  */
index 723ba5f..aeb4817 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This file contains the handling of TX in wlan driver.
  */
index b5557af..aa40d65 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LIBERTAS_THINFIRM
        tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"
        depends on MAC80211
index ff5544d..9360568 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 libertas_tf-objs := main.o cmd.o
 
 libertas_tf_usb-objs += if_usb.o
index 572d187..64d8a11 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MWIFIEX
        tristate "Marvell WiFi-Ex Driver"
        depends on CFG80211
index ff5fc89..02d1120 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_MEDIATEK
        bool "MediaTek devices"
        default y
index 00f945f..8061726 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT7601U)  += mt7601u/
 obj-$(CONFIG_MT76_CORE)        += mt76/
index 30e44e4..cbc2d8a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT76_CORE
        tristate
 
index 7beae23..4d03596 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT76_CORE) += mt76.o
 obj-$(CONFIG_MT76_USB) += mt76-usb.o
 obj-$(CONFIG_MT76x02_LIB) += mt76x02-lib.o
index 087945c..e108bf8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT7603E
        tristate "MediaTek MT7603E (PCIe) and MT76x8 WLAN support"
        select MT76_CORE
index d95a304..6878e30 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT7603E) += mt7603e.o
 
 mt7603e-y := \
index 3b8aba0..2ed47b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT7615E
        tristate "MediaTek MT7615E (PCIe) support"
        select MT76_CORE
index 9a6157d..209d8ab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT76x0_COMMON
        tristate
        select MT76x02_LIB
index aa22ba9..8dcfb4c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT76x0U) += mt76x0u.o
 obj-$(CONFIG_MT76x0E) += mt76x0e.o
 obj-$(CONFIG_MT76x0_COMMON) += mt76x0-common.o
index 2b414a0..1f69908 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT76x2_COMMON
        tristate
        select MT76x02_LIB
index 9297b85..7b2b187 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT76x2_COMMON) += mt76x2-common.o
 obj-$(CONFIG_MT76x2E) += mt76x2e.o
 obj-$(CONFIG_MT76x2U) += mt76x2u.o
index f46bed9..0b230f3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MT7601U
        tristate "MediaTek MT7601U (USB) support"
        depends on MAC80211
index 08fc802..30f2391 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MT7601U)  += mt7601u.o
 
 mt7601u-objs   = \
index 7628d9c..91d78c6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_QUANTENNA
        bool "Quantenna wireless cards support"
        default y
index 6cf5202..b4a6df0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QTNFMAC
        tristate
        depends on QTNFMAC_PCIE
index 9b79e59..92eec8f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_RALINK
        bool "Ralink devices"
        default y
index f84c0a2..fd9ae21 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_RT2X00)   += rt2x00/
index a1d1cfe..858f8aa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig RT2X00
        tristate "Ralink driver support"
        depends on MAC80211 && HAS_DMA
index 49a7327..4d44509 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 0fd3a9d..b8187b6 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index e8e7bfe..4620990 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 573e87b..7e64aee 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 3df8c4b..fce05fc 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 78cc035..0c07028 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 06c38ba..d758e88 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index c8f2bf1..621cd4c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
          Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
          <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 759eab2..48adc6c 100644 (file)
@@ -1,20 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2009 Bartlomiej Zolnierkiewicz
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef RT2800LIB_H
index ecc4c93..d1de8e2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*     Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  *     Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
  *     Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
@@ -7,19 +8,6 @@
  *     Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
  *     Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
  *     <http://rt2x00.serialmonkey.com>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*     Module: rt2800mmio
index ca58e6c..29b5cfd 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*     Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  *     Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
  *     Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
@@ -7,19 +8,6 @@
  *     Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
  *     Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
  *     <http://rt2x00.serialmonkey.com>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*     Module: rt2800mmio
index 43e1b1e..ead8bd3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
@@ -9,18 +10,6 @@
        Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9dfef46..aa17824 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2009 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
@@ -9,18 +10,6 @@
        Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 4e9e387..230557d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*     Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  *     Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
  *     Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
@@ -7,19 +8,6 @@
  *     Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
  *     Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
  *     <http://rt2x00.serialmonkey.com>
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This 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.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*     Module: rt2800soc
index b5f75df..551427b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2009 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
@@ -7,18 +8,6 @@
        Copyright (C) 2009 Axel Kollhofer <rain_maker@root-forum.org>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index ea7cac0..9e180e9 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2009 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
@@ -6,18 +7,6 @@
        Copyright (C) 2009 Axel Kollhofer <rain_maker@root-forum.org>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9c6ef0c..64a792a 100644 (file)
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 3505074..0ee1813 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index a2fd05b..c861811 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 05a2e8d..aac3aae 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index a357a07..86658ec 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 1b08b01..a6c374c 100644 (file)
@@ -1,20 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 3b14eef..9f99158 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 5813300..c20886b 100644 (file)
@@ -1,20 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index c681d04..f5361d5 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index b2c5269..826058d 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9ddc168..2f1385b 100644 (file)
@@ -1,20 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 2010a77..939cfa5 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index e8462f2..beb20c5 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 4956a54..93f76ac 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 03e6cdb..9c7e31c 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index eb6dbcd..7f9baa9 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 283e2e6..fd955cc 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 03b2064..3b6100e 100644 (file)
@@ -1,21 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 20113f8..099e747 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 3cc541d..ffe802b 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 29250f7..596b8a4 100644 (file)
@@ -1,20 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        Copyright (C) 2004 - 2009 Felix Fietkau <nbd@openwrt.org>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9948d35..021fd06 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9cdd7f2..67b81c7 100644 (file)
@@ -1,20 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
        Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index ff94c69..f14e16a 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 52b9fc4..d83288b 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index ab86415..5f208ad 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 319ec4f..e908c30 100644 (file)
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 4a4f235..1b56d28 100644 (file)
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
        Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
        <http://rt2x00.serialmonkey.com>
 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This 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.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 9189fd6..8ea2d8d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_REALTEK
        bool "Realtek devices"
        default y
index 118af99..888b5d5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Wireless network device drivers for Realtek units
 #
index 1ce1d55..e1aa3fc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RTL818X Wireless LAN device configuration
 #
index 9975690..e03afcb 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_RTL8180)  += rtl8180/
 obj-$(CONFIG_RTL8187)  += rtl8187/
index 5d6b06d..565a9a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 rtl818x_pci-objs       := dev.o rtl8225.o sa2400.o max2820.o grf5101.o rtl8225se.o
 
 obj-$(CONFIG_RTL8180)  += rtl818x_pci.o
index 95bac73..0bf64df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 rtl8187-objs           := dev.o rtl8225.o leds.o rfkill.o
 
 obj-$(CONFIG_RTL8187)  += rtl8187.o
index 8f053c3..32d151c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RTL8XXXU Wireless LAN device configuration
 #
index 1cf951e..b278f86 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_RTL8XXXU) += rtl8xxxu.o
 
 rtl8xxxu-y     := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \
index 73067ca..28c247f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig RTL_CARDS
        tristate "Realtek rtlwifi family of devices"
        depends on MAC80211 && (PCI || USB)
index 55b1bf3..33bd7ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig RTW88
        tristate "Realtek 802.11ac wireless chips support"
        depends on MAC80211
index e07a115..c8f8fe5 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for RNDIS based wireless USB devices.
  *
  * Copyright (C) 2007 by Bjorge Dijkstra <bjd@jooz.net>
  * Copyright (C) 2008-2009 by Jussi Kivilinna <jussi.kivilinna@iki.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  *  Portions of this file are based on NDISwrapper project,
  *  Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
  *  http://ndiswrapper.sourceforge.net/
index 976c218..ad5d343 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_RSI
        bool "Redpine Signals Inc devices"
        default y
index ff69a80..441d1b8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_ST
        bool "STMicroelectronics devices"
        default y
index a60d635..7fe91b2 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CW1200)   += cw1200/
index 0880742..03575e9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CW1200
        tristate "CW1200 WLAN support"
        depends on MAC80211 && CFG80211
index 366c687..b81f2e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_TI
        bool "Texas Instrument devices"
        default y
index 7142ccf..7d39f0a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WL1251
        tristate "TI wl1251 driver support"
        depends on MAC80211
index c218359..e409042 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WL12XX
        tristate "TI wl12xx support"
        depends on MAC80211
index e6a2405..9c019a7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 wl12xx-objs    = main.o cmd.o acx.o debugfs.o scan.o event.o
 
 obj-$(CONFIG_WL12XX)           += wl12xx.o
index 1cfdb25..e29aa2a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WL18XX
        tristate "TI wl18xx support"
        depends on MAC80211
index ae2b817..aeb4254 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 wl18xx-objs    = main.o acx.o tx.o io.o debugfs.o scan.o cmd.o event.o
 
 obj-$(CONFIG_WL18XX)           += wl18xx.o
index 8a8f1e7..a9db128 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLCORE
        tristate "TI wlcore support"
        depends on MAC80211
index da62220..a25b179 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * WL3501 Wireless LAN PCMCIA Card Driver for Linux
  * Written originally for Linux 2.0.30 by Fox Chen, mhchen@golf.ccl.itri.org.tw
index b327f86..78a45cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WLAN_VENDOR_ZYDAS
        bool "ZyDAS devices"
        default y
index 679fbbf..c70003d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ZD1211RW)         += zd1211rw/
 
 obj-$(CONFIG_USB_ZD1201)       += zd1201.o
index 9592058..0b7f181 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ZD1211RW
        tristate "ZyDAS ZD1211/ZD1211B USB-wireless support"
        depends on USB && MAC80211
index dd6a86b..40c0a86 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* This file implements all the hardware specific functions for the ZD1211
index b03786c..70a1548 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ZD_CHIP_H
index 41bd755..8ca2d0a 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ZD_DEF_H
index 9ccd780..da7e63f 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
  * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net>
  * Copyright (C) 2007-2008 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/netdevice.h>
index 5a48423..5ff84bd 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ZD_MAC_H
index dc179c4..d356ae3 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/errno.h>
index 8f14e25..8bfec9e 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ZD_RF_H
index 99aed7d..23ee557 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 5fea485..3567834 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index d4e512f..e4c1a8a 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 61b9240..a4e7f18 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index a094d5b..1965cd0 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
  * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index a9075f2..a52ee32 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ZD1211 USB-WLAN driver for Linux
  *
  * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ZD_USB_H
index d49798a..84e9cbc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XEN_NETDEV_BACKEND) := xen-netback.o
 
 xen-netback-y := netback.o xenbus.o interface.o hash.o rx.o
index 41c9e8f..4103426 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Xenbus code for netif backend
  *
  * Copyright (C) 2005 Rusty Russell <rusty@rustcorp.com.au>
  * Copyright (C) 2005 XenSource Ltd
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "common.h"
index b065eb6..75c65d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Near Field Communication (NFC) devices
 #
index fbccd9d..f575d2a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_FDP
        tristate "Intel FDP NFC driver"
        depends on NFC_NCI
index e79d51b..232f646 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for FDP NCI based NFC driver
 #
index 2c6dbc9..07be6d4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_MICROREAD
        tristate
        select CRC_CCITT
index f538641..044f5e4 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 - 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __LOCAL_MICROREAD_H_
index 670af76..06f34fb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_MRVL
        tristate
        help
index 37b4061..12df2c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_NXP_NCI
        tristate "NXP-NCI NFC driver"
        depends on NFC_NCI
index c9ec786..3ff713a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for NXP-NCI NFC driver
 #
index d94122d..f6d6b34 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_PN533
        tristate
        help
index 51d24c6..43c25b4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for PN533 NFC driver
 #
index 4389eb4..1832cd9 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for NXP PN533 NFC Chip - I2C transport layer
  *
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  * Copyright (C) 2012-2013 Tieto Poland
  * Copyright (C) 2016 HALE electronic
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/device.h>
index 5961f14..a172a32 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for NXP PN533 NFC Chip - core functions
  *
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  * Copyright (C) 2012-2013 Tieto Poland
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/device.h>
index 88d5696..8bf9d6e 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Driver for NXP PN533 NFC Chip
  *
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  * Copyright (C) 2012-2013 Tieto Poland
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define PN533_DEVICE_STD     0x1
index 5d823e9..c5289ea 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Driver for NXP PN533 NFC Chip - USB transport layer
  *
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  * Copyright (C) 2012-2013 Tieto Poland
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/device.h>
index 2b8bde3..47ef5e3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_PN544
        tristate
        select CRC_CCITT
index 29fb5a1..c013fd8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for PN544 HCI based NFC driver
 #
index 2aa9233..5634ba2 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 - 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __LOCAL_PN544_H_
index 1eef919..c4e86df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_S3FWRN5
        tristate
        select CRYPTO
index ddfa7be..d0ffa35 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Samsung S3FWRN5 NFC driver
 #
index 5c6e21c..8fe53da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_ST_NCI
        tristate
        ---help---
index cc3bd56..ab20724 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_ST21NFCA
        tristate
        select CRC_CCITT
index ded6489..9fc5f0e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ST21NFCA HCI based NFC driver
 #
index 224f266..e36f0bc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_ST95HF
        tristate "ST95HF NFC Transceiver driver"
        depends on SPI && NFC_DIGITAL
index 00760b3..699500b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for STMicroelectronics NFC transceiver ST95HF
 #
index 95944e5..c99eed8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig NTB
        tristate "Non-Transparent Bridge support"
        depends on PCI
index 1921dec..5c64438 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB) += ntb.o hw/ test/
 obj-$(CONFIG_NTB_TRANSPORT) += ntb_transport.o
index e51b581..e77c587 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 source "drivers/ntb/hw/amd/Kconfig"
 source "drivers/ntb/hw/idt/Kconfig"
 source "drivers/ntb/hw/intel/Kconfig"
index 923c442..4714d62 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_AMD)  += amd/
 obj-$(CONFIG_NTB_IDT)  += idt/
 obj-$(CONFIG_NTB_INTEL)        += intel/
index cfe903c..dd9fb9e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTB_AMD
        tristate "AMD Non-Transparent Bridge support"
        depends on X86_64
index ad54da9..7c23b4a 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_AMD) += ntb_hw_amd.o
index f8948cf..bfc7cac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTB_IDT
        tristate "IDT PCIe-switch Non-Transparent Bridge support"
        depends on PCI
index a102cf1..f75e9d6 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_IDT) += ntb_hw_idt.o
index 91f995e..ed4d6dd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTB_INTEL
        tristate "Intel Non-Transparent Bridge support"
        depends on X86_64
index 4ff22af..60ec8a7 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_INTEL) += ntb_hw_intel.o
 ntb_hw_intel-y := ntb_hw_gen1.o ntb_hw_gen3.o
index 013ed67..ea63bd8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTB_SWITCHTEC
        tristate "MicroSemi Switchtec Non-Transparent Bridge Support"
        select PCI_SW_SWITCHTEC
index 064686e..756a75a 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_SWITCHTEC) += ntb_hw_switchtec.o
index a5d0eda..a8db00a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTB_PINGPONG
        tristate "NTB Ping Pong Test Client"
        help
index 9e77e0b..cbfd676 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NTB_PINGPONG) += ntb_pingpong.o
 obj-$(CONFIG_NTB_TOOL) += ntb_tool.o
 obj-$(CONFIG_NTB_PERF) += ntb_perf.o
index 6d063cd..0f03032 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the nubus specific drivers.
 #
index 5e27918..5450079 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig LIBNVDIMM
        tristate "NVDIMM (Non-Volatile Memory Device) Support"
        depends on PHYS_ADDR_T_64BIT
index 36be9b6..87f72f7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2015, Christoph Hellwig.
  * Copyright (c) 2015, Intel Corporation.
index f3d753d..2030805 100644 (file)
@@ -756,6 +756,17 @@ static const guid_t *to_abstraction_guid(enum nvdimm_claim_class claim_class,
                return &guid_null;
 }
 
+static void reap_victim(struct nd_mapping *nd_mapping,
+               struct nd_label_ent *victim)
+{
+       struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
+       u32 slot = to_slot(ndd, victim->label);
+
+       dev_dbg(ndd->dev, "free: %d\n", slot);
+       nd_label_free_slot(ndd, slot);
+       victim->label = NULL;
+}
+
 static int __pmem_label_update(struct nd_region *nd_region,
                struct nd_mapping *nd_mapping, struct nd_namespace_pmem *nspm,
                int pos, unsigned long flags)
@@ -763,9 +774,9 @@ static int __pmem_label_update(struct nd_region *nd_region,
        struct nd_namespace_common *ndns = &nspm->nsio.common;
        struct nd_interleave_set *nd_set = nd_region->nd_set;
        struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
-       struct nd_label_ent *label_ent, *victim = NULL;
        struct nd_namespace_label *nd_label;
        struct nd_namespace_index *nsindex;
+       struct nd_label_ent *label_ent;
        struct nd_label_id label_id;
        struct resource *res;
        unsigned long *free;
@@ -834,18 +845,10 @@ static int __pmem_label_update(struct nd_region *nd_region,
        list_for_each_entry(label_ent, &nd_mapping->labels, list) {
                if (!label_ent->label)
                        continue;
-               if (memcmp(nspm->uuid, label_ent->label->uuid,
-                                       NSLABEL_UUID_LEN) != 0)
-                       continue;
-               victim = label_ent;
-               list_move_tail(&victim->list, &nd_mapping->labels);
-               break;
-       }
-       if (victim) {
-               dev_dbg(ndd->dev, "free: %d\n", slot);
-               slot = to_slot(ndd, victim->label);
-               nd_label_free_slot(ndd, slot);
-               victim->label = NULL;
+               if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags)
+                               || memcmp(nspm->uuid, label_ent->label->uuid,
+                                       NSLABEL_UUID_LEN) == 0)
+                       reap_victim(nd_mapping, label_ent);
        }
 
        /* update index */
index f293556..d021464 100644 (file)
@@ -1247,12 +1247,27 @@ static int namespace_update_uuid(struct nd_region *nd_region,
        for (i = 0; i < nd_region->ndr_mappings; i++) {
                struct nd_mapping *nd_mapping = &nd_region->mapping[i];
                struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
+               struct nd_label_ent *label_ent;
                struct resource *res;
 
                for_each_dpa_resource(ndd, res)
                        if (strcmp(res->name, old_label_id.id) == 0)
                                sprintf((void *) res->name, "%s",
                                                new_label_id.id);
+
+               mutex_lock(&nd_mapping->lock);
+               list_for_each_entry(label_ent, &nd_mapping->labels, list) {
+                       struct nd_namespace_label *nd_label = label_ent->label;
+                       struct nd_label_id label_id;
+
+                       if (!nd_label)
+                               continue;
+                       nd_label_gen_id(&label_id, nd_label->uuid,
+                                       __le32_to_cpu(nd_label->flags));
+                       if (strcmp(old_label_id.id, label_id.id) == 0)
+                               set_bit(ND_LABEL_REAP, &label_ent->flags);
+               }
+               mutex_unlock(&nd_mapping->lock);
        }
        kfree(*old_uuid);
  out:
index a5ac3b2..191d62a 100644 (file)
@@ -113,8 +113,12 @@ struct nd_percpu_lane {
        spinlock_t lock;
 };
 
+enum nd_label_flags {
+       ND_LABEL_REAP,
+};
 struct nd_label_ent {
        struct list_head list;
+       unsigned long flags;
        struct nd_namespace_label *label;
 };
 
index 04008e0..87ae409 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "NVME Support"
 
 source "drivers/nvme/host/Kconfig"
index 0096a7f..fb42c44 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-y          += host/
 obj-y          += target/
index 0f345e2..ec43ac9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NVME_CORE
        tristate
 
index a6644a2..7da80f3 100644 (file)
@@ -1257,10 +1257,9 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
                return 0;
        }
 
+       effects |= nvme_known_admin_effects(opcode);
        if (ctrl->effects)
                effects = le32_to_cpu(ctrl->effects->acs[opcode]);
-       else
-               effects = nvme_known_admin_effects(opcode);
 
        /*
         * For simplicity, IO to all namespaces is quiesced even if the command
@@ -2342,20 +2341,35 @@ static const struct attribute_group *nvme_subsys_attrs_groups[] = {
        NULL,
 };
 
-static int nvme_active_ctrls(struct nvme_subsystem *subsys)
+static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
+               struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 {
-       int count = 0;
-       struct nvme_ctrl *ctrl;
+       struct nvme_ctrl *tmp;
+
+       lockdep_assert_held(&nvme_subsystems_lock);
+
+       list_for_each_entry(tmp, &subsys->ctrls, subsys_entry) {
+               if (ctrl->state == NVME_CTRL_DELETING ||
+                   ctrl->state == NVME_CTRL_DEAD)
+                       continue;
+
+               if (tmp->cntlid == ctrl->cntlid) {
+                       dev_err(ctrl->device,
+                               "Duplicate cntlid %u with %s, rejecting\n",
+                               ctrl->cntlid, dev_name(tmp->device));
+                       return false;
+               }
 
-       mutex_lock(&subsys->lock);
-       list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
-               if (ctrl->state != NVME_CTRL_DELETING &&
-                   ctrl->state != NVME_CTRL_DEAD)
-                       count++;
+               if ((id->cmic & (1 << 1)) ||
+                   (ctrl->opts && ctrl->opts->discovery_nqn))
+                       continue;
+
+               dev_err(ctrl->device,
+                       "Subsystem does not support multiple controllers\n");
+               return false;
        }
-       mutex_unlock(&subsys->lock);
 
-       return count;
+       return true;
 }
 
 static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
@@ -2395,22 +2409,13 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
        mutex_lock(&nvme_subsystems_lock);
        found = __nvme_find_get_subsystem(subsys->subnqn);
        if (found) {
-               /*
-                * Verify that the subsystem actually supports multiple
-                * controllers, else bail out.
-                */
-               if (!(ctrl->opts && ctrl->opts->discovery_nqn) &&
-                   nvme_active_ctrls(found) && !(id->cmic & (1 << 1))) {
-                       dev_err(ctrl->device,
-                               "ignoring ctrl due to duplicate subnqn (%s).\n",
-                               found->subnqn);
-                       nvme_put_subsystem(found);
-                       ret = -EINVAL;
-                       goto out_unlock;
-               }
-
                __nvme_release_subsystem(subsys);
                subsys = found;
+
+               if (!nvme_validate_cntlid(subsys, ctrl, id)) {
+                       ret = -EINVAL;
+                       goto out_put_subsystem;
+               }
        } else {
                ret = device_add(&subsys->dev);
                if (ret) {
@@ -2422,23 +2427,20 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
                list_add_tail(&subsys->entry, &nvme_subsystems);
        }
 
-       ctrl->subsys = subsys;
-       mutex_unlock(&nvme_subsystems_lock);
-
        if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj,
                        dev_name(ctrl->device))) {
                dev_err(ctrl->device,
                        "failed to create sysfs link from subsystem.\n");
-               /* the transport driver will eventually put the subsystem */
-               return -EINVAL;
+               goto out_put_subsystem;
        }
 
-       mutex_lock(&subsys->lock);
+       ctrl->subsys = subsys;
        list_add_tail(&ctrl->subsys_entry, &subsys->ctrls);
-       mutex_unlock(&subsys->lock);
-
+       mutex_unlock(&nvme_subsystems_lock);
        return 0;
 
+out_put_subsystem:
+       nvme_put_subsystem(subsys);
 out_unlock:
        mutex_unlock(&nvme_subsystems_lock);
        put_device(&subsys->dev);
@@ -3605,19 +3607,18 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
 {
        u32 aer_notice_type = (result & 0xff00) >> 8;
 
+       trace_nvme_async_event(ctrl, aer_notice_type);
+
        switch (aer_notice_type) {
        case NVME_AER_NOTICE_NS_CHANGED:
-               trace_nvme_async_event(ctrl, aer_notice_type);
                set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
                nvme_queue_scan(ctrl);
                break;
        case NVME_AER_NOTICE_FW_ACT_STARTING:
-               trace_nvme_async_event(ctrl, aer_notice_type);
                queue_work(nvme_wq, &ctrl->fw_act_work);
                break;
 #ifdef CONFIG_NVME_MULTIPATH
        case NVME_AER_NOTICE_ANA:
-               trace_nvme_async_event(ctrl, aer_notice_type);
                if (!ctrl->ana_log_buf)
                        break;
                queue_work(nvme_wq, &ctrl->ana_work);
@@ -3696,10 +3697,10 @@ static void nvme_free_ctrl(struct device *dev)
        __free_page(ctrl->discard_page);
 
        if (subsys) {
-               mutex_lock(&subsys->lock);
+               mutex_lock(&nvme_subsystems_lock);
                list_del(&ctrl->subsys_entry);
-               mutex_unlock(&subsys->lock);
                sysfs_remove_link(&subsys->dev.kobj, dev_name(ctrl->device));
+               mutex_unlock(&nvme_subsystems_lock);
        }
 
        ctrl->ops->free_ctrl(ctrl);
index 592d1e6..5838f7c 100644 (file)
@@ -978,7 +978,7 @@ EXPORT_SYMBOL_GPL(nvmf_free_options);
                                 NVMF_OPT_DISABLE_SQFLOW)
 
 static struct nvme_ctrl *
-nvmf_create_ctrl(struct device *dev, const char *buf, size_t count)
+nvmf_create_ctrl(struct device *dev, const char *buf)
 {
        struct nvmf_ctrl_options *opts;
        struct nvmf_transport_ops *ops;
@@ -1073,7 +1073,7 @@ static ssize_t nvmf_dev_write(struct file *file, const char __user *ubuf,
                goto out_unlock;
        }
 
-       ctrl = nvmf_create_ctrl(nvmf_device, buf, count);
+       ctrl = nvmf_create_ctrl(nvmf_device, buf);
        if (IS_ERR(ctrl)) {
                ret = PTR_ERR(ctrl);
                goto out_unlock;
index 9544eb6..dd8169b 100644 (file)
@@ -202,7 +202,7 @@ static LIST_HEAD(nvme_fc_lport_list);
 static DEFINE_IDA(nvme_fc_local_port_cnt);
 static DEFINE_IDA(nvme_fc_ctrl_cnt);
 
-
+static struct workqueue_struct *nvme_fc_wq;
 
 /*
  * These items are short-term. They will eventually be moved into
@@ -2054,7 +2054,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
         */
        if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
                active = atomic_xchg(&ctrl->err_work_active, 1);
-               if (!active && !schedule_work(&ctrl->err_work)) {
+               if (!active && !queue_work(nvme_fc_wq, &ctrl->err_work)) {
                        atomic_set(&ctrl->err_work_active, 0);
                        WARN_ON(1);
                }
@@ -3399,6 +3399,10 @@ static int __init nvme_fc_init_module(void)
 {
        int ret;
 
+       nvme_fc_wq = alloc_workqueue("nvme_fc_wq", WQ_MEM_RECLAIM, 0);
+       if (!nvme_fc_wq)
+               return -ENOMEM;
+
        /*
         * NOTE:
         * It is expected that in the future the kernel will combine
@@ -3416,7 +3420,7 @@ static int __init nvme_fc_init_module(void)
        ret = class_register(&fc_class);
        if (ret) {
                pr_err("couldn't register class fc\n");
-               return ret;
+               goto out_destroy_wq;
        }
 
        /*
@@ -3440,6 +3444,9 @@ out_destroy_device:
        device_destroy(&fc_class, MKDEV(0, 0));
 out_destroy_class:
        class_unregister(&fc_class);
+out_destroy_wq:
+       destroy_workqueue(nvme_fc_wq);
+
        return ret;
 }
 
@@ -3456,6 +3463,7 @@ static void __exit nvme_fc_exit_module(void)
 
        device_destroy(&fc_class, MKDEV(0, 0));
        class_unregister(&fc_class);
+       destroy_workqueue(nvme_fc_wq);
 }
 
 module_init(nvme_fc_init_module);
index 949e29e..4f20a10 100644 (file)
@@ -977,6 +977,7 @@ int nvme_nvm_register(struct nvme_ns *ns, char *disk_name, int node)
        geo->csecs = 1 << ns->lba_shift;
        geo->sos = ns->ms;
        geo->ext = ns->ext;
+       geo->mdts = ns->ctrl->max_hw_sectors;
 
        dev->q = q;
        memcpy(dev->name, disk_name, DISK_NAME_LEN);
index 5c9429d..499acf0 100644 (file)
@@ -31,7 +31,7 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
                sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
        } else if (ns->head->disk) {
                sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
-                               ctrl->cntlid, ns->head->instance);
+                               ctrl->instance, ns->head->instance);
                *flags = GENHD_FL_HIDDEN;
        } else {
                sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance,
index 3e4fb89..2a8708c 100644 (file)
@@ -1296,6 +1296,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
        switch (dev->ctrl.state) {
        case NVME_CTRL_DELETING:
                shutdown = true;
+               /* fall through */
        case NVME_CTRL_CONNECTING:
        case NVME_CTRL_RESETTING:
                dev_warn_ratelimited(dev->ctrl.device,
@@ -2280,8 +2281,6 @@ static int nvme_dev_add(struct nvme_dev *dev)
                        return ret;
                }
                dev->ctrl.tagset = &dev->tagset;
-
-               nvme_dbbuf_set(dev);
        } else {
                blk_mq_update_nr_hw_queues(&dev->tagset, dev->online_queues - 1);
 
@@ -2289,6 +2288,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
                nvme_free_queues(dev, dev->online_queues);
        }
 
+       nvme_dbbuf_set(dev);
        return 0;
 }
 
index e1824c2..f383146 100644 (file)
@@ -697,15 +697,6 @@ out_free_queues:
        return ret;
 }
 
-static void nvme_rdma_free_tagset(struct nvme_ctrl *nctrl,
-               struct blk_mq_tag_set *set)
-{
-       struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
-
-       blk_mq_free_tag_set(set);
-       nvme_rdma_dev_put(ctrl->device);
-}
-
 static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
                bool admin)
 {
@@ -744,24 +735,9 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
 
        ret = blk_mq_alloc_tag_set(set);
        if (ret)
-               goto out;
-
-       /*
-        * We need a reference on the device as long as the tag_set is alive,
-        * as the MRs in the request structures need a valid ib_device.
-        */
-       ret = nvme_rdma_dev_get(ctrl->device);
-       if (!ret) {
-               ret = -EINVAL;
-               goto out_free_tagset;
-       }
+               return ERR_PTR(ret);
 
        return set;
-
-out_free_tagset:
-       blk_mq_free_tag_set(set);
-out:
-       return ERR_PTR(ret);
 }
 
 static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
@@ -769,7 +745,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
 {
        if (remove) {
                blk_cleanup_queue(ctrl->ctrl.admin_q);
-               nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset);
+               blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
        }
        if (ctrl->async_event_sqe.data) {
                nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
@@ -847,7 +823,7 @@ out_cleanup_queue:
                blk_cleanup_queue(ctrl->ctrl.admin_q);
 out_free_tagset:
        if (new)
-               nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset);
+               blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
 out_free_async_qe:
        nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
                sizeof(struct nvme_command), DMA_TO_DEVICE);
@@ -862,7 +838,7 @@ static void nvme_rdma_destroy_io_queues(struct nvme_rdma_ctrl *ctrl,
 {
        if (remove) {
                blk_cleanup_queue(ctrl->ctrl.connect_q);
-               nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.tagset);
+               blk_mq_free_tag_set(ctrl->ctrl.tagset);
        }
        nvme_rdma_free_io_queues(ctrl);
 }
@@ -903,7 +879,7 @@ out_cleanup_connect_q:
                blk_cleanup_queue(ctrl->ctrl.connect_q);
 out_free_tag_set:
        if (new)
-               nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.tagset);
+               blk_mq_free_tag_set(ctrl->ctrl.tagset);
 out_free_io_queues:
        nvme_rdma_free_io_queues(ctrl);
        return ret;
index 97d3c77..e71502d 100644 (file)
@@ -167,6 +167,7 @@ TRACE_EVENT(nvme_async_event,
                aer_name(NVME_AER_NOTICE_NS_CHANGED),
                aer_name(NVME_AER_NOTICE_ANA),
                aer_name(NVME_AER_NOTICE_FW_ACT_STARTING),
+               aer_name(NVME_AER_NOTICE_DISC_CHANGED),
                aer_name(NVME_AER_ERROR),
                aer_name(NVME_AER_SMART),
                aer_name(NVME_AER_CSS),
index 3ef0a4e..d7f48c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config NVME_TARGET
        tristate "NVMe Target support"
index 6b2c425..afa4335 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig NVMEM
        bool "NVMEM Support"
        help
index 490c8fc..5893543 100644 (file)
@@ -16,6 +16,8 @@ struct zynqmp_nvmem_data {
        struct nvmem_device *nvmem;
 };
 
+static const struct zynqmp_eemi_ops *eemi_ops;
+
 static int zynqmp_nvmem_read(void *context, unsigned int offset,
                             void *val, size_t bytes)
 {
@@ -23,9 +25,7 @@ static int zynqmp_nvmem_read(void *context, unsigned int offset,
        int idcode, version;
        struct zynqmp_nvmem_data *priv = context;
 
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
-
-       if (!eemi_ops || !eemi_ops->get_chipid)
+       if (!eemi_ops->get_chipid)
                return -ENXIO;
 
        ret = eemi_ops->get_chipid(&idcode, &version);
@@ -61,6 +61,10 @@ static int zynqmp_nvmem_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       eemi_ops = zynqmp_pm_get_eemi_ops();
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
+
        priv->dev = dev;
        econfig.dev = dev;
        econfig.reg_read = zynqmp_nvmem_read;
index a7fbb93..fe54d34 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PM_OPP
        bool
        select SRCU
index 6ce6aef..f65ed59 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
 obj-y                          += core.o cpu.o
 obj-$(CONFIG_OF)               += of.o
index 74e119a..9eb2c1b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Bus options (PCI, PCMCIA, EISA, GSC, ISA)"
 
 config GSC
index a97f4ea..24189c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/kconfig-language.txt.
index 9c68f2a..3301861 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Low-level parallel port routines for the Amiga built-in port
  *
  * Author: Joerg Dorchain <joerg@dorchain.net>
index 9fbf6cc..f8dd368 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Low-level parallel port routines for the Atari builtin port
  *
  * Author: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
index 7f4be0e..9f87faf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Low-level parallel port routines for the Multiface 3 card
  *
  * Author: Joerg Dorchain <joerg@dorchain.net>
index 6296dbb..1f17a39 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Low-level parallel-port routines for 8255-based PC-style hardware.
  *
  * Authors: Phil Blundell <philb@gnu.org>
index 8de3295..d5a669b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* parport_sunbpp.c: Parallel-port routines for SBUS
  * 
  * Author: Derrick J. Brashear <shadow@dementia.org>
index fab92ba..e004d8d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PCCARD (PCMCIA/CardBus) bus subsystem configuration
 #
index 19e1782..eb6168e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PCMCIA socket code for the Alchemy Db1xxx/Pb1xxx boards.
  *
index aae7e6d..ec54a2a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 
  * Driver for Intel I82092AA PCI-PCMCIA bridge.
  *
index c2a17a7..267fb87 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <mach/hardware.h>
 #include <asm/io.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #include <mach/mux.h>
 #include <mach/tc.h>
index 5ef351f..1178341 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/drivers/pcmcia/sa1111_generic.c
  *
index b2a1895..b11c7ab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PCMCIA socket code for the MyCable XXS1500 system.
  *
index ac6a3f4..810761a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Regular cardbus driver ("yenta_socket")
  *
index a94e586..e4221a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Performance Monitor Drivers
 #
index eec75b9..2d06b80 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #undef DEBUG
 
 /*
index 7cb766d..e120f93 100644 (file)
@@ -855,16 +855,8 @@ static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages,
        if (!pglist)
                goto out_free_buf;
 
-       for (i = 0; i < nr_pages; ++i) {
-               struct page *page = virt_to_page(pages[i]);
-
-               if (PagePrivate(page)) {
-                       pr_warn("unexpected high-order page for auxbuf!");
-                       goto out_free_pglist;
-               }
-
+       for (i = 0; i < nr_pages; ++i)
                pglist[i] = virt_to_page(pages[i]);
-       }
 
        buf->base = vmap(pglist, nr_pages, VM_MAP, PAGE_KERNEL);
        if (!buf->base)
index 2621d51..c3a96ec 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HISI_PMU) += hisi_uncore_pmu.o hisi_uncore_l3c_pmu.o hisi_uncore_hha_pmu.o hisi_uncore_ddrc_pmu.o
index 27574e8..3259e2e 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * APM X-Gene SoC PMU (Performance Monitor Unit)
  *
  * Copyright (c) 2016, Applied Micro Circuits Corporation
  * Author: Hoan Tran <hotran@apm.com>
  *         Tai Nguyen <ttnguyen@apm.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/acpi.h>
index 250abe2..0263db2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PHY
 #
index 53772d3..2154252 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Allwinner platforms
 #
index 7d0053e..799a65c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_SUN4I_USB)            += phy-sun4i-usb.o
 obj-$(CONFIG_PHY_SUN6I_MIPI_DPHY)      += phy-sun6i-mipi-dphy.o
 obj-$(CONFIG_PHY_SUN9I_USB)            += phy-sun9i-usb.o
index 4c08c1c..af774ac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Amlogic platforms
 #
index fdd008e..11d1c42 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_MESON8B_USB2)         += phy-meson8b-usb2.o
 obj-$(CONFIG_PHY_MESON_GXL_USB2)       += phy-meson-gxl-usb2.o
 obj-$(CONFIG_PHY_MESON_G12A_USB2)      += phy-meson-g12a-usb2.o
index f30f481..d3d983c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Broadcom platforms
 #
index 31f18b6..b2db916 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Cadence PHYs
 #
index 2f9e345..8f89560 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_CADENCE_DP)   += phy-cadence-dp.o
 obj-$(CONFIG_PHY_CADENCE_DPHY) += cdns-dphy.o
 obj-$(CONFIG_PHY_CADENCE_SIERRA)       += phy-cadence-sierra.o
index 832670b..f435d64 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PHY_FSL_IMX8MQ_USB
        tristate "Freescale i.MX8M USB3 PHY"
        depends on OF && HAS_IOMEM
index dc2b3f1..a459a44 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_FSL_IMX8MQ_USB)       += phy-fsl-imx8mq-usb.o
index 3c142f0..534e393 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Hisilicon platforms
 #
index 75ba64e..92e874a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_HI6220_USB)           += phy-hi6220-usb.o
 obj-$(CONFIG_PHY_HI3660_USB)           += phy-hi3660-usb3.o
 obj-$(CONFIG_PHY_HISTB_COMBPHY)                += phy-histb-combphy.o
index 5243812..9b16f13 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * HiSilicon INNO USB2 PHY Driver.
  *
  * Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/clk.h>
index 326d88a..eb66c85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Lantiq / Intel platforms
 #
index f73eb56..5400490 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_LANTIQ_RCU_USB2)      += phy-lantiq-rcu-usb2.o
index 9ba8723..0e16424 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Marvell platforms
 #
index b5a89db..376f5d1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Mediatek devices
 #
index 718f872..4b5e605 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Motorola devices
 #
index 3514f98..7c791cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the phy drivers.
 #
index 2e2a466..83be16d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Microsemi devices
 #
index e147491..7bec61a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Microsemi phy drivers.
 #
index ae266e0..3c91894 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * AppliedMicro X-Gene Multi-purpose PHY driver
  *
@@ -6,19 +7,6 @@
  *         Tuan Phan <tphan@apm.com>
  *         Suman Tripathi <stripathi@apm.com>
  *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  * The APM X-Gene PHY consists of two PLL clock macro's (CMU) and lanes.
  * The first PLL clock macro is used for internal reference clock. The second
  * PLL clock macro is used to generate the clock for the PHY. This driver
index 32f7d34..eb49864 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Qualcomm and Atheros platforms
 #
index 14fd219..da982c9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PHY drivers for Ralink platforms.
 #
index 5c9e326..d8d3ffc 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_RALINK_USB)   += phy-ralink-usb.o
index 990204a..c454c90 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Rockchip platforms
 #
index 2a5d33c..290a6c7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for Samsung platforms
 #
index 9c85231..8c9d7c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PHY drivers for Socionext platforms.
 #
index 609719b..b32f44f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for STMicro platforms
 #
index c0091ad..c862dd9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_MIPHY28LP)            += phy-miphy28lp.o
 obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY)   += phy-spear1310-miphy.o
 obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY)   += phy-spear1340-miphy.o
index a3b1de9..e516967 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PHY_TEGRA_XUSB
        tristate "NVIDIA Tegra XUSB pad controller driver"
        depends on ARCH_TEGRA
index a93cd9a..64ccaea 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_TEGRA_XUSB) += phy-tegra-xusb.o
 
 phy-tegra-xusb-y += xusb.o
index 781514e..c3fa184 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phy drivers for TI platforms
 #
index ea79854..0522c22 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PINCTRL infrastructure and drivers
 #
index c7ed1d4..966f1c2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_OWL
        bool "Actions Semi OWL pinctrl driver"
        depends on (ARCH_ACTIONS || COMPILE_TEST) && OF
index 86521ed..61aa910 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PINCTRL_OWL)      += pinctrl-owl.o
 obj-$(CONFIG_PINCTRL_S700)     += pinctrl-s700.o
 obj-$(CONFIG_PINCTRL_S900)     += pinctrl-s900.o
index 998eabe..4cf5417 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_ASPEED
        bool
        depends on (ARCH_ASPEED || COMPILE_TEST) && OF
index 790b406..068729b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Aspeed pinctrl support
 
 ccflags-y += $(call cc-option,-Woverride-init)
index c857539..97284c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Broadcom pinctrl drivers
 #
index 0dd6027..9b1644d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if (ARCH_BERLIN || COMPILE_TEST)
 
 config PINCTRL_BERLIN
index 00c53ca..7b4aa54 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                                  += berlin.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2)       += berlin-bg2.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2CD)     += berlin-bg2cd.o
index 74af07e..e546a6b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_LOCHNAGAR
        tristate "Cirrus Logic Lochnagar pinctrl driver"
        depends on MFD_LOCHNAGAR
index 20baebf..0c5deb6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Cirrus Logic pinctrl drivers
 obj-$(CONFIG_PINCTRL_LOCHNAGAR)        += pinctrl-lochnagar.o
 
index 0d83878..aeab0d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_IMX
        bool
        select GENERIC_PINCTRL_GROUPS
index 26ed5dc..701f9af 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "MediaTek pinctrl drivers"
        depends on ARCH_MEDIATEK || COMPILE_TEST
 
index 9ab537e..df55f61 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig PINCTRL_MESON
        bool "Amlogic SoC pinctrl drivers"
        depends on ARCH_MESON
index cf283f4..a69c565 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PINCTRL_MESON) += pinctrl-meson.o
 obj-$(CONFIG_PINCTRL_MESON8_PMX) += pinctrl-meson8-pmx.o
 obj-$(CONFIG_PINCTRL_MESON8) += pinctrl-meson8.o
index d9773b7..d69c257 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_MVEBU
        bool
        select PINMUX
index c3efe7d..d6d849e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_U8500
 
 config PINCTRL_ABX500
index 6056841..48ba046 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_NPCM7XX
        bool "Pinctrl and GPIO driver for Nuvoton NPCM7XX"
        depends on (ARCH_NPCM7XX || COMPILE_TEST) && OF
index f0cdb52..568ca96 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* MCP23S08 SPI/I2C GPIO driver */
 
 #include <linux/kernel.h>
index 2b1a61d..348423b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for the U300 pin controller
  *
index 90fd37e..c6052a0 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Zynq pin controller
  *
  *  Copyright (C) 2014 Xilinx
  *
  *  Sören Brinkmann <soren.brinkmann@xilinx.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
index c29bdcf..2f4a867 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if (ARCH_PXA || COMPILE_TEST)
 
 config PINCTRL_PXA
index ca2ade1..f75bcd0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Marvell PXA pin control drivers
 obj-$(CONFIG_PINCTRL_PXA25X)   += pinctrl-pxa2xx.o pinctrl-pxa25x.o
 obj-$(CONFIG_PINCTRL_PXA27X)   += pinctrl-pxa2xx.o pinctrl-pxa27x.o
index 2e66ab7..890d0a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if (ARCH_QCOM || COMPILE_TEST)
 
 config PINCTRL_MSM
index fd58e0b..1ab0742 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # CSR SiRFsoc pinmux support
 
 obj-y  += pinctrl-sirf.o
index 45f8391..ab35d59 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pinctrl pads, groups, functions for CSR SiRFatlasVI
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/pinctrl/pinctrl.h>
index 8a0eee0..9240803 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pinctrl pads, groups, functions for CSR SiRFatlasVII
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/init.h>
index 357678e..49da2a7 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pinctrl pads, groups, functions for CSR SiRFprimaII
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/pinctrl/pinctrl.h>
index 2b3bd1a..780c31b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * pinmux driver for CSR SiRFprimaII
  *
@@ -8,8 +9,6 @@
  *
  * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  * company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/init.h>
index 9550335..d7125b8 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * pinmux driver shared headfile for CSR SiRFsoc
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef __PINMUX_SIRF_H__
index 9ef18eb..98f5a84 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ST Microelectronics SPEAr PINCTRL drivers
 #
index bc7f3fa..b6c5479 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Spreadtrum pin control drivers
 #
index b6caa8c..3d49890 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PINCTRL_SPRD)             += pinctrl-sprd.o
 obj-$(CONFIG_PINCTRL_SPRD_SC9860)      += pinctrl-sprd-sc9860.o
index cd3936e..f36f291 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_STM32 || COMPILE_TEST
 
 config PINCTRL_STM32
index 9093a42..f7aae20 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_SUNXI
 
 config PINCTRL_SUNXI
index 24e20cc..5906a85 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_TEGRA
        bool
        select PINMUX
index 5420770..d7cf279 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_TI_IODELAY
        tristate "TI IODelay Module pinconf driver"
        depends on OF && (SOC_DRA7XX || COMPILE_TEST)
index 913744e..0599e41 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PINCTRL_TI_IODELAY)       += pinctrl-ti-iodelay.o
index 9f2a1c6..c51a4db 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig PINCTRL_UNIPHIER
        bool "UniPhier SoC pinctrl drivers"
        depends on ARCH_UNIPHIER || COMPILE_TEST
index 55724a7..2ca00b5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # VIA/Wondermedia PINCTRL drivers
 #
index 0d97352..4fdc705 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PINCTRL_ZX
        bool
        select PINMUX
index c42e651..2084c78 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PINCTRL_ZX)       += pinctrl-zx.o
 obj-$(CONFIG_PINCTRL_ZX296718) += pinctrl-zx296718.o
index d4c2e42..0b3a906 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if X86
 source "drivers/platform/x86/Kconfig"
 endif
index 997317d..2826f71 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Platform support for Chrome OS hardware (Chromebooks and Chromeboxes)
 #
index e09e4ce..fd29cbf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WILCO_EC
        tristate "ChromeOS Wilco Embedded Controller"
        depends on ACPI && X86 && CROS_EC_LPC && CROS_EC_LPC_MEC
index 74fdfa6..77b35df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig GOLDFISH
        bool "Platform support for Goldfish virtual devices"
        depends on X86_32 || X86_64 || ARM || ARM64 || MIPS
index e0c202d..76ba1d5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Goldfish platform specific drivers
 #
index b3ae30a..62ea193 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MIPS Platform Specific Drivers
 #
index 8dfd039..be8146c 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CPU_HWMON) += cpu_hwmon.o
index 42efcb8..a7f184b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/reboot.h>
index dc8b26b..cee085c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # OLPC XO platform-specific drivers
 #
index 85b92a9..5d5cc61 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # X86 Platform Specific Drivers
 #
index 55cf10b..86cc2cc 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2009  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index 4f9bc72..09dfa6f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*-*-linux-c-*-*/
 
 /*
@@ -7,20 +8,6 @@
 
   Copyright (C) 2006 Lennart Poettering <mzxreary (at) 0pointer (dot) de>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-  02110-1301, USA.
  */
 
 /*
index 6afeaec..8092938 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*-*-linux-c-*-*/
 
 /*
   Templated from msi-laptop.c and thinkpad_acpi.c which is copyright
   by its respective authors.
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-  02110-1301, USA.
  */
 
 /*
index d6ea5e9..12c31fd 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Airplane mode button for HP & Xiaomi laptops
  *
  *  Copyright (C) 2014-2017 Alex Hung <alex.hung@canonical.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/kernel.h>
index 2d94536..5fb9bfd 100644 (file)
@@ -1,23 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  ideapad-laptop.c - Lenovo IdeaPad ACPI Extras
  *
  *  Copyright © 2010 Intel Corporation
  *  Copyright © 2010 David Woodhouse <dwmw2@infradead.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- *  02110-1301, USA.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index d5bfcc6..24ffc8e 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*-*-linux-c-*-*/
 
 /*
   Copyright (C) 2006 Lennart Poettering <mzxreary (at) 0pointer (dot) de>
 
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This 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.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-  02110-1301, USA.
  */
 
 /*
index 71cfaf2..7bde464 100644 (file)
@@ -1,24 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  thinkpad_acpi.c - ThinkPad ACPI Extras
  *
- *
  *  Copyright (C) 2004-2005 Borislav Deianov <borislav@users.sf.net>
  *  Copyright (C) 2006-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- *  02110-1301, USA.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index e366977..a1e6569 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  toshiba_acpi.c - Toshiba Laptop ACPI Extras
  *
@@ -6,19 +7,6 @@
  *  Copyright (C) 2010 Pierre Ducroquet
  *  Copyright (C) 2014-2016 Azael Avalos
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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".
- *
  *  The devolpment page for this driver is located at
  *  http://memebeam.org/toys/ToshibaAcpiDriver.
  *
index 2a37b3f..39191be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Plug and Play configuration
 #
index a1af146..4b58a3d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ISA Plug and Play configuration
 #
index 6e607aa..a0e0c0a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel ISAPNP driver.
 #
index b04767c..70f733f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Plug and Play ACPI configuration
 #
index 40c93da..fb1c715 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel PNPACPI driver.
 #
index a786086..7da992b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Plug and Play BIOS configuration
 #
index 240b0ff..a91437c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernel PNPBIOS driver.
 #
index 63454b5..ff0350c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 source "drivers/power/avs/Kconfig"
 source "drivers/power/reset/Kconfig"
 source "drivers/power/supply/Kconfig"
index ff35c71..b7c2e37 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_POWER_AVS)                += avs/
 obj-$(CONFIG_POWER_RESET)      += reset/
 obj-$(CONFIG_POWER_SUPPLY)     += supply/
index a67eeac..b5a217b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig POWER_AVS
        bool "Adaptive Voltage Scaling class support"
        help
index ba4c7bc..a1b8cd4 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_POWER_AVS_OMAP)           += smartreflex.o
 obj-$(CONFIG_ROCKCHIP_IODOMAIN)                += rockchip-io-domain.o
index 6533aa5..980951d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig POWER_RESET
        bool "Board level reset or power off"
        help
index 2b686c5..e341cc5 100644 (file)
 
 #define SHDW_WK_PIN(reg, cfg)  ((reg) & AT91_SHDW_WKUPIS((cfg)->wkup_pin_input))
 #define SHDW_RTCWK(reg, cfg)   (((reg) >> ((cfg)->sr_rtcwk_shift)) & 0x1)
+#define SHDW_RTTWK(reg, cfg)   (((reg) >> ((cfg)->sr_rttwk_shift)) & 0x1)
 #define SHDW_RTCWKEN(cfg)      (1 << ((cfg)->mr_rtcwk_shift))
+#define SHDW_RTTWKEN(cfg)      (1 << ((cfg)->mr_rttwk_shift))
 
 #define DBC_PERIOD_US(x)       DIV_ROUND_UP_ULL((1000000 * (x)), \
                                                        SLOW_CLOCK_FREQ)
 
+#define SHDW_CFG_NOT_USED      (32)
+
 struct shdwc_config {
        u8 wkup_pin_input;
        u8 mr_rtcwk_shift;
+       u8 mr_rttwk_shift;
        u8 sr_rtcwk_shift;
+       u8 sr_rttwk_shift;
 };
 
 struct shdwc {
@@ -104,6 +110,8 @@ static void __init at91_wakeup_status(struct platform_device *pdev)
                reason = "WKUP pin";
        else if (SHDW_RTCWK(reg, shdw->cfg))
                reason = "RTC";
+       else if (SHDW_RTTWK(reg, shdw->cfg))
+               reason = "RTT";
 
        pr_info("AT91: Wake-Up source: %s\n", reason);
 }
@@ -221,6 +229,9 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev)
        if (of_property_read_bool(np, "atmel,wakeup-rtc-timer"))
                mode |= SHDW_RTCWKEN(shdw->cfg);
 
+       if (of_property_read_bool(np, "atmel,wakeup-rtt-timer"))
+               mode |= SHDW_RTTWKEN(shdw->cfg);
+
        dev_dbg(&pdev->dev, "%s: mode = %#x\n", __func__, mode);
        writel(mode, shdw->shdwc_base + AT91_SHDW_MR);
 
@@ -231,13 +242,27 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev)
 static const struct shdwc_config sama5d2_shdwc_config = {
        .wkup_pin_input = 0,
        .mr_rtcwk_shift = 17,
+       .mr_rttwk_shift = SHDW_CFG_NOT_USED,
        .sr_rtcwk_shift = 5,
+       .sr_rttwk_shift = SHDW_CFG_NOT_USED,
+};
+
+static const struct shdwc_config sam9x60_shdwc_config = {
+       .wkup_pin_input = 0,
+       .mr_rtcwk_shift = 17,
+       .mr_rttwk_shift = 16,
+       .sr_rtcwk_shift = 5,
+       .sr_rttwk_shift = 4,
 };
 
 static const struct of_device_id at91_shdwc_of_match[] = {
        {
                .compatible = "atmel,sama5d2-shdwc",
                .data = &sama5d2_shdwc_config,
+       },
+       {
+               .compatible = "microchip,sam9x60-shdwc",
+               .data = &sam9x60_shdwc_config,
        }, {
                /*sentinel*/
        }
index 7d0d269..5a6bb63 100644 (file)
@@ -27,6 +27,7 @@
 struct syscon_reboot_context {
        struct regmap *map;
        u32 offset;
+       u32 value;
        u32 mask;
        struct notifier_block restart_handler;
 };
@@ -39,7 +40,7 @@ static int syscon_restart_handle(struct notifier_block *this,
                                        restart_handler);
 
        /* Issue the reboot */
-       regmap_write(ctx->map, ctx->offset, ctx->mask);
+       regmap_update_bits(ctx->map, ctx->offset, ctx->mask, ctx->value);
 
        mdelay(1000);
 
@@ -51,6 +52,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
 {
        struct syscon_reboot_context *ctx;
        struct device *dev = &pdev->dev;
+       int mask_err, value_err;
        int err;
 
        ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
@@ -64,8 +66,21 @@ static int syscon_reboot_probe(struct platform_device *pdev)
        if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
                return -EINVAL;
 
-       if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask))
+       value_err = of_property_read_u32(pdev->dev.of_node, "value", &ctx->value);
+       mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask);
+       if (value_err && mask_err) {
+               dev_err(dev, "unable to read 'value' and 'mask'");
                return -EINVAL;
+       }
+
+       if (value_err) {
+               /* support old binding */
+               ctx->value = ctx->mask;
+               ctx->mask = 0xFFFFFFFF;
+       } else if (mask_err) {
+               /* support value without mask*/
+               ctx->mask = 0xFFFFFFFF;
+       }
 
        ctx->restart_handler.notifier_call = syscon_restart_handle;
        ctx->restart_handler.priority = 192;
index 0230c96..dd7da41 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig POWER_SUPPLY
        bool "Power supply class support"
        help
@@ -169,6 +170,17 @@ config BATTERY_COLLIE
          Say Y to enable support for the battery on the Sharp Zaurus
          SL-5500 (collie) models.
 
+config BATTERY_INGENIC
+       tristate "Ingenic JZ47xx SoCs battery driver"
+       depends on MIPS || COMPILE_TEST
+       depends on INGENIC_ADC
+       help
+         Choose this option if you want to monitor battery status on
+         Ingenic JZ47xx SoC based devices.
+
+         This driver can also be built as a module. If so, the module will be
+         called ingenic-battery.
+
 config BATTERY_IPAQ_MICRO
        tristate "iPAQ Atmel Micro ASIC battery driver"
        depends on MFD_IPAQ_MICRO
@@ -475,12 +487,12 @@ config CHARGER_MANAGER
           runtime and in suspend-to-RAM by waking up the system periodically
           with help of suspend_again support.
 
-config CHARGER_LTC3651
-       tristate "LTC3651 charger"
+config CHARGER_LT3651
+       tristate "Analog Devices LT3651 charger"
        depends on GPIOLIB
        help
-         Say Y to include support for the LTC3651 battery charger which reports
-         its status via GPIO lines.
+         Say Y to include support for the Analog Devices (Linear Technology)
+         LT3651 battery charger which reports its status via GPIO lines.
 
 config CHARGER_MAX14577
        tristate "Maxim MAX14577/77836 battery charger driver"
@@ -667,4 +679,14 @@ config FUEL_GAUGE_SC27XX
         Say Y here to enable support for fuel gauge with SC27XX
         PMIC chips.
 
+config CHARGER_UCS1002
+       tristate "Microchip UCS1002 USB Port Power Controller"
+       depends on I2C
+       depends on OF
+       depends on REGULATOR
+       select REGMAP_I2C
+       help
+         Say Y to enable support for Microchip UCS1002 Programmable
+         USB Port Power Controller with Charger Emulation.
+
 endif # POWER_SUPPLY
index b73eb8c..f208273 100644 (file)
@@ -34,6 +34,7 @@ obj-$(CONFIG_BATTERY_PMU)     += pmu_battery.o
 obj-$(CONFIG_BATTERY_OLPC)     += olpc_battery.o
 obj-$(CONFIG_BATTERY_TOSA)     += tosa_battery.o
 obj-$(CONFIG_BATTERY_COLLIE)   += collie_battery.o
+obj-$(CONFIG_BATTERY_INGENIC)  += ingenic-battery.o
 obj-$(CONFIG_BATTERY_IPAQ_MICRO) += ipaq_micro_battery.o
 obj-$(CONFIG_BATTERY_WM97XX)   += wm97xx_battery.o
 obj-$(CONFIG_BATTERY_SBS)      += sbs-battery.o
@@ -67,7 +68,7 @@ obj-$(CONFIG_CHARGER_LP8727)  += lp8727_charger.o
 obj-$(CONFIG_CHARGER_LP8788)   += lp8788-charger.o
 obj-$(CONFIG_CHARGER_GPIO)     += gpio-charger.o
 obj-$(CONFIG_CHARGER_MANAGER)  += charger-manager.o
-obj-$(CONFIG_CHARGER_LTC3651)  += ltc3651-charger.o
+obj-$(CONFIG_CHARGER_LT3651)   += lt3651-charger.o
 obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
 obj-$(CONFIG_CHARGER_DETECTOR_MAX14656)        += max14656_charger_detector.o
 obj-$(CONFIG_CHARGER_MAX77650) += max77650-charger.o
@@ -88,3 +89,4 @@ obj-$(CONFIG_AXP288_CHARGER)  += axp288_charger.o
 obj-$(CONFIG_CHARGER_CROS_USBPD)       += cros_usbpd-charger.o
 obj-$(CONFIG_CHARGER_SC2731)   += sc2731_charger.o
 obj-$(CONFIG_FUEL_GAUGE_SC27XX)        += sc27xx_fuel_gauge.o
+obj-$(CONFIG_CHARGER_UCS1002)  += ucs1002_power.o
index 7b2b699..f6a6697 100644 (file)
@@ -508,6 +508,7 @@ int ab8500_bm_of_probe(struct device *dev,
        btech = of_get_property(battery_node, "stericsson,battery-type", NULL);
        if (!btech) {
                dev_warn(dev, "missing property battery-name/type\n");
+               of_node_put(battery_node);
                return -EINVAL;
        }
 
index f52fe77..d2b1255 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/iio/consumer.h>
+#include <linux/workqueue.h>
 
 #define DRVNAME "axp20x-usb-power-supply"
 
 #define AXP20X_VBUS_VHOLD_MASK         GENMASK(5, 3)
 #define AXP20X_VBUS_VHOLD_OFFSET       3
 #define AXP20X_VBUS_CLIMIT_MASK                3
-#define AXP20X_VBUC_CLIMIT_900mA       0
-#define AXP20X_VBUC_CLIMIT_500mA       1
-#define AXP20X_VBUC_CLIMIT_100mA       2
-#define AXP20X_VBUC_CLIMIT_NONE                3
+#define AXP20X_VBUS_CLIMIT_900mA       0
+#define AXP20X_VBUS_CLIMIT_500mA       1
+#define AXP20X_VBUS_CLIMIT_100mA       2
+#define AXP20X_VBUS_CLIMIT_NONE                3
+
+#define AXP813_VBUS_CLIMIT_900mA       0
+#define AXP813_VBUS_CLIMIT_1500mA      1
+#define AXP813_VBUS_CLIMIT_2000mA      2
+#define AXP813_VBUS_CLIMIT_2500mA      3
 
 #define AXP20X_ADC_EN1_VBUS_CURR       BIT(2)
 #define AXP20X_ADC_EN1_VBUS_VOLT       BIT(3)
 
 #define AXP20X_VBUS_MON_VBUS_VALID     BIT(3)
 
+/*
+ * Note do not raise the debounce time, we must report Vusb high within
+ * 100ms otherwise we get Vbus errors in musb.
+ */
+#define DEBOUNCE_TIME                  msecs_to_jiffies(50)
+
 struct axp20x_usb_power {
        struct device_node *np;
        struct regmap *regmap;
@@ -53,6 +65,8 @@ struct axp20x_usb_power {
        enum axp20x_variants axp20x_id;
        struct iio_channel *vbus_v;
        struct iio_channel *vbus_i;
+       struct delayed_work vbus_detect;
+       unsigned int old_status;
 };
 
 static irqreturn_t axp20x_usb_power_irq(int irq, void *devid)
@@ -64,6 +78,89 @@ static irqreturn_t axp20x_usb_power_irq(int irq, void *devid)
        return IRQ_HANDLED;
 }
 
+static void axp20x_usb_power_poll_vbus(struct work_struct *work)
+{
+       struct axp20x_usb_power *power =
+               container_of(work, struct axp20x_usb_power, vbus_detect.work);
+       unsigned int val;
+       int ret;
+
+       ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, &val);
+       if (ret)
+               goto out;
+
+       val &= (AXP20X_PWR_STATUS_VBUS_PRESENT | AXP20X_PWR_STATUS_VBUS_USED);
+       if (val != power->old_status)
+               power_supply_changed(power->supply);
+
+       power->old_status = val;
+
+out:
+       mod_delayed_work(system_wq, &power->vbus_detect, DEBOUNCE_TIME);
+}
+
+static bool axp20x_usb_vbus_needs_polling(struct axp20x_usb_power *power)
+{
+       if (power->axp20x_id >= AXP221_ID)
+               return true;
+
+       return false;
+}
+
+static int axp20x_get_current_max(struct axp20x_usb_power *power, int *val)
+{
+       unsigned int v;
+       int ret = regmap_read(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, &v);
+
+       if (ret)
+               return ret;
+
+       switch (v & AXP20X_VBUS_CLIMIT_MASK) {
+       case AXP20X_VBUS_CLIMIT_100mA:
+               if (power->axp20x_id == AXP221_ID)
+                       *val = -1; /* No 100mA limit */
+               else
+                       *val = 100000;
+               break;
+       case AXP20X_VBUS_CLIMIT_500mA:
+               *val = 500000;
+               break;
+       case AXP20X_VBUS_CLIMIT_900mA:
+               *val = 900000;
+               break;
+       case AXP20X_VBUS_CLIMIT_NONE:
+               *val = -1;
+               break;
+       }
+
+       return 0;
+}
+
+static int axp813_get_current_max(struct axp20x_usb_power *power, int *val)
+{
+       unsigned int v;
+       int ret = regmap_read(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, &v);
+
+       if (ret)
+               return ret;
+
+       switch (v & AXP20X_VBUS_CLIMIT_MASK) {
+       case AXP813_VBUS_CLIMIT_900mA:
+               *val = 900000;
+               break;
+       case AXP813_VBUS_CLIMIT_1500mA:
+               *val = 1500000;
+               break;
+       case AXP813_VBUS_CLIMIT_2000mA:
+               *val = 2000000;
+               break;
+       case AXP813_VBUS_CLIMIT_2500mA:
+               *val = 2500000;
+               break;
+       }
+       return 0;
+}
+
 static int axp20x_usb_power_get_property(struct power_supply *psy,
        enum power_supply_property psp, union power_supply_propval *val)
 {
@@ -102,28 +199,9 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
                val->intval = ret * 1700; /* 1 step = 1.7 mV */
                return 0;
        case POWER_SUPPLY_PROP_CURRENT_MAX:
-               ret = regmap_read(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, &v);
-               if (ret)
-                       return ret;
-
-               switch (v & AXP20X_VBUS_CLIMIT_MASK) {
-               case AXP20X_VBUC_CLIMIT_100mA:
-                       if (power->axp20x_id == AXP221_ID)
-                               val->intval = -1; /* No 100mA limit */
-                       else
-                               val->intval = 100000;
-                       break;
-               case AXP20X_VBUC_CLIMIT_500mA:
-                       val->intval = 500000;
-                       break;
-               case AXP20X_VBUC_CLIMIT_900mA:
-                       val->intval = 900000;
-                       break;
-               case AXP20X_VBUC_CLIMIT_NONE:
-                       val->intval = -1;
-                       break;
-               }
-               return 0;
+               if (power->axp20x_id == AXP813_ID)
+                       return axp813_get_current_max(power, &val->intval);
+               return axp20x_get_current_max(power, &val->intval);
        case POWER_SUPPLY_PROP_CURRENT_NOW:
                if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
                        ret = iio_read_channel_processed(power->vbus_i,
@@ -214,6 +292,31 @@ static int axp20x_usb_power_set_voltage_min(struct axp20x_usb_power *power,
        return -EINVAL;
 }
 
+static int axp813_usb_power_set_current_max(struct axp20x_usb_power *power,
+                                           int intval)
+{
+       int val;
+
+       switch (intval) {
+       case 900000:
+               return regmap_update_bits(power->regmap,
+                                         AXP20X_VBUS_IPSOUT_MGMT,
+                                         AXP20X_VBUS_CLIMIT_MASK,
+                                         AXP813_VBUS_CLIMIT_900mA);
+       case 1500000:
+       case 2000000:
+       case 2500000:
+               val = (intval - 1000000) / 500000;
+               return regmap_update_bits(power->regmap,
+                                         AXP20X_VBUS_IPSOUT_MGMT,
+                                         AXP20X_VBUS_CLIMIT_MASK, val);
+       default:
+               return -EINVAL;
+       }
+
+       return -EINVAL;
+}
+
 static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
                                            int intval)
 {
@@ -248,6 +351,9 @@ static int axp20x_usb_power_set_property(struct power_supply *psy,
                return axp20x_usb_power_set_voltage_min(power, val->intval);
 
        case POWER_SUPPLY_PROP_CURRENT_MAX:
+               if (power->axp20x_id == AXP813_ID)
+                       return axp813_usb_power_set_current_max(power,
+                                                               val->intval);
                return axp20x_usb_power_set_current_max(power, val->intval);
 
        default:
@@ -357,6 +463,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
        if (!power)
                return -ENOMEM;
 
+       platform_set_drvdata(pdev, power);
        power->axp20x_id = (enum axp20x_variants)of_device_get_match_data(
                                                                &pdev->dev);
 
@@ -382,7 +489,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
                usb_power_desc = &axp20x_usb_power_desc;
                irq_names = axp20x_irq_names;
        } else if (power->axp20x_id == AXP221_ID ||
-                  power->axp20x_id == AXP223_ID) {
+                  power->axp20x_id == AXP223_ID ||
+                  power->axp20x_id == AXP813_ID) {
                usb_power_desc = &axp22x_usb_power_desc;
                irq_names = axp22x_irq_names;
        } else {
@@ -415,6 +523,19 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
                                 irq_names[i], ret);
        }
 
+       INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus);
+       if (axp20x_usb_vbus_needs_polling(power))
+               queue_delayed_work(system_wq, &power->vbus_detect, 0);
+
+       return 0;
+}
+
+static int axp20x_usb_power_remove(struct platform_device *pdev)
+{
+       struct axp20x_usb_power *power = platform_get_drvdata(pdev);
+
+       cancel_delayed_work_sync(&power->vbus_detect);
+
        return 0;
 }
 
@@ -428,12 +549,16 @@ static const struct of_device_id axp20x_usb_power_match[] = {
        }, {
                .compatible = "x-powers,axp223-usb-power-supply",
                .data = (void *)AXP223_ID,
+       }, {
+               .compatible = "x-powers,axp813-usb-power-supply",
+               .data = (void *)AXP813_ID,
        }, { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
 
 static struct platform_driver axp20x_usb_power_driver = {
        .probe = axp20x_usb_power_probe,
+       .remove = axp20x_usb_power_remove,
        .driver = {
                .name = DRVNAME,
                .of_match_table = axp20x_usb_power_match,
index f8c6da9..00b9618 100644 (file)
@@ -833,6 +833,10 @@ static int axp288_charger_probe(struct platform_device *pdev)
        /* Register charger interrupts */
        for (i = 0; i < CHRG_INTR_END; i++) {
                pirq = platform_get_irq(info->pdev, i);
+               if (pirq < 0) {
+                       dev_err(&pdev->dev, "Failed to get IRQ: %d\n", pirq);
+                       return pirq;
+               }
                info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
                if (info->irq[i] < 0) {
                        dev_warn(&info->pdev->dev,
index 9ff2461..368281b 100644 (file)
@@ -686,6 +686,26 @@ intr_failed:
  */
 static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
        {
+               /* ACEPC T8 Cherry Trail Z8350 mini PC */
+               .matches = {
+                       DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
+                       DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),
+                       /* also match on somewhat unique bios-version */
+                       DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
+               },
+       },
+       {
+               /* ACEPC T11 Cherry Trail Z8350 mini PC */
+               .matches = {
+                       DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
+                       DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
+                       DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),
+                       /* also match on somewhat unique bios-version */
+                       DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
+               },
+       },
+       {
                /* Intel Cherry Trail Compute Stick, Windows version */
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
index 29b3a40..195c18c 100644 (file)
@@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
                        di->charge_design_full = bq27xxx_battery_read_dcap(di);
        }
 
-       if (di->cache.capacity != cache.capacity)
+       if ((di->cache.capacity != cache.capacity) ||
+           (di->cache.flags != cache.flags))
                power_supply_changed(di->bat);
 
        if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
index 2e8db5e..a6900aa 100644 (file)
@@ -1987,6 +1987,9 @@ static struct platform_driver charger_manager_driver = {
 static int __init charger_manager_init(void)
 {
        cm_wq = create_freezable_workqueue("charger_manager");
+       if (unlikely(!cm_wq))
+               return -ENOMEM;
+
        INIT_DELAYED_WORK(&cm_monitor_work, cm_monitor_poller);
 
        return platform_driver_register(&charger_manager_driver);
index 6887870..61d6447 100644 (file)
@@ -82,9 +82,9 @@ struct cpcap_battery_config {
 };
 
 struct cpcap_coulomb_counter_data {
-       s32 sample;             /* 24-bits */
+       s32 sample;             /* 24 or 32 bits */
        s32 accumulator;
-       s16 offset;             /* 10-bits */
+       s16 offset;             /* bits */
 };
 
 enum cpcap_battery_state {
@@ -213,7 +213,7 @@ static int cpcap_battery_get_current(struct cpcap_battery_ddata *ddata)
  * TI or ST coulomb counter in the PMIC.
  */
 static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata,
-                                   u32 sample, s32 accumulator,
+                                   s32 sample, s32 accumulator,
                                    s16 offset, u32 divider)
 {
        s64 acc;
@@ -224,9 +224,6 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata,
        if (!divider)
                return 0;
 
-       sample &= 0xffffff;             /* 24-bits, unsigned */
-       offset &= 0x7ff;                /* 10-bits, signed */
-
        switch (ddata->vendor) {
        case CPCAP_VENDOR_ST:
                cc_lsb = 95374;         /* μAms per LSB */
@@ -259,7 +256,7 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata,
 
 /* 3600000μAms = 1μAh */
 static int cpcap_battery_cc_to_uah(struct cpcap_battery_ddata *ddata,
-                                  u32 sample, s32 accumulator,
+                                  s32 sample, s32 accumulator,
                                   s16 offset)
 {
        return cpcap_battery_cc_raw_div(ddata, sample,
@@ -268,7 +265,7 @@ static int cpcap_battery_cc_to_uah(struct cpcap_battery_ddata *ddata,
 }
 
 static int cpcap_battery_cc_to_ua(struct cpcap_battery_ddata *ddata,
-                                 u32 sample, s32 accumulator,
+                                 s32 sample, s32 accumulator,
                                  s16 offset)
 {
        return cpcap_battery_cc_raw_div(ddata, sample,
@@ -312,17 +309,19 @@ cpcap_battery_read_accumulated(struct cpcap_battery_ddata *ddata,
        /* Sample value CPCAP_REG_CCS1 & 2 */
        ccd->sample = (buf[1] & 0x0fff) << 16;
        ccd->sample |= buf[0];
+       if (ddata->vendor == CPCAP_VENDOR_TI)
+               ccd->sample = sign_extend32(24, ccd->sample);
 
        /* Accumulator value CPCAP_REG_CCA1 & 2 */
        ccd->accumulator = ((s16)buf[3]) << 16;
        ccd->accumulator |= buf[2];
 
-       /* Offset value CPCAP_REG_CCO */
-       ccd->offset = buf[5];
-
-       /* Adjust offset based on mode value CPCAP_REG_CCM? */
-       if (buf[4] >= 0x200)
-               ccd->offset |= 0xfc00;
+       /*
+        * Coulomb counter calibration offset is CPCAP_REG_CCM,
+        * REG_CCO seems unused
+        */
+       ccd->offset = buf[4];
+       ccd->offset = sign_extend32(ccd->offset, 9);
 
        return cpcap_battery_cc_to_uah(ddata,
                                       ccd->sample,
@@ -477,11 +476,11 @@ static int cpcap_battery_get_property(struct power_supply *psy,
                val->intval = ddata->config.info.voltage_min_design;
                break;
        case POWER_SUPPLY_PROP_CURRENT_AVG:
-               if (cached) {
+               sample = latest->cc.sample - previous->cc.sample;
+               if (!sample) {
                        val->intval = cpcap_battery_cc_get_avg_current(ddata);
                        break;
                }
-               sample = latest->cc.sample - previous->cc.sample;
                accumulator = latest->cc.accumulator - previous->cc.accumulator;
                val->intval = cpcap_battery_cc_to_ua(ddata, sample,
                                                     accumulator,
@@ -498,13 +497,13 @@ static int cpcap_battery_get_property(struct power_supply *psy,
                val->intval = div64_s64(tmp, 100);
                break;
        case POWER_SUPPLY_PROP_POWER_AVG:
-               if (cached) {
+               sample = latest->cc.sample - previous->cc.sample;
+               if (!sample) {
                        tmp = cpcap_battery_cc_get_avg_current(ddata);
                        tmp *= (latest->voltage / 10000);
                        val->intval = div64_s64(tmp, 100);
                        break;
                }
-               sample = latest->cc.sample - previous->cc.sample;
                accumulator = latest->cc.accumulator - previous->cc.accumulator;
                tmp = cpcap_battery_cc_to_ua(ddata, sample, accumulator,
                                             latest->cc.offset);
@@ -562,11 +561,11 @@ static irqreturn_t cpcap_battery_irq_thread(int irq, void *data)
 
        switch (d->action) {
        case CPCAP_BATTERY_IRQ_ACTION_BATTERY_LOW:
-               if (latest->counter_uah >= 0)
+               if (latest->current_ua >= 0)
                        dev_warn(ddata->dev, "Battery low at 3.3V!\n");
                break;
        case CPCAP_BATTERY_IRQ_ACTION_POWEROFF:
-               if (latest->counter_uah >= 0) {
+               if (latest->current_ua >= 0) {
                        dev_emerg(ddata->dev,
                                  "Battery empty at 3.1V, powering off\n");
                        orderly_poweroff(true);
@@ -670,8 +669,9 @@ static int cpcap_battery_init_iio(struct cpcap_battery_ddata *ddata)
        return 0;
 
 out_err:
-       dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
-               error);
+       if (error != -EPROBE_DEFER)
+               dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
+                       error);
 
        return error;
 }
index c3ed7b4..b4781b5 100644 (file)
@@ -574,8 +574,9 @@ static int cpcap_charger_init_iio(struct cpcap_charger_ddata *ddata)
        return 0;
 
 out_err:
-       dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
-               error);
+       if (error != -EPROBE_DEFER)
+               dev_err(ddata->dev, "could not initialize VBUS or ID IIO: %i\n",
+                       error);
 
        return error;
 }
index 7e4f11d..f99e8f1 100644 (file)
 
 struct gpio_charger {
        unsigned int irq;
+       unsigned int charge_status_irq;
        bool wakeup_enabled;
 
        struct power_supply *charger;
        struct power_supply_desc charger_desc;
        struct gpio_desc *gpiod;
+       struct gpio_desc *charge_status;
 };
 
 static irqreturn_t gpio_charger_irq(int irq, void *devid)
@@ -59,6 +61,12 @@ static int gpio_charger_get_property(struct power_supply *psy,
        case POWER_SUPPLY_PROP_ONLINE:
                val->intval = gpiod_get_value_cansleep(gpio_charger->gpiod);
                break;
+       case POWER_SUPPLY_PROP_STATUS:
+               if (gpiod_get_value_cansleep(gpio_charger->charge_status))
+                       val->intval = POWER_SUPPLY_STATUS_CHARGING;
+               else
+                       val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+               break;
        default:
                return -EINVAL;
        }
@@ -93,8 +101,29 @@ static enum power_supply_type gpio_charger_get_type(struct device *dev)
        return POWER_SUPPLY_TYPE_UNKNOWN;
 }
 
+static int gpio_charger_get_irq(struct device *dev, void *dev_id,
+                               struct gpio_desc *gpio)
+{
+       int ret, irq = gpiod_to_irq(gpio);
+
+       if (irq > 0) {
+               ret = devm_request_any_context_irq(dev, irq, gpio_charger_irq,
+                                                  IRQF_TRIGGER_RISING |
+                                                  IRQF_TRIGGER_FALLING,
+                                                  dev_name(dev),
+                                                  dev_id);
+               if (ret < 0) {
+                       dev_warn(dev, "Failed to request irq: %d\n", ret);
+                       irq = 0;
+               }
+       }
+
+       return irq;
+}
+
 static enum power_supply_property gpio_charger_properties[] = {
        POWER_SUPPLY_PROP_ONLINE,
+       POWER_SUPPLY_PROP_STATUS /* Must always be last in the array. */
 };
 
 static int gpio_charger_probe(struct platform_device *pdev)
@@ -104,8 +133,10 @@ static int gpio_charger_probe(struct platform_device *pdev)
        struct power_supply_config psy_cfg = {};
        struct gpio_charger *gpio_charger;
        struct power_supply_desc *charger_desc;
+       struct gpio_desc *charge_status;
+       int charge_status_irq;
        unsigned long flags;
-       int irq, ret;
+       int ret;
 
        if (!pdata && !dev->of_node) {
                dev_err(dev, "No platform data\n");
@@ -151,9 +182,17 @@ static int gpio_charger_probe(struct platform_device *pdev)
                return PTR_ERR(gpio_charger->gpiod);
        }
 
+       charge_status = devm_gpiod_get_optional(dev, "charge-status", GPIOD_IN);
+       gpio_charger->charge_status = charge_status;
+       if (IS_ERR(gpio_charger->charge_status))
+               return PTR_ERR(gpio_charger->charge_status);
+
        charger_desc = &gpio_charger->charger_desc;
        charger_desc->properties = gpio_charger_properties;
        charger_desc->num_properties = ARRAY_SIZE(gpio_charger_properties);
+       /* Remove POWER_SUPPLY_PROP_STATUS from the supported properties. */
+       if (!gpio_charger->charge_status)
+               charger_desc->num_properties -= 1;
        charger_desc->get_property = gpio_charger_get_property;
 
        psy_cfg.of_node = dev->of_node;
@@ -180,16 +219,12 @@ static int gpio_charger_probe(struct platform_device *pdev)
                return ret;
        }
 
-       irq = gpiod_to_irq(gpio_charger->gpiod);
-       if (irq > 0) {
-               ret = devm_request_any_context_irq(dev, irq, gpio_charger_irq,
-                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                               dev_name(dev), gpio_charger->charger);
-               if (ret < 0)
-                       dev_warn(dev, "Failed to request irq: %d\n", ret);
-               else
-                       gpio_charger->irq = irq;
-       }
+       gpio_charger->irq = gpio_charger_get_irq(dev, gpio_charger->charger,
+                                                gpio_charger->gpiod);
+
+       charge_status_irq = gpio_charger_get_irq(dev, gpio_charger->charger,
+                                                gpio_charger->charge_status);
+       gpio_charger->charge_status_irq = charge_status_irq;
 
        platform_set_drvdata(pdev, gpio_charger);
 
diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c
new file mode 100644 (file)
index 0000000..35816d4
--- /dev/null
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Battery driver for the Ingenic JZ47xx SoCs
+ * Copyright (c) 2019 Artur Rojek <contact@artur-rojek.eu>
+ *
+ * based on drivers/power/supply/jz4740-battery.c
+ */
+
+#include <linux/iio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>
+#include <linux/property.h>
+
+struct ingenic_battery {
+       struct device *dev;
+       struct iio_channel *channel;
+       struct power_supply_desc desc;
+       struct power_supply *battery;
+       struct power_supply_battery_info info;
+};
+
+static int ingenic_battery_get_property(struct power_supply *psy,
+                                       enum power_supply_property psp,
+                                       union power_supply_propval *val)
+{
+       struct ingenic_battery *bat = power_supply_get_drvdata(psy);
+       struct power_supply_battery_info *info = &bat->info;
+       int ret;
+
+       switch (psp) {
+       case POWER_SUPPLY_PROP_HEALTH:
+               ret = iio_read_channel_processed(bat->channel, &val->intval);
+               val->intval *= 1000;
+               if (val->intval < info->voltage_min_design_uv)
+                       val->intval = POWER_SUPPLY_HEALTH_DEAD;
+               else if (val->intval > info->voltage_max_design_uv)
+                       val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
+               else
+                       val->intval = POWER_SUPPLY_HEALTH_GOOD;
+               return ret;
+       case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+               ret = iio_read_channel_processed(bat->channel, &val->intval);
+               val->intval *= 1000;
+               return ret;
+       case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
+               val->intval = info->voltage_min_design_uv;
+               return 0;
+       case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
+               val->intval = info->voltage_max_design_uv;
+               return 0;
+       default:
+               return -EINVAL;
+       };
+}
+
+/* Set the most appropriate IIO channel voltage reference scale
+ * based on the battery's max voltage.
+ */
+static int ingenic_battery_set_scale(struct ingenic_battery *bat)
+{
+       const int *scale_raw;
+       int scale_len, scale_type, best_idx = -1, best_mV, max_raw, i, ret;
+       u64 max_mV;
+
+       ret = iio_read_max_channel_raw(bat->channel, &max_raw);
+       if (ret) {
+               dev_err(bat->dev, "Unable to read max raw channel value\n");
+               return ret;
+       }
+
+       ret = iio_read_avail_channel_attribute(bat->channel, &scale_raw,
+                                              &scale_type, &scale_len,
+                                              IIO_CHAN_INFO_SCALE);
+       if (ret < 0) {
+               dev_err(bat->dev, "Unable to read channel avail scale\n");
+               return ret;
+       }
+       if (ret != IIO_AVAIL_LIST || scale_type != IIO_VAL_FRACTIONAL_LOG2)
+               return -EINVAL;
+
+       max_mV = bat->info.voltage_max_design_uv / 1000;
+
+       for (i = 0; i < scale_len; i += 2) {
+               u64 scale_mV = (max_raw * scale_raw[i]) >> scale_raw[i + 1];
+
+               if (scale_mV < max_mV)
+                       continue;
+
+               if (best_idx >= 0 && scale_mV > best_mV)
+                       continue;
+
+               best_mV = scale_mV;
+               best_idx = i;
+       }
+
+       if (best_idx < 0) {
+               dev_err(bat->dev, "Unable to find matching voltage scale\n");
+               return -EINVAL;
+       }
+
+       return iio_write_channel_attribute(bat->channel,
+                                          scale_raw[best_idx],
+                                          scale_raw[best_idx + 1],
+                                          IIO_CHAN_INFO_SCALE);
+}
+
+static enum power_supply_property ingenic_battery_properties[] = {
+       POWER_SUPPLY_PROP_HEALTH,
+       POWER_SUPPLY_PROP_VOLTAGE_NOW,
+       POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+       POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
+};
+
+static int ingenic_battery_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct ingenic_battery *bat;
+       struct power_supply_config psy_cfg = {};
+       struct power_supply_desc *desc;
+       int ret;
+
+       bat = devm_kzalloc(dev, sizeof(*bat), GFP_KERNEL);
+       if (!bat)
+               return -ENOMEM;
+
+       bat->dev = dev;
+       bat->channel = devm_iio_channel_get(dev, "battery");
+       if (IS_ERR(bat->channel))
+               return PTR_ERR(bat->channel);
+
+       desc = &bat->desc;
+       desc->name = "jz-battery";
+       desc->type = POWER_SUPPLY_TYPE_BATTERY;
+       desc->properties = ingenic_battery_properties;
+       desc->num_properties = ARRAY_SIZE(ingenic_battery_properties);
+       desc->get_property = ingenic_battery_get_property;
+       psy_cfg.drv_data = bat;
+       psy_cfg.of_node = dev->of_node;
+
+       bat->battery = devm_power_supply_register(dev, desc, &psy_cfg);
+       if (IS_ERR(bat->battery)) {
+               dev_err(dev, "Unable to register battery\n");
+               return PTR_ERR(bat->battery);
+       }
+
+       ret = power_supply_get_battery_info(bat->battery, &bat->info);
+       if (ret) {
+               dev_err(dev, "Unable to get battery info: %d\n", ret);
+               return ret;
+       }
+       if (bat->info.voltage_min_design_uv < 0) {
+               dev_err(dev, "Unable to get voltage min design\n");
+               return bat->info.voltage_min_design_uv;
+       }
+       if (bat->info.voltage_max_design_uv < 0) {
+               dev_err(dev, "Unable to get voltage max design\n");
+               return bat->info.voltage_max_design_uv;
+       }
+
+       return ingenic_battery_set_scale(bat);
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id ingenic_battery_of_match[] = {
+       { .compatible = "ingenic,jz4740-battery", },
+       { },
+};
+MODULE_DEVICE_TABLE(of, ingenic_battery_of_match);
+#endif
+
+static struct platform_driver ingenic_battery_driver = {
+       .driver = {
+               .name = "ingenic-battery",
+               .of_match_table = of_match_ptr(ingenic_battery_of_match),
+       },
+       .probe = ingenic_battery_probe,
+};
+module_platform_driver(ingenic_battery_driver);
+
+MODULE_DESCRIPTION("Battery driver for Ingenic JZ47xx SoCs");
+MODULE_AUTHOR("Artur Rojek <contact@artur-rojek.eu>");
+MODULE_LICENSE("GPL");
similarity index 50%
rename from drivers/power/supply/ltc3651-charger.c
rename to drivers/power/supply/lt3651-charger.c
index eea63ff..8de500f 100644 (file)
@@ -1,11 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
+ *  Driver for Analog Devices (Linear Technology) LT3651 charger IC.
  *  Copyright (C) 2017, Topic Embedded Products
- *  Driver for LTC3651 charger IC.
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under  the terms of the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the License, or (at your
- *  option) any later version.
  */
 
 #include <linux/device.h>
@@ -19,7 +15,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 
-struct ltc3651_charger {
+struct lt3651_charger {
        struct power_supply *charger;
        struct power_supply_desc charger_desc;
        struct gpio_desc *acpr_gpio;
@@ -27,7 +23,7 @@ struct ltc3651_charger {
        struct gpio_desc *chrg_gpio;
 };
 
-static irqreturn_t ltc3651_charger_irq(int irq, void *devid)
+static irqreturn_t lt3651_charger_irq(int irq, void *devid)
 {
        struct power_supply *charger = devid;
 
@@ -36,37 +32,37 @@ static irqreturn_t ltc3651_charger_irq(int irq, void *devid)
        return IRQ_HANDLED;
 }
 
-static inline struct ltc3651_charger *psy_to_ltc3651_charger(
+static inline struct lt3651_charger *psy_to_lt3651_charger(
        struct power_supply *psy)
 {
        return power_supply_get_drvdata(psy);
 }
 
-static int ltc3651_charger_get_property(struct power_supply *psy,
+static int lt3651_charger_get_property(struct power_supply *psy,
                enum power_supply_property psp, union power_supply_propval *val)
 {
-       struct ltc3651_charger *ltc3651_charger = psy_to_ltc3651_charger(psy);
+       struct lt3651_charger *lt3651_charger = psy_to_lt3651_charger(psy);
 
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
-               if (!ltc3651_charger->chrg_gpio) {
+               if (!lt3651_charger->chrg_gpio) {
                        val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
                        break;
                }
-               if (gpiod_get_value(ltc3651_charger->chrg_gpio))
+               if (gpiod_get_value(lt3651_charger->chrg_gpio))
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
                else
                        val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
                break;
        case POWER_SUPPLY_PROP_ONLINE:
-               val->intval = gpiod_get_value(ltc3651_charger->acpr_gpio);
+               val->intval = gpiod_get_value(lt3651_charger->acpr_gpio);
                break;
        case POWER_SUPPLY_PROP_HEALTH:
-               if (!ltc3651_charger->fault_gpio) {
+               if (!lt3651_charger->fault_gpio) {
                        val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
                        break;
                }
-               if (!gpiod_get_value(ltc3651_charger->fault_gpio)) {
+               if (!gpiod_get_value(lt3651_charger->fault_gpio)) {
                        val->intval = POWER_SUPPLY_HEALTH_GOOD;
                        break;
                }
@@ -74,11 +70,11 @@ static int ltc3651_charger_get_property(struct power_supply *psy,
                 * If the fault pin is active, the chrg pin explains the type
                 * of failure.
                 */
-               if (!ltc3651_charger->chrg_gpio) {
+               if (!lt3651_charger->chrg_gpio) {
                        val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
                        break;
                }
-               val->intval = gpiod_get_value(ltc3651_charger->chrg_gpio) ?
+               val->intval = gpiod_get_value(lt3651_charger->chrg_gpio) ?
                                POWER_SUPPLY_HEALTH_OVERHEAT :
                                POWER_SUPPLY_HEALTH_DEAD;
                break;
@@ -89,59 +85,59 @@ static int ltc3651_charger_get_property(struct power_supply *psy,
        return 0;
 }
 
-static enum power_supply_property ltc3651_charger_properties[] = {
+static enum power_supply_property lt3651_charger_properties[] = {
        POWER_SUPPLY_PROP_STATUS,
        POWER_SUPPLY_PROP_ONLINE,
        POWER_SUPPLY_PROP_HEALTH,
 };
 
-static int ltc3651_charger_probe(struct platform_device *pdev)
+static int lt3651_charger_probe(struct platform_device *pdev)
 {
        struct power_supply_config psy_cfg = {};
-       struct ltc3651_charger *ltc3651_charger;
+       struct lt3651_charger *lt3651_charger;
        struct power_supply_desc *charger_desc;
        int ret;
 
-       ltc3651_charger = devm_kzalloc(&pdev->dev, sizeof(*ltc3651_charger),
+       lt3651_charger = devm_kzalloc(&pdev->dev, sizeof(*lt3651_charger),
                                        GFP_KERNEL);
-       if (!ltc3651_charger)
+       if (!lt3651_charger)
                return -ENOMEM;
 
-       ltc3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev,
+       lt3651_charger->acpr_gpio = devm_gpiod_get(&pdev->dev,
                                        "lltc,acpr", GPIOD_IN);
-       if (IS_ERR(ltc3651_charger->acpr_gpio)) {
-               ret = PTR_ERR(ltc3651_charger->acpr_gpio);
+       if (IS_ERR(lt3651_charger->acpr_gpio)) {
+               ret = PTR_ERR(lt3651_charger->acpr_gpio);
                dev_err(&pdev->dev, "Failed to acquire acpr GPIO: %d\n", ret);
                return ret;
        }
-       ltc3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev,
+       lt3651_charger->fault_gpio = devm_gpiod_get_optional(&pdev->dev,
                                        "lltc,fault", GPIOD_IN);
-       if (IS_ERR(ltc3651_charger->fault_gpio)) {
-               ret = PTR_ERR(ltc3651_charger->fault_gpio);
+       if (IS_ERR(lt3651_charger->fault_gpio)) {
+               ret = PTR_ERR(lt3651_charger->fault_gpio);
                dev_err(&pdev->dev, "Failed to acquire fault GPIO: %d\n", ret);
                return ret;
        }
-       ltc3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev,
+       lt3651_charger->chrg_gpio = devm_gpiod_get_optional(&pdev->dev,
                                        "lltc,chrg", GPIOD_IN);
-       if (IS_ERR(ltc3651_charger->chrg_gpio)) {
-               ret = PTR_ERR(ltc3651_charger->chrg_gpio);
+       if (IS_ERR(lt3651_charger->chrg_gpio)) {
+               ret = PTR_ERR(lt3651_charger->chrg_gpio);
                dev_err(&pdev->dev, "Failed to acquire chrg GPIO: %d\n", ret);
                return ret;
        }
 
-       charger_desc = &ltc3651_charger->charger_desc;
+       charger_desc = &lt3651_charger->charger_desc;
        charger_desc->name = pdev->dev.of_node->name;
        charger_desc->type = POWER_SUPPLY_TYPE_MAINS;
-       charger_desc->properties = ltc3651_charger_properties;
-       charger_desc->num_properties = ARRAY_SIZE(ltc3651_charger_properties);
-       charger_desc->get_property = ltc3651_charger_get_property;
+       charger_desc->properties = lt3651_charger_properties;
+       charger_desc->num_properties = ARRAY_SIZE(lt3651_charger_properties);
+       charger_desc->get_property = lt3651_charger_get_property;
        psy_cfg.of_node = pdev->dev.of_node;
-       psy_cfg.drv_data = ltc3651_charger;
+       psy_cfg.drv_data = lt3651_charger;
 
-       ltc3651_charger->charger = devm_power_supply_register(&pdev->dev,
+       lt3651_charger->charger = devm_power_supply_register(&pdev->dev,
                                                      charger_desc, &psy_cfg);
-       if (IS_ERR(ltc3651_charger->charger)) {
-               ret = PTR_ERR(ltc3651_charger->charger);
+       if (IS_ERR(lt3651_charger->charger)) {
+               ret = PTR_ERR(lt3651_charger->charger);
                dev_err(&pdev->dev, "Failed to register power supply: %d\n",
                        ret);
                return ret;
@@ -152,59 +148,60 @@ static int ltc3651_charger_probe(struct platform_device *pdev)
         * support IRQs on these pins, userspace will have to poll the sysfs
         * files manually.
         */
-       if (ltc3651_charger->acpr_gpio) {
-               ret = gpiod_to_irq(ltc3651_charger->acpr_gpio);
+       if (lt3651_charger->acpr_gpio) {
+               ret = gpiod_to_irq(lt3651_charger->acpr_gpio);
                if (ret >= 0)
                        ret = devm_request_any_context_irq(&pdev->dev, ret,
-                               ltc3651_charger_irq,
+                               lt3651_charger_irq,
                                IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                               dev_name(&pdev->dev), ltc3651_charger->charger);
+                               dev_name(&pdev->dev), lt3651_charger->charger);
                if (ret < 0)
                        dev_warn(&pdev->dev, "Failed to request acpr irq\n");
        }
-       if (ltc3651_charger->fault_gpio) {
-               ret = gpiod_to_irq(ltc3651_charger->fault_gpio);
+       if (lt3651_charger->fault_gpio) {
+               ret = gpiod_to_irq(lt3651_charger->fault_gpio);
                if (ret >= 0)
                        ret = devm_request_any_context_irq(&pdev->dev, ret,
-                               ltc3651_charger_irq,
+                               lt3651_charger_irq,
                                IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                               dev_name(&pdev->dev), ltc3651_charger->charger);
+                               dev_name(&pdev->dev), lt3651_charger->charger);
                if (ret < 0)
                        dev_warn(&pdev->dev, "Failed to request fault irq\n");
        }
-       if (ltc3651_charger->chrg_gpio) {
-               ret = gpiod_to_irq(ltc3651_charger->chrg_gpio);
+       if (lt3651_charger->chrg_gpio) {
+               ret = gpiod_to_irq(lt3651_charger->chrg_gpio);
                if (ret >= 0)
                        ret = devm_request_any_context_irq(&pdev->dev, ret,
-                               ltc3651_charger_irq,
+                               lt3651_charger_irq,
                                IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
-                               dev_name(&pdev->dev), ltc3651_charger->charger);
+                               dev_name(&pdev->dev), lt3651_charger->charger);
                if (ret < 0)
                        dev_warn(&pdev->dev, "Failed to request chrg irq\n");
        }
 
-       platform_set_drvdata(pdev, ltc3651_charger);
+       platform_set_drvdata(pdev, lt3651_charger);
 
        return 0;
 }
 
-static const struct of_device_id ltc3651_charger_match[] = {
-       { .compatible = "lltc,ltc3651-charger" },
+static const struct of_device_id lt3651_charger_match[] = {
+       { .compatible = "lltc,ltc3651-charger" }, /* DEPRECATED */
+       { .compatible = "lltc,lt3651-charger" },
        { }
 };
-MODULE_DEVICE_TABLE(of, ltc3651_charger_match);
+MODULE_DEVICE_TABLE(of, lt3651_charger_match);
 
-static struct platform_driver ltc3651_charger_driver = {
-       .probe = ltc3651_charger_probe,
+static struct platform_driver lt3651_charger_driver = {
+       .probe = lt3651_charger_probe,
        .driver = {
-               .name = "ltc3651-charger",
-               .of_match_table = ltc3651_charger_match,
+               .name = "lt3651-charger",
+               .of_match_table = lt3651_charger_match,
        },
 };
 
-module_platform_driver(ltc3651_charger_driver);
+module_platform_driver(lt3651_charger_driver);
 
 MODULE_AUTHOR("Mike Looijmans <mike.looijmans@topic.nl>");
-MODULE_DESCRIPTION("Driver for LTC3651 charger");
+MODULE_DESCRIPTION("Driver for LT3651 charger");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:ltc3651-charger");
+MODULE_ALIAS("platform:lt3651-charger");
index 4f129bb..da49436 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * I2C client/driver for the Linear Technology LTC2941, LTC2942, LTC2943
  * and LTC2944 Battery Gas Gauge IC
index b91b1d2..9e64728 100644 (file)
@@ -240,6 +240,14 @@ static enum power_supply_property max14656_battery_props[] = {
        POWER_SUPPLY_PROP_MANUFACTURER,
 };
 
+static void stop_irq_work(void *data)
+{
+       struct max14656_chip *chip = data;
+
+       cancel_delayed_work_sync(&chip->irq_work);
+}
+
+
 static int max14656_probe(struct i2c_client *client,
                          const struct i2c_device_id *id)
 {
@@ -278,7 +286,19 @@ static int max14656_probe(struct i2c_client *client,
        if (ret)
                return -ENODEV;
 
+       chip->detect_psy = devm_power_supply_register(dev,
+                      &chip->psy_desc, &psy_cfg);
+       if (IS_ERR(chip->detect_psy)) {
+               dev_err(dev, "power_supply_register failed\n");
+               return -EINVAL;
+       }
+
        INIT_DELAYED_WORK(&chip->irq_work, max14656_irq_worker);
+       ret = devm_add_action(dev, stop_irq_work, chip);
+       if (ret) {
+               dev_err(dev, "devm_add_action %d failed\n", ret);
+               return ret;
+       }
 
        ret = devm_request_irq(dev, chip->irq, max14656_irq,
                               IRQF_TRIGGER_FALLING,
@@ -289,13 +309,6 @@ static int max14656_probe(struct i2c_client *client,
        }
        enable_irq_wake(chip->irq);
 
-       chip->detect_psy = devm_power_supply_register(dev,
-                      &chip->psy_desc, &psy_cfg);
-       if (IS_ERR(chip->detect_psy)) {
-               dev_err(dev, "power_supply_register failed\n");
-               return -EINVAL;
-       }
-
        schedule_delayed_work(&chip->irq_work, msecs_to_jiffies(2000));
 
        return 0;
index 5a97e42..7720e4c 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
 #include <linux/jiffies.h>
 
 #define BAT_ADDR_MFR_TYPE      0x5F
 
+struct olpc_battery_data {
+       struct power_supply *olpc_ac;
+       struct power_supply *olpc_bat;
+       char bat_serial[17];
+       bool new_proto;
+       bool little_endian;
+};
+
 /*********************************************************************
  *             Power
  *********************************************************************/
@@ -90,13 +99,10 @@ static const struct power_supply_desc olpc_ac_desc = {
        .get_property = olpc_ac_get_prop,
 };
 
-static struct power_supply *olpc_ac;
-
-static char bat_serial[17]; /* Ick */
-
-static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte)
+static int olpc_bat_get_status(struct olpc_battery_data *data,
+               union power_supply_propval *val, uint8_t ec_byte)
 {
-       if (olpc_platform_info.ecver > 0x44) {
+       if (data->new_proto) {
                if (ec_byte & (BAT_STAT_CHARGING | BAT_STAT_TRICKLE))
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
                else if (ec_byte & BAT_STAT_DISCHARGING)
@@ -318,6 +324,14 @@ static int olpc_bat_get_voltage_max_design(union power_supply_propval *val)
        return ret;
 }
 
+static u16 ecword_to_cpu(struct olpc_battery_data *data, u16 ec_word)
+{
+       if (data->little_endian)
+               return le16_to_cpu((__force __le16)ec_word);
+       else
+               return be16_to_cpu((__force __be16)ec_word);
+}
+
 /*********************************************************************
  *             Battery properties
  *********************************************************************/
@@ -325,8 +339,9 @@ static int olpc_bat_get_property(struct power_supply *psy,
                                 enum power_supply_property psp,
                                 union power_supply_propval *val)
 {
+       struct olpc_battery_data *data = power_supply_get_drvdata(psy);
        int ret = 0;
-       __be16 ec_word;
+       u16 ec_word;
        uint8_t ec_byte;
        __be64 ser_buf;
 
@@ -346,7 +361,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
 
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
-               ret = olpc_bat_get_status(val, ec_byte);
+               ret = olpc_bat_get_status(data, val, ec_byte);
                if (ret)
                        return ret;
                break;
@@ -389,7 +404,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
                if (ret)
                        return ret;
 
-               val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32;
+               val->intval = ecword_to_cpu(data, ec_word) * 9760L / 32;
                break;
        case POWER_SUPPLY_PROP_CURRENT_AVG:
        case POWER_SUPPLY_PROP_CURRENT_NOW:
@@ -397,7 +412,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
                if (ret)
                        return ret;
 
-               val->intval = (s16)be16_to_cpu(ec_word) * 15625L / 120;
+               val->intval = ecword_to_cpu(data, ec_word) * 15625L / 120;
                break;
        case POWER_SUPPLY_PROP_CAPACITY:
                ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1);
@@ -428,29 +443,29 @@ static int olpc_bat_get_property(struct power_supply *psy,
                if (ret)
                        return ret;
 
-               val->intval = (s16)be16_to_cpu(ec_word) * 10 / 256;
+               val->intval = ecword_to_cpu(data, ec_word) * 10 / 256;
                break;
        case POWER_SUPPLY_PROP_TEMP_AMBIENT:
                ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
                if (ret)
                        return ret;
 
-               val->intval = (int)be16_to_cpu(ec_word) * 10 / 256;
+               val->intval = (int)ecword_to_cpu(data, ec_word) * 10 / 256;
                break;
        case POWER_SUPPLY_PROP_CHARGE_COUNTER:
                ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
                if (ret)
                        return ret;
 
-               val->intval = (s16)be16_to_cpu(ec_word) * 6250 / 15;
+               val->intval = ecword_to_cpu(data, ec_word) * 6250 / 15;
                break;
        case POWER_SUPPLY_PROP_SERIAL_NUMBER:
                ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
                if (ret)
                        return ret;
 
-               sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
-               val->strval = bat_serial;
+               sprintf(data->bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
+               val->strval = data->bat_serial;
                break;
        case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
                ret = olpc_bat_get_voltage_max_design(val);
@@ -536,7 +551,7 @@ static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj,
        return count;
 }
 
-static const struct bin_attribute olpc_bat_eeprom = {
+static struct bin_attribute olpc_bat_eeprom = {
        .attr = {
                .name = "eeprom",
                .mode = S_IRUGO,
@@ -560,7 +575,7 @@ static ssize_t olpc_bat_error_read(struct device *dev,
        return sprintf(buf, "%d\n", ec_byte);
 }
 
-static const struct device_attribute olpc_bat_error = {
+static struct device_attribute olpc_bat_error = {
        .attr = {
                .name = "error",
                .mode = S_IRUGO,
@@ -568,6 +583,27 @@ static const struct device_attribute olpc_bat_error = {
        .show = olpc_bat_error_read,
 };
 
+static struct attribute *olpc_bat_sysfs_attrs[] = {
+       &olpc_bat_error.attr,
+       NULL
+};
+
+static struct bin_attribute *olpc_bat_sysfs_bin_attrs[] = {
+       &olpc_bat_eeprom,
+       NULL
+};
+
+static const struct attribute_group olpc_bat_sysfs_group = {
+       .attrs = olpc_bat_sysfs_attrs,
+       .bin_attrs = olpc_bat_sysfs_bin_attrs,
+
+};
+
+static const struct attribute_group *olpc_bat_sysfs_groups[] = {
+       &olpc_bat_sysfs_group,
+       NULL
+};
+
 /*********************************************************************
  *             Initialisation
  *********************************************************************/
@@ -578,17 +614,17 @@ static struct power_supply_desc olpc_bat_desc = {
        .use_for_apm = 1,
 };
 
-static struct power_supply *olpc_bat;
-
 static int olpc_battery_suspend(struct platform_device *pdev,
                                pm_message_t state)
 {
-       if (device_may_wakeup(&olpc_ac->dev))
+       struct olpc_battery_data *data = platform_get_drvdata(pdev);
+
+       if (device_may_wakeup(&data->olpc_ac->dev))
                olpc_ec_wakeup_set(EC_SCI_SRC_ACPWR);
        else
                olpc_ec_wakeup_clear(EC_SCI_SRC_ACPWR);
 
-       if (device_may_wakeup(&olpc_bat->dev))
+       if (device_may_wakeup(&data->olpc_bat->dev))
                olpc_ec_wakeup_set(EC_SCI_SRC_BATTERY | EC_SCI_SRC_BATSOC
                                   | EC_SCI_SRC_BATERR);
        else
@@ -600,16 +636,37 @@ static int olpc_battery_suspend(struct platform_device *pdev,
 
 static int olpc_battery_probe(struct platform_device *pdev)
 {
-       int ret;
+       struct power_supply_config bat_psy_cfg = {};
+       struct power_supply_config ac_psy_cfg = {};
+       struct olpc_battery_data *data;
        uint8_t status;
+       uint8_t ecver;
+       int ret;
+
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+       platform_set_drvdata(pdev, data);
 
-       /*
-        * We've seen a number of EC protocol changes; this driver requires
-        * the latest EC protocol, supported by 0x44 and above.
-        */
-       if (olpc_platform_info.ecver < 0x44) {
+       /* See if the EC is already there and get the EC revision */
+       ret = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ecver, 1);
+       if (ret)
+               return ret;
+
+       if (of_find_compatible_node(NULL, NULL, "olpc,xo1.75-ec")) {
+               /* XO 1.75 */
+               data->new_proto = true;
+               data->little_endian = true;
+       } else if (ecver > 0x44) {
+               /* XO 1 or 1.5 with a new EC firmware. */
+               data->new_proto = true;
+       } else if (ecver < 0x44) {
+               /*
+                * We've seen a number of EC protocol changes; this driver
+                * requires the latest EC protocol, supported by 0x44 and above.
+                */
                printk(KERN_NOTICE "OLPC EC version 0x%02x too old for "
-                       "battery driver.\n", olpc_platform_info.ecver);
+                       "battery driver.\n", ecver);
                return -ENXIO;
        }
 
@@ -619,59 +676,44 @@ static int olpc_battery_probe(struct platform_device *pdev)
 
        /* Ignore the status. It doesn't actually matter */
 
-       olpc_ac = power_supply_register(&pdev->dev, &olpc_ac_desc, NULL);
-       if (IS_ERR(olpc_ac))
-               return PTR_ERR(olpc_ac);
+       ac_psy_cfg.of_node = pdev->dev.of_node;
+       ac_psy_cfg.drv_data = data;
+
+       data->olpc_ac = devm_power_supply_register(&pdev->dev, &olpc_ac_desc,
+                                                               &ac_psy_cfg);
+       if (IS_ERR(data->olpc_ac))
+               return PTR_ERR(data->olpc_ac);
 
-       if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */
+       if (of_device_is_compatible(pdev->dev.of_node, "olpc,xo1.5-battery")) {
+               /* XO-1.5 */
                olpc_bat_desc.properties = olpc_xo15_bat_props;
                olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo15_bat_props);
-       } else { /* XO-1 */
+       } else {
+               /* XO-1 */
                olpc_bat_desc.properties = olpc_xo1_bat_props;
                olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props);
        }
 
-       olpc_bat = power_supply_register(&pdev->dev, &olpc_bat_desc, NULL);
-       if (IS_ERR(olpc_bat)) {
-               ret = PTR_ERR(olpc_bat);
-               goto battery_failed;
-       }
-
-       ret = device_create_bin_file(&olpc_bat->dev, &olpc_bat_eeprom);
-       if (ret)
-               goto eeprom_failed;
+       bat_psy_cfg.of_node = pdev->dev.of_node;
+       bat_psy_cfg.drv_data = data;
+       bat_psy_cfg.attr_grp = olpc_bat_sysfs_groups;
 
-       ret = device_create_file(&olpc_bat->dev, &olpc_bat_error);
-       if (ret)
-               goto error_failed;
+       data->olpc_bat = devm_power_supply_register(&pdev->dev, &olpc_bat_desc,
+                                                               &bat_psy_cfg);
+       if (IS_ERR(data->olpc_bat))
+               return PTR_ERR(data->olpc_bat);
 
        if (olpc_ec_wakeup_available()) {
-               device_set_wakeup_capable(&olpc_ac->dev, true);
-               device_set_wakeup_capable(&olpc_bat->dev, true);
+               device_set_wakeup_capable(&data->olpc_ac->dev, true);
+               device_set_wakeup_capable(&data->olpc_bat->dev, true);
        }
 
        return 0;
-
-error_failed:
-       device_remove_bin_file(&olpc_bat->dev, &olpc_bat_eeprom);
-eeprom_failed:
-       power_supply_unregister(olpc_bat);
-battery_failed:
-       power_supply_unregister(olpc_ac);
-       return ret;
-}
-
-static int olpc_battery_remove(struct platform_device *pdev)
-{
-       device_remove_file(&olpc_bat->dev, &olpc_bat_error);
-       device_remove_bin_file(&olpc_bat->dev, &olpc_bat_eeprom);
-       power_supply_unregister(olpc_bat);
-       power_supply_unregister(olpc_ac);
-       return 0;
 }
 
 static const struct of_device_id olpc_battery_ids[] = {
        { .compatible = "olpc,xo1-battery" },
+       { .compatible = "olpc,xo1.5-battery" },
        {}
 };
 MODULE_DEVICE_TABLE(of, olpc_battery_ids);
@@ -682,7 +724,6 @@ static struct platform_driver olpc_battery_driver = {
                .of_match_table = olpc_battery_ids,
        },
        .probe = olpc_battery_probe,
-       .remove = olpc_battery_remove,
        .suspend = olpc_battery_suspend,
 };
 
index c917a8b..f7033ec 100644 (file)
@@ -598,10 +598,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
 
        err = of_property_read_string(battery_np, "compatible", &value);
        if (err)
-               return err;
+               goto out_put_node;
 
-       if (strcmp("simple-battery", value))
-               return -ENODEV;
+       if (strcmp("simple-battery", value)) {
+               err = -ENODEV;
+               goto out_put_node;
+       }
 
        /* The property and field names below must correspond to elements
         * in enum power_supply_property. For reasoning, see
@@ -620,19 +622,21 @@ int power_supply_get_battery_info(struct power_supply *psy,
                             &info->precharge_current_ua);
        of_property_read_u32(battery_np, "charge-term-current-microamp",
                             &info->charge_term_current_ua);
-       of_property_read_u32(battery_np, "constant_charge_current_max_microamp",
+       of_property_read_u32(battery_np, "constant-charge-current-max-microamp",
                             &info->constant_charge_current_max_ua);
-       of_property_read_u32(battery_np, "constant_charge_voltage_max_microvolt",
+       of_property_read_u32(battery_np, "constant-charge-voltage-max-microvolt",
                             &info->constant_charge_voltage_max_uv);
        of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms",
                             &info->factory_internal_resistance_uohm);
 
        len = of_property_count_u32_elems(battery_np, "ocv-capacity-celsius");
        if (len < 0 && len != -EINVAL) {
-               return len;
+               err = len;
+               goto out_put_node;
        } else if (len > POWER_SUPPLY_OCV_TEMP_MAX) {
                dev_err(&psy->dev, "Too many temperature values\n");
-               return -EINVAL;
+               err = -EINVAL;
+               goto out_put_node;
        } else if (len > 0) {
                of_property_read_u32_array(battery_np, "ocv-capacity-celsius",
                                           info->ocv_temp, len);
@@ -650,7 +654,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
                        dev_err(&psy->dev, "failed to get %s\n", propname);
                        kfree(propname);
                        power_supply_put_battery_info(psy, info);
-                       return -EINVAL;
+                       err = -EINVAL;
+                       goto out_put_node;
                }
 
                kfree(propname);
@@ -661,16 +666,21 @@ int power_supply_get_battery_info(struct power_supply *psy,
                        devm_kcalloc(&psy->dev, tab_len, sizeof(*table), GFP_KERNEL);
                if (!info->ocv_table[index]) {
                        power_supply_put_battery_info(psy, info);
-                       return -ENOMEM;
+                       err = -ENOMEM;
+                       goto out_put_node;
                }
 
                for (i = 0; i < tab_len; i++) {
-                       table[i].ocv = be32_to_cpu(*list++);
-                       table[i].capacity = be32_to_cpu(*list++);
+                       table[i].ocv = be32_to_cpu(*list);
+                       list++;
+                       table[i].capacity = be32_to_cpu(*list);
+                       list++;
                }
        }
 
-       return 0;
+out_put_node:
+       of_node_put(battery_np);
+       return err;
 }
 EXPORT_SYMBOL_GPL(power_supply_get_battery_info);
 
@@ -899,7 +909,7 @@ static int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd,
        return ret;
 }
 
-static int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd,
+static int ps_get_cur_charge_cntl_limit(struct thermal_cooling_device *tcd,
                                        unsigned long *state)
 {
        struct power_supply *psy;
@@ -934,7 +944,7 @@ static int ps_set_cur_charge_cntl_limit(struct thermal_cooling_device *tcd,
 
 static const struct thermal_cooling_device_ops psy_tcd_ops = {
        .get_max_state = ps_get_max_charge_cntl_limit,
-       .get_cur_state = ps_get_cur_chrage_cntl_limit,
+       .get_cur_state = ps_get_cur_charge_cntl_limit,
        .set_cur_state = ps_set_cur_charge_cntl_limit,
 };
 
index 5358a80..a704a76 100644 (file)
@@ -56,13 +56,13 @@ static const char * const power_supply_status_text[] = {
 };
 
 static const char * const power_supply_charge_type_text[] = {
-       "Unknown", "N/A", "Trickle", "Fast"
+       "Unknown", "N/A", "Trickle", "Fast", "Standard", "Adaptive", "Custom"
 };
 
 static const char * const power_supply_health_text[] = {
        "Unknown", "Good", "Overheat", "Dead", "Over voltage",
        "Unspecified failure", "Cold", "Watchdog timer expire",
-       "Safety timer expire"
+       "Safety timer expire", "Over current"
 };
 
 static const char * const power_supply_technology_text[] = {
@@ -274,6 +274,8 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(constant_charge_voltage_max),
        POWER_SUPPLY_ATTR(charge_control_limit),
        POWER_SUPPLY_ATTR(charge_control_limit_max),
+       POWER_SUPPLY_ATTR(charge_control_start_threshold),
+       POWER_SUPPLY_ATTR(charge_control_end_threshold),
        POWER_SUPPLY_ATTR(input_current_limit),
        POWER_SUPPLY_ATTR(energy_full_design),
        POWER_SUPPLY_ATTR(energy_empty_design),
index 5654708..8548b63 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Nokia RX-51 battery driver
  *
  * Copyright (C) 2012  Pali Rohár <pali.rohar@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 4d41acb..48649dc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Dumb driver for LiIon batteries using TWL4030 madc.
  *
diff --git a/drivers/power/supply/ucs1002_power.c b/drivers/power/supply/ucs1002_power.c
new file mode 100644 (file)
index 0000000..1c89d03
--- /dev/null
@@ -0,0 +1,646 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Driver for UCS1002 Programmable USB Port Power Controller
+ *
+ * Copyright (C) 2019 Zodiac Inflight Innovations
+ */
+#include <linux/bits.h>
+#include <linux/freezer.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/kthread.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/power_supply.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
+
+/* UCS1002 Registers */
+#define UCS1002_REG_CURRENT_MEASUREMENT        0x00
+
+/*
+ * The Total Accumulated Charge registers store the total accumulated
+ * charge delivered from the VS source to a portable device. The total
+ * value is calculated using four registers, from 01h to 04h. The bit
+ * weighting of the registers is given in mA/hrs.
+ */
+#define UCS1002_REG_TOTAL_ACC_CHARGE   0x01
+
+/* Other Status Register */
+#define UCS1002_REG_OTHER_STATUS       0x0f
+#  define F_ADET_PIN                   BIT(4)
+#  define F_CHG_ACT                    BIT(3)
+
+/* Interrupt Status */
+#define UCS1002_REG_INTERRUPT_STATUS   0x10
+#  define F_DISCHARGE_ERR              BIT(6)
+#  define F_RESET                      BIT(5)
+#  define F_MIN_KEEP_OUT               BIT(4)
+#  define F_TSD                                BIT(3)
+#  define F_OVER_VOLT                  BIT(2)
+#  define F_BACK_VOLT                  BIT(1)
+#  define F_OVER_ILIM                  BIT(0)
+
+/* Pin Status Register */
+#define UCS1002_REG_PIN_STATUS         0x14
+#  define UCS1002_PWR_STATE_MASK       0x03
+#  define F_PWR_EN_PIN                 BIT(6)
+#  define F_M2_PIN                     BIT(5)
+#  define F_M1_PIN                     BIT(4)
+#  define F_EM_EN_PIN                  BIT(3)
+#  define F_SEL_PIN                    BIT(2)
+#  define F_ACTIVE_MODE_MASK           GENMASK(5, 3)
+#  define F_ACTIVE_MODE_PASSTHROUGH    F_M2_PIN
+#  define F_ACTIVE_MODE_DEDICATED      F_EM_EN_PIN
+#  define F_ACTIVE_MODE_BC12_DCP       (F_M2_PIN | F_EM_EN_PIN)
+#  define F_ACTIVE_MODE_BC12_SDP       F_M1_PIN
+#  define F_ACTIVE_MODE_BC12_CDP       (F_M1_PIN | F_M2_PIN | F_EM_EN_PIN)
+
+/* General Configuration Register */
+#define UCS1002_REG_GENERAL_CFG                0x15
+#  define F_RATION_EN                  BIT(3)
+
+/* Emulation Configuration Register */
+#define UCS1002_REG_EMU_CFG            0x16
+
+/* Switch Configuration Register */
+#define UCS1002_REG_SWITCH_CFG         0x17
+#  define F_PIN_IGNORE                 BIT(7)
+#  define F_EM_EN_SET                  BIT(5)
+#  define F_M2_SET                     BIT(4)
+#  define F_M1_SET                     BIT(3)
+#  define F_S0_SET                     BIT(2)
+#  define F_PWR_EN_SET                 BIT(1)
+#  define F_LATCH_SET                  BIT(0)
+#  define V_SET_ACTIVE_MODE_MASK       GENMASK(5, 3)
+#  define V_SET_ACTIVE_MODE_PASSTHROUGH        F_M2_SET
+#  define V_SET_ACTIVE_MODE_DEDICATED  F_EM_EN_SET
+#  define V_SET_ACTIVE_MODE_BC12_DCP   (F_M2_SET | F_EM_EN_SET)
+#  define V_SET_ACTIVE_MODE_BC12_SDP   F_M1_SET
+#  define V_SET_ACTIVE_MODE_BC12_CDP   (F_M1_SET | F_M2_SET | F_EM_EN_SET)
+
+/* Current Limit Register */
+#define UCS1002_REG_ILIMIT             0x19
+#  define UCS1002_ILIM_SW_MASK         GENMASK(3, 0)
+
+/* Product ID */
+#define UCS1002_REG_PRODUCT_ID         0xfd
+#  define UCS1002_PRODUCT_ID           0x4e
+
+/* Manufacture name */
+#define UCS1002_MANUFACTURER           "SMSC"
+
+struct ucs1002_info {
+       struct power_supply *charger;
+       struct i2c_client *client;
+       struct regmap *regmap;
+       struct regulator_desc *regulator_descriptor;
+       bool present;
+};
+
+static enum power_supply_property ucs1002_props[] = {
+       POWER_SUPPLY_PROP_ONLINE,
+       POWER_SUPPLY_PROP_CHARGE_NOW,
+       POWER_SUPPLY_PROP_CURRENT_NOW,
+       POWER_SUPPLY_PROP_CURRENT_MAX,
+       POWER_SUPPLY_PROP_PRESENT, /* the presence of PED */
+       POWER_SUPPLY_PROP_MANUFACTURER,
+       POWER_SUPPLY_PROP_USB_TYPE,
+       POWER_SUPPLY_PROP_HEALTH,
+};
+
+static int ucs1002_get_online(struct ucs1002_info *info,
+                             union power_supply_propval *val)
+{
+       unsigned int reg;
+       int ret;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_OTHER_STATUS, &reg);
+       if (ret)
+               return ret;
+
+       val->intval = !!(reg & F_CHG_ACT);
+
+       return 0;
+}
+
+static int ucs1002_get_charge(struct ucs1002_info *info,
+                             union power_supply_propval *val)
+{
+       /*
+        * To fit within 32 bits some values are rounded (uA/h)
+        *
+        * For Total Accumulated Charge Middle Low Byte register, addr
+        * 03h, byte 2
+        *
+        *   B0: 0.01084 mA/h rounded to 11 uA/h
+        *   B1: 0.02169 mA/h rounded to 22 uA/h
+        *   B2: 0.04340 mA/h rounded to 43 uA/h
+        *   B3: 0.08676 mA/h rounded to 87 uA/h
+        *   B4: 0.17350 mA/h rounded to 173 uÁ/h
+        *
+        * For Total Accumulated Charge Low Byte register, addr 04h,
+        * byte 3
+        *
+        *   B6: 0.00271 mA/h rounded to 3 uA/h
+        *   B7: 0.005422 mA/h rounded to 5 uA/h
+        */
+       static const int bit_weights_uAh[BITS_PER_TYPE(u32)] = {
+               /*
+                * Bit corresponding to low byte (offset 0x04)
+                * B0 B1 B2 B3 B4 B5 B6 B7
+                */
+               0, 0, 0, 0, 0, 0, 3, 5,
+               /*
+                * Bit corresponding to middle low byte (offset 0x03)
+                * B0 B1 B2 B3 B4 B5 B6 B7
+                */
+               11, 22, 43, 87, 173, 347, 694, 1388,
+               /*
+                * Bit corresponding to middle high byte (offset 0x02)
+                * B0 B1 B2 B3 B4 B5 B6 B7
+                */
+               2776, 5552, 11105, 22210, 44420, 88840, 177700, 355400,
+               /*
+                * Bit corresponding to high byte (offset 0x01)
+                * B0 B1 B2 B3 B4 B5 B6 B7
+                */
+               710700, 1421000, 2843000, 5685000, 11371000, 22742000,
+               45484000, 90968000,
+       };
+       unsigned long total_acc_charger;
+       unsigned int reg;
+       int i, ret;
+
+       ret = regmap_bulk_read(info->regmap, UCS1002_REG_TOTAL_ACC_CHARGE,
+                              &reg, sizeof(u32));
+       if (ret)
+               return ret;
+
+       total_acc_charger = be32_to_cpu(reg); /* BE as per offsets above */
+       val->intval = 0;
+
+       for_each_set_bit(i, &total_acc_charger, ARRAY_SIZE(bit_weights_uAh))
+               val->intval += bit_weights_uAh[i];
+
+       return 0;
+}
+
+static int ucs1002_get_current(struct ucs1002_info *info,
+                              union power_supply_propval *val)
+{
+       /*
+        * The Current Measurement register stores the measured
+        * current value delivered to the portable device. The range
+        * is from 9.76 mA to 2.5 A.
+        */
+       static const int bit_weights_uA[BITS_PER_TYPE(u8)] = {
+               9760, 19500, 39000, 78100, 156200, 312300, 624600, 1249300,
+       };
+       unsigned long current_measurement;
+       unsigned int reg;
+       int i, ret;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_CURRENT_MEASUREMENT, &reg);
+       if (ret)
+               return ret;
+
+       current_measurement = reg;
+       val->intval = 0;
+
+       for_each_set_bit(i, &current_measurement, ARRAY_SIZE(bit_weights_uA))
+               val->intval += bit_weights_uA[i];
+
+       return 0;
+}
+
+/*
+ * The Current Limit register stores the maximum current used by the
+ * port switch. The range is from 500mA to 2.5 A.
+ */
+static const u32 ucs1002_current_limit_uA[] = {
+       500000, 900000, 1000000, 1200000, 1500000, 1800000, 2000000, 2500000,
+};
+
+static int ucs1002_get_max_current(struct ucs1002_info *info,
+                                  union power_supply_propval *val)
+{
+       unsigned int reg;
+       int ret;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_ILIMIT, &reg);
+       if (ret)
+               return ret;
+
+       val->intval = ucs1002_current_limit_uA[reg & UCS1002_ILIM_SW_MASK];
+
+       return 0;
+}
+
+static int ucs1002_set_max_current(struct ucs1002_info *info, u32 val)
+{
+       unsigned int reg;
+       int ret, idx;
+
+       for (idx = 0; idx < ARRAY_SIZE(ucs1002_current_limit_uA); idx++) {
+               if (val == ucs1002_current_limit_uA[idx])
+                       break;
+       }
+
+       if (idx == ARRAY_SIZE(ucs1002_current_limit_uA))
+               return -EINVAL;
+
+       ret = regmap_write(info->regmap, UCS1002_REG_ILIMIT, idx);
+       if (ret)
+               return ret;
+       /*
+        * Any current limit setting exceeding the one set via ILIM
+        * pin will be rejected, so we read out freshly changed limit
+        * to make sure that it took effect.
+        */
+       ret = regmap_read(info->regmap, UCS1002_REG_ILIMIT, &reg);
+       if (ret)
+               return ret;
+
+       if (reg != idx)
+               return -EINVAL;
+
+       return 0;
+}
+
+static enum power_supply_usb_type ucs1002_usb_types[] = {
+       POWER_SUPPLY_USB_TYPE_PD,
+       POWER_SUPPLY_USB_TYPE_SDP,
+       POWER_SUPPLY_USB_TYPE_DCP,
+       POWER_SUPPLY_USB_TYPE_CDP,
+       POWER_SUPPLY_USB_TYPE_UNKNOWN,
+};
+
+static int ucs1002_set_usb_type(struct ucs1002_info *info, int val)
+{
+       unsigned int mode;
+
+       if (val < 0 || val >= ARRAY_SIZE(ucs1002_usb_types))
+               return -EINVAL;
+
+       switch (ucs1002_usb_types[val]) {
+       case POWER_SUPPLY_USB_TYPE_PD:
+               mode = V_SET_ACTIVE_MODE_DEDICATED;
+               break;
+       case POWER_SUPPLY_USB_TYPE_SDP:
+               mode = V_SET_ACTIVE_MODE_BC12_SDP;
+               break;
+       case POWER_SUPPLY_USB_TYPE_DCP:
+               mode = V_SET_ACTIVE_MODE_BC12_DCP;
+               break;
+       case POWER_SUPPLY_USB_TYPE_CDP:
+               mode = V_SET_ACTIVE_MODE_BC12_CDP;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return regmap_update_bits(info->regmap, UCS1002_REG_SWITCH_CFG,
+                                 V_SET_ACTIVE_MODE_MASK, mode);
+}
+
+static int ucs1002_get_usb_type(struct ucs1002_info *info,
+                               union power_supply_propval *val)
+{
+       enum power_supply_usb_type type;
+       unsigned int reg;
+       int ret;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_PIN_STATUS, &reg);
+       if (ret)
+               return ret;
+
+       switch (reg & F_ACTIVE_MODE_MASK) {
+       default:
+               type = POWER_SUPPLY_USB_TYPE_UNKNOWN;
+               break;
+       case F_ACTIVE_MODE_DEDICATED:
+               type = POWER_SUPPLY_USB_TYPE_PD;
+               break;
+       case F_ACTIVE_MODE_BC12_SDP:
+               type = POWER_SUPPLY_USB_TYPE_SDP;
+               break;
+       case F_ACTIVE_MODE_BC12_DCP:
+               type = POWER_SUPPLY_USB_TYPE_DCP;
+               break;
+       case F_ACTIVE_MODE_BC12_CDP:
+               type = POWER_SUPPLY_USB_TYPE_CDP;
+               break;
+       };
+
+       val->intval = type;
+
+       return 0;
+}
+
+static int ucs1002_get_health(struct ucs1002_info *info,
+                             union power_supply_propval *val)
+{
+       unsigned int reg;
+       int ret, health;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_INTERRUPT_STATUS, &reg);
+       if (ret)
+               return ret;
+
+       if (reg & F_TSD)
+               health = POWER_SUPPLY_HEALTH_OVERHEAT;
+       else if (reg & (F_OVER_VOLT | F_BACK_VOLT))
+               health = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
+       else if (reg & F_OVER_ILIM)
+               health = POWER_SUPPLY_HEALTH_OVERCURRENT;
+       else if (reg & (F_DISCHARGE_ERR | F_MIN_KEEP_OUT))
+               health = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+       else
+               health = POWER_SUPPLY_HEALTH_GOOD;
+
+       val->intval = health;
+
+       return 0;
+}
+
+static int ucs1002_get_property(struct power_supply *psy,
+                               enum power_supply_property psp,
+                               union power_supply_propval *val)
+{
+       struct ucs1002_info *info = power_supply_get_drvdata(psy);
+
+       switch (psp) {
+       case POWER_SUPPLY_PROP_ONLINE:
+               return ucs1002_get_online(info, val);
+       case POWER_SUPPLY_PROP_CHARGE_NOW:
+               return ucs1002_get_charge(info, val);
+       case POWER_SUPPLY_PROP_CURRENT_NOW:
+               return ucs1002_get_current(info, val);
+       case POWER_SUPPLY_PROP_CURRENT_MAX:
+               return ucs1002_get_max_current(info, val);
+       case POWER_SUPPLY_PROP_USB_TYPE:
+               return ucs1002_get_usb_type(info, val);
+       case POWER_SUPPLY_PROP_HEALTH:
+               return ucs1002_get_health(info, val);
+       case POWER_SUPPLY_PROP_PRESENT:
+               val->intval = info->present;
+               return 0;
+       case POWER_SUPPLY_PROP_MANUFACTURER:
+               val->strval = UCS1002_MANUFACTURER;
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}
+
+static int ucs1002_set_property(struct power_supply *psy,
+                               enum power_supply_property psp,
+                               const union power_supply_propval *val)
+{
+       struct ucs1002_info *info = power_supply_get_drvdata(psy);
+
+       switch (psp) {
+       case POWER_SUPPLY_PROP_CURRENT_MAX:
+               return ucs1002_set_max_current(info, val->intval);
+       case POWER_SUPPLY_PROP_USB_TYPE:
+               return ucs1002_set_usb_type(info, val->intval);
+       default:
+               return -EINVAL;
+       }
+}
+
+static int ucs1002_property_is_writeable(struct power_supply *psy,
+                                        enum power_supply_property psp)
+{
+       switch (psp) {
+       case POWER_SUPPLY_PROP_CURRENT_MAX:
+       case POWER_SUPPLY_PROP_USB_TYPE:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static const struct power_supply_desc ucs1002_charger_desc = {
+       .name                   = "ucs1002",
+       .type                   = POWER_SUPPLY_TYPE_USB,
+       .usb_types              = ucs1002_usb_types,
+       .num_usb_types          = ARRAY_SIZE(ucs1002_usb_types),
+       .get_property           = ucs1002_get_property,
+       .set_property           = ucs1002_set_property,
+       .property_is_writeable  = ucs1002_property_is_writeable,
+       .properties             = ucs1002_props,
+       .num_properties         = ARRAY_SIZE(ucs1002_props),
+};
+
+static irqreturn_t ucs1002_charger_irq(int irq, void *data)
+{
+       int ret, regval;
+       bool present;
+       struct ucs1002_info *info = data;
+
+       present = info->present;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_OTHER_STATUS, &regval);
+       if (ret)
+               return IRQ_HANDLED;
+
+       /* update attached status */
+       info->present = regval & F_ADET_PIN;
+
+       /* notify the change */
+       if (present != info->present)
+               power_supply_changed(info->charger);
+
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t ucs1002_alert_irq(int irq, void *data)
+{
+       struct ucs1002_info *info = data;
+
+       power_supply_changed(info->charger);
+
+       return IRQ_HANDLED;
+}
+
+static const struct regulator_ops ucs1002_regulator_ops = {
+       .is_enabled     = regulator_is_enabled_regmap,
+       .enable         = regulator_enable_regmap,
+       .disable        = regulator_disable_regmap,
+};
+
+static const struct regulator_desc ucs1002_regulator_descriptor = {
+       .name           = "ucs1002-vbus",
+       .ops            = &ucs1002_regulator_ops,
+       .type           = REGULATOR_VOLTAGE,
+       .owner          = THIS_MODULE,
+       .enable_reg     = UCS1002_REG_SWITCH_CFG,
+       .enable_mask    = F_PWR_EN_SET,
+       .enable_val     = F_PWR_EN_SET,
+       .fixed_uV       = 5000000,
+       .n_voltages     = 1,
+};
+
+static int ucs1002_probe(struct i2c_client *client,
+                        const struct i2c_device_id *dev_id)
+{
+       struct device *dev = &client->dev;
+       struct power_supply_config charger_config = {};
+       const struct regmap_config regmap_config = {
+               .reg_bits = 8,
+               .val_bits = 8,
+       };
+       struct regulator_config regulator_config = {};
+       int irq_a_det, irq_alert, ret;
+       struct regulator_dev *rdev;
+       struct ucs1002_info *info;
+       unsigned int regval;
+
+       info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
+       if (!info)
+               return -ENOMEM;
+
+       info->regmap = devm_regmap_init_i2c(client, &regmap_config);
+       ret = PTR_ERR_OR_ZERO(info->regmap);
+       if (ret) {
+               dev_err(dev, "Regmap initialization failed: %d\n", ret);
+               return ret;
+       }
+
+       info->client = client;
+
+       irq_a_det = of_irq_get_byname(dev->of_node, "a_det");
+       irq_alert = of_irq_get_byname(dev->of_node, "alert");
+
+       charger_config.of_node = dev->of_node;
+       charger_config.drv_data = info;
+
+       ret = regmap_read(info->regmap, UCS1002_REG_PRODUCT_ID, &regval);
+       if (ret) {
+               dev_err(dev, "Failed to read product ID: %d\n", ret);
+               return ret;
+       }
+
+       if (regval != UCS1002_PRODUCT_ID) {
+               dev_err(dev,
+                       "Product ID does not match (0x%02x != 0x%02x)\n",
+                       regval, UCS1002_PRODUCT_ID);
+               return -ENODEV;
+       }
+
+       /* Enable charge rationing by default */
+       ret = regmap_update_bits(info->regmap, UCS1002_REG_GENERAL_CFG,
+                                F_RATION_EN, F_RATION_EN);
+       if (ret) {
+               dev_err(dev, "Failed to read general config: %d\n", ret);
+               return ret;
+       }
+
+       /*
+        * Ignore the M1, M2, PWR_EN, and EM_EN pin states. Set active
+        * mode selection to BC1.2 CDP.
+        */
+       ret = regmap_update_bits(info->regmap, UCS1002_REG_SWITCH_CFG,
+                                V_SET_ACTIVE_MODE_MASK | F_PIN_IGNORE,
+                                V_SET_ACTIVE_MODE_BC12_CDP | F_PIN_IGNORE);
+       if (ret) {
+               dev_err(dev, "Failed to configure default mode: %d\n", ret);
+               return ret;
+       }
+       /*
+        * Be safe and set initial current limit to 500mA
+        */
+       ret = ucs1002_set_max_current(info, 500000);
+       if (ret) {
+               dev_err(dev, "Failed to set max current default: %d\n", ret);
+               return ret;
+       }
+
+       info->charger = devm_power_supply_register(dev, &ucs1002_charger_desc,
+                                                  &charger_config);
+       ret = PTR_ERR_OR_ZERO(info->charger);
+       if (ret) {
+               dev_err(dev, "Failed to register power supply: %d\n", ret);
+               return ret;
+       }
+
+       ret = regmap_read(info->regmap, UCS1002_REG_PIN_STATUS, &regval);
+       if (ret) {
+               dev_err(dev, "Failed to read pin status: %d\n", ret);
+               return ret;
+       }
+
+       info->regulator_descriptor =
+               devm_kmemdup(dev, &ucs1002_regulator_descriptor,
+                            sizeof(ucs1002_regulator_descriptor),
+                            GFP_KERNEL);
+       if (!info->regulator_descriptor)
+               return -ENOMEM;
+
+       info->regulator_descriptor->enable_is_inverted = !(regval & F_SEL_PIN);
+
+       regulator_config.dev = dev;
+       regulator_config.of_node = dev->of_node;
+       regulator_config.regmap = info->regmap;
+
+       rdev = devm_regulator_register(dev, info->regulator_descriptor,
+                                      &regulator_config);
+       ret = PTR_ERR_OR_ZERO(rdev);
+       if (ret) {
+               dev_err(dev, "Failed to register VBUS regulator: %d\n", ret);
+               return ret;
+       }
+
+       if (irq_a_det > 0) {
+               ret = devm_request_threaded_irq(dev, irq_a_det, NULL,
+                                               ucs1002_charger_irq,
+                                               IRQF_ONESHOT,
+                                               "ucs1002-a_det", info);
+               if (ret) {
+                       dev_err(dev, "Failed to request A_DET threaded irq: %d\n",
+                               ret);
+                       return ret;
+               }
+       }
+
+       if (irq_alert > 0) {
+               ret = devm_request_threaded_irq(dev, irq_alert, NULL,
+                                               ucs1002_alert_irq,
+                                               IRQF_ONESHOT,
+                                               "ucs1002-alert", info);
+               if (ret) {
+                       dev_err(dev, "Failed to request ALERT threaded irq: %d\n",
+                               ret);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
+static const struct of_device_id ucs1002_of_match[] = {
+       { .compatible = "microchip,ucs1002", },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ucs1002_of_match);
+
+static struct i2c_driver ucs1002_driver = {
+       .driver = {
+                  .name = "ucs1002",
+                  .of_match_table = ucs1002_of_match,
+       },
+       .probe = ucs1002_probe,
+};
+module_i2c_driver(ucs1002_driver);
+
+MODULE_DESCRIPTION("Microchip UCS1002 Programmable USB Port Power Controller");
+MODULE_AUTHOR("Enric Balletbo Serra <enric.balletbo@collabora.com>");
+MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
+MODULE_LICENSE("GPL");
index 6ac27e5..42d3798 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Generic power capping sysfs interface configuration
 #
index 1b32885..81c8cca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_POWERCAP) += powercap_sys.o
 obj-$(CONFIG_INTEL_RAPL) += intel_rapl.o
 obj-$(CONFIG_IDLE_INJECT) += idle_inject.o
index 965aa08..afbf5e2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PPS support configuration
 #
index 4483eaa..ceaf65c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the PPS core.
 #
index 7f02a9b..4f3244e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PPS clients configuration
 #
index a461d15..7a3807e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for PPS clients.
 #
index dd5d110..4b64180 100644 (file)
 #include <linux/slab.h>
 #include <linux/pps_kernel.h>
 #include <linux/pps-gpio.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/list.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 /* Info for each registered platform device */
 struct pps_gpio_device_data {
        int irq;                        /* IRQ used as PPS source */
        struct pps_device *pps;         /* PPS source device */
        struct pps_source_info info;    /* PPS source information */
+       struct gpio_desc *gpio_pin;     /* GPIO port descriptors */
+       struct gpio_desc *echo_pin;
+       struct timer_list echo_timer;   /* timer to reset echo active state */
        bool assert_falling_edge;
        bool capture_clear;
-       unsigned int gpio_pin;
+       unsigned int echo_active_ms;    /* PPS echo active duration */
+       unsigned long echo_timeout;     /* timer timeout value in jiffies */
 };
 
 /*
@@ -61,18 +67,101 @@ static irqreturn_t pps_gpio_irq_handler(int irq, void *data)
 
        info = data;
 
-       rising_edge = gpio_get_value(info->gpio_pin);
+       rising_edge = gpiod_get_value(info->gpio_pin);
        if ((rising_edge && !info->assert_falling_edge) ||
                        (!rising_edge && info->assert_falling_edge))
-               pps_event(info->pps, &ts, PPS_CAPTUREASSERT, NULL);
+               pps_event(info->pps, &ts, PPS_CAPTUREASSERT, data);
        else if (info->capture_clear &&
                        ((rising_edge && info->assert_falling_edge) ||
-                        (!rising_edge && !info->assert_falling_edge)))
-               pps_event(info->pps, &ts, PPS_CAPTURECLEAR, NULL);
+                       (!rising_edge && !info->assert_falling_edge)))
+               pps_event(info->pps, &ts, PPS_CAPTURECLEAR, data);
 
        return IRQ_HANDLED;
 }
 
+/* This function will only be called when an ECHO GPIO is defined */
+static void pps_gpio_echo(struct pps_device *pps, int event, void *data)
+{
+       /* add_timer() needs to write into info->echo_timer */
+       struct pps_gpio_device_data *info = data;
+
+       switch (event) {
+       case PPS_CAPTUREASSERT:
+               if (pps->params.mode & PPS_ECHOASSERT)
+                       gpiod_set_value(info->echo_pin, 1);
+               break;
+
+       case PPS_CAPTURECLEAR:
+               if (pps->params.mode & PPS_ECHOCLEAR)
+                       gpiod_set_value(info->echo_pin, 1);
+               break;
+       }
+
+       /* fire the timer */
+       if (info->pps->params.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) {
+               info->echo_timer.expires = jiffies + info->echo_timeout;
+               add_timer(&info->echo_timer);
+       }
+}
+
+/* Timer callback to reset the echo pin to the inactive state */
+static void pps_gpio_echo_timer_callback(struct timer_list *t)
+{
+       const struct pps_gpio_device_data *info;
+
+       info = from_timer(info, t, echo_timer);
+
+       gpiod_set_value(info->echo_pin, 0);
+}
+
+static int pps_gpio_setup(struct platform_device *pdev)
+{
+       struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
+       struct device_node *np = pdev->dev.of_node;
+       int ret;
+       u32 value;
+
+       data->gpio_pin = devm_gpiod_get(&pdev->dev,
+               NULL,   /* request "gpios" */
+               GPIOD_IN);
+       if (IS_ERR(data->gpio_pin)) {
+               dev_err(&pdev->dev,
+                       "failed to request PPS GPIO\n");
+               return PTR_ERR(data->gpio_pin);
+       }
+
+       data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
+                       "echo",
+                       GPIOD_OUT_LOW);
+       if (data->echo_pin) {
+               if (IS_ERR(data->echo_pin)) {
+                       dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
+                       return PTR_ERR(data->echo_pin);
+               }
+
+               ret = of_property_read_u32(np,
+                       "echo-active-ms",
+                       &value);
+               if (ret) {
+                       dev_err(&pdev->dev,
+                               "failed to get echo-active-ms from OF\n");
+                       return ret;
+               }
+               data->echo_active_ms = value;
+               /* sanity check on echo_active_ms */
+               if (!data->echo_active_ms || data->echo_active_ms > 999) {
+                       dev_err(&pdev->dev,
+                               "echo-active-ms: %u - bad value from OF\n",
+                               data->echo_active_ms);
+                       return -EINVAL;
+               }
+       }
+
+       if (of_property_read_bool(np, "assert-falling-edge"))
+               data->assert_falling_edge = true;
+       return 0;
+}
+
 static unsigned long
 get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
 {
@@ -90,53 +179,32 @@ get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
 static int pps_gpio_probe(struct platform_device *pdev)
 {
        struct pps_gpio_device_data *data;
-       const char *gpio_label;
        int ret;
        int pps_default_params;
        const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
-       struct device_node *np = pdev->dev.of_node;
 
        /* allocate space for device info */
-       data = devm_kzalloc(&pdev->dev, sizeof(struct pps_gpio_device_data),
-                       GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
        if (!data)
                return -ENOMEM;
+       platform_set_drvdata(pdev, data);
 
+       /* GPIO setup */
        if (pdata) {
                data->gpio_pin = pdata->gpio_pin;
-               gpio_label = pdata->gpio_label;
+               data->echo_pin = pdata->echo_pin;
 
                data->assert_falling_edge = pdata->assert_falling_edge;
                data->capture_clear = pdata->capture_clear;
+               data->echo_active_ms = pdata->echo_active_ms;
        } else {
-               ret = of_get_gpio(np, 0);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "failed to get GPIO from device tree\n");
-                       return ret;
-               }
-               data->gpio_pin = ret;
-               gpio_label = PPS_GPIO_NAME;
-
-               if (of_get_property(np, "assert-falling-edge", NULL))
-                       data->assert_falling_edge = true;
-       }
-
-       /* GPIO setup */
-       ret = devm_gpio_request(&pdev->dev, data->gpio_pin, gpio_label);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to request GPIO %u\n",
-                       data->gpio_pin);
-               return ret;
-       }
-
-       ret = gpio_direction_input(data->gpio_pin);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to set pin direction\n");
-               return -EINVAL;
+               ret = pps_gpio_setup(pdev);
+               if (ret)
+                       return -EINVAL;
        }
 
        /* IRQ setup */
-       ret = gpio_to_irq(data->gpio_pin);
+       ret = gpiod_to_irq(data->gpio_pin);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to map GPIO to IRQ: %d\n", ret);
                return -EINVAL;
@@ -152,6 +220,11 @@ static int pps_gpio_probe(struct platform_device *pdev)
        data->info.owner = THIS_MODULE;
        snprintf(data->info.name, PPS_MAX_NAME_LEN - 1, "%s.%d",
                 pdev->name, pdev->id);
+       if (data->echo_pin) {
+               data->info.echo = pps_gpio_echo;
+               data->echo_timeout = msecs_to_jiffies(data->echo_active_ms);
+               timer_setup(&data->echo_timer, pps_gpio_echo_timer_callback, 0);
+       }
 
        /* register PPS source */
        pps_default_params = PPS_CAPTUREASSERT | PPS_OFFSETASSERT;
@@ -173,7 +246,6 @@ static int pps_gpio_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       platform_set_drvdata(pdev, data);
        dev_info(data->pps->dev, "Registered IRQ %d as PPS source\n",
                 data->irq);
 
@@ -185,6 +257,11 @@ static int pps_gpio_remove(struct platform_device *pdev)
        struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
 
        pps_unregister_source(data->pps);
+       if (data->echo_pin) {
+               del_timer_sync(&data->echo_timer);
+               /* reset echo pin in any case */
+               gpiod_set_value(data->echo_pin, 0);
+       }
        dev_info(&pdev->dev, "removed IRQ %d as PPS source\n", data->irq);
        return 0;
 }
@@ -209,4 +286,4 @@ MODULE_AUTHOR("Ricardo Martins <rasm@fe.up.pt>");
 MODULE_AUTHOR("James Nuss <jamesnuss@nanometrics.ca>");
 MODULE_DESCRIPTION("Use GPIO pin as PPS source");
 MODULE_LICENSE("GPL");
-MODULE_VERSION("1.0.0");
+MODULE_VERSION("1.2.0");
index e4c4f3d..d615e64 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PPS generators configuration
 #
index 303304a..2d56dd0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for PPS generators.
 #
index 50cb1e1..c4d1f46 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PS3_VUART) += ps3-vuart.o
 obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o
 ps3av_mod-y            := ps3av.o ps3av_cmd.o
index 7fe1863..9b8fee5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PTP clock support configuration
 #
index 1311b54..dff5a93 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig PWM
        bool "Pulse-Width Modulation (PWM) Support"
        help
index 3998ebd..275b5f3 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Generic pwmlib implementation
  *
  * Copyright (C) 2011 Sascha Hauer <s.hauer@pengutronix.de>
  * Copyright (C) 2011-2012 Avionic Design GmbH
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/module.h>
index 0d0f837..7da1fdb 100644 (file)
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
-#include <linux/atmel_tc.h>
 #include <linux/pwm.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
+#include <soc/at91/atmel_tcb.h>
 
 #define NPWM   6
 
index bbf10ae..fa16858 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <asm/div64.h>
 
-#include <mach/platform.h>     /* for ep93xx_pwm_{acquire,release}_gpio() */
+#include <linux/soc/cirrus/ep93xx.h>   /* for ep93xx_pwm_{acquire,release}_gpio() */
 
 #define EP93XX_PWMx_TERM_COUNT 0x00
 #define EP93XX_PWMx_DUTY_CYCLE 0x04
index a0b0960..753bd58 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * PWM Controller Driver for HiSilicon BVT SoCs
  *
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/bitops.h>
index 48c4595..aa12fb3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * drivers/pwm/pwm-tegra.c
  *
@@ -5,20 +6,6 @@
  *
  * Copyright (c) 2010, NVIDIA Corporation.
  * Based on arch/arm/plat-mxc/pwm.c by Sascha Hauer <s.hauer@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #include <linux/clk.h>
index e3d8fe4..fadafc6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RapidIO configuration
 #
index c4cb087..9a19565 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RapidIO master port configuration
 #
index 927dbf8..bf0e2e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for RapidIO devices
 #
index 7f5d443..d375c02 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DMA Engine support for Tsi721 PCIExpress-to-SRIO bridge
  *
  * Copyright (c) 2011-2014 Integrated Device Technology, Inc.
  * Alexandre Bounine <alexandre.bounine@idt.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 
 #include <linux/io.h>
index cf45829..b29fc25 100644 (file)
@@ -2147,6 +2147,14 @@ static int riocm_add_mport(struct device *dev,
        mutex_init(&cm->rx_lock);
        riocm_rx_fill(cm, RIOCM_RX_RING_SIZE);
        cm->rx_wq = create_workqueue(DRV_NAME "/rxq");
+       if (!cm->rx_wq) {
+               riocm_error("failed to allocate IBMBOX_%d on %s",
+                           cmbox, mport->name);
+               rio_release_outb_mbox(mport, cmbox);
+               kfree(cm);
+               return -ENOMEM;
+       }
+
        INIT_WORK(&cm->rx_work, rio_ibmsg_handler);
 
        cm->tx_slot = 0;
index 92767fd..c1eb9cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RapidIO switches configuration
 #
index b834ff5..c2a236f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig RAS
        bool "Reliability, Availability and Serviceability (RAS) features"
        help
index 7b26dd3..ef6777e 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_RAS)      += ras.o debugfs.o
 obj-$(CONFIG_RAS_CEC)  += cec.o
index 5016030..9c1b717 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/debugfs.h>
 
 struct dentry *ras_debugfs_dir;
index 6c37f0d..8553bdf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig REGULATOR
        bool "Voltage and Current Regulator Support"
        help
index f0abd26..18be41b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Remoteproc drivers"
 
 config REMOTEPROC
index 2c8c23d..d506d32 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_HAS_RESET_CONTROLLER
        bool
 
index 10134dc..945ef7a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config COMMON_RESET_HI3660
        tristate "Hi3660 Reset Driver"
        depends on ARCH_HISI || COMPILE_TEST
index ab8a7bf..cf86d13 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_COMMON_RESET_HI6220) += hi6220_reset.o
 obj-$(CONFIG_COMMON_RESET_HI3660) += reset-hi3660.o
index 2ef1f13..99e75d9 100644 (file)
@@ -79,11 +79,11 @@ static int zynqmp_reset_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       platform_set_drvdata(pdev, priv);
-
        priv->eemi_ops = zynqmp_pm_get_eemi_ops();
-       if (!priv->eemi_ops)
-               return -ENXIO;
+       if (IS_ERR(priv->eemi_ops))
+               return PTR_ERR(priv->eemi_ops);
+
+       platform_set_drvdata(pdev, priv);
 
        priv->rcdev.ops = &zynqmp_reset_ops;
        priv->rcdev.owner = THIS_MODULE;
index 71592b5..9455e1c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_STI
 
 config STI_RESET_SYSCFG
index f9d8241..3eb30f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o
 
 obj-$(CONFIG_STIH407_RESET) += reset-stih407.o
index d2afa29..e4a9a38 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config RESET_TEGRA_BPMP
        def_bool TEGRA_BPMP
index 775243a..eccba89 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_RESET_TEGRA_BPMP) += reset-bpmp.o
index 7b8e156..5c0790e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RTC class/drivers configuration
 #
index 113493b..472e756 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* rtc-bq4802.c: TI BQ4802 RTC driver.
  *
  * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
index 50fabe1..b225bcf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Dallas DS1216 RTC driver
  *
index 1bf5d23..89ae78e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* rtc-generic: RTC driver using the generic RTC abstraction
  *
  * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
index 18a6f15..2ecd875 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/bcd.h>
 #include <linux/delay.h>
 #include <linux/export.h>
index 0c72a2e..1c2d3c4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Oki MSM6242 RTC Driver
  *
index 32994b0..a2941c8 100644 (file)
@@ -403,15 +403,12 @@ static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 static struct omap_rtc *omap_rtc_power_off_rtc;
 
-/*
- * omap_rtc_poweroff: RTC-controlled power off
- *
- * The RTC can be used to control an external PMIC via the pmic_power_en pin,
- * which can be configured to transition to OFF on ALARM2 events.
- *
- * Called with local interrupts disabled.
+/**
+ * omap_rtc_power_off_program: Set the pmic power off sequence. The RTC
+ * generates pmic_pwr_enable control, which can be used to control an external
+ * PMIC.
  */
-static void omap_rtc_power_off(void)
+int omap_rtc_power_off_program(struct device *dev)
 {
        struct omap_rtc *rtc = omap_rtc_power_off_rtc;
        struct rtc_time tm;
@@ -425,6 +422,9 @@ static void omap_rtc_power_off(void)
        rtc_writel(rtc, OMAP_RTC_PMIC_REG, val | OMAP_RTC_PMIC_POWER_EN_EN);
 
 again:
+       /* Clear any existing ALARM2 event */
+       rtc_writel(rtc, OMAP_RTC_STATUS_REG, OMAP_RTC_STATUS_ALARM2);
+
        /* set alarm one second from now */
        omap_rtc_read_time_raw(rtc, &tm);
        seconds = tm.tm_sec;
@@ -461,6 +461,39 @@ again:
 
        rtc->type->lock(rtc);
 
+       return 0;
+}
+EXPORT_SYMBOL(omap_rtc_power_off_program);
+
+/*
+ * omap_rtc_poweroff: RTC-controlled power off
+ *
+ * The RTC can be used to control an external PMIC via the pmic_power_en pin,
+ * which can be configured to transition to OFF on ALARM2 events.
+ *
+ * Notes:
+ * The one-second alarm offset is the shortest offset possible as the alarm
+ * registers must be set before the next timer update and the offset
+ * calculation is too heavy for everything to be done within a single access
+ * period (~15 us).
+ *
+ * Called with local interrupts disabled.
+ */
+static void omap_rtc_power_off(void)
+{
+       struct rtc_device *rtc = omap_rtc_power_off_rtc->rtc;
+       u32 val;
+
+       omap_rtc_power_off_program(rtc->dev.parent);
+
+       /* Set PMIC power enable and EXT_WAKEUP in case PB power on is used */
+       omap_rtc_power_off_rtc->type->unlock(omap_rtc_power_off_rtc);
+       val = rtc_readl(omap_rtc_power_off_rtc, OMAP_RTC_PMIC_REG);
+       val |= OMAP_RTC_PMIC_POWER_EN_EN | OMAP_RTC_PMIC_EXT_WKUP_POL(0) |
+                       OMAP_RTC_PMIC_EXT_WKUP_EN(0);
+       rtc_writel(omap_rtc_power_off_rtc, OMAP_RTC_PMIC_REG, val);
+       omap_rtc_power_off_rtc->type->lock(omap_rtc_power_off_rtc);
+
        /*
         * Wait for alarm to trigger (within one second) and external PMIC to
         * power off the system. Add a 500 ms margin for external latencies
index 1943c81..2498278 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * EPSON TOYOCOM RTC-7301SF/DG Driver
  *
index f1c160f..8776ead 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Ricoh RP5C01 RTC Driver
  *
index 9ba28d1..c759c55 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SiRFSoC Real Time Clock interface for Linux
  *
  * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index 21865d3..6eeabb8 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * An RTC driver for Allwinner A10/A20
  *
  * Copyright (c) 2013, Carlo Caione <carlo.caione@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #include <linux/delay.h>
index f89f9d0..c09039e 100644 (file)
@@ -3827,7 +3827,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev,
        if ((start_padding_sectors || end_padding_sectors) &&
            (rq_data_dir(req) == WRITE)) {
                DBF_DEV_EVENT(DBF_ERR, basedev,
-                             "raw write not track aligned (%lu,%lu) req %p",
+                             "raw write not track aligned (%llu,%llu) req %p",
                              start_padding_sectors, end_padding_sectors, req);
                return ERR_PTR(-EINVAL);
        }
index cfce255..7b7620d 100644 (file)
@@ -205,17 +205,22 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr,
                                 int auto_ack, int merge_pending)
 {
        unsigned char __state = 0;
-       int i;
+       int i = 1;
 
        if (is_qebsm(q))
                return qdio_do_eqbs(q, state, bufnr, count, auto_ack);
 
        /* get initial state: */
        __state = q->slsb.val[bufnr];
+
+       /* Bail out early if there is no work on the queue: */
+       if (__state & SLSB_OWNER_CU)
+               goto out;
+
        if (merge_pending && __state == SLSB_P_OUTPUT_PENDING)
                __state = SLSB_P_OUTPUT_EMPTY;
 
-       for (i = 1; i < count; i++) {
+       for (; i < count; i++) {
                bufnr = next_buf(bufnr);
 
                /* merge PENDING into EMPTY: */
@@ -228,6 +233,8 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr,
                if (q->slsb.val[bufnr] != __state)
                        break;
        }
+
+out:
        *state = __state;
        return i;
 }
@@ -382,7 +389,7 @@ int debug_get_buf_state(struct qdio_q *q, unsigned int bufnr,
 {
        if (need_siga_sync(q))
                qdio_siga_sync_q(q);
-       return get_buf_states(q, bufnr, state, 1, 0, 0);
+       return get_buf_state(q, bufnr, state, 0);
 }
 
 static inline void qdio_stop_polling(struct qdio_q *q)
@@ -719,11 +726,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q, unsigned int start)
                    multicast_outbound(q)))
                        qdio_siga_sync_q(q);
 
-       /*
-        * Don't check 128 buffers, as otherwise qdio_inbound_q_moved
-        * would return 0.
-        */
-       count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
+       count = atomic_read(&q->nr_buf_used);
        if (!count)
                return 0;
 
index e331cd9..882ee53 100644 (file)
@@ -21,5 +21,4 @@ EXPORT_TRACEPOINT_SYMBOL(s390_cio_csch);
 EXPORT_TRACEPOINT_SYMBOL(s390_cio_hsch);
 EXPORT_TRACEPOINT_SYMBOL(s390_cio_xsch);
 EXPORT_TRACEPOINT_SYMBOL(s390_cio_rsch);
-EXPORT_TRACEPOINT_SYMBOL(s390_cio_rchp);
 EXPORT_TRACEPOINT_SYMBOL(s390_cio_chsc);
index 0ebb29b..4803139 100644 (file)
@@ -274,29 +274,6 @@ DEFINE_EVENT(s390_class_schid, s390_cio_rsch,
        TP_ARGS(schid, cc)
 );
 
-/**
- * s390_cio_rchp - Reset Channel Path (RCHP) instruction was performed
- * @chpid: Channel-Path Identifier
- * @cc: Condition code
- */
-TRACE_EVENT(s390_cio_rchp,
-       TP_PROTO(struct chp_id chpid, int cc),
-       TP_ARGS(chpid, cc),
-       TP_STRUCT__entry(
-               __field(u8, cssid)
-               __field(u8, id)
-               __field(int, cc)
-       ),
-       TP_fast_assign(
-               __entry->cssid = chpid.cssid;
-               __entry->id = chpid.id;
-               __entry->cc = cc;
-       ),
-       TP_printk("chpid=%x.%02x cc=%d", __entry->cssid, __entry->id,
-                 __entry->cc
-       )
-);
-
 #define CHSC_MAX_REQUEST_LEN           64
 #define CHSC_MAX_RESPONSE_LEN          64
 
index e94dc25..5c56763 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index 89edd13..cebfbbb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menu "Misc Linux/SPARC drivers"
 
index 129967a..537e55c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* bbc_i2c.c: I2C low-level driver for BBC device on UltraSPARC-III
  *            platforms.
  *
index a36e4cf..971fe07 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* display7seg.c - Driver implementation for the 7-segment display
  *                 present on Sun Microsystems CP1400 and CP1500
  *
index 1a6e722..a63d5e4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* envctrl.c: Temperature and Fan monitoring on Machines providing it.
  *
  * Copyright (C) 1998  Eddie C. Dost  (ecd@skynet.be)
index 515dc1f..e85a05a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* flash.c: Allow mmap access to the OBP Flash, for OBP updates.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
index 8090dc9..8af2162 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 0a50133..7173a2e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* uctrl.c: TS102 Microcontroller interface on Tadpole Sparcbook 3
  *
  * Copyright 1999 Derrick J Brashear (shadow@dementia.org)
index d528018..61da513 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "SCSI device support"
 
 config SCSI_MOD
index c96bc72..564b354 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
index dcf435f..222c77c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/mm.h>
 #include <linux/ioport.h>
index 66c5730..5e575af 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux.
  *             Amiga Technologies A4000T SCSI controller.
index 3893b95..8f0eec6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Adaptec aacraid
 
 obj-$(CONFIG_SCSI_AACRAID) := aacraid.o
index 6085aa0..0ed3f80 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  aachba.c
  *
  * Abstract: Contains Interfaces to manage IOs.
- *
  */
 
 #include <linux/kernel.h>
index 11fb68d..3fa0323 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc. <alan@redhat.com>
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  aacraid.h
  *
  * Abstract: Contains all routines for control of the aacraid driver
- *
  */
 
 #ifndef _AACRAID_H_
index f0ff403..ffe41bc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  commctrl.c
  *
  * Abstract: Contains all routines for control of the AFA comm layer
- *
  */
 
 #include <linux/kernel.h>
index 0dc7b5a..d4fcfa1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *               2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  comminit.c
  *
  * Abstract: This supports the initialization of the host adapter commuication interface.
  *    This is a platform dependent module for the pci cyclone board.
- *
  */
 
 #include <linux/kernel.h>
index 78430a7..2142a64 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  commsup.c
  *
  * Abstract: Contain all routines that are required for FSA host/adapter
  *    communication.
- *
  */
 
 #include <linux/kernel.h>
index 40a771d..a557aa6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  dpcsup.c
  *
  * Abstract: All DPC processing routines for the cyclone board occur here.
- *
- *
  */
 
 #include <linux/kernel.h>
index 8e28a50..644f7f5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
@@ -9,20 +10,6 @@
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *   linit.c
  *
index c59074e..b5d6b24 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *
@@ -8,25 +9,10 @@
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  nark.c
  *
  * Abstract: Hardware Device Interface for NEMER/ARK
- *
  */
 
 #include <linux/pci.h>
index a1bc5bb..5f2cede 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  rkt.c
  *
  * Abstract: Hardware miniport for Drawbridge specific hardware functions.
- *
  */
 
 #include <linux/blkdev.h>
index 576cdf9..3dea348 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  rx.c
  *
  * Abstract: Hardware miniport for Drawbridge specific hardware functions.
- *
  */
 
 #include <linux/kernel.h>
index efa96c1..aa5d763 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  sa.c
  *
  * Abstract: Drawbridge specific support functions
- *
  */
 
 #include <linux/kernel.h>
index 97bb9e9..3b66e06 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     Adaptec AAC series RAID controller driver
  *     (c) Copyright 2001 Red Hat Inc.
  *               2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com)
  *              2016-2017 Microsemi Corp. (aacraid@microsemi.com)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * Module Name:
  *  src.c
  *
  * Abstract: Hardware Device Interface for PMC SRC based controllers
- *
  */
 
 #include <linux/kernel.h>
index ba7a572..dc5667a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Driver for Adaptec AHA-1542 SCSI host adapters
  *
index 3b3d599..16743fb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # AIC79XX 2.5.X Kernel configuration File.
 # $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#4 $
index 40fe08a..3546b8c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # AIC7XXX and AIC79XX 2.5.X Kernel configuration File.
 # $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#7 $
index 27c0a4a..b69edb4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * AMD am53c974 driver.
  * Copyright (c) 2014 Hannes Reinecke, SUSE Linux GmbH
index 721aced..9051f66 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # File: drivers/arcmsr/Makefile
 # Makefile for the ARECA PCI-X PCI-EXPRESS SATA RAID controllers SCSI driver.
 
index cfd172a..f34badc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SCSI driver configuration for Acorn
 #
index 5e9dd9f..5914141 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/drivers/scsi/arm/arxescsi.c
  *
index e2d2a81..3fd9443 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic Generic NCR5380 driver
  *
index 8f2efaa..7c9d361 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Oak Generic NCR5380 driver
  *
index 446a789..e41f0bb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* 
  *  Copyright (C) 1997 Wu Ching Chen
  *  2.1.x update (C) 1998  Krzysztof G. Baranowski
index bad5f32..958c9b4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BE2ISCSI
        tristate "Emulex 10Gbps iSCSI - BladeEngine 2"
        depends on PCI && SCSI && NET
index d0488ea..9108853 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile to build the iSCSI driver for Emulex OneConnect.
 #
index d401a09..e0ccb48 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_BNX2X_FCOE
        tristate "QLogic FCoE offload support"
        depends on PCI
index 141149e..1d72e27 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCSI_BNX2X_FCOE) += bnx2fc.o
 
 bnx2fc-y := bnx2fc_els.o bnx2fc_fcoe.o bnx2fc_hwi.o bnx2fc_io.o bnx2fc_tgt.o \
index ba30ff8..702dc82 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_BNX2_ISCSI
        tristate "QLogic NetXtreme II iSCSI support"
        depends on NET
index b5802bd..2537867 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 bnx2i-y := bnx2i_init.o bnx2i_hwi.o bnx2i_iscsi.o bnx2i_sysfs.o
 
 obj-$(CONFIG_SCSI_BNX2_ISCSI) += bnx2i.o
index 0f846ae..8d72b25 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Detection routine for the NCR53c710 based BVME6000 SCSI Controllers for Linux.
  *
index 1c5051b..5f8153c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SCSI Media Changer device driver for Linux 2.6
  *
index 7c7e508..c6c03f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_CHELSIO_FCOE
        tristate "Chelsio Communications FCoE support"
        depends on PCI && SCSI
index 17eb5d5..75f9428 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 source "drivers/scsi/cxgbi/cxgb3i/Kconfig"
 source "drivers/scsi/cxgbi/cxgb4i/Kconfig"
index f78c9cc..abfd38a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb
 
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libcxgbi.o cxgb3i/
index f68c871..3e4b644 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_CXGB3_ISCSI
        tristate "Chelsio T3 iSCSI support"
        depends on PCI && INET && (IPV6 || IPV6=n)
index f36b76e..d1f1bab 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_CXGB4_ISCSI
        tristate "Chelsio T4 iSCSI support"
        depends on PCI && INET && (IPV6 || IPV6=n)
index f1b17e3..5533bdc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IBM CXL-attached Flash Accelerator SCSI Driver
 #
index 283377d..fd2f0dd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CXLFLASH) += cxlflash.o
 cxlflash-y += main.o superpipe.o lunmgt.o vlun.o
 cxlflash-$(CONFIG_CXL) += cxl_hw.o
index 0b331c9..368eb94 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SCSI Device Handler configuration
 #
index 09866c5..0a603ae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SCSI Device Handler
 #
index bea8e13..caa685c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Target driver for EMC CLARiiON AX/CX-series hardware.
  * Based on code from Lars Marowsky-Bree <lmb@suse.de>
@@ -5,20 +6,6 @@
  *
  * Copyright (C) 2006 Red Hat, Inc.  All rights reserved.
  * Copyright (C) 2006 Mike Christie
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #include <linux/slab.h>
 #include <linux/module.h>
index 80129b0..8acd4bb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Basic HP/COMPAQ MSA 1000 support. This is only needed if your HW cannot be
  * upgraded.
@@ -5,20 +6,6 @@
  * Copyright (C) 2006 Red Hat, Inc.  All rights reserved.
  * Copyright (C) 2006 Mike Christie
  * Copyright (C) 2008 Hannes Reinecke <hare@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/slab.h>
index 78fdbfd..19f6d30 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_ESAS2R
        tristate "ATTO Technology's ExpressSAS RAID adapter driver"
        depends on PCI && SCSI
index c77160b..279d9cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCSI_ESAS2R)      += esas2r.o
 
 esas2r-objs := esas2r_log.o esas2r_disc.o esas2r_flash.o esas2r_init.o \
index 76fd02c..76e7ca8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* esp_scsi.c: ESP SCSI driver.
  *
  * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
index aed0f5d..1183e80 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_FCOE) += fcoe.o
 obj-$(CONFIG_LIBFCOE) += libfcoe.o
 
index 9cdca06..2ab774e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic Generic NCR5380 driver
  *
index d2acd0d..11df0ec 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
index 57183fc..90a1745 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_HISI_SAS
        tristate "HiSilicon SAS"
        depends on HAS_IOMEM
index 24623f2..742e732 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCSI_HISI_SAS)            += hisi_sas_main.o
 obj-$(CONFIG_SCSI_HISI_SAS)            += hisi_sas_v1_hw.o hisi_sas_v2_hw.o
 obj-$(CONFIG_SCSI_HISI_SAS_PCI)                += hisi_sas_v3_hw.o
index eaf329d..ff0d8c6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  hosts.c Copyright (C) 1992 Drew Eckhardt
  *          Copyright (C) 1993, 1994, 1995 Eric Youngdale
index 3840c64..5eb1cb1 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCSI_IBMVSCSI)    += ibmvscsi.o
 obj-$(CONFIG_SCSI_IBMVFC)      += ibmvfc.o
index 0c060ce..cc7a825 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SCSI_IBMVSCSIS)   += ibmvscsis.o
 
 ibmvscsis-y := libsrp.o ibmvscsi_tgt.o
index 64ae418..9751309 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* imm.c   --  low level driver for the IOMEGA MatchMaker
  * parallel port SCSI host adapter.
  * 
index eb2778b..41fd64c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /**************************************************************************
  * Initio 9100 device driver for Linux.
  *
@@ -6,21 +7,6 @@
  * Copyright (c) 2004 Christoph Hellwig <hch@lst.de>
  * Copyright (c) 2007 Red Hat
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *************************************************************************
  *
  * DESCRIPTION:
index 1ad2826..7f683e4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* jazz_esp.c: ESP front-end for MIPS JAZZ systems.
  *
  * Copyright (C) 2007 Thomas Bogendörfer (tsbogend@alpha.frankende)
index c3b9bef..1ded7d8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include "sas_internal.h"
 
index c8e6ae9..35d3e32 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SCSI low-level driver for the 53c94 SCSI bus adaptor found
  * on Power Macintosh computers, controlling the external SCSI chain.
index ee74120..1c78bc1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* mac_esp.c: ESP front-end for Macintosh Quadra systems.
  *
  * Adapted from jazz_esp.c and the old mac_esp.c.
index 8b4b5b1..dba9517 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic Macintosh NCR5380 driver
  *
index 17419e3..e630e41 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MEGARAID_NEWGEN
        bool "LSI Logic New Generation RAID Device Drivers"
        depends on PCI && SCSI
index 6fd57f7..fe9a785 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Linux MegaRAID driver for SAS based RAID controllers
  *
@@ -5,19 +6,6 @@
  *  Copyright (c) 2013-2016  Avago Technologies
  *  Copyright (c) 2016-2018  Broadcom Inc.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  *  FILE: megaraid_sas.h
  *
  *  Authors: Broadcom Inc.
index 473a120..3dd1df4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Linux MegaRAID driver for SAS based RAID controllers
  *
@@ -5,19 +6,6 @@
  *  Copyright (c) 2013-2016  Avago Technologies
  *  Copyright (c) 2016-2018  Broadcom Inc.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  *  Authors: Broadcom Inc.
  *           Sreenivas Bagalkote
  *           Sumant Patro
index 87c2c04..1263760 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Linux MegaRAID driver for SAS based RAID controllers
  *
@@ -5,19 +6,6 @@
  *  Copyright (c) 2013-2016  Avago Technologies
  *  Copyright (c) 2016-2018  Broadcom Inc.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  *  FILE: megaraid_sas_fp.c
  *
  *  Authors: Broadcom Inc.
index 6129399..4dfa068 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Linux MegaRAID driver for SAS based RAID controllers
  *
@@ -5,19 +6,6 @@
  *  Copyright (c) 2013-2016  Avago Technologies
  *  Copyright (c) 2016-2018  Broadcom Inc.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  *  FILE: megaraid_sas_fusion.c
  *
  *  Authors: Broadcom Inc.
index 1481bf0..7fa73ea 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Linux MegaRAID driver for SAS based RAID controllers
  *
@@ -5,19 +6,6 @@
  *  Copyright (c) 2013-2016  Avago Technologies
  *  Copyright (c) 2016-2018  Broadcom Inc.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  *  FILE: megaraid_sas_fusion.h
  *
  *  Authors: Broadcom Inc.
index c9dc774..74fb506 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SCSI low-level driver for the MESH (Macintosh Enhanced SCSI Hardware)
  * bus adaptor found on Power Macintosh computers.
index 050c8c3..21d6382 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Detection routine for the NCR53c710 based MVME16x SCSI Controllers for Linux.
  *
index 4bad544..815bb40 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
   SCSI Tape Driver for Linux version 1.1 and newer. See the accompanying
   file Documentation/scsi/st.txt for more information.
index 2d435f1..c544f48 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # PCMCIA SCSI adapter configuration
 #
index 943f5ee..7cd993b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QEDF
        tristate "QLogic QEDF 25/40/100Gb FCoE Initiator Driver Support"
        depends on PCI && SCSI
index 414f2a7..c462878 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QEDF) := qedf.o
 qedf-y = qedf_dbg.o qedf_main.o qedf_io.o qedf_fip.o \
         qedf_attr.o qedf_els.o drv_scsi_fw_funcs.o drv_fcoe_fw_funcs.o
index d1db92d..7ab07f3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QEDI
        tristate "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver Support"
        depends on PCI && SCSI && UIO
index 90a6925..d84eedf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QEDI) := qedi.o
 qedi-y := qedi_main.o qedi_iscsi.o qedi_fw.o qedi_sysfs.o \
            qedi_dbg.o qedi_fw_api.o
index 036cc3f..7645018 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_QLA_FC
        tristate "QLogic QLA2XXX Fibre Channel Support"
        depends on PCI && SCSI
index e4dc7c7..4bdf31b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SCSI_QLA_ISCSI
        tristate "QLogic ISP4XXX and ISP82XX host adapter family support"
        depends on PCI && SCSI && NET
index 4230977..1f8a909 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 qla4xxx-y := ql4_os.o ql4_init.o ql4_mbx.o ql4_iocb.o ql4_isr.o \
                ql4_nx.o ql4_nvram.o ql4_dbg.o ql4_attr.o ql4_bsg.o ql4_83xx.o
 
index 0e22512..9335849 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* qlogicpti.c: Performance Technologies QlogicISP sbus card driver.
  *
  * Copyright (C) 1996, 2006, 2008 David S. Miller (davem@davemloft.net)
index 99a7b9f..653d5ea 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  scsi.c Copyright (C) 1992 Drew Eckhardt
  *         Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
index 8e96805..bfa569f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  scsi_error.c Copyright (C) 1997 Eric Youngdale
  *
index 840d96f..57bcd05 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Changes:
  * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 08/23/2000
index 0916bd6..65d0a10 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 1999 Eric Youngdale
  * Copyright (C) 2014 Christoph Hellwig
index 7639df9..48ee680 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     scsi_pm.c       Copyright (C) 2010 Alan Stern
  *
index 3b119ca..dbb206c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * scsi_sysfs.c
  *
index ebc8035..c0f12ad 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *      sd.c Copyright (C) 1992 Drew Eckhardt
  *           Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
index c3f443d..4664fdf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  sr.c Copyright (C) 1992 David Giller
  *           Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
index 3c6a18a..baada5b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
    SCSI Tape Driver for Linux version 1.1 and newer. See the accompanying
    file Documentation/scsi/st.txt for more information.
index 95a7ea7..3d80ab6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
  *
index c9a55d0..440a73e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* sun3x_esp.c: ESP front-end for Sun3x systems.
  *
  * Copyright (C) 2007,2008 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
index c71bd01..964130d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* sun_esp.c: ESP front-end for Sparc SBUS systems.
  *
  * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net)
index 873e8ce..0751e2a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the NCR/SYMBIOS/LSI 53C8XX PCI SCSI controllers driver.
 
 sym53c8xx-objs := sym_fw.o sym_glue.o sym_hipd.o sym_malloc.o sym_nvram.o
index e3310e9..c2f4006 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for Western Digital WD7193, WD7197 and WD7296 SCSI cards
  * Copyright 2013 Ondrej Zary
index 4722660..77bce20 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Zalon 53c7xx device driver.
  * By Richard Hirst (rhirst@linuxcare.com)
index aff3199..27b9e2b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux.
  *             Amiga MacroSystemUS WarpEngine SCSI controller.
index dd11512..1878d37 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SFI Configuration
 #
index 2343732..ca9436b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += sfi_acpi.o
 obj-y  += sfi_core.o
 
index f168a61..3588fcc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "SuperH / SH-Mobile Driver Options"
 
 source "drivers/sh/intc/Kconfig"
index 5d15ebf..0158ff3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  := core.o
 
 obj-$(CONFIG_SH_CLK_CPG)       += cpg.o
index 6a1b05d..5c70170 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SH_INTC
        bool
        select IRQ_DOMAIN
index 54ec2a0..bdd8553 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  := access.o chip.o core.o handle.o irqdomain.o virq.o
 
 obj-$(CONFIG_INTC_BALANCING)           += balancing.o
index e649cea..87d69e7 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/stat.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include "internals.h"
 
 static void __iomem *uimask;
index 65dfeeb..c3a8091 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for Maple Bus
 
 obj-$(CONFIG_MAPLE) := maple.o
index 499dc47..6dfa41f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SuperHyway bus drivers.
 #
index 083d2e6..4326db3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SIOX
        tristate "Eckelmann SIOX Support"
        help
index a956f65..8b5ebb1 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SIOX) += siox-core.o
 obj-$(CONFIG_SIOX_BUS_GPIO) += siox-bus-gpio.o
index c66ba9a..a6c443d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Miscellaneous SN-specific devices
 #
index 693db8b..f0e809a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Altix device drivers.
 #
index fb7ea0d..358025a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * SGI IOC3 master driver and IRQ demuxer
  *
index c07b4a8..833e04a 100644 (file)
@@ -1,11 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "SOC (System On Chip) specific Drivers"
 
 source "drivers/soc/actions/Kconfig"
 source "drivers/soc/amlogic/Kconfig"
+source "drivers/soc/aspeed/Kconfig"
 source "drivers/soc/atmel/Kconfig"
 source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/imx/Kconfig"
+source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
index 90b686e..524ecdc 100644 (file)
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_ARCH_ACTIONS)     += actions/
+obj-$(CONFIG_SOC_ASPEED)       += aspeed/
 obj-$(CONFIG_ARCH_AT91)                += atmel/
 obj-y                          += bcm/
 obj-$(CONFIG_ARCH_DOVE)                += dove/
@@ -11,6 +12,7 @@ obj-$(CONFIG_MACH_DOVE)               += dove/
 obj-y                          += fsl/
 obj-$(CONFIG_ARCH_GEMINI)      += gemini/
 obj-$(CONFIG_ARCH_MXC)         += imx/
+obj-$(CONFIG_ARCH_IXP4XX)      += ixp4xx/
 obj-$(CONFIG_SOC_XWAY)         += lantiq/
 obj-y                          += mediatek/
 obj-y                          += amlogic/
index 1a0b964..1aca205 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_ACTIONS || COMPILE_TEST
 
 config OWL_PM_DOMAINS_HELPER
index 5501ad5..23bfb8e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Amlogic SoC drivers"
 
 config MESON_CANVAS
index bf2d109..f2e4ed1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MESON_CANVAS) += meson-canvas.o
 obj-$(CONFIG_MESON_CLK_MEASURE) += meson-clk-measure.o
 obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o
index 6289965..511b685 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/bitfield.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
+#include <linux/of_device.h>
 #include <linux/reset.h>
 #include <linux/clk.h>
 
@@ -26,6 +27,7 @@
 #define HHI_MEM_PD_REG0                        (0x40 << 2)
 #define HHI_VPU_MEM_PD_REG0            (0x41 << 2)
 #define HHI_VPU_MEM_PD_REG1            (0x42 << 2)
+#define HHI_VPU_MEM_PD_REG2            (0x4d << 2)
 
 struct meson_gx_pwrc_vpu {
        struct generic_pm_domain genpd;
@@ -54,12 +56,55 @@ static int meson_gx_pwrc_vpu_power_off(struct generic_pm_domain *genpd)
        /* Power Down Memories */
        for (i = 0; i < 32; i += 2) {
                regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0,
-                                  0x2 << i, 0x3 << i);
+                                  0x3 << i, 0x3 << i);
                udelay(5);
        }
        for (i = 0; i < 32; i += 2) {
                regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1,
-                                  0x2 << i, 0x3 << i);
+                                  0x3 << i, 0x3 << i);
+               udelay(5);
+       }
+       for (i = 8; i < 16; i++) {
+               regmap_update_bits(pd->regmap_hhi, HHI_MEM_PD_REG0,
+                                  BIT(i), BIT(i));
+               udelay(5);
+       }
+       udelay(20);
+
+       regmap_update_bits(pd->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+                          GEN_PWR_VPU_HDMI, GEN_PWR_VPU_HDMI);
+
+       msleep(20);
+
+       clk_disable_unprepare(pd->vpu_clk);
+       clk_disable_unprepare(pd->vapb_clk);
+
+       return 0;
+}
+
+static int meson_g12a_pwrc_vpu_power_off(struct generic_pm_domain *genpd)
+{
+       struct meson_gx_pwrc_vpu *pd = genpd_to_pd(genpd);
+       int i;
+
+       regmap_update_bits(pd->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+                          GEN_PWR_VPU_HDMI_ISO, GEN_PWR_VPU_HDMI_ISO);
+       udelay(20);
+
+       /* Power Down Memories */
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0,
+                                  0x3 << i, 0x3 << i);
+               udelay(5);
+       }
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1,
+                                  0x3 << i, 0x3 << i);
+               udelay(5);
+       }
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG2,
+                                  0x3 << i, 0x3 << i);
                udelay(5);
        }
        for (i = 8; i < 16; i++) {
@@ -108,13 +153,67 @@ static int meson_gx_pwrc_vpu_power_on(struct generic_pm_domain *genpd)
        /* Power Up Memories */
        for (i = 0; i < 32; i += 2) {
                regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0,
-                                  0x2 << i, 0);
+                                  0x3 << i, 0);
+               udelay(5);
+       }
+
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1,
+                                  0x3 << i, 0);
+               udelay(5);
+       }
+
+       for (i = 8; i < 16; i++) {
+               regmap_update_bits(pd->regmap_hhi, HHI_MEM_PD_REG0,
+                                  BIT(i), 0);
+               udelay(5);
+       }
+       udelay(20);
+
+       ret = reset_control_assert(pd->rstc);
+       if (ret)
+               return ret;
+
+       regmap_update_bits(pd->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+                          GEN_PWR_VPU_HDMI_ISO, 0);
+
+       ret = reset_control_deassert(pd->rstc);
+       if (ret)
+               return ret;
+
+       ret = meson_gx_pwrc_vpu_setup_clk(pd);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+static int meson_g12a_pwrc_vpu_power_on(struct generic_pm_domain *genpd)
+{
+       struct meson_gx_pwrc_vpu *pd = genpd_to_pd(genpd);
+       int ret;
+       int i;
+
+       regmap_update_bits(pd->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+                          GEN_PWR_VPU_HDMI, 0);
+       udelay(20);
+
+       /* Power Up Memories */
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG0,
+                                  0x3 << i, 0);
                udelay(5);
        }
 
        for (i = 0; i < 32; i += 2) {
                regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG1,
-                                  0x2 << i, 0);
+                                  0x3 << i, 0);
+               udelay(5);
+       }
+
+       for (i = 0; i < 32; i += 2) {
+               regmap_update_bits(pd->regmap_hhi, HHI_VPU_MEM_PD_REG2,
+                                  0x3 << i, 0);
                udelay(5);
        }
 
@@ -160,15 +259,37 @@ static struct meson_gx_pwrc_vpu vpu_hdmi_pd = {
        },
 };
 
+static struct meson_gx_pwrc_vpu vpu_hdmi_pd_g12a = {
+       .genpd = {
+               .name = "vpu_hdmi",
+               .power_off = meson_g12a_pwrc_vpu_power_off,
+               .power_on = meson_g12a_pwrc_vpu_power_on,
+       },
+};
+
 static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
 {
+       const struct meson_gx_pwrc_vpu *vpu_pd_match;
        struct regmap *regmap_ao, *regmap_hhi;
+       struct meson_gx_pwrc_vpu *vpu_pd;
        struct reset_control *rstc;
        struct clk *vpu_clk;
        struct clk *vapb_clk;
        bool powered_off;
        int ret;
 
+       vpu_pd_match = of_device_get_match_data(&pdev->dev);
+       if (!vpu_pd_match) {
+               dev_err(&pdev->dev, "failed to get match data\n");
+               return -ENODEV;
+       }
+
+       vpu_pd = devm_kzalloc(&pdev->dev, sizeof(*vpu_pd), GFP_KERNEL);
+       if (!vpu_pd)
+               return -ENOMEM;
+
+       memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd));
+
        regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
        if (IS_ERR(regmap_ao)) {
                dev_err(&pdev->dev, "failed to get regmap\n");
@@ -201,39 +322,46 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
                return PTR_ERR(vapb_clk);
        }
 
-       vpu_hdmi_pd.regmap_ao = regmap_ao;
-       vpu_hdmi_pd.regmap_hhi = regmap_hhi;
-       vpu_hdmi_pd.rstc = rstc;
-       vpu_hdmi_pd.vpu_clk = vpu_clk;
-       vpu_hdmi_pd.vapb_clk = vapb_clk;
+       vpu_pd->regmap_ao = regmap_ao;
+       vpu_pd->regmap_hhi = regmap_hhi;
+       vpu_pd->rstc = rstc;
+       vpu_pd->vpu_clk = vpu_clk;
+       vpu_pd->vapb_clk = vapb_clk;
+
+       platform_set_drvdata(pdev, vpu_pd);
 
-       powered_off = meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd);
+       powered_off = meson_gx_pwrc_vpu_get_power(vpu_pd);
 
        /* If already powered, sync the clock states */
        if (!powered_off) {
-               ret = meson_gx_pwrc_vpu_setup_clk(&vpu_hdmi_pd);
+               ret = meson_gx_pwrc_vpu_setup_clk(vpu_pd);
                if (ret)
                        return ret;
        }
 
-       pm_genpd_init(&vpu_hdmi_pd.genpd, &pm_domain_always_on_gov,
+       pm_genpd_init(&vpu_pd->genpd, &pm_domain_always_on_gov,
                      powered_off);
 
        return of_genpd_add_provider_simple(pdev->dev.of_node,
-                                           &vpu_hdmi_pd.genpd);
+                                           &vpu_pd->genpd);
 }
 
 static void meson_gx_pwrc_vpu_shutdown(struct platform_device *pdev)
 {
+       struct meson_gx_pwrc_vpu *vpu_pd = platform_get_drvdata(pdev);
        bool powered_off;
 
-       powered_off = meson_gx_pwrc_vpu_get_power(&vpu_hdmi_pd);
+       powered_off = meson_gx_pwrc_vpu_get_power(vpu_pd);
        if (!powered_off)
-               meson_gx_pwrc_vpu_power_off(&vpu_hdmi_pd.genpd);
+               vpu_pd->genpd.power_off(&vpu_pd->genpd);
 }
 
 static const struct of_device_id meson_gx_pwrc_vpu_match_table[] = {
-       { .compatible = "amlogic,meson-gx-pwrc-vpu" },
+       { .compatible = "amlogic,meson-gx-pwrc-vpu", .data = &vpu_hdmi_pd },
+       {
+         .compatible = "amlogic,meson-g12a-pwrc-vpu",
+         .data = &vpu_hdmi_pd_g12a
+       },
        { /* sentinel */ }
 };
 
index 37ea0a1..bca3495 100644 (file)
@@ -37,26 +37,34 @@ static const struct meson_gx_soc_id {
        { "AXG", 0x25 },
        { "GXLX", 0x26 },
        { "TXHD", 0x27 },
+       { "G12A", 0x28 },
+       { "G12B", 0x29 },
 };
 
 static const struct meson_gx_package_id {
        const char *name;
        unsigned int major_id;
        unsigned int pack_id;
+       unsigned int pack_mask;
 } soc_packages[] = {
-       { "S905", 0x1f, 0 },
-       { "S905H", 0x1f, 0x13 },
-       { "S905M", 0x1f, 0x20 },
-       { "S905D", 0x21, 0 },
-       { "S905X", 0x21, 0x80 },
-       { "S905W", 0x21, 0xa0 },
-       { "S905L", 0x21, 0xc0 },
-       { "S905M2", 0x21, 0xe0 },
-       { "S912", 0x22, 0 },
-       { "962X", 0x24, 0x10 },
-       { "962E", 0x24, 0x20 },
-       { "A113X", 0x25, 0x37 },
-       { "A113D", 0x25, 0x22 },
+       { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */
+       { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */
+       { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */
+       { "S905D", 0x21, 0, 0xf0 },
+       { "S905X", 0x21, 0x80, 0xf0 },
+       { "S905W", 0x21, 0xa0, 0xf0 },
+       { "S905L", 0x21, 0xc0, 0xf0 },
+       { "S905M2", 0x21, 0xe0, 0xf0 },
+       { "S805X", 0x21, 0x30, 0xf0 },
+       { "S805Y", 0x21, 0xb0, 0xf0 },
+       { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */
+       { "962X", 0x24, 0x10, 0xf0 },
+       { "962E", 0x24, 0x20, 0xf0 },
+       { "A113X", 0x25, 0x37, 0xff },
+       { "A113D", 0x25, 0x22, 0xff },
+       { "S905D2", 0x28, 0x10, 0xf0 },
+       { "S905X2", 0x28, 0x40, 0xf0 },
+       { "S922X", 0x29, 0x40, 0xf0 },
 };
 
 static inline unsigned int socinfo_to_major(u32 socinfo)
@@ -81,13 +89,14 @@ static inline unsigned int socinfo_to_misc(u32 socinfo)
 
 static const char *socinfo_to_package_id(u32 socinfo)
 {
-       unsigned int pack = socinfo_to_pack(socinfo) & 0xf0;
+       unsigned int pack = socinfo_to_pack(socinfo);
        unsigned int major = socinfo_to_major(socinfo);
        int i;
 
        for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) {
                if (soc_packages[i].major_id == major &&
-                   soc_packages[i].pack_id == pack)
+                   soc_packages[i].pack_id ==
+                               (pack & soc_packages[i].pack_mask))
                        return soc_packages[i].name;
        }
 
@@ -123,8 +132,10 @@ static int __init meson_gx_socinfo_init(void)
                return -ENODEV;
 
        /* check if interface is enabled */
-       if (!of_device_is_available(np))
+       if (!of_device_is_available(np)) {
+               of_node_put(np);
                return -ENODEV;
+       }
 
        /* check if chip-id is available */
        if (!of_property_read_bool(np, "amlogic,has-chip-id"))
diff --git a/drivers/soc/aspeed/Kconfig b/drivers/soc/aspeed/Kconfig
new file mode 100644 (file)
index 0000000..323e177
--- /dev/null
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menu "Aspeed SoC drivers"
+
+config SOC_ASPEED
+       def_bool y
+       depends on ARCH_ASPEED || COMPILE_TEST
+
+config ASPEED_LPC_CTRL
+       depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+       tristate "Aspeed ast2400/2500 HOST LPC to BMC bridge control"
+       ---help---
+         Control Aspeed ast2400/2500 HOST LPC to BMC mappings through
+         ioctl()s, the driver also provides a read/write interface to a BMC ram
+         region where the host LPC read/write region can be buffered.
+
+config ASPEED_LPC_SNOOP
+       tristate "Aspeed ast2500 HOST LPC snoop support"
+       depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+       help
+         Provides a driver to control the LPC snoop interface which
+         allows the BMC to listen on and save the data written by
+         the host to an arbitrary LPC I/O port.
+
+config ASPEED_P2A_CTRL
+       depends on SOC_ASPEED && REGMAP && MFD_SYSCON
+       tristate "Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC bridge control"
+       help
+         Control Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC mappings through
+         ioctl()s, the driver also provides an interface for userspace mappings to
+         a pre-defined region.
+
+endmenu
diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile
new file mode 100644 (file)
index 0000000..b64be47
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ASPEED_LPC_CTRL)  += aspeed-lpc-ctrl.o
+obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
+obj-$(CONFIG_ASPEED_P2A_CTRL)  += aspeed-p2a-ctrl.o
index 6242ebb..0552813 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config AT91_SOC_ID
        bool "SoC bus for Atmel ARM SoCs"
        depends on ARCH_AT91 || COMPILE_TEST
index 2d92f32..7ca355d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AT91_SOC_ID) += soc.o
index 03fa91f..648e326 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Broadcom SoC drivers"
 
 config BCM2835_POWER
index c81df4b..d92268a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM2835_POWER)    += bcm2835-power.o
 obj-$(CONFIG_RASPBERRYPI_POWER)        += raspberrypi-power.o
 obj-$(CONFIG_SOC_BRCMSTB)      += brcmstb/
index d36f6e0..38e4769 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if SOC_BRCMSTB
 
 config BRCMSTB_PM
index 01687c2..fe5c43d 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += common.o biuctrl.o
 obj-$(CONFIG_BRCMSTB_PM)       += pm/
index 08bbd24..8e10abb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ARM)              += s2-arm.o pm-arm.o
 AFLAGS_s2-arm.o                        := -march=armv7-a
 obj-$(CONFIG_BMIPS_GENERIC)    += s2-mips.o s3-mips.o pm-mips.o
index 2db8e65..daf4549 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y          += pmu.o
index 61f8e14..217f775 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # NXP/Freescale QorIQ series SOC drivers
 #
index 803ef1b..158541a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Kernel SOC fsl specific device drivers
 #
index b0943e5..bdecb86 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig FSL_DPAA
        bool "QorIQ DPAA1 framework support"
        depends on ((FSL_SOC_BOOKE || ARCH_LAYERSCAPE) && ARCH_DMA_ADDR_T_64BIT)
index fabba17..cfa4b29 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # QE Communication options
 #
index 819bed0..51b3a47 100644 (file)
@@ -179,8 +179,10 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
        if (err < 0)
                goto err0;
        gc = gpio_to_chip(err);
-       if (WARN_ON(!gc))
+       if (WARN_ON(!gc)) {
+               err = -ENODEV;
                goto err0;
+       }
 
        if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) {
                pr_debug("%s: tried to get a non-qe pin\n", __func__);
index d80f899..ade1b46 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "i.MX SoC drivers"
 
 config IMX_GPCV2_PM_DOMAINS
index 506a6f3..caa8653 100644 (file)
@@ -1,2 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
+obj-$(CONFIG_ARCH_MXC) += soc-imx8.o
index 7d14a4b..d9231bd 100644 (file)
@@ -406,7 +406,6 @@ static int imx_gpc_probe(struct platform_device *pdev)
        const struct imx_gpc_dt_data *of_id_data = of_id->data;
        struct device_node *pgc_node;
        struct regmap *regmap;
-       struct resource *res;
        void __iomem *base;
        int ret;
 
@@ -417,8 +416,7 @@ static int imx_gpc_probe(struct platform_device *pdev)
            !pgc_node)
                return 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(&pdev->dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
@@ -431,10 +429,19 @@ static int imx_gpc_probe(struct platform_device *pdev)
                return ret;
        }
 
-       /* Disable PU power down in normal operation if ERR009619 is present */
+       /*
+        * Disable PU power down by runtime PM if ERR009619 is present.
+        *
+        * The PRE clock will be paused for several cycles when turning on the
+        * PU domain LDO from power down state. If PRE is in use at that time,
+        * the IPU/PRG cannot get the correct display data from the PRE.
+        *
+        * This is not a concern when the whole system enters suspend state, so
+        * it's safe to power down PU in this case.
+        */
        if (of_id_data->err009619_present)
                imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |=
-                               GENPD_FLAG_ALWAYS_ON;
+                               GENPD_FLAG_RPM_ALWAYS_ON;
 
        /* Keep DISP always on if ERR006287 is present */
        if (of_id_data->err006287_present)
index 176f473..31b8d00 100644 (file)
@@ -136,8 +136,8 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd,
                GPC_PU_PGC_SW_PUP_REQ : GPC_PU_PGC_SW_PDN_REQ;
        const bool enable_power_control = !on;
        const bool has_regulator = !IS_ERR(domain->regulator);
-       unsigned long deadline;
        int i, ret = 0;
+       u32 pxx_req;
 
        regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
                           domain->bits.map, domain->bits.map);
@@ -169,30 +169,19 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd,
         * As per "5.5.9.4 Example Code 4" in IMX7DRM.pdf wait
         * for PUP_REQ/PDN_REQ bit to be cleared
         */
-       deadline = jiffies + msecs_to_jiffies(1);
-       while (true) {
-               u32 pxx_req;
-
-               regmap_read(domain->regmap, offset, &pxx_req);
-
-               if (!(pxx_req & domain->bits.pxx))
-                       break;
-
-               if (time_after(jiffies, deadline)) {
-                       dev_err(domain->dev, "falied to command PGC\n");
-                       ret = -ETIMEDOUT;
-                       /*
-                        * If we were in a process of enabling a
-                        * domain and failed we might as well disable
-                        * the regulator we just enabled. And if it
-                        * was the opposite situation and we failed to
-                        * power down -- keep the regulator on
-                        */
-                       on = !on;
-                       break;
-               }
-
-               cpu_relax();
+       ret = regmap_read_poll_timeout(domain->regmap, offset, pxx_req,
+                                      !(pxx_req & domain->bits.pxx),
+                                      0, USEC_PER_MSEC);
+       if (ret) {
+               dev_err(domain->dev, "failed to command PGC\n");
+               /*
+                * If we were in a process of enabling a
+                * domain and failed we might as well disable
+                * the regulator we just enabled. And if it
+                * was the opposite situation and we failed to
+                * power down -- keep the regulator on
+                */
+               on = !on;
        }
 
        if (enable_power_control)
@@ -574,7 +563,6 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct device_node *pgc_np, *np;
        struct regmap *regmap;
-       struct resource *res;
        void __iomem *base;
        int ret;
 
@@ -584,8 +572,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       res  = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       base = devm_ioremap_resource(dev, res);
+       base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);
 
diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c
new file mode 100644 (file)
index 0000000..fc6429f
--- /dev/null
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 NXP.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/slab.h>
+#include <linux/sys_soc.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+
+#define REV_B1                         0x21
+
+#define IMX8MQ_SW_INFO_B1              0x40
+#define IMX8MQ_SW_MAGIC_B1             0xff0055aa
+
+struct imx8_soc_data {
+       char *name;
+       u32 (*soc_revision)(void);
+};
+
+static u32 __init imx8mq_soc_revision(void)
+{
+       struct device_node *np;
+       void __iomem *ocotp_base;
+       u32 magic;
+       u32 rev = 0;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-ocotp");
+       if (!np)
+               goto out;
+
+       ocotp_base = of_iomap(np, 0);
+       WARN_ON(!ocotp_base);
+
+       magic = readl_relaxed(ocotp_base + IMX8MQ_SW_INFO_B1);
+       if (magic == IMX8MQ_SW_MAGIC_B1)
+               rev = REV_B1;
+
+       iounmap(ocotp_base);
+
+out:
+       of_node_put(np);
+       return rev;
+}
+
+static const struct imx8_soc_data imx8mq_soc_data = {
+       .name = "i.MX8MQ",
+       .soc_revision = imx8mq_soc_revision,
+};
+
+static const struct of_device_id imx8_soc_match[] = {
+       { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
+       { }
+};
+
+#define imx8_revision(soc_rev) \
+       soc_rev ? \
+       kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf,  soc_rev & 0xf) : \
+       "unknown"
+
+static int __init imx8_soc_init(void)
+{
+       struct soc_device_attribute *soc_dev_attr;
+       struct soc_device *soc_dev;
+       struct device_node *root;
+       const struct of_device_id *id;
+       u32 soc_rev = 0;
+       const struct imx8_soc_data *data;
+       int ret;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return -ENODEV;
+
+       soc_dev_attr->family = "Freescale i.MX";
+
+       root = of_find_node_by_path("/");
+       ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
+       if (ret)
+               goto free_soc;
+
+       id = of_match_node(imx8_soc_match, root);
+       if (!id)
+               goto free_soc;
+
+       of_node_put(root);
+
+       data = id->data;
+       if (data) {
+               soc_dev_attr->soc_id = data->name;
+               if (data->soc_revision)
+                       soc_rev = data->soc_revision();
+       }
+
+       soc_dev_attr->revision = imx8_revision(soc_rev);
+       if (!soc_dev_attr->revision)
+               goto free_soc;
+
+       soc_dev = soc_device_register(soc_dev_attr);
+       if (IS_ERR(soc_dev))
+               goto free_rev;
+
+       return 0;
+
+free_rev:
+       kfree(soc_dev_attr->revision);
+free_soc:
+       kfree(soc_dev_attr);
+       of_node_put(root);
+       return -ENODEV;
+}
+device_initcall(imx8_soc_init);
diff --git a/drivers/soc/ixp4xx/Kconfig b/drivers/soc/ixp4xx/Kconfig
new file mode 100644 (file)
index 0000000..de2e62c
--- /dev/null
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menu "IXP4xx SoC drivers"
+
+config IXP4XX_QMGR
+       tristate "IXP4xx Queue Manager support"
+       help
+         This driver supports IXP4xx built-in hardware queue manager
+         and is automatically selected by Ethernet and HSS drivers.
+
+config IXP4XX_NPE
+       tristate "IXP4xx Network Processor Engine support"
+       select FW_LOADER
+       help
+         This driver supports IXP4xx built-in network coprocessors
+         and is automatically selected by Ethernet and HSS drivers.
+
+endmenu
diff --git a/drivers/soc/ixp4xx/Makefile b/drivers/soc/ixp4xx/Makefile
new file mode 100644 (file)
index 0000000..bebb07d
--- /dev/null
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_IXP4XX_QMGR)      += ixp4xx-qmgr.o
+obj-$(CONFIG_IXP4XX_NPE)       += ixp4xx-npe.o
similarity index 94%
rename from arch/arm/mach-ixp4xx/ixp4xx_npe.c
rename to drivers/soc/ixp4xx/ixp4xx-npe.c
index d4eb09a..15979d4 100644 (file)
@@ -20,7 +20,9 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <mach/npe.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/soc/ixp4xx/npe.h>
 
 #define DEBUG_MSG                      0
 #define DEBUG_FW                       0
@@ -153,16 +155,10 @@ static struct {
 static struct npe npe_tab[NPE_COUNT] = {
        {
                .id     = 0,
-               .regs   = (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT,
-               .regs_phys = IXP4XX_NPEA_BASE_PHYS,
        }, {
                .id     = 1,
-               .regs   = (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT,
-               .regs_phys = IXP4XX_NPEB_BASE_PHYS,
        }, {
                .id     = 2,
-               .regs   = (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT,
-               .regs_phys = IXP4XX_NPEC_BASE_PHYS,
        }
 };
 
@@ -682,28 +678,37 @@ void npe_release(struct npe *npe)
        module_put(THIS_MODULE);
 }
 
-
-static int __init npe_init_module(void)
+static int ixp4xx_npe_probe(struct platform_device *pdev)
 {
-
        int i, found = 0;
+       struct device *dev = &pdev->dev;
+       struct resource *res;
 
        for (i = 0; i < NPE_COUNT; i++) {
                struct npe *npe = &npe_tab[i];
+
+               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+               if (!res)
+                       return -ENODEV;
+
                if (!(ixp4xx_read_feature_bits() &
-                     (IXP4XX_FEATURE_RESET_NPEA << i)))
+                     (IXP4XX_FEATURE_RESET_NPEA << i))) {
+                       dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n",
+                                i, res->start, res->end);
                        continue; /* NPE already disabled or not present */
-               if (!(npe->mem_res = request_mem_region(npe->regs_phys,
-                                                       REGS_SIZE,
-                                                       npe_name(npe)))) {
-                       print_npe(KERN_ERR, npe,
-                                 "failed to request memory region\n");
-                       continue;
                }
+               npe->regs = devm_ioremap_resource(dev, res);
+               if (!npe->regs)
+                       return -ENOMEM;
 
-               if (npe_reset(npe))
+               if (npe_reset(npe)) {
+                       dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
+                                i, res->start, res->end);
                        continue;
+               }
                npe->valid = 1;
+               dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n",
+                        i, res->start, res->end);
                found++;
        }
 
@@ -712,19 +717,34 @@ static int __init npe_init_module(void)
        return 0;
 }
 
-static void __exit npe_cleanup_module(void)
+static int ixp4xx_npe_remove(struct platform_device *pdev)
 {
        int i;
 
        for (i = 0; i < NPE_COUNT; i++)
-               if (npe_tab[i].mem_res) {
+               if (npe_tab[i].regs) {
                        npe_reset(&npe_tab[i]);
-                       release_resource(npe_tab[i].mem_res);
                }
+
+       return 0;
 }
 
-module_init(npe_init_module);
-module_exit(npe_cleanup_module);
+static const struct of_device_id ixp4xx_npe_of_match[] = {
+       {
+               .compatible = "intel,ixp4xx-network-processing-engine",
+        },
+       {},
+};
+
+static struct platform_driver ixp4xx_npe_driver = {
+       .driver = {
+               .name           = "ixp4xx-npe",
+               .of_match_table = of_match_ptr(ixp4xx_npe_of_match),
+       },
+       .probe = ixp4xx_npe_probe,
+       .remove = ixp4xx_npe_remove,
+};
+module_platform_driver(ixp4xx_npe_driver);
 
 MODULE_AUTHOR("Krzysztof Halasa");
 MODULE_LICENSE("GPL v2");
similarity index 66%
rename from arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
rename to drivers/soc/ixp4xx/ixp4xx-qmgr.c
index 9d1b6b7..bb90670 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <mach/qmgr.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
-static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
-static struct resource *mem_res;
+static struct qmgr_regs __iomem *qmgr_regs;
+static int qmgr_irq_1;
+static int qmgr_irq_2;
 static spinlock_t qmgr_lock;
 static u32 used_sram_bitmap[4]; /* 128 16-dword pages */
 static void (*irq_handlers[QUEUES])(void *pdev);
@@ -25,6 +28,94 @@ static void *irq_pdevs[QUEUES];
 char qmgr_queue_descs[QUEUES][32];
 #endif
 
+void qmgr_put_entry(unsigned int queue, u32 val)
+{
+#if DEBUG_QMGR
+       BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
+
+       printk(KERN_DEBUG "Queue %s(%i) put %X\n",
+              qmgr_queue_descs[queue], queue, val);
+#endif
+       __raw_writel(val, &qmgr_regs->acc[queue][0]);
+}
+
+u32 qmgr_get_entry(unsigned int queue)
+{
+       u32 val;
+       val = __raw_readl(&qmgr_regs->acc[queue][0]);
+#if DEBUG_QMGR
+       BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
+
+       printk(KERN_DEBUG "Queue %s(%i) get %X\n",
+              qmgr_queue_descs[queue], queue, val);
+#endif
+       return val;
+}
+
+static int __qmgr_get_stat1(unsigned int queue)
+{
+       return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
+               >> ((queue & 7) << 2)) & 0xF;
+}
+
+static int __qmgr_get_stat2(unsigned int queue)
+{
+       BUG_ON(queue >= HALF_QUEUES);
+       return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
+               >> ((queue & 0xF) << 1)) & 0x3;
+}
+
+/**
+ * qmgr_stat_empty() - checks if a hardware queue is empty
+ * @queue:     queue number
+ *
+ * Returns non-zero value if the queue is empty.
+ */
+int qmgr_stat_empty(unsigned int queue)
+{
+       BUG_ON(queue >= HALF_QUEUES);
+       return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY;
+}
+
+/**
+ * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark
+ * @queue:     queue number
+ *
+ * Returns non-zero value if the queue is below low watermark.
+ */
+int qmgr_stat_below_low_watermark(unsigned int queue)
+{
+       if (queue >= HALF_QUEUES)
+               return (__raw_readl(&qmgr_regs->statne_h) >>
+                       (queue - HALF_QUEUES)) & 0x01;
+       return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY;
+}
+
+/**
+ * qmgr_stat_full() - checks if a hardware queue is full
+ * @queue:     queue number
+ *
+ * Returns non-zero value if the queue is full.
+ */
+int qmgr_stat_full(unsigned int queue)
+{
+       if (queue >= HALF_QUEUES)
+               return (__raw_readl(&qmgr_regs->statf_h) >>
+                       (queue - HALF_QUEUES)) & 0x01;
+       return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL;
+}
+
+/**
+ * qmgr_stat_overflow() - checks if a hardware queue experienced overflow
+ * @queue:     queue number
+ *
+ * Returns non-zero value if the queue experienced overflow.
+ */
+int qmgr_stat_overflow(unsigned int queue)
+{
+       return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW;
+}
+
 void qmgr_set_irq(unsigned int queue, int src,
                  void (*handler)(void *pdev), void *pdev)
 {
@@ -95,7 +186,7 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev)
 
 static irqreturn_t qmgr_irq(int irq, void *pdev)
 {
-       int i, half = (irq == IRQ_IXP4XX_QM1 ? 0 : 1);
+       int i, half = (irq == qmgr_irq_1 ? 0 : 1);
        u32 req_bitmap = __raw_readl(&qmgr_regs->irqstat[half]);
 
        if (!req_bitmap)
@@ -282,16 +373,29 @@ void qmgr_release_queue(unsigned int queue)
        module_put(THIS_MODULE);
 }
 
-static int qmgr_init(void)
+static int ixp4xx_qmgr_probe(struct platform_device *pdev)
 {
        int i, err;
        irq_handler_t handler1, handler2;
+       struct device *dev = &pdev->dev;
+       struct resource *res;
+       int irq1, irq2;
 
-       mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS,
-                                    IXP4XX_QMGR_REGION_SIZE,
-                                    "IXP4xx Queue Manager");
-       if (mem_res == NULL)
-               return -EBUSY;
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -ENODEV;
+       qmgr_regs = devm_ioremap_resource(dev, res);
+       if (IS_ERR(qmgr_regs))
+               return PTR_ERR(qmgr_regs);
+
+       irq1 = platform_get_irq(pdev, 0);
+       if (irq1 <= 0)
+               return irq1 ? irq1 : -EINVAL;
+       qmgr_irq_1 = irq1;
+       irq2 = platform_get_irq(pdev, 1);
+       if (irq2 <= 0)
+               return irq2 ? irq2 : -EINVAL;
+       qmgr_irq_2 = irq2;
 
        /* reset qmgr registers */
        for (i = 0; i < 4; i++) {
@@ -316,50 +420,62 @@ static int qmgr_init(void)
        } else
                handler1 = handler2 = qmgr_irq;
 
-       err = request_irq(IRQ_IXP4XX_QM1, handler1, 0, "IXP4xx Queue Manager",
-                         NULL);
+       err = devm_request_irq(dev, irq1, handler1, 0, "IXP4xx Queue Manager",
+                              NULL);
        if (err) {
-               printk(KERN_ERR "qmgr: failed to request IRQ%i (%i)\n",
-                      IRQ_IXP4XX_QM1, err);
-               goto error_irq;
+               dev_err(dev, "failed to request IRQ%i (%i)\n",
+                       irq1, err);
+               return err;
        }
 
-       err = request_irq(IRQ_IXP4XX_QM2, handler2, 0, "IXP4xx Queue Manager",
-                         NULL);
+       err = devm_request_irq(dev, irq2, handler2, 0, "IXP4xx Queue Manager",
+                              NULL);
        if (err) {
-               printk(KERN_ERR "qmgr: failed to request IRQ%i (%i)\n",
-                      IRQ_IXP4XX_QM2, err);
-               goto error_irq2;
+               dev_err(dev, "failed to request IRQ%i (%i)\n",
+                       irq2, err);
+               return err;
        }
 
        used_sram_bitmap[0] = 0xF; /* 4 first pages reserved for config */
        spin_lock_init(&qmgr_lock);
 
-       printk(KERN_INFO "IXP4xx Queue Manager initialized.\n");
+       dev_info(dev, "IXP4xx Queue Manager initialized.\n");
        return 0;
-
-error_irq2:
-       free_irq(IRQ_IXP4XX_QM1, NULL);
-error_irq:
-       release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
-       return err;
 }
 
-static void qmgr_remove(void)
+static int ixp4xx_qmgr_remove(struct platform_device *pdev)
 {
-       free_irq(IRQ_IXP4XX_QM1, NULL);
-       free_irq(IRQ_IXP4XX_QM2, NULL);
-       synchronize_irq(IRQ_IXP4XX_QM1);
-       synchronize_irq(IRQ_IXP4XX_QM2);
-       release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
+       synchronize_irq(qmgr_irq_1);
+       synchronize_irq(qmgr_irq_2);
+       return 0;
 }
 
-module_init(qmgr_init);
-module_exit(qmgr_remove);
+static const struct of_device_id ixp4xx_qmgr_of_match[] = {
+       {
+               .compatible = "intel,ixp4xx-ahb-queue-manager",
+        },
+       {},
+};
+
+static struct platform_driver ixp4xx_qmgr_driver = {
+       .driver = {
+               .name           = "ixp4xx-qmgr",
+               .of_match_table = of_match_ptr(ixp4xx_qmgr_of_match),
+       },
+       .probe = ixp4xx_qmgr_probe,
+       .remove = ixp4xx_qmgr_remove,
+};
+module_platform_driver(ixp4xx_qmgr_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Krzysztof Halasa");
 
+EXPORT_SYMBOL(qmgr_put_entry);
+EXPORT_SYMBOL(qmgr_get_entry);
+EXPORT_SYMBOL(qmgr_stat_empty);
+EXPORT_SYMBOL(qmgr_stat_below_low_watermark);
+EXPORT_SYMBOL(qmgr_stat_full);
+EXPORT_SYMBOL(qmgr_stat_overflow);
 EXPORT_SYMBOL(qmgr_set_irq);
 EXPORT_SYMBOL(qmgr_enable_irq);
 EXPORT_SYMBOL(qmgr_disable_irq);
index 35aa86b..976f42f 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y                          += fpi-bus.o
index 17bd759..2114b56 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MediaTek SoC drivers
 #
index 64ce5ee..b017330 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
index 8236a6c..c4449a1 100644 (file)
@@ -381,6 +381,10 @@ enum pwrap_regs {
        PWRAP_EXT_GPS_AUXADC_RDATA_ADDR,
        PWRAP_GPSINF_0_STA,
        PWRAP_GPSINF_1_STA,
+
+       /* MT8516 only regs */
+       PWRAP_OP_TYPE,
+       PWRAP_MSB_FIRST,
 };
 
 static int mt2701_regs[] = {
@@ -852,6 +856,91 @@ static int mt8183_regs[] = {
        [PWRAP_WACS2_VLDCLR] =                  0xC28,
 };
 
+static int mt8516_regs[] = {
+       [PWRAP_MUX_SEL] =               0x0,
+       [PWRAP_WRAP_EN] =               0x4,
+       [PWRAP_DIO_EN] =                0x8,
+       [PWRAP_SIDLY] =                 0xc,
+       [PWRAP_RDDMY] =                 0x10,
+       [PWRAP_SI_CK_CON] =             0x14,
+       [PWRAP_CSHEXT_WRITE] =          0x18,
+       [PWRAP_CSHEXT_READ] =           0x1c,
+       [PWRAP_CSLEXT_START] =          0x20,
+       [PWRAP_CSLEXT_END] =            0x24,
+       [PWRAP_STAUPD_PRD] =            0x28,
+       [PWRAP_STAUPD_GRPEN] =          0x2c,
+       [PWRAP_STAUPD_MAN_TRIG] =       0x40,
+       [PWRAP_STAUPD_STA] =            0x44,
+       [PWRAP_WRAP_STA] =              0x48,
+       [PWRAP_HARB_INIT] =             0x4c,
+       [PWRAP_HARB_HPRIO] =            0x50,
+       [PWRAP_HIPRIO_ARB_EN] =         0x54,
+       [PWRAP_HARB_STA0] =             0x58,
+       [PWRAP_HARB_STA1] =             0x5c,
+       [PWRAP_MAN_EN] =                0x60,
+       [PWRAP_MAN_CMD] =               0x64,
+       [PWRAP_MAN_RDATA] =             0x68,
+       [PWRAP_MAN_VLDCLR] =            0x6c,
+       [PWRAP_WACS0_EN] =              0x70,
+       [PWRAP_INIT_DONE0] =            0x74,
+       [PWRAP_WACS0_CMD] =             0x78,
+       [PWRAP_WACS0_RDATA] =           0x7c,
+       [PWRAP_WACS0_VLDCLR] =          0x80,
+       [PWRAP_WACS1_EN] =              0x84,
+       [PWRAP_INIT_DONE1] =            0x88,
+       [PWRAP_WACS1_CMD] =             0x8c,
+       [PWRAP_WACS1_RDATA] =           0x90,
+       [PWRAP_WACS1_VLDCLR] =          0x94,
+       [PWRAP_WACS2_EN] =              0x98,
+       [PWRAP_INIT_DONE2] =            0x9c,
+       [PWRAP_WACS2_CMD] =             0xa0,
+       [PWRAP_WACS2_RDATA] =           0xa4,
+       [PWRAP_WACS2_VLDCLR] =          0xa8,
+       [PWRAP_INT_EN] =                0xac,
+       [PWRAP_INT_FLG_RAW] =           0xb0,
+       [PWRAP_INT_FLG] =               0xb4,
+       [PWRAP_INT_CLR] =               0xb8,
+       [PWRAP_SIG_ADR] =               0xbc,
+       [PWRAP_SIG_MODE] =              0xc0,
+       [PWRAP_SIG_VALUE] =             0xc4,
+       [PWRAP_SIG_ERRVAL] =            0xc8,
+       [PWRAP_CRC_EN] =                0xcc,
+       [PWRAP_TIMER_EN] =              0xd0,
+       [PWRAP_TIMER_STA] =             0xd4,
+       [PWRAP_WDT_UNIT] =              0xd8,
+       [PWRAP_WDT_SRC_EN] =            0xdc,
+       [PWRAP_WDT_FLG] =               0xe0,
+       [PWRAP_DEBUG_INT_SEL] =         0xe4,
+       [PWRAP_DVFS_ADR0] =             0xe8,
+       [PWRAP_DVFS_WDATA0] =           0xec,
+       [PWRAP_DVFS_ADR1] =             0xf0,
+       [PWRAP_DVFS_WDATA1] =           0xf4,
+       [PWRAP_DVFS_ADR2] =             0xf8,
+       [PWRAP_DVFS_WDATA2] =           0xfc,
+       [PWRAP_DVFS_ADR3] =             0x100,
+       [PWRAP_DVFS_WDATA3] =           0x104,
+       [PWRAP_DVFS_ADR4] =             0x108,
+       [PWRAP_DVFS_WDATA4] =           0x10c,
+       [PWRAP_DVFS_ADR5] =             0x110,
+       [PWRAP_DVFS_WDATA5] =           0x114,
+       [PWRAP_DVFS_ADR6] =             0x118,
+       [PWRAP_DVFS_WDATA6] =           0x11c,
+       [PWRAP_DVFS_ADR7] =             0x120,
+       [PWRAP_DVFS_WDATA7] =           0x124,
+       [PWRAP_SPMINF_STA] =            0x128,
+       [PWRAP_CIPHER_KEY_SEL] =        0x12c,
+       [PWRAP_CIPHER_IV_SEL] =         0x130,
+       [PWRAP_CIPHER_EN] =             0x134,
+       [PWRAP_CIPHER_RDY] =            0x138,
+       [PWRAP_CIPHER_MODE] =           0x13c,
+       [PWRAP_CIPHER_SWRST] =          0x140,
+       [PWRAP_DCM_EN] =                0x144,
+       [PWRAP_DCM_DBC_PRD] =           0x148,
+       [PWRAP_SW_RST] =                0x168,
+       [PWRAP_OP_TYPE] =               0x16c,
+       [PWRAP_MSB_FIRST] =             0x170,
+};
+
 enum pmic_type {
        PMIC_MT6323,
        PMIC_MT6351,
@@ -869,6 +958,7 @@ enum pwrap_type {
        PWRAP_MT8135,
        PWRAP_MT8173,
        PWRAP_MT8183,
+       PWRAP_MT8516,
 };
 
 struct pmic_wrapper;
@@ -1281,7 +1371,7 @@ static bool pwrap_is_pmic_cipher_ready(struct pmic_wrapper *wrp)
 static int pwrap_init_cipher(struct pmic_wrapper *wrp)
 {
        int ret;
-       u32 rdata;
+       u32 rdata = 0;
 
        pwrap_writel(wrp, 0x1, PWRAP_CIPHER_SWRST);
        pwrap_writel(wrp, 0x0, PWRAP_CIPHER_SWRST);
@@ -1297,6 +1387,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
        case PWRAP_MT6765:
        case PWRAP_MT6797:
        case PWRAP_MT8173:
+       case PWRAP_MT8516:
                pwrap_writel(wrp, 1, PWRAP_CIPHER_EN);
                break;
        case PWRAP_MT7622:
@@ -1478,7 +1569,8 @@ static int pwrap_init(struct pmic_wrapper *wrp)
 {
        int ret;
 
-       reset_control_reset(wrp->rstc);
+       if (wrp->rstc)
+               reset_control_reset(wrp->rstc);
        if (wrp->rstc_bridge)
                reset_control_reset(wrp->rstc_bridge);
 
@@ -1764,6 +1856,18 @@ static const struct pmic_wrapper_type pwrap_mt8183 = {
        .init_soc_specific = pwrap_mt8183_init_soc_specific,
 };
 
+static struct pmic_wrapper_type pwrap_mt8516 = {
+       .regs = mt8516_regs,
+       .type = PWRAP_MT8516,
+       .arb_en_all = 0xff,
+       .int_en_all = ~(u32)(BIT(31) | BIT(2)),
+       .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
+       .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
+       .caps = PWRAP_CAP_DCM,
+       .init_reg_clock = pwrap_mt2701_init_reg_clock,
+       .init_soc_specific = NULL,
+};
+
 static const struct of_device_id of_pwrap_match_tbl[] = {
        {
                .compatible = "mediatek,mt2701-pwrap",
@@ -1787,6 +1891,9 @@ static const struct of_device_id of_pwrap_match_tbl[] = {
                .compatible = "mediatek,mt8183-pwrap",
                .data = &pwrap_mt8183,
        }, {
+               .compatible = "mediatek,mt8516-pwrap",
+               .data = &pwrap_mt8516,
+       }, {
                /* sentinel */
        }
 };
index 1ee298f..880cf02 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # QCOM Soc drivers
 #
index c701b3b..f6c3d17 100644 (file)
@@ -248,8 +248,8 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
        }
 
        cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB);
-       if (IS_ERR_OR_NULL(cmd_db_header)) {
-               ret = PTR_ERR(cmd_db_header);
+       if (!cmd_db_header) {
+               ret = -ENOMEM;
                cmd_db_header = NULL;
                return ret;
        }
index c239a28..f9e309f 100644 (file)
@@ -345,8 +345,7 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
        struct qmi_handle *qmi = txn->qmi;
        int ret;
 
-       ret = wait_for_completion_interruptible_timeout(&txn->completion,
-                                                       timeout);
+       ret = wait_for_completion_timeout(&txn->completion, timeout);
 
        mutex_lock(&qmi->txn_lock);
        mutex_lock(&txn->lock);
@@ -354,9 +353,7 @@ int qmi_txn_wait(struct qmi_txn *txn, unsigned long timeout)
        mutex_unlock(&txn->lock);
        mutex_unlock(&qmi->txn_lock);
 
-       if (ret < 0)
-               return ret;
-       else if (ret == 0)
+       if (ret == 0)
                return -ETIMEDOUT;
        else
                return txn->result;
index 7200d76..6f5e8be 100644 (file)
@@ -137,6 +137,26 @@ static struct class rmtfs_class = {
        .name           = "rmtfs",
 };
 
+static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma)
+{
+       struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data;
+
+       if (vma->vm_end - vma->vm_start > rmtfs_mem->size) {
+               dev_dbg(&rmtfs_mem->dev,
+                       "vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n",
+                       vma->vm_end, vma->vm_start,
+                       (vma->vm_end - vma->vm_start), &rmtfs_mem->size);
+               return -EINVAL;
+       }
+
+       vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+       return remap_pfn_range(vma,
+                              vma->vm_start,
+                              rmtfs_mem->addr >> PAGE_SHIFT,
+                              vma->vm_end - vma->vm_start,
+                              vma->vm_page_prot);
+}
+
 static const struct file_operations qcom_rmtfs_mem_fops = {
        .owner = THIS_MODULE,
        .open = qcom_rmtfs_mem_open,
@@ -144,6 +164,7 @@ static const struct file_operations qcom_rmtfs_mem_fops = {
        .write = qcom_rmtfs_mem_write,
        .release = qcom_rmtfs_mem_release,
        .llseek = default_llseek,
+       .mmap = qcom_rmtfs_mem_mmap,
 };
 
 static void qcom_rmtfs_mem_release_device(struct device *dev)
index 75bd9a8..e278fc1 100644 (file)
@@ -459,7 +459,7 @@ static int find_slots(struct tcs_group *tcs, const struct tcs_request *msg,
        do {
                slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS,
                                                  i, msg->num_cmds, 0);
-               if (slot == tcs->num_tcs * tcs->ncpt)
+               if (slot >= tcs->num_tcs * tcs->ncpt)
                        return -ENOMEM;
                i += tcs->ncpt;
        } while (slot + msg->num_cmds - 1 >= i);
index 4af96e6..3299cf5 100644 (file)
@@ -335,6 +335,9 @@ static int __init renesas_soc_init(void)
                /* R-Car M3-W ES1.1 incorrectly identifies as ES2.0 */
                if ((product & 0x7fff) == 0x5210)
                        product ^= 0x11;
+               /* R-Car M3-W ES1.3 incorrectly identifies as ES2.1 */
+               if ((product & 0x7fff) == 0x5211)
+                       product ^= 0x12;
                if (soc->id && ((product >> 8) & 0xff) != soc->id) {
                        pr_warn("SoC mismatch (product = 0x%x)\n", product);
                        return -ENODEV;
index 20da55d..b71b73b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_ROCKCHIP || COMPILE_TEST
 
 #
index c851fa0..afca0a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Rockchip Soc drivers
 #
index 96882ff..3b81e1d 100644 (file)
@@ -66,9 +66,11 @@ static const struct rockchip_grf_info rk3228_grf __initconst = {
 };
 
 #define RK3288_GRF_SOC_CON0            0x244
+#define RK3288_GRF_SOC_CON2            0x24c
 
 static const struct rockchip_grf_value rk3288_defaults[] __initconst = {
        { "jtag switching", RK3288_GRF_SOC_CON0, HIWORD_UPDATE(0, 1, 12) },
+       { "pwm select", RK3288_GRF_SOC_CON2, HIWORD_UPDATE(1, 1, 0) },
 };
 
 static const struct rockchip_grf_info rk3288_grf __initconst = {
index e84eb4e..f10fd6c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Allwinner sunXi SoC drivers
 #
index 4cf9dbd..7816fbb 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SUNXI_SRAM) +=    sunxi_sram.o
index a0b0344..fbfce48 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if ARCH_TEGRA
 
 # 32-bit ARM SoCs
index 0df2585..5648e5c 100644 (file)
@@ -272,6 +272,14 @@ static const char * const tegra30_reset_sources[] = {
        "WATCHDOG",
        "SENSOR",
        "SW_MAIN",
+       "LP0"
+};
+
+static const char * const tegra210_reset_sources[] = {
+       "POWER_ON_RESET",
+       "WATCHDOG",
+       "SENSOR",
+       "SW_MAIN",
        "LP0",
        "AOTAG"
 };
@@ -656,10 +664,15 @@ static int tegra_genpd_power_on(struct generic_pm_domain *domain)
        int err;
 
        err = tegra_powergate_power_up(pg, true);
-       if (err)
+       if (err) {
                dev_err(dev, "failed to turn on PM domain %s: %d\n",
                        pg->genpd.name, err);
+               goto out;
+       }
+
+       reset_control_release(pg->reset);
 
+out:
        return err;
 }
 
@@ -669,10 +682,18 @@ static int tegra_genpd_power_off(struct generic_pm_domain *domain)
        struct device *dev = pg->pmc->dev;
        int err;
 
+       err = reset_control_acquire(pg->reset);
+       if (err < 0) {
+               pr_err("failed to acquire resets: %d\n", err);
+               return err;
+       }
+
        err = tegra_powergate_power_down(pg);
-       if (err)
+       if (err) {
                dev_err(dev, "failed to turn off PM domain %s: %d\n",
                        pg->genpd.name, err);
+               reset_control_release(pg->reset);
+       }
 
        return err;
 }
@@ -937,38 +958,53 @@ static int tegra_powergate_of_get_resets(struct tegra_powergate *pg,
        struct device *dev = pg->pmc->dev;
        int err;
 
-       pg->reset = of_reset_control_array_get_exclusive(np);
+       pg->reset = of_reset_control_array_get_exclusive_released(np);
        if (IS_ERR(pg->reset)) {
                err = PTR_ERR(pg->reset);
                dev_err(dev, "failed to get device resets: %d\n", err);
                return err;
        }
 
-       if (off)
+       err = reset_control_acquire(pg->reset);
+       if (err < 0) {
+               pr_err("failed to acquire resets: %d\n", err);
+               goto out;
+       }
+
+       if (off) {
                err = reset_control_assert(pg->reset);
-       else
+       } else {
                err = reset_control_deassert(pg->reset);
+               if (err < 0)
+                       goto out;
 
-       if (err)
+               reset_control_release(pg->reset);
+       }
+
+out:
+       if (err) {
+               reset_control_release(pg->reset);
                reset_control_put(pg->reset);
+       }
 
        return err;
 }
 
-static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
+static int tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
 {
        struct device *dev = pmc->dev;
        struct tegra_powergate *pg;
-       int id, err;
+       int id, err = 0;
        bool off;
 
        pg = kzalloc(sizeof(*pg), GFP_KERNEL);
        if (!pg)
-               return;
+               return -ENOMEM;
 
        id = tegra_powergate_lookup(pmc, np->name);
        if (id < 0) {
                dev_err(dev, "powergate lookup failed for %pOFn: %d\n", np, id);
+               err = -ENODEV;
                goto free_mem;
        }
 
@@ -1021,7 +1057,7 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
 
        dev_dbg(dev, "added PM domain %s\n", pg->genpd.name);
 
-       return;
+       return 0;
 
 remove_genpd:
        pm_genpd_remove(&pg->genpd);
@@ -1040,25 +1076,67 @@ set_available:
 
 free_mem:
        kfree(pg);
+
+       return err;
 }
 
-static void tegra_powergate_init(struct tegra_pmc *pmc,
-                                struct device_node *parent)
+static int tegra_powergate_init(struct tegra_pmc *pmc,
+                               struct device_node *parent)
 {
        struct device_node *np, *child;
-       unsigned int i;
+       int err = 0;
+
+       np = of_get_child_by_name(parent, "powergates");
+       if (!np)
+               return 0;
+
+       for_each_child_of_node(np, child) {
+               err = tegra_powergate_add(pmc, child);
+               if (err < 0) {
+                       of_node_put(child);
+                       break;
+               }
+       }
+
+       of_node_put(np);
+
+       return err;
+}
+
+static void tegra_powergate_remove(struct generic_pm_domain *genpd)
+{
+       struct tegra_powergate *pg = to_powergate(genpd);
+
+       reset_control_put(pg->reset);
+
+       while (pg->num_clks--)
+               clk_put(pg->clks[pg->num_clks]);
+
+       kfree(pg->clks);
 
-       /* Create a bitmap of the available and valid partitions */
-       for (i = 0; i < pmc->soc->num_powergates; i++)
-               if (pmc->soc->powergates[i])
-                       set_bit(i, pmc->powergates_available);
+       set_bit(pg->id, pmc->powergates_available);
+
+       kfree(pg);
+}
+
+static void tegra_powergate_remove_all(struct device_node *parent)
+{
+       struct generic_pm_domain *genpd;
+       struct device_node *np, *child;
 
        np = of_get_child_by_name(parent, "powergates");
        if (!np)
                return;
 
-       for_each_child_of_node(np, child)
-               tegra_powergate_add(pmc, child);
+       for_each_child_of_node(np, child) {
+               of_genpd_del_provider(child);
+
+               genpd = of_genpd_remove_last(child);
+               if (IS_ERR(genpd))
+                       continue;
+
+               tegra_powergate_remove(genpd);
+       }
 
        of_node_put(np);
 }
@@ -1709,13 +1787,16 @@ static int tegra_pmc_pinctrl_init(struct tegra_pmc *pmc)
 static ssize_t reset_reason_show(struct device *dev,
                                 struct device_attribute *attr, char *buf)
 {
-       u32 value, rst_src;
+       u32 value;
 
        value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
-       rst_src = (value & pmc->soc->regs->rst_source_mask) >>
-                       pmc->soc->regs->rst_source_shift;
+       value &= pmc->soc->regs->rst_source_mask;
+       value >>= pmc->soc->regs->rst_source_shift;
+
+       if (WARN_ON(value >= pmc->soc->num_reset_sources))
+               return sprintf(buf, "%s\n", "UNKNOWN");
 
-       return sprintf(buf, "%s\n", pmc->soc->reset_sources[rst_src]);
+       return sprintf(buf, "%s\n", pmc->soc->reset_sources[value]);
 }
 
 static DEVICE_ATTR_RO(reset_reason);
@@ -1723,13 +1804,16 @@ static DEVICE_ATTR_RO(reset_reason);
 static ssize_t reset_level_show(struct device *dev,
                                struct device_attribute *attr, char *buf)
 {
-       u32 value, rst_lvl;
+       u32 value;
 
        value = tegra_pmc_readl(pmc, pmc->soc->regs->rst_status);
-       rst_lvl = (value & pmc->soc->regs->rst_level_mask) >>
-                       pmc->soc->regs->rst_level_shift;
+       value &= pmc->soc->regs->rst_level_mask;
+       value >>= pmc->soc->regs->rst_level_shift;
 
-       return sprintf(buf, "%s\n", pmc->soc->reset_levels[rst_lvl]);
+       if (WARN_ON(value >= pmc->soc->num_reset_levels))
+               return sprintf(buf, "%s\n", "UNKNOWN");
+
+       return sprintf(buf, "%s\n", pmc->soc->reset_levels[value]);
 }
 
 static DEVICE_ATTR_RO(reset_level);
@@ -1999,7 +2083,7 @@ static int tegra_pmc_probe(struct platform_device *pdev)
        if (IS_ENABLED(CONFIG_DEBUG_FS)) {
                err = tegra_powergate_debugfs_init();
                if (err < 0)
-                       return err;
+                       goto cleanup_sysfs;
        }
 
        err = register_restart_handler(&tegra_pmc_restart_handler);
@@ -2013,9 +2097,13 @@ static int tegra_pmc_probe(struct platform_device *pdev)
        if (err)
                goto cleanup_restart_handler;
 
+       err = tegra_powergate_init(pmc, pdev->dev.of_node);
+       if (err < 0)
+               goto cleanup_powergates;
+
        err = tegra_pmc_irq_init(pmc);
        if (err < 0)
-               goto cleanup_restart_handler;
+               goto cleanup_powergates;
 
        mutex_lock(&pmc->powergates_lock);
        iounmap(pmc->base);
@@ -2026,10 +2114,15 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 
        return 0;
 
+cleanup_powergates:
+       tegra_powergate_remove_all(pdev->dev.of_node);
 cleanup_restart_handler:
        unregister_restart_handler(&tegra_pmc_restart_handler);
 cleanup_debugfs:
        debugfs_remove(pmc->debugfs);
+cleanup_sysfs:
+       device_remove_file(&pdev->dev, &dev_attr_reset_reason);
+       device_remove_file(&pdev->dev, &dev_attr_reset_level);
        return err;
 }
 
@@ -2185,7 +2278,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = {
        .init = tegra20_pmc_init,
        .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
        .reset_sources = tegra30_reset_sources,
-       .num_reset_sources = 5,
+       .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
        .reset_levels = NULL,
        .num_reset_levels = 0,
 };
@@ -2236,7 +2329,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = {
        .init = tegra20_pmc_init,
        .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
        .reset_sources = tegra30_reset_sources,
-       .num_reset_sources = 5,
+       .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
        .reset_levels = NULL,
        .num_reset_levels = 0,
 };
@@ -2347,7 +2440,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = {
        .init = tegra20_pmc_init,
        .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
        .reset_sources = tegra30_reset_sources,
-       .num_reset_sources = 5,
+       .num_reset_sources = ARRAY_SIZE(tegra30_reset_sources),
        .reset_levels = NULL,
        .num_reset_levels = 0,
 };
@@ -2452,8 +2545,8 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = {
        .regs = &tegra20_pmc_regs,
        .init = tegra20_pmc_init,
        .setup_irq_polarity = tegra20_pmc_setup_irq_polarity,
-       .reset_sources = tegra30_reset_sources,
-       .num_reset_sources = 5,
+       .reset_sources = tegra210_reset_sources,
+       .num_reset_sources = ARRAY_SIZE(tegra210_reset_sources),
        .reset_levels = NULL,
        .num_reset_levels = 0,
 };
@@ -2578,9 +2671,9 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = {
        .init = NULL,
        .setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
        .reset_sources = tegra186_reset_sources,
-       .num_reset_sources = 14,
+       .num_reset_sources = ARRAY_SIZE(tegra186_reset_sources),
        .reset_levels = tegra186_reset_levels,
-       .num_reset_levels = 3,
+       .num_reset_levels = ARRAY_SIZE(tegra186_reset_levels),
        .num_wake_events = ARRAY_SIZE(tegra186_wake_events),
        .wake_events = tegra186_wake_events,
 };
@@ -2719,6 +2812,7 @@ static int __init tegra_pmc_early_init(void)
        const struct of_device_id *match;
        struct device_node *np;
        struct resource regs;
+       unsigned int i;
        bool invert;
 
        mutex_init(&pmc->powergates_lock);
@@ -2775,7 +2869,10 @@ static int __init tegra_pmc_early_init(void)
                if (pmc->soc->maybe_tz_only)
                        pmc->tz_only = tegra_pmc_detect_tz_only(pmc);
 
-               tegra_powergate_init(pmc, np);
+               /* Create a bitmap of the available and valid partitions */
+               for (i = 0; i < pmc->soc->num_powergates; i++)
+                       if (pmc->soc->powergates[i])
+                               set_bit(i, pmc->powergates_available);
 
                /*
                 * Invert the interrupt polarity if a PMC device tree node
index be4570b..ea0859f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # 64-bit ARM SoCs from TI
 if ARM64
 
@@ -45,11 +46,12 @@ config KEYSTONE_NAVIGATOR_DMA
 config AMX3_PM
        tristate "AMx3 Power Management"
        depends on SOC_AM33XX || SOC_AM43XX
-       depends on WKUP_M3_IPC && TI_EMIF_SRAM && SRAM
+       depends on WKUP_M3_IPC && TI_EMIF_SRAM && SRAM && RTC_DRV_OMAP
        help
          Enable power management on AM335x and AM437x. Required for suspend to mem
          and standby states on both AM335x and AM437x platforms and for deeper cpuidle
-         c-states on AM335x.
+         c-states on AM335x. Also required for rtc and ddr in self-refresh low
+         power mode on AM437x platforms.
 
 config WKUP_M3_IPC
        tristate "TI AMx3 Wkup-M3 IPC Driver"
@@ -73,4 +75,10 @@ config TI_SCI_PM_DOMAINS
          called ti_sci_pm_domains. Note this is needed early in boot before
          rootfs may be available.
 
+config TI_SCI_INTA_MSI_DOMAIN
+       bool
+       select GENERIC_MSI_IRQ_DOMAIN
+       help
+         Driver to enable Interrupt Aggregator specific MSI Domain.
+
 endif # SOC_TI
index a22edc0..b3868d3 100644 (file)
@@ -8,3 +8,4 @@ obj-$(CONFIG_KEYSTONE_NAVIGATOR_DMA)    += knav_dma.o
 obj-$(CONFIG_AMX3_PM)                  += pm33xx.o
 obj-$(CONFIG_WKUP_M3_IPC)              += wkup_m3_ipc.o
 obj-$(CONFIG_TI_SCI_PM_DOMAINS)                += ti_sci_pm_domains.o
+obj-$(CONFIG_TI_SCI_INTA_MSI_DOMAIN)   += ti_sci_inta_msi.o
index d0dab32..fc5802c 100644 (file)
@@ -6,6 +6,7 @@
  *     Vaibhav Bedia, Dave Gerlach
  */
 
+#include <linux/clk.h>
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/genalloc.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/nvmem-consumer.h>
 #include <linux/of.h>
 #include <linux/platform_data/pm33xx.h>
 #include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/rtc/rtc-omap.h>
 #include <linux/sizes.h>
 #include <linux/sram.h>
 #include <linux/suspend.h>
 #define AMX3_PM_SRAM_SYMBOL_OFFSET(sym) ((unsigned long)(sym) - \
                                         (unsigned long)pm_sram->do_wfi)
 
+#define RTC_SCRATCH_RESUME_REG 0
+#define RTC_SCRATCH_MAGIC_REG  1
+#define RTC_REG_BOOT_MAGIC     0x8cd0 /* RTC */
+#define GIC_INT_SET_PENDING_BASE 0x200
+#define AM43XX_GIC_DIST_BASE   0x48241000
+
+static u32 rtc_magic_val;
+
 static int (*am33xx_do_wfi_sram)(unsigned long unused);
 static phys_addr_t am33xx_do_wfi_sram_phys;
 
 static struct gen_pool *sram_pool, *sram_pool_data;
 static unsigned long ocmcram_location, ocmcram_location_data;
 
+static struct rtc_device *omap_rtc;
+static void __iomem *gic_dist_base;
+
 static struct am33xx_pm_platform_data *pm_ops;
 static struct am33xx_pm_sram_addr *pm_sram;
 
 static struct device *pm33xx_dev;
 static struct wkup_m3_ipc *m3_ipc;
 
+#ifdef CONFIG_SUSPEND
+static int rtc_only_idle;
+static int retrigger_irq;
 static unsigned long suspend_wfi_flags;
 
+static struct wkup_m3_wakeup_src wakeup_src = {.irq_nr = 0,
+       .src = "Unknown",
+};
+
+static struct wkup_m3_wakeup_src rtc_alarm_wakeup = {
+       .irq_nr = 108, .src = "RTC Alarm",
+};
+
+static struct wkup_m3_wakeup_src rtc_ext_wakeup = {
+       .irq_nr = 0, .src = "Ext wakeup",
+};
+#endif
+
 static u32 sram_suspend_address(unsigned long addr)
 {
        return ((unsigned long)am33xx_do_wfi_sram +
                AMX3_PM_SRAM_SYMBOL_OFFSET(addr));
 }
 
+static int am33xx_push_sram_idle(void)
+{
+       struct am33xx_pm_ro_sram_data ro_sram_data;
+       int ret;
+       u32 table_addr, ro_data_addr;
+       void *copy_addr;
+
+       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();
+
+       /* Save physical address to calculate resume offset during pm init */
+       am33xx_do_wfi_sram_phys = gen_pool_virt_to_phys(sram_pool,
+                                                       ocmcram_location);
+
+       am33xx_do_wfi_sram = sram_exec_copy(sram_pool, (void *)ocmcram_location,
+                                           pm_sram->do_wfi,
+                                           *pm_sram->do_wfi_sz);
+       if (!am33xx_do_wfi_sram) {
+               dev_err(pm33xx_dev,
+                       "PM: %s: am33xx_do_wfi copy to sram failed\n",
+                       __func__);
+               return -ENODEV;
+       }
+
+       table_addr =
+               sram_suspend_address((unsigned long)pm_sram->emif_sram_table);
+       ret = ti_emif_copy_pm_function_table(sram_pool, (void *)table_addr);
+       if (ret) {
+               dev_dbg(pm33xx_dev,
+                       "PM: %s: EMIF function copy failed\n", __func__);
+               return -EPROBE_DEFER;
+       }
+
+       ro_data_addr =
+               sram_suspend_address((unsigned long)pm_sram->ro_sram_data);
+       copy_addr = sram_exec_copy(sram_pool, (void *)ro_data_addr,
+                                  &ro_sram_data,
+                                  sizeof(ro_sram_data));
+       if (!copy_addr) {
+               dev_err(pm33xx_dev,
+                       "PM: %s: ro_sram_data copy to sram failed\n",
+                       __func__);
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
+static int __init am43xx_map_gic(void)
+{
+       gic_dist_base = ioremap(AM43XX_GIC_DIST_BASE, SZ_4K);
+
+       if (!gic_dist_base)
+               return -ENOMEM;
+
+       return 0;
+}
+
 #ifdef CONFIG_SUSPEND
+struct wkup_m3_wakeup_src rtc_wake_src(void)
+{
+       u32 i;
+
+       i = __raw_readl(pm_ops->get_rtc_base_addr() + 0x44) & 0x40;
+
+       if (i) {
+               retrigger_irq = rtc_alarm_wakeup.irq_nr;
+               return rtc_alarm_wakeup;
+       }
+
+       retrigger_irq = rtc_ext_wakeup.irq_nr;
+
+       return rtc_ext_wakeup;
+}
+
+int am33xx_rtc_only_idle(unsigned long wfi_flags)
+{
+       omap_rtc_power_off_program(&omap_rtc->dev);
+       am33xx_do_wfi_sram(wfi_flags);
+       return 0;
+}
+
 static int am33xx_pm_suspend(suspend_state_t suspend_state)
 {
        int i, ret = 0;
 
-       ret = pm_ops->soc_suspend((unsigned long)suspend_state,
-                                 am33xx_do_wfi_sram, suspend_wfi_flags);
+       if (suspend_state == PM_SUSPEND_MEM &&
+           pm_ops->check_off_mode_enable()) {
+               pm_ops->prepare_rtc_suspend();
+               pm_ops->save_context();
+               suspend_wfi_flags |= WFI_FLAG_RTC_ONLY;
+               clk_save_context();
+               ret = pm_ops->soc_suspend(suspend_state, am33xx_rtc_only_idle,
+                                         suspend_wfi_flags);
+
+               suspend_wfi_flags &= ~WFI_FLAG_RTC_ONLY;
+
+               if (!ret) {
+                       clk_restore_context();
+                       pm_ops->restore_context();
+                       m3_ipc->ops->set_rtc_only(m3_ipc);
+                       am33xx_push_sram_idle();
+               }
+       } else {
+               ret = pm_ops->soc_suspend(suspend_state, am33xx_do_wfi_sram,
+                                         suspend_wfi_flags);
+       }
 
        if (ret) {
                dev_err(pm33xx_dev, "PM: Kernel suspend failure\n");
@@ -77,8 +210,20 @@ static int am33xx_pm_suspend(suspend_state_t suspend_state)
                                "PM: CM3 returned unknown result = %d\n", i);
                        ret = -1;
                }
+
+               /* print the wakeup reason */
+               if (rtc_only_idle) {
+                       wakeup_src = rtc_wake_src();
+                       pr_info("PM: Wakeup source %s\n", wakeup_src.src);
+               } else {
+                       pr_info("PM: Wakeup source %s\n",
+                               m3_ipc->ops->request_wake_src(m3_ipc));
+               }
        }
 
+       if (suspend_state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable())
+               pm_ops->prepare_rtc_resume();
+
        return ret;
 }
 
@@ -101,6 +246,18 @@ static int am33xx_pm_enter(suspend_state_t suspend_state)
 static int am33xx_pm_begin(suspend_state_t state)
 {
        int ret = -EINVAL;
+       struct nvmem_device *nvmem;
+
+       if (state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) {
+               nvmem = devm_nvmem_device_get(&omap_rtc->dev,
+                                             "omap_rtc_scratch0");
+               if (nvmem)
+                       nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4,
+                                          (void *)&rtc_magic_val);
+               rtc_only_idle = 1;
+       } else {
+               rtc_only_idle = 0;
+       }
 
        switch (state) {
        case PM_SUSPEND_MEM:
@@ -116,7 +273,28 @@ static int am33xx_pm_begin(suspend_state_t state)
 
 static void am33xx_pm_end(void)
 {
+       u32 val = 0;
+       struct nvmem_device *nvmem;
+
+       nvmem = devm_nvmem_device_get(&omap_rtc->dev, "omap_rtc_scratch0");
        m3_ipc->ops->finish_low_power(m3_ipc);
+       if (rtc_only_idle) {
+               if (retrigger_irq)
+                       /*
+                        * 32 bits of Interrupt Set-Pending correspond to 32
+                        * 32 interrupts. Compute the bit offset of the
+                        * Interrupt and set that particular bit
+                        * Compute the register offset by dividing interrupt
+                        * number by 32 and mutiplying by 4
+                        */
+                       writel_relaxed(1 << (retrigger_irq & 31),
+                                      gic_dist_base + GIC_INT_SET_PENDING_BASE
+                                      + retrigger_irq / 32 * 4);
+                       nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4, 4,
+                                          (void *)&val);
+       }
+
+       rtc_only_idle = 0;
 }
 
 static int am33xx_pm_valid(suspend_state_t state)
@@ -219,51 +397,37 @@ mpu_put_node:
        return ret;
 }
 
-static int am33xx_push_sram_idle(void)
+static int am33xx_pm_rtc_setup(void)
 {
-       struct am33xx_pm_ro_sram_data ro_sram_data;
-       int ret;
-       u32 table_addr, ro_data_addr;
-       void *copy_addr;
-
-       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();
+       struct device_node *np;
+       unsigned long val = 0;
+       struct nvmem_device *nvmem;
 
-       /* Save physical address to calculate resume offset during pm init */
-       am33xx_do_wfi_sram_phys = gen_pool_virt_to_phys(sram_pool,
-                                                       ocmcram_location);
+       np = of_find_node_by_name(NULL, "rtc");
 
-       am33xx_do_wfi_sram = sram_exec_copy(sram_pool, (void *)ocmcram_location,
-                                           pm_sram->do_wfi,
-                                           *pm_sram->do_wfi_sz);
-       if (!am33xx_do_wfi_sram) {
-               dev_err(pm33xx_dev,
-                       "PM: %s: am33xx_do_wfi copy to sram failed\n",
-                       __func__);
-               return -ENODEV;
-       }
-
-       table_addr =
-               sram_suspend_address((unsigned long)pm_sram->emif_sram_table);
-       ret = ti_emif_copy_pm_function_table(sram_pool, (void *)table_addr);
-       if (ret) {
-               dev_dbg(pm33xx_dev,
-                       "PM: %s: EMIF function copy failed\n", __func__);
-               return -EPROBE_DEFER;
-       }
+       if (of_device_is_available(np)) {
+               omap_rtc = rtc_class_open("rtc0");
+               if (!omap_rtc) {
+                       pr_warn("PM: rtc0 not available");
+                       return -EPROBE_DEFER;
+               }
 
-       ro_data_addr =
-               sram_suspend_address((unsigned long)pm_sram->ro_sram_data);
-       copy_addr = sram_exec_copy(sram_pool, (void *)ro_data_addr,
-                                  &ro_sram_data,
-                                  sizeof(ro_sram_data));
-       if (!copy_addr) {
-               dev_err(pm33xx_dev,
-                       "PM: %s: ro_sram_data copy to sram failed\n",
-                       __func__);
-               return -ENODEV;
+               nvmem = devm_nvmem_device_get(&omap_rtc->dev,
+                                             "omap_rtc_scratch0");
+               if (nvmem) {
+                       nvmem_device_read(nvmem, RTC_SCRATCH_MAGIC_REG * 4,
+                                         4, (void *)&rtc_magic_val);
+                       if ((rtc_magic_val & 0xffff) != RTC_REG_BOOT_MAGIC)
+                               pr_warn("PM: bootloader does not support rtc-only!\n");
+
+                       nvmem_device_write(nvmem, RTC_SCRATCH_MAGIC_REG * 4,
+                                          4, (void *)&val);
+                       val = pm_sram->resume_address;
+                       nvmem_device_write(nvmem, RTC_SCRATCH_RESUME_REG * 4,
+                                          4, (void *)&val);
+               }
+       } else {
+               pr_warn("PM: no-rtc available, rtc-only mode disabled.\n");
        }
 
        return 0;
@@ -284,34 +448,42 @@ static int am33xx_pm_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       ret = am43xx_map_gic();
+       if (ret) {
+               pr_err("PM: Could not ioremap GIC base\n");
+               return ret;
+       }
+
        pm_sram = pm_ops->get_sram_addrs();
        if (!pm_sram) {
                dev_err(dev, "PM: Cannot get PM asm function addresses!!\n");
                return -ENODEV;
        }
 
+       m3_ipc = wkup_m3_ipc_get();
+       if (!m3_ipc) {
+               pr_err("PM: Cannot get wkup_m3_ipc handle\n");
+               return -EPROBE_DEFER;
+       }
+
        pm33xx_dev = dev;
 
        ret = am33xx_pm_alloc_sram();
        if (ret)
                return ret;
 
-       ret = am33xx_push_sram_idle();
+       ret = am33xx_pm_rtc_setup();
        if (ret)
                goto err_free_sram;
 
-       m3_ipc = wkup_m3_ipc_get();
-       if (!m3_ipc) {
-               dev_dbg(dev, "PM: Cannot get wkup_m3_ipc handle\n");
-               ret = -EPROBE_DEFER;
+       ret = am33xx_push_sram_idle();
+       if (ret)
                goto err_free_sram;
-       }
 
        am33xx_pm_set_ipc_ops();
 
 #ifdef CONFIG_SUSPEND
        suspend_set_ops(&am33xx_pm_ops);
-#endif /* CONFIG_SUSPEND */
 
        /*
         * For a system suspend we must flush the caches, we want
@@ -323,6 +495,7 @@ static int am33xx_pm_probe(struct platform_device *pdev)
        suspend_wfi_flags |= WFI_FLAG_SELF_REFRESH;
        suspend_wfi_flags |= WFI_FLAG_SAVE_EMIF;
        suspend_wfi_flags |= WFI_FLAG_WAKE_M3;
+#endif /* CONFIG_SUSPEND */
 
        ret = pm_ops->init();
        if (ret) {
diff --git a/drivers/soc/ti/ti_sci_inta_msi.c b/drivers/soc/ti/ti_sci_inta_msi.c
new file mode 100644 (file)
index 0000000..0eb9462
--- /dev/null
@@ -0,0 +1,146 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Texas Instruments' K3 Interrupt Aggregator MSI bus
+ *
+ * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
+ *     Lokesh Vutla <lokeshvutla@ti.com>
+ */
+
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/msi.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/soc/ti/ti_sci_inta_msi.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+static void ti_sci_inta_msi_write_msg(struct irq_data *data,
+                                     struct msi_msg *msg)
+{
+       /* Nothing to do */
+}
+
+static void ti_sci_inta_msi_compose_msi_msg(struct irq_data *data,
+                                           struct msi_msg *msg)
+{
+       /* Nothing to do */
+}
+
+static void ti_sci_inta_msi_update_chip_ops(struct msi_domain_info *info)
+{
+       struct irq_chip *chip = info->chip;
+
+       if (WARN_ON(!chip))
+               return;
+
+       chip->irq_request_resources = irq_chip_request_resources_parent;
+       chip->irq_release_resources = irq_chip_release_resources_parent;
+       chip->irq_compose_msi_msg = ti_sci_inta_msi_compose_msi_msg;
+       chip->irq_write_msi_msg = ti_sci_inta_msi_write_msg;
+       chip->irq_set_type = irq_chip_set_type_parent;
+       chip->irq_unmask = irq_chip_unmask_parent;
+       chip->irq_mask = irq_chip_mask_parent;
+       chip->irq_ack = irq_chip_ack_parent;
+}
+
+struct irq_domain *ti_sci_inta_msi_create_irq_domain(struct fwnode_handle *fwnode,
+                                                    struct msi_domain_info *info,
+                                                    struct irq_domain *parent)
+{
+       struct irq_domain *domain;
+
+       ti_sci_inta_msi_update_chip_ops(info);
+
+       domain = msi_create_irq_domain(fwnode, info, parent);
+       if (domain)
+               irq_domain_update_bus_token(domain, DOMAIN_BUS_TI_SCI_INTA_MSI);
+
+       return domain;
+}
+EXPORT_SYMBOL_GPL(ti_sci_inta_msi_create_irq_domain);
+
+static void ti_sci_inta_msi_free_descs(struct device *dev)
+{
+       struct msi_desc *desc, *tmp;
+
+       list_for_each_entry_safe(desc, tmp, dev_to_msi_list(dev), list) {
+               list_del(&desc->list);
+               free_msi_entry(desc);
+       }
+}
+
+static int ti_sci_inta_msi_alloc_descs(struct device *dev,
+                                      struct ti_sci_resource *res)
+{
+       struct msi_desc *msi_desc;
+       int set, i, count = 0;
+
+       for (set = 0; set < res->sets; set++) {
+               for (i = 0; i < res->desc[set].num; i++) {
+                       msi_desc = alloc_msi_entry(dev, 1, NULL);
+                       if (!msi_desc) {
+                               ti_sci_inta_msi_free_descs(dev);
+                               return -ENOMEM;
+                       }
+
+                       msi_desc->inta.dev_index = res->desc[set].start + i;
+                       INIT_LIST_HEAD(&msi_desc->list);
+                       list_add_tail(&msi_desc->list, dev_to_msi_list(dev));
+                       count++;
+               }
+       }
+
+       return count;
+}
+
+int ti_sci_inta_msi_domain_alloc_irqs(struct device *dev,
+                                     struct ti_sci_resource *res)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       struct irq_domain *msi_domain;
+       int ret, nvec;
+
+       msi_domain = dev_get_msi_domain(dev);
+       if (!msi_domain)
+               return -EINVAL;
+
+       if (pdev->id < 0)
+               return -ENODEV;
+
+       nvec = ti_sci_inta_msi_alloc_descs(dev, res);
+       if (nvec <= 0)
+               return nvec;
+
+       ret = msi_domain_alloc_irqs(msi_domain, dev, nvec);
+       if (ret) {
+               dev_err(dev, "Failed to allocate IRQs %d\n", ret);
+               goto cleanup;
+       }
+
+       return 0;
+
+cleanup:
+       ti_sci_inta_msi_free_descs(&pdev->dev);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(ti_sci_inta_msi_domain_alloc_irqs);
+
+void ti_sci_inta_msi_domain_free_irqs(struct device *dev)
+{
+       msi_domain_free_irqs(dev->msi_domain, dev);
+       ti_sci_inta_msi_free_descs(dev);
+}
+EXPORT_SYMBOL_GPL(ti_sci_inta_msi_domain_free_irqs);
+
+unsigned int ti_sci_inta_msi_get_virq(struct device *dev, u32 dev_index)
+{
+       struct msi_desc *desc;
+
+       for_each_msi_entry(desc, dev)
+               if (desc->inta.dev_index == dev_index)
+                       return desc->irq;
+
+       return -ENODEV;
+}
+EXPORT_SYMBOL_GPL(ti_sci_inta_msi_get_virq);
index 025a44a..0e04272 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config UX500_SOC_ID
        bool "SoC bus for ST-Ericsson ux500"
        depends on ARCH_U8500 || COMPILE_TEST
index 0b87ad0..f164539 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_UX500_SOC_ID) += ux500-soc-id.o
index a928a7f..c3792c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ARM Versatile SoC drivers
 #
index cf612fe..1e0a37c 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SOC_INTEGRATOR_CM)        += soc-integrator.o
 obj-$(CONFIG_SOC_REALVIEW)     += soc-realview.o
index 354d256..600f57c 100644 (file)
@@ -23,6 +23,8 @@
 /* Flag stating if PM nodes mapped to the PM domain has been requested */
 #define ZYNQMP_PM_DOMAIN_REQUESTED     BIT(0)
 
+static const struct zynqmp_eemi_ops *eemi_ops;
+
 /**
  * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain
  * @gpd:               Generic power domain
@@ -71,9 +73,8 @@ static int zynqmp_gpd_power_on(struct generic_pm_domain *domain)
 {
        int ret;
        struct zynqmp_pm_domain *pd;
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 
-       if (!eemi_ops || !eemi_ops->set_requirement)
+       if (!eemi_ops->set_requirement)
                return -ENXIO;
 
        pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -107,9 +108,8 @@ static int zynqmp_gpd_power_off(struct generic_pm_domain *domain)
        struct zynqmp_pm_domain *pd;
        u32 capabilities = 0;
        bool may_wakeup;
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 
-       if (!eemi_ops || !eemi_ops->set_requirement)
+       if (!eemi_ops->set_requirement)
                return -ENXIO;
 
        pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -160,9 +160,8 @@ static int zynqmp_gpd_attach_dev(struct generic_pm_domain *domain,
 {
        int ret;
        struct zynqmp_pm_domain *pd;
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 
-       if (!eemi_ops || !eemi_ops->request_node)
+       if (!eemi_ops->request_node)
                return -ENXIO;
 
        pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -197,9 +196,8 @@ static void zynqmp_gpd_detach_dev(struct generic_pm_domain *domain,
 {
        int ret;
        struct zynqmp_pm_domain *pd;
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 
-       if (!eemi_ops || !eemi_ops->release_node)
+       if (!eemi_ops->release_node)
                return;
 
        pd = container_of(domain, struct zynqmp_pm_domain, gpd);
@@ -266,6 +264,10 @@ static int zynqmp_gpd_probe(struct platform_device *pdev)
        struct zynqmp_pm_domain *pd;
        struct device *dev = &pdev->dev;
 
+       eemi_ops = zynqmp_pm_get_eemi_ops();
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
+
        pd = devm_kcalloc(dev, ZYNQMP_NUM_DOMAINS, sizeof(*pd), GFP_KERNEL);
        if (!pd)
                return -ENOMEM;
index 771cb59..1b9d144 100644 (file)
@@ -31,6 +31,7 @@ static const char *const suspend_modes[] = {
 };
 
 static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD;
+static const struct zynqmp_eemi_ops *eemi_ops;
 
 enum pm_api_cb_id {
        PM_INIT_SUSPEND_CB = 30,
@@ -92,9 +93,8 @@ static ssize_t suspend_mode_store(struct device *dev,
                                  const char *buf, size_t count)
 {
        int md, ret = -EINVAL;
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 
-       if (!eemi_ops || !eemi_ops->set_suspend_mode)
+       if (!eemi_ops->set_suspend_mode)
                return ret;
 
        for (md = PM_SUSPEND_MODE_FIRST; md < ARRAY_SIZE(suspend_modes); md++)
@@ -120,9 +120,11 @@ static int zynqmp_pm_probe(struct platform_device *pdev)
        int ret, irq;
        u32 pm_api_version;
 
-       const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
+       eemi_ops = zynqmp_pm_get_eemi_ops();
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
 
-       if (!eemi_ops || !eemi_ops->get_api_version || !eemi_ops->init_finalize)
+       if (!eemi_ops->get_api_version || !eemi_ops->init_finalize)
                return -ENXIO;
 
        eemi_ops->init_finalize();
index e9d750c..1cf1938 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ZTE SoC drivers
 #
index 96b7cd4..728c677 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ZTE SOC drivers
 #
index 53b55b7..3a01cfd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SoundWire subsystem configuration
 #
index 5817bea..fd99a83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for soundwire core
 #
index 0fba8f4..30a4028 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SPI driver configuration
 #
index 8779377..d12e149 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Cavium ThunderX SPI driver.
  *
index 702fe57..cc49fa4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * J-Core SPI controller driver
  *
index d456c52..f236e30 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * CE4100's SPI device is more or less the same one as found on PXA
  *
index 3912526..cdb613d 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <linux/clk.h>
 #include <linux/dmaengine.h>
+#include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
index f009d76..71b882a 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SPI bus driver for CSR SiRFprimaII
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index 9f83e1b..9850a0e 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
+#include <linux/firmware/xlnx-zynqmp.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
 
 #define SPI_AUTOSUSPEND_TIMEOUT                3000
 enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA};
+static const struct zynqmp_eemi_ops *eemi_ops;
 
 /**
  * struct zynqmp_qspi - Defines qspi driver instance
@@ -1021,6 +1023,10 @@ static int zynqmp_qspi_probe(struct platform_device *pdev)
        struct resource *res;
        struct device *dev = &pdev->dev;
 
+       eemi_ops = zynqmp_pm_get_eemi_ops();
+       if (IS_ERR(eemi_ops))
+               return PTR_ERR(eemi_ops);
+
        master = spi_alloc_master(&pdev->dev, sizeof(*xqspi));
        if (!master)
                return -ENOMEM;
index d48ed7c..a53bad5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SPMI driver configuration
 #
index fc75104..55a94ca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for kernel SPMI framework.
 #
index df30e13..34fa19d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SSB_POSSIBLE
        bool
        depends on HAS_IOMEM && HAS_DMA
index e5e28e5..b0b865a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig FIELDBUS_DEV
        tristate "Fieldbus Device Support"
        help
index 41f241c..8bc3d9a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HMS_ANYBUSS_BUS
        tristate "HMS Anybus-S Bus Support"
        select REGMAP
index 1ba4a51..64037b0 100644 (file)
@@ -1266,7 +1266,7 @@ static int prp_registered(struct v4l2_subdev *sd)
        if (ret)
                return ret;
 
-       ret = imx_media_capture_device_register(priv->vdev);
+       ret = imx_media_capture_device_register(priv->md, priv->vdev);
        if (ret)
                return ret;
 
index b7ce9d4..9430c83 100644 (file)
@@ -701,7 +701,8 @@ void imx_media_capture_device_error(struct imx_media_video_dev *vdev)
 }
 EXPORT_SYMBOL_GPL(imx_media_capture_device_error);
 
-int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
+int imx_media_capture_device_register(struct imx_media_dev *md,
+                                     struct imx_media_video_dev *vdev)
 {
        struct capture_priv *priv = to_capture_priv(vdev);
        struct v4l2_subdev *sd = priv->src_sd;
@@ -710,8 +711,7 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
        struct v4l2_subdev_format fmt_src;
        int ret;
 
-       /* get media device */
-       priv->md = dev_get_drvdata(sd->v4l2_dev->dev);
+       priv->md = md;
 
        vfd->v4l2_dev = sd->v4l2_dev;
 
index 28fe660..1d248ac 100644 (file)
@@ -1812,7 +1812,7 @@ static int csi_registered(struct v4l2_subdev *sd)
        if (ret)
                goto free_fim;
 
-       ret = imx_media_capture_device_register(priv->vdev);
+       ret = imx_media_capture_device_register(priv->md, priv->vdev);
        if (ret)
                goto free_fim;
 
index eb59ba0..6587aa4 100644 (file)
@@ -268,7 +268,8 @@ int imx_media_of_add_csi(struct imx_media_dev *imxmd,
 struct imx_media_video_dev *
 imx_media_capture_device_init(struct v4l2_subdev *src_sd, int pad);
 void imx_media_capture_device_remove(struct imx_media_video_dev *vdev);
-int imx_media_capture_device_register(struct imx_media_video_dev *vdev);
+int imx_media_capture_device_register(struct imx_media_dev *md,
+                                     struct imx_media_video_dev *vdev);
 void imx_media_capture_device_unregister(struct imx_media_video_dev *vdev);
 struct imx_media_buffer *
 imx_media_capture_device_next_buf(struct imx_media_video_dev *vdev);
index 18eb5d3..a708a03 100644 (file)
@@ -1126,7 +1126,7 @@ static int imx7_csi_registered(struct v4l2_subdev *sd)
        if (ret < 0)
                return ret;
 
-       ret = imx_media_capture_device_register(csi->vdev);
+       ret = imx_media_capture_device_register(csi->imxmd, csi->vdev);
        if (ret < 0)
                return ret;
 
index 58721c4..8bbc905 100644 (file)
@@ -352,7 +352,7 @@ static int rockchip_vpu_video_device_register(struct rockchip_vpu_dev *vpu)
        vpu->vfd_enc = vfd;
        video_set_drvdata(vfd, vpu);
 
-       ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
+       ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
        if (ret) {
                v4l2_err(&vpu->v4l2_dev, "Failed to register video device\n");
                goto err_free_dev;
@@ -463,6 +463,8 @@ static int rockchip_vpu_probe(struct platform_device *pdev)
 
        vpu->mdev.dev = vpu->dev;
        strscpy(vpu->mdev.model, DRIVER_NAME, sizeof(vpu->mdev.model));
+       strscpy(vpu->mdev.bus_info, "platform: " DRIVER_NAME,
+               sizeof(vpu->mdev.model));
        media_device_init(&vpu->mdev);
        vpu->v4l2_dev.mdev = &vpu->mdev;
 
@@ -480,15 +482,18 @@ static int rockchip_vpu_probe(struct platform_device *pdev)
        return 0;
 err_video_dev_unreg:
        if (vpu->vfd_enc) {
+               v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
                video_unregister_device(vpu->vfd_enc);
                video_device_release(vpu->vfd_enc);
        }
 err_m2m_rel:
+       media_device_cleanup(&vpu->mdev);
        v4l2_m2m_release(vpu->m2m_dev);
 err_v4l2_unreg:
        v4l2_device_unregister(&vpu->v4l2_dev);
 err_clk_unprepare:
        clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
+       pm_runtime_dont_use_autosuspend(vpu->dev);
        pm_runtime_disable(vpu->dev);
        return ret;
 }
@@ -500,15 +505,16 @@ static int rockchip_vpu_remove(struct platform_device *pdev)
        v4l2_info(&vpu->v4l2_dev, "Removing %s\n", pdev->name);
 
        media_device_unregister(&vpu->mdev);
-       v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
-       v4l2_m2m_release(vpu->m2m_dev);
-       media_device_cleanup(&vpu->mdev);
        if (vpu->vfd_enc) {
+               v4l2_m2m_unregister_media_controller(vpu->m2m_dev);
                video_unregister_device(vpu->vfd_enc);
                video_device_release(vpu->vfd_enc);
        }
+       media_device_cleanup(&vpu->mdev);
+       v4l2_m2m_release(vpu->m2m_dev);
        v4l2_device_unregister(&vpu->v4l2_dev);
        clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
+       pm_runtime_dont_use_autosuspend(vpu->dev);
        pm_runtime_disable(vpu->dev);
        return 0;
 }
index fb5e36a..dcbfc3c 100644 (file)
@@ -152,9 +152,10 @@ static int vidioc_querycap(struct file *file, void *priv,
                           struct v4l2_capability *cap)
 {
        struct rockchip_vpu_dev *vpu = video_drvdata(file);
+       struct video_device *vdev = video_devdata(file);
 
        strscpy(cap->driver, vpu->dev->driver->name, sizeof(cap->driver));
-       strscpy(cap->card, vpu->vfd_enc->name, sizeof(cap->card));
+       strscpy(cap->card, vdev->name, sizeof(cap->card));
        snprintf(cap->bus_info, sizeof(cap->bus_info), "platform: %s",
                 vpu->dev->driver->name);
        return 0;
index cb6f32c..c163b14 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig TARGET_CORE
        tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
index bbdbf9c..1f93ea3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ISCSI_TARGET
        tristate "Linux-iSCSI.org iSCSI Target Mode Stack"
        depends on NET
index bc6c1d5..8686dbd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ISCSI_TARGET_CXGB4
        tristate "Chelsio iSCSI target offload driver"
        depends on ISCSI_TARGET && CHELSIO_T4 && INET
index d16aaae..0dcaf20 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4
-ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb
-ccflags-y += -Idrivers/target/iscsi
+ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4
+ccflags-y += -I $(srctree)/drivers/net/ethernet/chelsio/libcxgb
+ccflags-y += -I $(srctree)/drivers/target/iscsi
 
 obj-$(CONFIG_ISCSI_TARGET_CXGB4)  += cxgbit.o
 
index 158ee9d..f40f316 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LOOPBACK_TARGET
        tristate "TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module"
        depends on SCSI
index 6abebdf..336bd44 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_LOOPBACK_TARGET)  += tcm_loop.o
index 1614bc7..53a1c75 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SBP_TARGET
        tristate "FireWire SBP-2 fabric module"
        depends on FIREWIRE
index 27747ad..766f236 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SBP_TARGET) += sbp_target.o
index 40caf45..4f3b926 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TCM_FC
        tristate "TCM_FC fabric Plugin"
        depends on LIBFC
index 623b210..6cccaf1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel.
 #
index a6df12d..676ffcb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Generic Trusted Execution Environment Configuration
 config TEE
        tristate "Trusted Execution Environment support"
index 3c59e19..d1ad512 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # OP-TEE Trusted Execution Environment Configuration
 config OPTEE
        tristate "OP-TEE"
index 0842b6e..48963ea 100644 (file)
@@ -419,9 +419,35 @@ static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn,
        return true;
 }
 
+static struct tee_shm_pool *optee_config_dyn_shm(void)
+{
+       struct tee_shm_pool_mgr *priv_mgr;
+       struct tee_shm_pool_mgr *dmabuf_mgr;
+       void *rc;
+
+       rc = optee_shm_pool_alloc_pages();
+       if (IS_ERR(rc))
+               return rc;
+       priv_mgr = rc;
+
+       rc = optee_shm_pool_alloc_pages();
+       if (IS_ERR(rc)) {
+               tee_shm_pool_mgr_destroy(priv_mgr);
+               return rc;
+       }
+       dmabuf_mgr = rc;
+
+       rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr);
+       if (IS_ERR(rc)) {
+               tee_shm_pool_mgr_destroy(priv_mgr);
+               tee_shm_pool_mgr_destroy(dmabuf_mgr);
+       }
+
+       return rc;
+}
+
 static struct tee_shm_pool *
-optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm,
-                         u32 sec_caps)
+optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm)
 {
        union {
                struct arm_smccc_res smccc;
@@ -436,10 +462,11 @@ optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm,
        struct tee_shm_pool_mgr *priv_mgr;
        struct tee_shm_pool_mgr *dmabuf_mgr;
        void *rc;
+       const int sz = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
 
        invoke_fn(OPTEE_SMC_GET_SHM_CONFIG, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
        if (res.result.status != OPTEE_SMC_RETURN_OK) {
-               pr_info("shm service not available\n");
+               pr_err("static shm service not available\n");
                return ERR_PTR(-ENOENT);
        }
 
@@ -465,28 +492,15 @@ optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm,
        }
        vaddr = (unsigned long)va;
 
-       /*
-        * If OP-TEE can work with unregistered SHM, we will use own pool
-        * for private shm
-        */
-       if (sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) {
-               rc = optee_shm_pool_alloc_pages();
-               if (IS_ERR(rc))
-                       goto err_memunmap;
-               priv_mgr = rc;
-       } else {
-               const size_t sz = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
-
-               rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, sz,
-                                                   3 /* 8 bytes aligned */);
-               if (IS_ERR(rc))
-                       goto err_memunmap;
-               priv_mgr = rc;
-
-               vaddr += sz;
-               paddr += sz;
-               size -= sz;
-       }
+       rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, sz,
+                                           3 /* 8 bytes aligned */);
+       if (IS_ERR(rc))
+               goto err_memunmap;
+       priv_mgr = rc;
+
+       vaddr += sz;
+       paddr += sz;
+       size -= sz;
 
        rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, size, PAGE_SHIFT);
        if (IS_ERR(rc))
@@ -552,7 +566,7 @@ static optee_invoke_fn *get_invoke_func(struct device_node *np)
 static struct optee *optee_probe(struct device_node *np)
 {
        optee_invoke_fn *invoke_fn;
-       struct tee_shm_pool *pool;
+       struct tee_shm_pool *pool = ERR_PTR(-EINVAL);
        struct optee *optee = NULL;
        void *memremaped_shm = NULL;
        struct tee_device *teedev;
@@ -581,13 +595,17 @@ static struct optee *optee_probe(struct device_node *np)
        }
 
        /*
-        * We have no other option for shared memory, if secure world
-        * doesn't have any reserved memory we can use we can't continue.
+        * Try to use dynamic shared memory if possible
         */
-       if (!(sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM))
-               return ERR_PTR(-EINVAL);
+       if (sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
+               pool = optee_config_dyn_shm();
+
+       /*
+        * If dynamic shared memory is not available or failed - try static one
+        */
+       if (IS_ERR(pool) && (sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM))
+               pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm);
 
-       pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm, sec_caps);
        if (IS_ERR(pool))
                return (void *)pool;
 
index 653aa27..9966364 100644 (file)
@@ -1,9 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Generic thermal sysfs drivers configuration
 #
 
 menuconfig THERMAL
-       tristate "Generic Thermal sysfs driver"
+       bool "Generic Thermal sysfs driver"
        help
          Generic Thermal Sysfs driver offers a generic mechanism for
          thermal management. Usually it's made up of one or more thermal
@@ -11,7 +12,7 @@ menuconfig THERMAL
          Each thermal zone contains its own temperature, trip points,
          cooling devices.
          All platforms with ACPI thermal support can use this driver.
-         If you want this support, you should say Y or M here.
+         If you want this support, you should say Y here.
 
 if THERMAL
 
@@ -24,7 +25,6 @@ config THERMAL_STATISTICS
 
 config THERMAL_EMERGENCY_POWEROFF_DELAY_MS
        int "Emergency poweroff delay in milli-seconds"
-       depends on THERMAL
        default 0
        help
          Thermal subsystem will issue a graceful shutdown when
@@ -149,10 +149,9 @@ config THERMAL_GOV_POWER_ALLOCATOR
          allocating and limiting power to devices.
 
 config CPU_THERMAL
-       bool "generic cpu cooling support"
+       bool "Generic cpu cooling support"
        depends on CPU_FREQ
        depends on THERMAL_OF
-       depends on THERMAL=y
        help
          This implements the generic cpu cooling mechanism through frequency
          reduction. An ACPI version of this already exists
@@ -200,6 +199,17 @@ config THERMAL_EMULATION
          because userland can easily disable the thermal policy by simply
          flooding this sysfs node with low temperature values.
 
+config THERMAL_MMIO
+       tristate "Generic Thermal MMIO driver"
+       depends on OF || COMPILE_TEST
+       depends on HAS_IOMEM
+       help
+         This option enables the generic thermal MMIO driver that will use
+         memory-mapped reads to get the temperature.  Any HW/System that
+         allows temperature reading by a single memory-mapped reading, be it
+         register or shared memory, is a potential candidate to work with this
+         driver.
+
 config HISI_THERMAL
        tristate "Hisilicon thermal driver"
        depends on ARCH_HISI || COMPILE_TEST
index 486d682..74a37c7 100644 (file)
@@ -29,6 +29,7 @@ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
 
 # platform thermal drivers
 obj-y                          += broadcom/
+obj-$(CONFIG_THERMAL_MMIO)             += thermal_mmio.o
 obj-$(CONFIG_SPEAR_THERMAL)    += spear_thermal.o
 obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
 obj-$(CONFIG_RCAR_THERMAL)     += rcar_thermal.o
index dc9a9bd..cf43e15 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BCM2835_THERMAL
        tristate "Thermal sensors on bcm2835 SoC"
        depends on ARCH_BCM2835 || COMPILE_TEST
index 79df69e..490ab1f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BCM2835_THERMAL)          += bcm2835_thermal.o
 obj-$(CONFIG_BRCMSTB_THERMAL)          += brcmstb_thermal.o
 obj-$(CONFIG_BCM_NS_THERMAL)           += ns-thermal.o
index 2284cbe..475ce29 100644 (file)
@@ -3,7 +3,6 @@
  * Copyright (C) 2018 Broadcom
  */
 
-#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
@@ -100,18 +99,11 @@ static const struct of_device_id sr_thermal_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sr_thermal_of_match);
 
-static const struct acpi_device_id sr_thermal_acpi_ids[] = {
-       { .id = "BRCM0500" },
-       { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(acpi, sr_thermal_acpi_ids);
-
 static struct platform_driver sr_thermal_driver = {
        .probe          = sr_thermal_probe,
        .driver = {
                .name = "sr-thermal",
                .of_match_table = sr_thermal_of_match,
-               .acpi_match_table = ACPI_PTR(sr_thermal_acpi_ids),
        },
 };
 module_platform_driver(sr_thermal_driver);
index f7c1f49..4c5db59 100644 (file)
@@ -1,26 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *  linux/drivers/thermal/cpu_cooling.c
  *
  *  Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
- *  Copyright (C) 2012  Amit Daniel <amit.kachhap@linaro.org>
  *
- *  Copyright (C) 2014  Viresh Kumar <viresh.kumar@linaro.org>
+ *  Copyright (C) 2012-2018 Linaro Limited.
  *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; version 2 of the License.
+ *  Authors:   Amit Daniel <amit.kachhap@linaro.org>
+ *             Viresh Kumar <viresh.kumar@linaro.org>
  *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 #include <linux/module.h>
 #include <linux/thermal.h>
@@ -99,7 +87,6 @@ struct cpufreq_cooling_device {
        unsigned int clipped_freq;
        unsigned int max_level;
        struct freq_table *freq_table;  /* In descending order */
-       struct thermal_cooling_device *cdev;
        struct cpufreq_policy *policy;
        struct list_head node;
        struct time_in_idle *idle_time;
@@ -207,8 +194,7 @@ static int update_freq_table(struct cpufreq_cooling_device *cpufreq_cdev,
 
        dev = get_cpu_device(cpu);
        if (unlikely(!dev)) {
-               dev_warn(&cpufreq_cdev->cdev->device,
-                        "No cpu device for cpu %d\n", cpu);
+               pr_warn("No cpu device for cpu %d\n", cpu);
                return -ENODEV;
        }
 
@@ -458,7 +444,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
                        load = 0;
 
                total_load += load;
-               if (trace_thermal_power_cpu_limit_enabled() && load_cpu)
+               if (load_cpu)
                        load_cpu[i] = load;
 
                i++;
@@ -541,7 +527,6 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev,
        struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
        struct cpufreq_policy *policy = cpufreq_cdev->policy;
 
-       power = power > 0 ? power : 0;
        last_load = cpufreq_cdev->last_load ?: 1;
        normalised_power = (power * 100) / last_load;
        target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power);
@@ -692,7 +677,6 @@ __cpufreq_cooling_register(struct device_node *np,
                goto remove_ida;
 
        cpufreq_cdev->clipped_freq = cpufreq_cdev->freq_table[0].frequency;
-       cpufreq_cdev->cdev = cdev;
 
        mutex_lock(&cooling_list_lock);
        /* Register the notifier for first cpufreq cooling device */
@@ -810,7 +794,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
                cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,
                                            CPUFREQ_POLICY_NOTIFIER);
 
-       thermal_cooling_device_unregister(cpufreq_cdev->cdev);
+       thermal_cooling_device_unregister(cdev);
        ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
        kfree(cpufreq_cdev->idle_time);
        kfree(cpufreq_cdev->freq_table);
index 2e013ee..8025b21 100644 (file)
@@ -1,6 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INTEL_POWERCLAMP
        tristate "Intel PowerClamp idle injection driver"
-       depends on THERMAL
        depends on X86
        depends on CPU_SUP_INTEL
        help
index 0ca908d..5333e01 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # ACPI INT340x thermal drivers configuration
 #
index 0c19fcd..79a7df2 100644 (file)
@@ -220,6 +220,7 @@ static int int3403_add(struct platform_device *pdev)
 {
        struct int3403_priv *priv;
        int result = 0;
+       unsigned long long tmp;
        acpi_status status;
 
        priv = devm_kzalloc(&pdev->dev, sizeof(struct int3403_priv),
@@ -234,19 +235,18 @@ static int int3403_add(struct platform_device *pdev)
                goto err;
        }
 
-       status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
-                                      NULL, &priv->type);
-       if (ACPI_FAILURE(status)) {
-               unsigned long long tmp;
 
-               status = acpi_evaluate_integer(priv->adev->handle, "_TMP",
-                                              NULL, &tmp);
+       status = acpi_evaluate_integer(priv->adev->handle, "_TMP",
+                                      NULL, &tmp);
+       if (ACPI_FAILURE(status)) {
+               status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
+                                      NULL, &priv->type);
                if (ACPI_FAILURE(status)) {
                        result = -EINVAL;
                        goto err;
-               } else {
-                       priv->type = INT3403_TYPE_SENSOR;
                }
+       } else {
+               priv->type = INT3403_TYPE_SENSOR;
        }
 
        platform_set_drvdata(pdev, priv);
index 8e1cf4d..2e6071a 100644 (file)
@@ -81,22 +81,13 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \
                                        struct device_attribute *attr, \
                                        char *buf) \
 { \
-       struct pci_dev *pci_dev; \
-       struct platform_device *pdev; \
-       struct proc_thermal_device *proc_dev; \
+       struct proc_thermal_device *proc_dev = dev_get_drvdata(dev); \
        \
        if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \
                dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \
                return 0; \
        } \
        \
-       if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \
-               pdev = to_platform_device(dev); \
-               proc_dev = platform_get_drvdata(pdev); \
-       } else { \
-               pci_dev = to_pci_dev(dev); \
-               proc_dev = pci_get_drvdata(pci_dev); \
-       } \
        return sprintf(buf, "%lu\n",\
        (unsigned long)proc_dev->power_limits[index].suffix * 1000); \
 }
@@ -274,7 +265,7 @@ static void proc_thermal_notify(acpi_handle handle, u32 event, void *data)
                                THERMAL_DEVICE_POWER_CAPABILITY_CHANGED);
                break;
        default:
-               dev_err(proc_priv->dev, "Unsupported event [0x%x]\n", event);
+               dev_dbg(proc_priv->dev, "Unsupported event [0x%x]\n", event);
                break;
        }
 }
index 2df059c..dc5093b 100644 (file)
@@ -5,6 +5,9 @@
  *  Copyright (C) 2013 Texas Instruments
  *  Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com>
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/thermal.h>
 #include <linux/slab.h>
 #include <linux/types.h>
index cdb455f..aa9c1d8 100644 (file)
@@ -1,6 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QCOM_TSENS
        tristate "Qualcomm TSENS Temperature Alarm"
-       depends on THERMAL
        depends on QCOM_QFPROM
        depends on ARCH_QCOM || COMPILE_TEST
        help
index 717a086..7c8dc6e 100644 (file)
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QCOM_TSENS)       += qcom_tsens.o
-qcom_tsens-y                   += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o
+
+qcom_tsens-y                   += tsens.o tsens-common.o tsens-v0_1.o \
+                                  tsens-8960.o tsens-v2.o tsens-v1.o
 obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM)     += qcom-spmi-temp-alarm.o
diff --git a/drivers/thermal/qcom/tsens-8916.c b/drivers/thermal/qcom/tsens-8916.c
deleted file mode 100644 (file)
index c6dd620..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2015, The Linux Foundation. All rights reserved.
- */
-
-#include <linux/platform_device.h>
-#include "tsens.h"
-
-/* eeprom layout data for 8916 */
-#define BASE0_MASK     0x0000007f
-#define BASE1_MASK     0xfe000000
-#define BASE0_SHIFT    0
-#define BASE1_SHIFT    25
-
-#define S0_P1_MASK     0x00000f80
-#define S1_P1_MASK     0x003e0000
-#define S2_P1_MASK     0xf8000000
-#define S3_P1_MASK     0x000003e0
-#define S4_P1_MASK     0x000f8000
-
-#define S0_P2_MASK     0x0001f000
-#define S1_P2_MASK     0x07c00000
-#define S2_P2_MASK     0x0000001f
-#define S3_P2_MASK     0x00007c00
-#define S4_P2_MASK     0x01f00000
-
-#define S0_P1_SHIFT    7
-#define S1_P1_SHIFT    17
-#define S2_P1_SHIFT    27
-#define S3_P1_SHIFT    5
-#define S4_P1_SHIFT    15
-
-#define S0_P2_SHIFT    12
-#define S1_P2_SHIFT    22
-#define S2_P2_SHIFT    0
-#define S3_P2_SHIFT    10
-#define S4_P2_SHIFT    20
-
-#define CAL_SEL_MASK   0xe0000000
-#define CAL_SEL_SHIFT  29
-
-static int calibrate_8916(struct tsens_device *tmdev)
-{
-       int base0 = 0, base1 = 0, i;
-       u32 p1[5], p2[5];
-       int mode = 0;
-       u32 *qfprom_cdata, *qfprom_csel;
-
-       qfprom_cdata = (u32 *)qfprom_read(tmdev->dev, "calib");
-       if (IS_ERR(qfprom_cdata))
-               return PTR_ERR(qfprom_cdata);
-
-       qfprom_csel = (u32 *)qfprom_read(tmdev->dev, "calib_sel");
-       if (IS_ERR(qfprom_csel))
-               return PTR_ERR(qfprom_csel);
-
-       mode = (qfprom_csel[0] & CAL_SEL_MASK) >> CAL_SEL_SHIFT;
-       dev_dbg(tmdev->dev, "calibration mode is %d\n", mode);
-
-       switch (mode) {
-       case TWO_PT_CALIB:
-               base1 = (qfprom_cdata[1] & BASE1_MASK) >> BASE1_SHIFT;
-               p2[0] = (qfprom_cdata[0] & S0_P2_MASK) >> S0_P2_SHIFT;
-               p2[1] = (qfprom_cdata[0] & S1_P2_MASK) >> S1_P2_SHIFT;
-               p2[2] = (qfprom_cdata[1] & S2_P2_MASK) >> S2_P2_SHIFT;
-               p2[3] = (qfprom_cdata[1] & S3_P2_MASK) >> S3_P2_SHIFT;
-               p2[4] = (qfprom_cdata[1] & S4_P2_MASK) >> S4_P2_SHIFT;
-               for (i = 0; i < tmdev->num_sensors; i++)
-                       p2[i] = ((base1 + p2[i]) << 3);
-               /* Fall through */
-       case ONE_PT_CALIB2:
-               base0 = (qfprom_cdata[0] & BASE0_MASK);
-               p1[0] = (qfprom_cdata[0] & S0_P1_MASK) >> S0_P1_SHIFT;
-               p1[1] = (qfprom_cdata[0] & S1_P1_MASK) >> S1_P1_SHIFT;
-               p1[2] = (qfprom_cdata[0] & S2_P1_MASK) >> S2_P1_SHIFT;
-               p1[3] = (qfprom_cdata[1] & S3_P1_MASK) >> S3_P1_SHIFT;
-               p1[4] = (qfprom_cdata[1] & S4_P1_MASK) >> S4_P1_SHIFT;
-               for (i = 0; i < tmdev->num_sensors; i++)
-                       p1[i] = (((base0) + p1[i]) << 3);
-               break;
-       default:
-               for (i = 0; i < tmdev->num_sensors; i++) {
-                       p1[i] = 500;
-                       p2[i] = 780;
-               }
-               break;
-       }
-
-       compute_intercept_slope(tmdev, p1, p2, mode);
-
-       return 0;
-}
-
-static const struct tsens_ops ops_8916 = {
-       .init           = init_common,
-       .calibrate      = calibrate_8916,
-       .get_temp       = get_temp_common,
-};
-
-const struct tsens_data data_8916 = {
-       .num_sensors    = 5,
-       .ops            = &ops_8916,
-       .reg_offsets    = { [SROT_CTRL_OFFSET] = 0x0 },
-       .hw_ids         = (unsigned int []){0, 1, 2, 4, 5 },
-};
index 0f0adb3..8d9b721 100644 (file)
 #define TRDY_MASK              BIT(7)
 #define TIMEOUT_US             100
 
-static int suspend_8960(struct tsens_device *tmdev)
+static int suspend_8960(struct tsens_priv *priv)
 {
        int ret;
        unsigned int mask;
-       struct regmap *map = tmdev->tm_map;
+       struct regmap *map = priv->tm_map;
 
-       ret = regmap_read(map, THRESHOLD_ADDR, &tmdev->ctx.threshold);
+       ret = regmap_read(map, THRESHOLD_ADDR, &priv->ctx.threshold);
        if (ret)
                return ret;
 
-       ret = regmap_read(map, CNTL_ADDR, &tmdev->ctx.control);
+       ret = regmap_read(map, CNTL_ADDR, &priv->ctx.control);
        if (ret)
                return ret;
 
-       if (tmdev->num_sensors > 1)
+       if (priv->num_sensors > 1)
                mask = SLP_CLK_ENA | EN;
        else
                mask = SLP_CLK_ENA_8660 | EN;
@@ -82,10 +82,10 @@ static int suspend_8960(struct tsens_device *tmdev)
        return 0;
 }
 
-static int resume_8960(struct tsens_device *tmdev)
+static int resume_8960(struct tsens_priv *priv)
 {
        int ret;
-       struct regmap *map = tmdev->tm_map;
+       struct regmap *map = priv->tm_map;
 
        ret = regmap_update_bits(map, CNTL_ADDR, SW_RST, SW_RST);
        if (ret)
@@ -95,80 +95,80 @@ static int resume_8960(struct tsens_device *tmdev)
         * Separate CONFIG restore is not needed only for 8660 as
         * config is part of CTRL Addr and its restored as such
         */
-       if (tmdev->num_sensors > 1) {
+       if (priv->num_sensors > 1) {
                ret = regmap_update_bits(map, CONFIG_ADDR, CONFIG_MASK, CONFIG);
                if (ret)
                        return ret;
        }
 
-       ret = regmap_write(map, THRESHOLD_ADDR, tmdev->ctx.threshold);
+       ret = regmap_write(map, THRESHOLD_ADDR, priv->ctx.threshold);
        if (ret)
                return ret;
 
-       ret = regmap_write(map, CNTL_ADDR, tmdev->ctx.control);
+       ret = regmap_write(map, CNTL_ADDR, priv->ctx.control);
        if (ret)
                return ret;
 
        return 0;
 }
 
-static int enable_8960(struct tsens_device *tmdev, int id)
+static int enable_8960(struct tsens_priv *priv, int id)
 {
        int ret;
        u32 reg, mask;
 
-       ret = regmap_read(tmdev->tm_map, CNTL_ADDR, &reg);
+       ret = regmap_read(priv->tm_map, CNTL_ADDR, &reg);
        if (ret)
                return ret;
 
        mask = BIT(id + SENSOR0_SHIFT);
-       ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg | SW_RST);
+       ret = regmap_write(priv->tm_map, CNTL_ADDR, reg | SW_RST);
        if (ret)
                return ret;
 
-       if (tmdev->num_sensors > 1)
+       if (priv->num_sensors > 1)
                reg |= mask | SLP_CLK_ENA | EN;
        else
                reg |= mask | SLP_CLK_ENA_8660 | EN;
 
-       ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg);
+       ret = regmap_write(priv->tm_map, CNTL_ADDR, reg);
        if (ret)
                return ret;
 
        return 0;
 }
 
-static void disable_8960(struct tsens_device *tmdev)
+static void disable_8960(struct tsens_priv *priv)
 {
        int ret;
        u32 reg_cntl;
        u32 mask;
 
-       mask = GENMASK(tmdev->num_sensors - 1, 0);
+       mask = GENMASK(priv->num_sensors - 1, 0);
        mask <<= SENSOR0_SHIFT;
        mask |= EN;
 
-       ret = regmap_read(tmdev->tm_map, CNTL_ADDR, &reg_cntl);
+       ret = regmap_read(priv->tm_map, CNTL_ADDR, &reg_cntl);
        if (ret)
                return;
 
        reg_cntl &= ~mask;
 
-       if (tmdev->num_sensors > 1)
+       if (priv->num_sensors > 1)
                reg_cntl &= ~SLP_CLK_ENA;
        else
                reg_cntl &= ~SLP_CLK_ENA_8660;
 
-       regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl);
+       regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
 }
 
-static int init_8960(struct tsens_device *tmdev)
+static int init_8960(struct tsens_priv *priv)
 {
        int ret, i;
        u32 reg_cntl;
 
-       tmdev->tm_map = dev_get_regmap(tmdev->dev, NULL);
-       if (!tmdev->tm_map)
+       priv->tm_map = dev_get_regmap(priv->dev, NULL);
+       if (!priv->tm_map)
                return -ENODEV;
 
        /*
@@ -177,21 +177,21 @@ static int init_8960(struct tsens_device *tmdev)
         * but the control registers stay in the same place, i.e
         * directly after the first 5 status registers.
         */
-       for (i = 0; i < tmdev->num_sensors; i++) {
+       for (i = 0; i < priv->num_sensors; i++) {
                if (i >= 5)
-                       tmdev->sensor[i].status = S0_STATUS_ADDR + 40;
-               tmdev->sensor[i].status += i * 4;
+                       priv->sensor[i].status = S0_STATUS_ADDR + 40;
+               priv->sensor[i].status += i * 4;
        }
 
        reg_cntl = SW_RST;
-       ret = regmap_update_bits(tmdev->tm_map, CNTL_ADDR, SW_RST, reg_cntl);
+       ret = regmap_update_bits(priv->tm_map, CNTL_ADDR, SW_RST, reg_cntl);
        if (ret)
                return ret;
 
-       if (tmdev->num_sensors > 1) {
+       if (priv->num_sensors > 1) {
                reg_cntl |= SLP_CLK_ENA | (MEASURE_PERIOD << 18);
                reg_cntl &= ~SW_RST;
-               ret = regmap_update_bits(tmdev->tm_map, CONFIG_ADDR,
+               ret = regmap_update_bits(priv->tm_map, CONFIG_ADDR,
                                         CONFIG_MASK, CONFIG);
        } else {
                reg_cntl |= SLP_CLK_ENA_8660 | (MEASURE_PERIOD << 16);
@@ -199,30 +199,30 @@ static int init_8960(struct tsens_device *tmdev)
                reg_cntl |= CONFIG_8660 << CONFIG_SHIFT_8660;
        }
 
-       reg_cntl |= GENMASK(tmdev->num_sensors - 1, 0) << SENSOR0_SHIFT;
-       ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl);
+       reg_cntl |= GENMASK(priv->num_sensors - 1, 0) << SENSOR0_SHIFT;
+       ret = regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
        if (ret)
                return ret;
 
        reg_cntl |= EN;
-       ret = regmap_write(tmdev->tm_map, CNTL_ADDR, reg_cntl);
+       ret = regmap_write(priv->tm_map, CNTL_ADDR, reg_cntl);
        if (ret)
                return ret;
 
        return 0;
 }
 
-static int calibrate_8960(struct tsens_device *tmdev)
+static int calibrate_8960(struct tsens_priv *priv)
 {
        int i;
        char *data;
 
-       ssize_t num_read = tmdev->num_sensors;
-       struct tsens_sensor *s = tmdev->sensor;
+       ssize_t num_read = priv->num_sensors;
+       struct tsens_sensor *s = priv->sensor;
 
-       data = qfprom_read(tmdev->dev, "calib");
+       data = qfprom_read(priv->dev, "calib");
        if (IS_ERR(data))
-               data = qfprom_read(tmdev->dev, "calib_backup");
+               data = qfprom_read(priv->dev, "calib_backup");
        if (IS_ERR(data))
                return PTR_ERR(data);
 
@@ -243,21 +243,21 @@ static inline int code_to_mdegC(u32 adc_code, const struct tsens_sensor *s)
        return adc_code * slope + offset;
 }
 
-static int get_temp_8960(struct tsens_device *tmdev, int id, int *temp)
+static int get_temp_8960(struct tsens_priv *priv, int id, int *temp)
 {
        int ret;
        u32 code, trdy;
-       const struct tsens_sensor *s = &tmdev->sensor[id];
+       const struct tsens_sensor *s = &priv->sensor[id];
        unsigned long timeout;
 
        timeout = jiffies + usecs_to_jiffies(TIMEOUT_US);
        do {
-               ret = regmap_read(tmdev->tm_map, INT_STATUS_ADDR, &trdy);
+               ret = regmap_read(priv->tm_map, INT_STATUS_ADDR, &trdy);
                if (ret)
                        return ret;
                if (!(trdy & TRDY_MASK))
                        continue;
-               ret = regmap_read(tmdev->tm_map, s->status, &code);
+               ret = regmap_read(priv->tm_map, s->status, &code);
                if (ret)
                        return ret;
                *temp = code_to_mdegC(code, s);
@@ -277,7 +277,7 @@ static const struct tsens_ops ops_8960 = {
        .resume         = resume_8960,
 };
 
-const struct tsens_data data_8960 = {
+const struct tsens_plat_data data_8960 = {
        .num_sensors    = 11,
        .ops            = &ops_8960,
 };
index f80c73f..928e8e8 100644 (file)
 #include <linux/regmap.h>
 #include "tsens.h"
 
-/* SROT */
-#define TSENS_EN               BIT(0)
-
-/* TM */
-#define STATUS_OFFSET          0x30
-#define SN_ADDR_OFFSET         0x4
-#define SN_ST_TEMP_MASK                0x3ff
-#define CAL_DEGC_PT1           30
-#define CAL_DEGC_PT2           120
-#define SLOPE_FACTOR           1000
-#define SLOPE_DEFAULT          3200
-
 char *qfprom_read(struct device *dev, const char *cname)
 {
        struct nvmem_cell *cell;
@@ -46,18 +34,18 @@ char *qfprom_read(struct device *dev, const char *cname)
  * and offset values are derived from tz->tzp->slope and tz->tzp->offset
  * resp.
  */
-void compute_intercept_slope(struct tsens_device *tmdev, u32 *p1,
+void compute_intercept_slope(struct tsens_priv *priv, u32 *p1,
                             u32 *p2, u32 mode)
 {
        int i;
        int num, den;
 
-       for (i = 0; i < tmdev->num_sensors; i++) {
-               dev_dbg(tmdev->dev,
+       for (i = 0; i < priv->num_sensors; i++) {
+               dev_dbg(priv->dev,
                        "sensor%d - data_point1:%#x data_point2:%#x\n",
                        i, p1[i], p2[i]);
 
-               tmdev->sensor[i].slope = SLOPE_DEFAULT;
+               priv->sensor[i].slope = SLOPE_DEFAULT;
                if (mode == TWO_PT_CALIB) {
                        /*
                         * slope (m) = adc_code2 - adc_code1 (y2 - y1)/
@@ -66,16 +54,30 @@ void compute_intercept_slope(struct tsens_device *tmdev, u32 *p1,
                        num = p2[i] - p1[i];
                        num *= SLOPE_FACTOR;
                        den = CAL_DEGC_PT2 - CAL_DEGC_PT1;
-                       tmdev->sensor[i].slope = num / den;
+                       priv->sensor[i].slope = num / den;
                }
 
-               tmdev->sensor[i].offset = (p1[i] * SLOPE_FACTOR) -
+               priv->sensor[i].offset = (p1[i] * SLOPE_FACTOR) -
                                (CAL_DEGC_PT1 *
-                               tmdev->sensor[i].slope);
-               dev_dbg(tmdev->dev, "offset:%d\n", tmdev->sensor[i].offset);
+                               priv->sensor[i].slope);
+               dev_dbg(priv->dev, "offset:%d\n", priv->sensor[i].offset);
        }
 }
 
+bool is_sensor_enabled(struct tsens_priv *priv, u32 hw_id)
+{
+       u32 val;
+       int ret;
+
+       if ((hw_id > (priv->num_sensors - 1)) || (hw_id < 0))
+               return -EINVAL;
+       ret = regmap_field_read(priv->rf[SENSOR_EN], &val);
+       if (ret)
+               return ret;
+
+       return val & (1 << hw_id);
+}
+
 static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s)
 {
        int degc, num, den;
@@ -95,18 +97,54 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s)
        return degc;
 }
 
-int get_temp_common(struct tsens_device *tmdev, int id, int *temp)
+int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp)
 {
-       struct tsens_sensor *s = &tmdev->sensor[id];
-       u32 code;
-       unsigned int status_reg;
+       struct tsens_sensor *s = &priv->sensor[i];
+       u32 temp_idx = LAST_TEMP_0 + s->hw_id;
+       u32 valid_idx = VALID_0 + s->hw_id;
+       u32 last_temp = 0, valid, mask;
+       int ret;
+
+       ret = regmap_field_read(priv->rf[valid_idx], &valid);
+       if (ret)
+               return ret;
+       while (!valid) {
+               /* Valid bit is 0 for 6 AHB clock cycles.
+                * At 19.2MHz, 1 AHB clock is ~60ns.
+                * We should enter this loop very, very rarely.
+                */
+               ndelay(400);
+               ret = regmap_field_read(priv->rf[valid_idx], &valid);
+               if (ret)
+                       return ret;
+       }
+
+       /* Valid bit is set, OK to read the temperature */
+       ret = regmap_field_read(priv->rf[temp_idx], &last_temp);
+       if (ret)
+               return ret;
+
+       if (priv->feat->adc) {
+               /* Convert temperature from ADC code to milliCelsius */
+               *temp = code_to_degc(last_temp, s) * 1000;
+       } else {
+               mask = GENMASK(priv->fields[LAST_TEMP_0].msb,
+                              priv->fields[LAST_TEMP_0].lsb);
+               /* Convert temperature from deciCelsius to milliCelsius */
+               *temp = sign_extend32(last_temp, fls(mask) - 1) * 100;
+       }
+
+       return 0;
+}
+
+int get_temp_common(struct tsens_priv *priv, int i, int *temp)
+{
+       struct tsens_sensor *s = &priv->sensor[i];
        int last_temp = 0, ret;
 
-       status_reg = tmdev->tm_offset + STATUS_OFFSET + s->hw_id * SN_ADDR_OFFSET;
-       ret = regmap_read(tmdev->tm_map, status_reg, &code);
+       ret = regmap_field_read(priv->rf[LAST_TEMP_0 + s->hw_id], &last_temp);
        if (ret)
                return ret;
-       last_temp = code & SN_ST_TEMP_MASK;
 
        *temp = code_to_degc(last_temp, s) * 1000;
 
@@ -127,21 +165,21 @@ static const struct regmap_config tsens_srot_config = {
        .reg_stride     = 4,
 };
 
-int __init init_common(struct tsens_device *tmdev)
+int __init init_common(struct tsens_priv *priv)
 {
        void __iomem *tm_base, *srot_base;
+       struct device *dev = priv->dev;
        struct resource *res;
-       u32 code;
-       int ret;
-       struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node);
-       u16 ctrl_offset = tmdev->reg_offsets[SROT_CTRL_OFFSET];
+       u32 enabled;
+       int ret, i, j;
+       struct platform_device *op = of_find_device_by_node(priv->dev->of_node);
 
        if (!op)
                return -EINVAL;
 
        if (op->num_resources > 1) {
                /* DT with separate SROT and TM address space */
-               tmdev->tm_offset = 0;
+               priv->tm_offset = 0;
                res = platform_get_resource(op, IORESOURCE_MEM, 1);
                srot_base = devm_ioremap_resource(&op->dev, res);
                if (IS_ERR(srot_base)) {
@@ -149,16 +187,15 @@ int __init init_common(struct tsens_device *tmdev)
                        goto err_put_device;
                }
 
-               tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, srot_base,
+               priv->srot_map = devm_regmap_init_mmio(dev, srot_base,
                                                        &tsens_srot_config);
-               if (IS_ERR(tmdev->srot_map)) {
-                       ret = PTR_ERR(tmdev->srot_map);
+               if (IS_ERR(priv->srot_map)) {
+                       ret = PTR_ERR(priv->srot_map);
                        goto err_put_device;
                }
-
        } else {
                /* old DTs where SROT and TM were in a contiguous 2K block */
-               tmdev->tm_offset = 0x1000;
+               priv->tm_offset = 0x1000;
        }
 
        res = platform_get_resource(op, IORESOURCE_MEM, 0);
@@ -168,19 +205,47 @@ int __init init_common(struct tsens_device *tmdev)
                goto err_put_device;
        }
 
-       tmdev->tm_map = devm_regmap_init_mmio(tmdev->dev, tm_base, &tsens_config);
-       if (IS_ERR(tmdev->tm_map)) {
-               ret = PTR_ERR(tmdev->tm_map);
+       priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config);
+       if (IS_ERR(priv->tm_map)) {
+               ret = PTR_ERR(priv->tm_map);
                goto err_put_device;
        }
 
-       if (tmdev->srot_map) {
-               ret = regmap_read(tmdev->srot_map, ctrl_offset, &code);
-               if (ret)
+       priv->rf[TSENS_EN] = devm_regmap_field_alloc(dev, priv->srot_map,
+                                                    priv->fields[TSENS_EN]);
+       if (IS_ERR(priv->rf[TSENS_EN])) {
+               ret = PTR_ERR(priv->rf[TSENS_EN]);
+               goto err_put_device;
+       }
+       ret = regmap_field_read(priv->rf[TSENS_EN], &enabled);
+       if (ret)
+               goto err_put_device;
+       if (!enabled) {
+               dev_err(dev, "tsens device is not enabled\n");
+               ret = -ENODEV;
+               goto err_put_device;
+       }
+
+       priv->rf[SENSOR_EN] = devm_regmap_field_alloc(dev, priv->srot_map,
+                                                     priv->fields[SENSOR_EN]);
+       if (IS_ERR(priv->rf[SENSOR_EN])) {
+               ret = PTR_ERR(priv->rf[SENSOR_EN]);
+               goto err_put_device;
+       }
+       /* now alloc regmap_fields in tm_map */
+       for (i = 0, j = LAST_TEMP_0; i < priv->feat->max_sensors; i++, j++) {
+               priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map,
+                                                     priv->fields[j]);
+               if (IS_ERR(priv->rf[j])) {
+                       ret = PTR_ERR(priv->rf[j]);
                        goto err_put_device;
-               if (!(code & TSENS_EN)) {
-                       dev_err(tmdev->dev, "tsens device is not enabled\n");
-                       ret = -ENODEV;
+               }
+       }
+       for (i = 0, j = VALID_0; i < priv->feat->max_sensors; i++, j++) {
+               priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map,
+                                                     priv->fields[j]);
+               if (IS_ERR(priv->rf[j])) {
+                       ret = PTR_ERR(priv->rf[j]);
                        goto err_put_device;
                }
        }
similarity index 56%
rename from drivers/thermal/qcom/tsens-8974.c
rename to drivers/thermal/qcom/tsens-v0_1.c
index 3d3fda3..a319283 100644 (file)
@@ -6,6 +6,48 @@
 #include <linux/platform_device.h>
 #include "tsens.h"
 
+/* ----- SROT ------ */
+#define SROT_CTRL_OFF 0x0000
+
+/* ----- TM ------ */
+#define TM_INT_EN_OFF                          0x0000
+#define TM_Sn_UPPER_LOWER_STATUS_CTRL_OFF      0x0004
+#define TM_Sn_STATUS_OFF                       0x0030
+#define TM_TRDY_OFF                            0x005c
+
+/* eeprom layout data for 8916 */
+#define MSM8916_BASE0_MASK     0x0000007f
+#define MSM8916_BASE1_MASK     0xfe000000
+#define MSM8916_BASE0_SHIFT    0
+#define MSM8916_BASE1_SHIFT    25
+
+#define MSM8916_S0_P1_MASK     0x00000f80
+#define MSM8916_S1_P1_MASK     0x003e0000
+#define MSM8916_S2_P1_MASK     0xf8000000
+#define MSM8916_S3_P1_MASK     0x000003e0
+#define MSM8916_S4_P1_MASK     0x000f8000
+
+#define MSM8916_S0_P2_MASK     0x0001f000
+#define MSM8916_S1_P2_MASK     0x07c00000
+#define MSM8916_S2_P2_MASK     0x0000001f
+#define MSM8916_S3_P2_MASK     0x00007c00
+#define MSM8916_S4_P2_MASK     0x01f00000
+
+#define MSM8916_S0_P1_SHIFT    7
+#define MSM8916_S1_P1_SHIFT    17
+#define MSM8916_S2_P1_SHIFT    27
+#define MSM8916_S3_P1_SHIFT    5
+#define MSM8916_S4_P1_SHIFT    15
+
+#define MSM8916_S0_P2_SHIFT    12
+#define MSM8916_S1_P2_SHIFT    22
+#define MSM8916_S2_P2_SHIFT    0
+#define MSM8916_S3_P2_SHIFT    10
+#define MSM8916_S4_P2_SHIFT    20
+
+#define MSM8916_CAL_SEL_MASK   0xe0000000
+#define MSM8916_CAL_SEL_SHIFT  29
+
 /* eeprom layout data for 8974 */
 #define BASE1_MASK             0xff
 #define S0_P1_MASK             0x3f00
 
 #define BIT_APPEND             0x3
 
-static int calibrate_8974(struct tsens_device *tmdev)
+static int calibrate_8916(struct tsens_priv *priv)
+{
+       int base0 = 0, base1 = 0, i;
+       u32 p1[5], p2[5];
+       int mode = 0;
+       u32 *qfprom_cdata, *qfprom_csel;
+
+       qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
+       if (IS_ERR(qfprom_cdata))
+               return PTR_ERR(qfprom_cdata);
+
+       qfprom_csel = (u32 *)qfprom_read(priv->dev, "calib_sel");
+       if (IS_ERR(qfprom_csel))
+               return PTR_ERR(qfprom_csel);
+
+       mode = (qfprom_csel[0] & MSM8916_CAL_SEL_MASK) >> MSM8916_CAL_SEL_SHIFT;
+       dev_dbg(priv->dev, "calibration mode is %d\n", mode);
+
+       switch (mode) {
+       case TWO_PT_CALIB:
+               base1 = (qfprom_cdata[1] & MSM8916_BASE1_MASK) >> MSM8916_BASE1_SHIFT;
+               p2[0] = (qfprom_cdata[0] & MSM8916_S0_P2_MASK) >> MSM8916_S0_P2_SHIFT;
+               p2[1] = (qfprom_cdata[0] & MSM8916_S1_P2_MASK) >> MSM8916_S1_P2_SHIFT;
+               p2[2] = (qfprom_cdata[1] & MSM8916_S2_P2_MASK) >> MSM8916_S2_P2_SHIFT;
+               p2[3] = (qfprom_cdata[1] & MSM8916_S3_P2_MASK) >> MSM8916_S3_P2_SHIFT;
+               p2[4] = (qfprom_cdata[1] & MSM8916_S4_P2_MASK) >> MSM8916_S4_P2_SHIFT;
+               for (i = 0; i < priv->num_sensors; i++)
+                       p2[i] = ((base1 + p2[i]) << 3);
+               /* Fall through */
+       case ONE_PT_CALIB2:
+               base0 = (qfprom_cdata[0] & MSM8916_BASE0_MASK);
+               p1[0] = (qfprom_cdata[0] & MSM8916_S0_P1_MASK) >> MSM8916_S0_P1_SHIFT;
+               p1[1] = (qfprom_cdata[0] & MSM8916_S1_P1_MASK) >> MSM8916_S1_P1_SHIFT;
+               p1[2] = (qfprom_cdata[0] & MSM8916_S2_P1_MASK) >> MSM8916_S2_P1_SHIFT;
+               p1[3] = (qfprom_cdata[1] & MSM8916_S3_P1_MASK) >> MSM8916_S3_P1_SHIFT;
+               p1[4] = (qfprom_cdata[1] & MSM8916_S4_P1_MASK) >> MSM8916_S4_P1_SHIFT;
+               for (i = 0; i < priv->num_sensors; i++)
+                       p1[i] = (((base0) + p1[i]) << 3);
+               break;
+       default:
+               for (i = 0; i < priv->num_sensors; i++) {
+                       p1[i] = 500;
+                       p2[i] = 780;
+               }
+               break;
+       }
+
+       compute_intercept_slope(priv, p1, p2, mode);
+
+       return 0;
+}
+
+static int calibrate_8974(struct tsens_priv *priv)
 {
        int base1 = 0, base2 = 0, i;
        u32 p1[11], p2[11];
@@ -99,11 +193,11 @@ static int calibrate_8974(struct tsens_device *tmdev)
        u32 *calib, *bkp;
        u32 calib_redun_sel;
 
-       calib = (u32 *)qfprom_read(tmdev->dev, "calib");
+       calib = (u32 *)qfprom_read(priv->dev, "calib");
        if (IS_ERR(calib))
                return PTR_ERR(calib);
 
-       bkp = (u32 *)qfprom_read(tmdev->dev, "calib_backup");
+       bkp = (u32 *)qfprom_read(priv->dev, "calib_backup");
        if (IS_ERR(bkp))
                return PTR_ERR(bkp);
 
@@ -184,25 +278,25 @@ static int calibrate_8974(struct tsens_device *tmdev)
 
        switch (mode) {
        case ONE_PT_CALIB:
-               for (i = 0; i < tmdev->num_sensors; i++)
+               for (i = 0; i < priv->num_sensors; i++)
                        p1[i] += (base1 << 2) | BIT_APPEND;
                break;
        case TWO_PT_CALIB:
-               for (i = 0; i < tmdev->num_sensors; i++) {
+               for (i = 0; i < priv->num_sensors; i++) {
                        p2[i] += base2;
                        p2[i] <<= 2;
                        p2[i] |= BIT_APPEND;
                }
                /* Fall through */
        case ONE_PT_CALIB2:
-               for (i = 0; i < tmdev->num_sensors; i++) {
+               for (i = 0; i < priv->num_sensors; i++) {
                        p1[i] += base1;
                        p1[i] <<= 2;
                        p1[i] |= BIT_APPEND;
                }
                break;
        default:
-               for (i = 0; i < tmdev->num_sensors; i++)
+               for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = 780;
                p1[0] = 502;
                p1[1] = 509;
@@ -218,19 +312,71 @@ static int calibrate_8974(struct tsens_device *tmdev)
                break;
        }
 
-       compute_intercept_slope(tmdev, p1, p2, mode);
+       compute_intercept_slope(priv, p1, p2, mode);
 
        return 0;
 }
 
+/* v0.1: 8916, 8974 */
+
+static const struct tsens_features tsens_v0_1_feat = {
+       .ver_major      = VER_0_1,
+       .crit_int       = 0,
+       .adc            = 1,
+       .srot_split     = 1,
+       .max_sensors    = 11,
+};
+
+static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
+       /* ----- SROT ------ */
+       /* No VERSION information */
+
+       /* CTRL_OFFSET */
+       [TSENS_EN]     = REG_FIELD(SROT_CTRL_OFF, 0,  0),
+       [TSENS_SW_RST] = REG_FIELD(SROT_CTRL_OFF, 1,  1),
+       [SENSOR_EN]    = REG_FIELD(SROT_CTRL_OFF, 3, 13),
+
+       /* ----- TM ------ */
+       /* INTERRUPT ENABLE */
+       [INT_EN] = REG_FIELD(TM_INT_EN_OFF, 0, 0),
+
+       /* Sn_STATUS */
+       REG_FIELD_FOR_EACH_SENSOR11(LAST_TEMP,    TM_Sn_STATUS_OFF,  0,  9),
+       /* No VALID field on v0.1 */
+       REG_FIELD_FOR_EACH_SENSOR11(MIN_STATUS,   TM_Sn_STATUS_OFF, 10, 10),
+       REG_FIELD_FOR_EACH_SENSOR11(LOWER_STATUS, TM_Sn_STATUS_OFF, 11, 11),
+       REG_FIELD_FOR_EACH_SENSOR11(UPPER_STATUS, TM_Sn_STATUS_OFF, 12, 12),
+       /* No CRITICAL field on v0.1 */
+       REG_FIELD_FOR_EACH_SENSOR11(MAX_STATUS,   TM_Sn_STATUS_OFF, 13, 13),
+
+       /* TRDY: 1=ready, 0=in progress */
+       [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
+};
+
+static const struct tsens_ops ops_8916 = {
+       .init           = init_common,
+       .calibrate      = calibrate_8916,
+       .get_temp       = get_temp_common,
+};
+
+const struct tsens_plat_data data_8916 = {
+       .num_sensors    = 5,
+       .ops            = &ops_8916,
+       .hw_ids         = (unsigned int []){0, 1, 2, 4, 5 },
+
+       .feat           = &tsens_v0_1_feat,
+       .fields = tsens_v0_1_regfields,
+};
+
 static const struct tsens_ops ops_8974 = {
        .init           = init_common,
        .calibrate      = calibrate_8974,
        .get_temp       = get_temp_common,
 };
 
-const struct tsens_data data_8974 = {
+const struct tsens_plat_data data_8974 = {
        .num_sensors    = 11,
        .ops            = &ops_8974,
-       .reg_offsets    = { [SROT_CTRL_OFFSET] = 0x0 },
+       .feat           = &tsens_v0_1_feat,
+       .fields = tsens_v0_1_regfields,
 };
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
new file mode 100644 (file)
index 0000000..10b595d
--- /dev/null
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019, Linaro Limited
+ */
+
+#include <linux/bitops.h>
+#include <linux/regmap.h>
+#include <linux/delay.h>
+#include "tsens.h"
+
+/* ----- SROT ------ */
+#define SROT_HW_VER_OFF        0x0000
+#define SROT_CTRL_OFF          0x0004
+
+/* ----- TM ------ */
+#define TM_INT_EN_OFF                          0x0000
+#define TM_Sn_UPPER_LOWER_STATUS_CTRL_OFF      0x0004
+#define TM_Sn_STATUS_OFF                       0x0044
+#define TM_TRDY_OFF                            0x0084
+
+/* eeprom layout data for qcs404/405 (v1) */
+#define BASE0_MASK     0x000007f8
+#define BASE1_MASK     0x0007f800
+#define BASE0_SHIFT    3
+#define BASE1_SHIFT    11
+
+#define S0_P1_MASK     0x0000003f
+#define S1_P1_MASK     0x0003f000
+#define S2_P1_MASK     0x3f000000
+#define S3_P1_MASK     0x000003f0
+#define S4_P1_MASK     0x003f0000
+#define S5_P1_MASK     0x0000003f
+#define S6_P1_MASK     0x0003f000
+#define S7_P1_MASK     0x3f000000
+#define S8_P1_MASK     0x000003f0
+#define S9_P1_MASK     0x003f0000
+
+#define S0_P2_MASK     0x00000fc0
+#define S1_P2_MASK     0x00fc0000
+#define S2_P2_MASK_1_0 0xc0000000
+#define S2_P2_MASK_5_2 0x0000000f
+#define S3_P2_MASK     0x0000fc00
+#define S4_P2_MASK     0x0fc00000
+#define S5_P2_MASK     0x00000fc0
+#define S6_P2_MASK     0x00fc0000
+#define S7_P2_MASK_1_0 0xc0000000
+#define S7_P2_MASK_5_2 0x0000000f
+#define S8_P2_MASK     0x0000fc00
+#define S9_P2_MASK     0x0fc00000
+
+#define S0_P1_SHIFT    0
+#define S0_P2_SHIFT    6
+#define S1_P1_SHIFT    12
+#define S1_P2_SHIFT    18
+#define S2_P1_SHIFT    24
+#define S2_P2_SHIFT_1_0        30
+
+#define S2_P2_SHIFT_5_2        0
+#define S3_P1_SHIFT    4
+#define S3_P2_SHIFT    10
+#define S4_P1_SHIFT    16
+#define S4_P2_SHIFT    22
+
+#define S5_P1_SHIFT    0
+#define S5_P2_SHIFT    6
+#define S6_P1_SHIFT    12
+#define S6_P2_SHIFT    18
+#define S7_P1_SHIFT    24
+#define S7_P2_SHIFT_1_0        30
+
+#define S7_P2_SHIFT_5_2        0
+#define S8_P1_SHIFT    4
+#define S8_P2_SHIFT    10
+#define S9_P1_SHIFT    16
+#define S9_P2_SHIFT    22
+
+#define CAL_SEL_MASK   7
+#define CAL_SEL_SHIFT  0
+
+static int calibrate_v1(struct tsens_priv *priv)
+{
+       u32 base0 = 0, base1 = 0;
+       u32 p1[10], p2[10];
+       u32 mode = 0, lsb = 0, msb = 0;
+       u32 *qfprom_cdata;
+       int i;
+
+       qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
+       if (IS_ERR(qfprom_cdata))
+               return PTR_ERR(qfprom_cdata);
+
+       mode = (qfprom_cdata[4] & CAL_SEL_MASK) >> CAL_SEL_SHIFT;
+       dev_dbg(priv->dev, "calibration mode is %d\n", mode);
+
+       switch (mode) {
+       case TWO_PT_CALIB:
+               base1 = (qfprom_cdata[4] & BASE1_MASK) >> BASE1_SHIFT;
+               p2[0] = (qfprom_cdata[0] & S0_P2_MASK) >> S0_P2_SHIFT;
+               p2[1] = (qfprom_cdata[0] & S1_P2_MASK) >> S1_P2_SHIFT;
+               /* This value is split over two registers, 2 bits and 4 bits */
+               lsb   = (qfprom_cdata[0] & S2_P2_MASK_1_0) >> S2_P2_SHIFT_1_0;
+               msb   = (qfprom_cdata[1] & S2_P2_MASK_5_2) >> S2_P2_SHIFT_5_2;
+               p2[2] = msb << 2 | lsb;
+               p2[3] = (qfprom_cdata[1] & S3_P2_MASK) >> S3_P2_SHIFT;
+               p2[4] = (qfprom_cdata[1] & S4_P2_MASK) >> S4_P2_SHIFT;
+               p2[5] = (qfprom_cdata[2] & S5_P2_MASK) >> S5_P2_SHIFT;
+               p2[6] = (qfprom_cdata[2] & S6_P2_MASK) >> S6_P2_SHIFT;
+               /* This value is split over two registers, 2 bits and 4 bits */
+               lsb   = (qfprom_cdata[2] & S7_P2_MASK_1_0) >> S7_P2_SHIFT_1_0;
+               msb   = (qfprom_cdata[3] & S7_P2_MASK_5_2) >> S7_P2_SHIFT_5_2;
+               p2[7] = msb << 2 | lsb;
+               p2[8] = (qfprom_cdata[3] & S8_P2_MASK) >> S8_P2_SHIFT;
+               p2[9] = (qfprom_cdata[3] & S9_P2_MASK) >> S9_P2_SHIFT;
+               for (i = 0; i < priv->num_sensors; i++)
+                       p2[i] = ((base1 + p2[i]) << 2);
+               /* Fall through */
+       case ONE_PT_CALIB2:
+               base0 = (qfprom_cdata[4] & BASE0_MASK) >> BASE0_SHIFT;
+               p1[0] = (qfprom_cdata[0] & S0_P1_MASK) >> S0_P1_SHIFT;
+               p1[1] = (qfprom_cdata[0] & S1_P1_MASK) >> S1_P1_SHIFT;
+               p1[2] = (qfprom_cdata[0] & S2_P1_MASK) >> S2_P1_SHIFT;
+               p1[3] = (qfprom_cdata[1] & S3_P1_MASK) >> S3_P1_SHIFT;
+               p1[4] = (qfprom_cdata[1] & S4_P1_MASK) >> S4_P1_SHIFT;
+               p1[5] = (qfprom_cdata[2] & S5_P1_MASK) >> S5_P1_SHIFT;
+               p1[6] = (qfprom_cdata[2] & S6_P1_MASK) >> S6_P1_SHIFT;
+               p1[7] = (qfprom_cdata[2] & S7_P1_MASK) >> S7_P1_SHIFT;
+               p1[8] = (qfprom_cdata[3] & S8_P1_MASK) >> S8_P1_SHIFT;
+               p1[9] = (qfprom_cdata[3] & S9_P1_MASK) >> S9_P1_SHIFT;
+               for (i = 0; i < priv->num_sensors; i++)
+                       p1[i] = (((base0) + p1[i]) << 2);
+               break;
+       default:
+               for (i = 0; i < priv->num_sensors; i++) {
+                       p1[i] = 500;
+                       p2[i] = 780;
+               }
+               break;
+       }
+
+       compute_intercept_slope(priv, p1, p2, mode);
+
+       return 0;
+}
+
+/* v1.x: qcs404,405 */
+
+static const struct tsens_features tsens_v1_feat = {
+       .ver_major      = VER_1_X,
+       .crit_int       = 0,
+       .adc            = 1,
+       .srot_split     = 1,
+       .max_sensors    = 11,
+};
+
+static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
+       /* ----- SROT ------ */
+       /* VERSION */
+       [VER_MAJOR] = REG_FIELD(SROT_HW_VER_OFF, 28, 31),
+       [VER_MINOR] = REG_FIELD(SROT_HW_VER_OFF, 16, 27),
+       [VER_STEP]  = REG_FIELD(SROT_HW_VER_OFF,  0, 15),
+       /* CTRL_OFFSET */
+       [TSENS_EN]     = REG_FIELD(SROT_CTRL_OFF, 0,  0),
+       [TSENS_SW_RST] = REG_FIELD(SROT_CTRL_OFF, 1,  1),
+       [SENSOR_EN]    = REG_FIELD(SROT_CTRL_OFF, 3, 13),
+
+       /* ----- TM ------ */
+       /* INTERRUPT ENABLE */
+       [INT_EN]     = REG_FIELD(TM_INT_EN_OFF, 0, 0),
+
+       /* Sn_STATUS */
+       REG_FIELD_FOR_EACH_SENSOR11(LAST_TEMP,    TM_Sn_STATUS_OFF,  0,  9),
+       REG_FIELD_FOR_EACH_SENSOR11(VALID,        TM_Sn_STATUS_OFF, 14, 14),
+       REG_FIELD_FOR_EACH_SENSOR11(MIN_STATUS,   TM_Sn_STATUS_OFF, 10, 10),
+       REG_FIELD_FOR_EACH_SENSOR11(LOWER_STATUS, TM_Sn_STATUS_OFF, 11, 11),
+       REG_FIELD_FOR_EACH_SENSOR11(UPPER_STATUS, TM_Sn_STATUS_OFF, 12, 12),
+       /* No CRITICAL field on v1.x */
+       REG_FIELD_FOR_EACH_SENSOR11(MAX_STATUS,   TM_Sn_STATUS_OFF, 13, 13),
+
+       /* TRDY: 1=ready, 0=in progress */
+       [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
+};
+
+static const struct tsens_ops ops_generic_v1 = {
+       .init           = init_common,
+       .calibrate      = calibrate_v1,
+       .get_temp       = get_temp_tsens_valid,
+};
+
+const struct tsens_plat_data data_tsens_v1 = {
+       .ops            = &ops_generic_v1,
+       .feat           = &tsens_v1_feat,
+       .fields = tsens_v1_regfields,
+};
index 381a212..1099069 100644 (file)
@@ -4,76 +4,81 @@
  * Copyright (c) 2018, Linaro Limited
  */
 
-#include <linux/regmap.h>
 #include <linux/bitops.h>
+#include <linux/regmap.h>
 #include "tsens.h"
 
-#define STATUS_OFFSET          0xa0
-#define LAST_TEMP_MASK         0xfff
-#define STATUS_VALID_BIT       BIT(21)
+/* ----- SROT ------ */
+#define SROT_HW_VER_OFF        0x0000
+#define SROT_CTRL_OFF          0x0004
+
+/* ----- TM ------ */
+#define TM_INT_EN_OFF                  0x0004
+#define TM_UPPER_LOWER_INT_STATUS_OFF  0x0008
+#define TM_UPPER_LOWER_INT_CLEAR_OFF   0x000c
+#define TM_UPPER_LOWER_INT_MASK_OFF    0x0010
+#define TM_CRITICAL_INT_STATUS_OFF     0x0014
+#define TM_CRITICAL_INT_CLEAR_OFF      0x0018
+#define TM_CRITICAL_INT_MASK_OFF       0x001c
+#define TM_Sn_UPPER_LOWER_THRESHOLD_OFF 0x0020
+#define TM_Sn_CRITICAL_THRESHOLD_OFF   0x0060
+#define TM_Sn_STATUS_OFF               0x00a0
+#define TM_TRDY_OFF                    0x00e4
 
-static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp)
-{
-       struct tsens_sensor *s = &tmdev->sensor[id];
-       u32 code;
-       unsigned int status_reg;
-       u32 last_temp = 0, last_temp2 = 0, last_temp3 = 0;
-       int ret;
+/* v2.x: 8996, 8998, sdm845 */
 
-       status_reg = tmdev->tm_offset + STATUS_OFFSET + s->hw_id * 4;
-       ret = regmap_read(tmdev->tm_map, status_reg, &code);
-       if (ret)
-               return ret;
-       last_temp = code & LAST_TEMP_MASK;
-       if (code & STATUS_VALID_BIT)
-               goto done;
+static const struct tsens_features tsens_v2_feat = {
+       .ver_major      = VER_2_X,
+       .crit_int       = 1,
+       .adc            = 0,
+       .srot_split     = 1,
+       .max_sensors    = 16,
+};
 
-       /* Try a second time */
-       ret = regmap_read(tmdev->tm_map, status_reg, &code);
-       if (ret)
-               return ret;
-       if (code & STATUS_VALID_BIT) {
-               last_temp = code & LAST_TEMP_MASK;
-               goto done;
-       } else {
-               last_temp2 = code & LAST_TEMP_MASK;
-       }
+static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
+       /* ----- SROT ------ */
+       /* VERSION */
+       [VER_MAJOR] = REG_FIELD(SROT_HW_VER_OFF, 28, 31),
+       [VER_MINOR] = REG_FIELD(SROT_HW_VER_OFF, 16, 27),
+       [VER_STEP]  = REG_FIELD(SROT_HW_VER_OFF,  0, 15),
+       /* CTRL_OFF */
+       [TSENS_EN]     = REG_FIELD(SROT_CTRL_OFF,    0,  0),
+       [TSENS_SW_RST] = REG_FIELD(SROT_CTRL_OFF,    1,  1),
+       [SENSOR_EN]    = REG_FIELD(SROT_CTRL_OFF,    3, 18),
 
-       /* Try a third/last time */
-       ret = regmap_read(tmdev->tm_map, status_reg, &code);
-       if (ret)
-               return ret;
-       if (code & STATUS_VALID_BIT) {
-               last_temp = code & LAST_TEMP_MASK;
-               goto done;
-       } else {
-               last_temp3 = code & LAST_TEMP_MASK;
-       }
+       /* ----- TM ------ */
+       /* INTERRUPT ENABLE */
+       /* v2 has separate enables for UPPER/LOWER/CRITICAL interrupts */
+       [INT_EN]  = REG_FIELD(TM_INT_EN_OFF, 0, 2),
 
-       if (last_temp == last_temp2)
-               last_temp = last_temp2;
-       else if (last_temp2 == last_temp3)
-               last_temp = last_temp3;
-done:
-       /* Convert temperature from deciCelsius to milliCelsius */
-       *temp = sign_extend32(last_temp, fls(LAST_TEMP_MASK) - 1) * 100;
+       /* Sn_STATUS */
+       REG_FIELD_FOR_EACH_SENSOR16(LAST_TEMP,       TM_Sn_STATUS_OFF,  0,  11),
+       REG_FIELD_FOR_EACH_SENSOR16(VALID,           TM_Sn_STATUS_OFF, 21,  21),
+       REG_FIELD_FOR_EACH_SENSOR16(MIN_STATUS,      TM_Sn_STATUS_OFF, 16,  16),
+       REG_FIELD_FOR_EACH_SENSOR16(LOWER_STATUS,    TM_Sn_STATUS_OFF, 17,  17),
+       REG_FIELD_FOR_EACH_SENSOR16(UPPER_STATUS,    TM_Sn_STATUS_OFF, 18,  18),
+       REG_FIELD_FOR_EACH_SENSOR16(CRITICAL_STATUS, TM_Sn_STATUS_OFF, 19,  19),
+       REG_FIELD_FOR_EACH_SENSOR16(MAX_STATUS,      TM_Sn_STATUS_OFF, 20,  20),
 
-       return 0;
-}
+       /* TRDY: 1=ready, 0=in progress */
+       [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
+};
 
 static const struct tsens_ops ops_generic_v2 = {
        .init           = init_common,
-       .get_temp       = get_temp_tsens_v2,
+       .get_temp       = get_temp_tsens_valid,
 };
 
-const struct tsens_data data_tsens_v2 = {
-       .ops            = &ops_generic_v2,
-       .reg_offsets    = { [SROT_CTRL_OFFSET] = 0x4 },
+const struct tsens_plat_data data_tsens_v2 = {
+       .ops            = &ops_generic_v2,
+       .feat           = &tsens_v2_feat,
+       .fields = tsens_v2_regfields,
 };
 
 /* Kept around for backward compatibility with old msm8996.dtsi */
-const struct tsens_data data_8996 = {
+const struct tsens_plat_data data_8996 = {
        .num_sensors    = 13,
        .ops            = &ops_generic_v2,
-       .reg_offsets    = { [SROT_CTRL_OFFSET] = 0x4 },
+       .feat           = &tsens_v2_feat,
+       .fields = tsens_v2_regfields,
 };
index f1ec9bb..36b0b52 100644 (file)
 static int tsens_get_temp(void *data, int *temp)
 {
        const struct tsens_sensor *s = data;
-       struct tsens_device *tmdev = s->tmdev;
+       struct tsens_priv *priv = s->priv;
 
-       return tmdev->ops->get_temp(tmdev, s->id, temp);
+       return priv->ops->get_temp(priv, s->id, temp);
 }
 
-static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
+static int tsens_get_trend(void *data, int trip, enum thermal_trend *trend)
 {
-       const struct tsens_sensor *s = p;
-       struct tsens_device *tmdev = s->tmdev;
+       const struct tsens_sensor *s = data;
+       struct tsens_priv *priv = s->priv;
 
-       if (tmdev->ops->get_trend)
-               return  tmdev->ops->get_trend(tmdev, s->id, trend);
+       if (priv->ops->get_trend)
+               return priv->ops->get_trend(priv, s->id, trend);
 
        return -ENOTSUPP;
 }
 
 static int  __maybe_unused tsens_suspend(struct device *dev)
 {
-       struct tsens_device *tmdev = dev_get_drvdata(dev);
+       struct tsens_priv *priv = dev_get_drvdata(dev);
 
-       if (tmdev->ops && tmdev->ops->suspend)
-               return tmdev->ops->suspend(tmdev);
+       if (priv->ops && priv->ops->suspend)
+               return priv->ops->suspend(priv);
 
        return 0;
 }
 
 static int __maybe_unused tsens_resume(struct device *dev)
 {
-       struct tsens_device *tmdev = dev_get_drvdata(dev);
+       struct tsens_priv *priv = dev_get_drvdata(dev);
 
-       if (tmdev->ops && tmdev->ops->resume)
-               return tmdev->ops->resume(tmdev);
+       if (priv->ops && priv->ops->resume)
+               return priv->ops->resume(priv);
 
        return 0;
 }
@@ -64,6 +64,9 @@ static const struct of_device_id tsens_table[] = {
                .compatible = "qcom,msm8996-tsens",
                .data = &data_8996,
        }, {
+               .compatible = "qcom,tsens-v1",
+               .data = &data_tsens_v1,
+       }, {
                .compatible = "qcom,tsens-v2",
                .data = &data_tsens_v2,
        },
@@ -76,22 +79,27 @@ static const struct thermal_zone_of_device_ops tsens_of_ops = {
        .get_trend = tsens_get_trend,
 };
 
-static int tsens_register(struct tsens_device *tmdev)
+static int tsens_register(struct tsens_priv *priv)
 {
        int i;
        struct thermal_zone_device *tzd;
 
-       for (i = 0;  i < tmdev->num_sensors; i++) {
-               tmdev->sensor[i].tmdev = tmdev;
-               tmdev->sensor[i].id = i;
-               tzd = devm_thermal_zone_of_sensor_register(tmdev->dev, i,
-                                                          &tmdev->sensor[i],
+       for (i = 0;  i < priv->num_sensors; i++) {
+               if (!is_sensor_enabled(priv, priv->sensor[i].hw_id)) {
+                       dev_err(priv->dev, "sensor %d: disabled\n",
+                               priv->sensor[i].hw_id);
+                       continue;
+               }
+               priv->sensor[i].priv = priv;
+               priv->sensor[i].id = i;
+               tzd = devm_thermal_zone_of_sensor_register(priv->dev, i,
+                                                          &priv->sensor[i],
                                                           &tsens_of_ops);
                if (IS_ERR(tzd))
                        continue;
-               tmdev->sensor[i].tzd = tzd;
-               if (tmdev->ops->enable)
-                       tmdev->ops->enable(tmdev, i);
+               priv->sensor[i].tzd = tzd;
+               if (priv->ops->enable)
+                       priv->ops->enable(priv, i);
        }
        return 0;
 }
@@ -101,8 +109,8 @@ static int tsens_probe(struct platform_device *pdev)
        int ret, i;
        struct device *dev;
        struct device_node *np;
-       struct tsens_device *tmdev;
-       const struct tsens_data *data;
+       struct tsens_priv *priv;
+       const struct tsens_plat_data *data;
        const struct of_device_id *id;
        u32 num_sensors;
 
@@ -129,55 +137,55 @@ static int tsens_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       tmdev = devm_kzalloc(dev,
-                            struct_size(tmdev, sensor, num_sensors),
+       priv = devm_kzalloc(dev,
+                            struct_size(priv, sensor, num_sensors),
                             GFP_KERNEL);
-       if (!tmdev)
+       if (!priv)
                return -ENOMEM;
 
-       tmdev->dev = dev;
-       tmdev->num_sensors = num_sensors;
-       tmdev->ops = data->ops;
-       for (i = 0;  i < tmdev->num_sensors; i++) {
+       priv->dev = dev;
+       priv->num_sensors = num_sensors;
+       priv->ops = data->ops;
+       for (i = 0;  i < priv->num_sensors; i++) {
                if (data->hw_ids)
-                       tmdev->sensor[i].hw_id = data->hw_ids[i];
+                       priv->sensor[i].hw_id = data->hw_ids[i];
                else
-                       tmdev->sensor[i].hw_id = i;
-       }
-       for (i = 0; i < REG_ARRAY_SIZE; i++) {
-               tmdev->reg_offsets[i] = data->reg_offsets[i];
+                       priv->sensor[i].hw_id = i;
        }
+       priv->feat = data->feat;
+       priv->fields = data->fields;
 
-       if (!tmdev->ops || !tmdev->ops->init || !tmdev->ops->get_temp)
+       if (!priv->ops || !priv->ops->init || !priv->ops->get_temp)
                return -EINVAL;
 
-       ret = tmdev->ops->init(tmdev);
+       ret = priv->ops->init(priv);
        if (ret < 0) {
                dev_err(dev, "tsens init failed\n");
                return ret;
        }
 
-       if (tmdev->ops->calibrate) {
-               ret = tmdev->ops->calibrate(tmdev);
+       if (priv->ops->calibrate) {
+               ret = priv->ops->calibrate(priv);
                if (ret < 0) {
-                       dev_err(dev, "tsens calibration failed\n");
+                       if (ret != -EPROBE_DEFER)
+                               dev_err(dev, "tsens calibration failed\n");
                        return ret;
                }
        }
 
-       ret = tsens_register(tmdev);
+       ret = tsens_register(priv);
 
-       platform_set_drvdata(pdev, tmdev);
+       platform_set_drvdata(pdev, priv);
 
        return ret;
 }
 
 static int tsens_remove(struct platform_device *pdev)
 {
-       struct tsens_device *tmdev = platform_get_drvdata(pdev);
+       struct tsens_priv *priv = platform_get_drvdata(pdev);
 
-       if (tmdev->ops->disable)
-               tmdev->ops->disable(tmdev);
+       if (priv->ops->disable)
+               priv->ops->disable(priv);
 
        return 0;
 }
index 7b7feee..eefe384 100644 (file)
@@ -9,17 +9,39 @@
 #define ONE_PT_CALIB           0x1
 #define ONE_PT_CALIB2          0x2
 #define TWO_PT_CALIB           0x3
+#define CAL_DEGC_PT1           30
+#define CAL_DEGC_PT2           120
+#define SLOPE_FACTOR           1000
+#define SLOPE_DEFAULT          3200
+
 
 #include <linux/thermal.h>
+#include <linux/regmap.h>
+
+struct tsens_priv;
 
-struct tsens_device;
+enum tsens_ver {
+       VER_0_1 = 0,
+       VER_1_X,
+       VER_2_X,
+};
 
+/**
+ * struct tsens_sensor - data for each sensor connected to the tsens device
+ * @priv: tsens device instance that this sensor is connected to
+ * @tzd: pointer to the thermal zone that this sensor is in
+ * @offset: offset of temperature adjustment curve
+ * @id: Sensor ID
+ * @hw_id: HW ID can be used in case of platform-specific IDs
+ * @slope: slope of temperature adjustment curve
+ * @status: 8960-specific variable to track 8960 and 8660 status register offset
+ */
 struct tsens_sensor {
-       struct tsens_device             *tmdev;
+       struct tsens_priv               *priv;
        struct thermal_zone_device      *tzd;
        int                             offset;
-       int                             id;
-       int                             hw_id;
+       unsigned int                    id;
+       unsigned int                    hw_id;
        int                             slope;
        u32                             status;
 };
@@ -37,63 +59,274 @@ struct tsens_sensor {
  */
 struct tsens_ops {
        /* mandatory callbacks */
-       int (*init)(struct tsens_device *);
-       int (*calibrate)(struct tsens_device *);
-       int (*get_temp)(struct tsens_device *, int, int *);
+       int (*init)(struct tsens_priv *priv);
+       int (*calibrate)(struct tsens_priv *priv);
+       int (*get_temp)(struct tsens_priv *priv, int i, int *temp);
        /* optional callbacks */
-       int (*enable)(struct tsens_device *, int);
-       void (*disable)(struct tsens_device *);
-       int (*suspend)(struct tsens_device *);
-       int (*resume)(struct tsens_device *);
-       int (*get_trend)(struct tsens_device *, int, enum thermal_trend *);
+       int (*enable)(struct tsens_priv *priv, int i);
+       void (*disable)(struct tsens_priv *priv);
+       int (*suspend)(struct tsens_priv *priv);
+       int (*resume)(struct tsens_priv *priv);
+       int (*get_trend)(struct tsens_priv *priv, int i, enum thermal_trend *trend);
 };
 
-enum reg_list {
-       SROT_CTRL_OFFSET,
+#define REG_FIELD_FOR_EACH_SENSOR11(_name, _offset, _startbit, _stopbit) \
+       [_name##_##0]  = REG_FIELD(_offset,      _startbit, _stopbit),  \
+       [_name##_##1]  = REG_FIELD(_offset +  4, _startbit, _stopbit), \
+       [_name##_##2]  = REG_FIELD(_offset +  8, _startbit, _stopbit), \
+       [_name##_##3]  = REG_FIELD(_offset + 12, _startbit, _stopbit), \
+       [_name##_##4]  = REG_FIELD(_offset + 16, _startbit, _stopbit), \
+       [_name##_##5]  = REG_FIELD(_offset + 20, _startbit, _stopbit), \
+       [_name##_##6]  = REG_FIELD(_offset + 24, _startbit, _stopbit), \
+       [_name##_##7]  = REG_FIELD(_offset + 28, _startbit, _stopbit), \
+       [_name##_##8]  = REG_FIELD(_offset + 32, _startbit, _stopbit), \
+       [_name##_##9]  = REG_FIELD(_offset + 36, _startbit, _stopbit), \
+       [_name##_##10] = REG_FIELD(_offset + 40, _startbit, _stopbit)
 
-       REG_ARRAY_SIZE,
+#define REG_FIELD_FOR_EACH_SENSOR16(_name, _offset, _startbit, _stopbit) \
+       [_name##_##0]  = REG_FIELD(_offset,      _startbit, _stopbit),  \
+       [_name##_##1]  = REG_FIELD(_offset +  4, _startbit, _stopbit), \
+       [_name##_##2]  = REG_FIELD(_offset +  8, _startbit, _stopbit), \
+       [_name##_##3]  = REG_FIELD(_offset + 12, _startbit, _stopbit), \
+       [_name##_##4]  = REG_FIELD(_offset + 16, _startbit, _stopbit), \
+       [_name##_##5]  = REG_FIELD(_offset + 20, _startbit, _stopbit), \
+       [_name##_##6]  = REG_FIELD(_offset + 24, _startbit, _stopbit), \
+       [_name##_##7]  = REG_FIELD(_offset + 28, _startbit, _stopbit), \
+       [_name##_##8]  = REG_FIELD(_offset + 32, _startbit, _stopbit), \
+       [_name##_##9]  = REG_FIELD(_offset + 36, _startbit, _stopbit), \
+       [_name##_##10] = REG_FIELD(_offset + 40, _startbit, _stopbit), \
+       [_name##_##11] = REG_FIELD(_offset + 44, _startbit, _stopbit), \
+       [_name##_##12] = REG_FIELD(_offset + 48, _startbit, _stopbit), \
+       [_name##_##13] = REG_FIELD(_offset + 52, _startbit, _stopbit), \
+       [_name##_##14] = REG_FIELD(_offset + 56, _startbit, _stopbit), \
+       [_name##_##15] = REG_FIELD(_offset + 60, _startbit, _stopbit)
+
+/* reg_field IDs to use as an index into an array */
+enum regfield_ids {
+       /* ----- SROT ------ */
+       /* HW_VER */
+       VER_MAJOR = 0,
+       VER_MINOR,
+       VER_STEP,
+       /* CTRL_OFFSET */
+       TSENS_EN =  3,
+       TSENS_SW_RST,
+       SENSOR_EN,
+       CODE_OR_TEMP,
+
+       /* ----- TM ------ */
+       /* STATUS */
+       LAST_TEMP_0 = 7,        /* Last temperature reading */
+       LAST_TEMP_1,
+       LAST_TEMP_2,
+       LAST_TEMP_3,
+       LAST_TEMP_4,
+       LAST_TEMP_5,
+       LAST_TEMP_6,
+       LAST_TEMP_7,
+       LAST_TEMP_8,
+       LAST_TEMP_9,
+       LAST_TEMP_10,
+       LAST_TEMP_11,
+       LAST_TEMP_12,
+       LAST_TEMP_13,
+       LAST_TEMP_14,
+       LAST_TEMP_15,
+       VALID_0 = 23,           /* VALID reading or not */
+       VALID_1,
+       VALID_2,
+       VALID_3,
+       VALID_4,
+       VALID_5,
+       VALID_6,
+       VALID_7,
+       VALID_8,
+       VALID_9,
+       VALID_10,
+       VALID_11,
+       VALID_12,
+       VALID_13,
+       VALID_14,
+       VALID_15,
+       MIN_STATUS_0,           /* MIN threshold violated */
+       MIN_STATUS_1,
+       MIN_STATUS_2,
+       MIN_STATUS_3,
+       MIN_STATUS_4,
+       MIN_STATUS_5,
+       MIN_STATUS_6,
+       MIN_STATUS_7,
+       MIN_STATUS_8,
+       MIN_STATUS_9,
+       MIN_STATUS_10,
+       MIN_STATUS_11,
+       MIN_STATUS_12,
+       MIN_STATUS_13,
+       MIN_STATUS_14,
+       MIN_STATUS_15,
+       MAX_STATUS_0,           /* MAX threshold violated */
+       MAX_STATUS_1,
+       MAX_STATUS_2,
+       MAX_STATUS_3,
+       MAX_STATUS_4,
+       MAX_STATUS_5,
+       MAX_STATUS_6,
+       MAX_STATUS_7,
+       MAX_STATUS_8,
+       MAX_STATUS_9,
+       MAX_STATUS_10,
+       MAX_STATUS_11,
+       MAX_STATUS_12,
+       MAX_STATUS_13,
+       MAX_STATUS_14,
+       MAX_STATUS_15,
+       LOWER_STATUS_0, /* LOWER threshold violated */
+       LOWER_STATUS_1,
+       LOWER_STATUS_2,
+       LOWER_STATUS_3,
+       LOWER_STATUS_4,
+       LOWER_STATUS_5,
+       LOWER_STATUS_6,
+       LOWER_STATUS_7,
+       LOWER_STATUS_8,
+       LOWER_STATUS_9,
+       LOWER_STATUS_10,
+       LOWER_STATUS_11,
+       LOWER_STATUS_12,
+       LOWER_STATUS_13,
+       LOWER_STATUS_14,
+       LOWER_STATUS_15,
+       UPPER_STATUS_0, /* UPPER threshold violated */
+       UPPER_STATUS_1,
+       UPPER_STATUS_2,
+       UPPER_STATUS_3,
+       UPPER_STATUS_4,
+       UPPER_STATUS_5,
+       UPPER_STATUS_6,
+       UPPER_STATUS_7,
+       UPPER_STATUS_8,
+       UPPER_STATUS_9,
+       UPPER_STATUS_10,
+       UPPER_STATUS_11,
+       UPPER_STATUS_12,
+       UPPER_STATUS_13,
+       UPPER_STATUS_14,
+       UPPER_STATUS_15,
+       CRITICAL_STATUS_0,      /* CRITICAL threshold violated */
+       CRITICAL_STATUS_1,
+       CRITICAL_STATUS_2,
+       CRITICAL_STATUS_3,
+       CRITICAL_STATUS_4,
+       CRITICAL_STATUS_5,
+       CRITICAL_STATUS_6,
+       CRITICAL_STATUS_7,
+       CRITICAL_STATUS_8,
+       CRITICAL_STATUS_9,
+       CRITICAL_STATUS_10,
+       CRITICAL_STATUS_11,
+       CRITICAL_STATUS_12,
+       CRITICAL_STATUS_13,
+       CRITICAL_STATUS_14,
+       CRITICAL_STATUS_15,
+       /* TRDY */
+       TRDY,
+       /* INTERRUPT ENABLE */
+       INT_EN, /* Pre-V1, V1.x */
+       LOW_INT_EN,     /* V2.x */
+       UP_INT_EN,      /* V2.x */
+       CRIT_INT_EN,    /* V2.x */
+
+       /* Keep last */
+       MAX_REGFIELDS
 };
 
 /**
- * struct tsens_data - tsens instance specific data
- * @num_sensors: Max number of sensors supported by platform
+ * struct tsens_features - Features supported by the IP
+ * @ver_major: Major number of IP version
+ * @crit_int: does the IP support critical interrupts?
+ * @adc:      do the sensors only output adc code (instead of temperature)?
+ * @srot_split: does the IP neatly splits the register space into SROT and TM,
+ *              with SROT only being available to secure boot firmware?
+ * @max_sensors: maximum sensors supported by this version of the IP
+ */
+struct tsens_features {
+       unsigned int ver_major;
+       unsigned int crit_int:1;
+       unsigned int adc:1;
+       unsigned int srot_split:1;
+       unsigned int max_sensors;
+};
+
+/**
+ * struct tsens_plat_data - tsens compile-time platform data
+ * @num_sensors: Number of sensors supported by platform
  * @ops: operations the tsens instance supports
  * @hw_ids: Subset of sensors ids supported by platform, if not the first n
- * @reg_offsets: Register offsets for commonly used registers
+ * @feat: features of the IP
+ * @fields: bitfield locations
  */
-struct tsens_data {
+struct tsens_plat_data {
        const u32               num_sensors;
        const struct tsens_ops  *ops;
-       const u16               reg_offsets[REG_ARRAY_SIZE];
        unsigned int            *hw_ids;
+       const struct tsens_features     *feat;
+       const struct reg_field          *fields;
 };
 
-/* Registers to be saved/restored across a context loss */
+/**
+ * struct tsens_context - Registers to be saved/restored across a context loss
+ */
 struct tsens_context {
        int     threshold;
        int     control;
 };
 
-struct tsens_device {
+/**
+ * struct tsens_priv - private data for each instance of the tsens IP
+ * @dev: pointer to struct device
+ * @num_sensors: number of sensors enabled on this device
+ * @tm_map: pointer to TM register address space
+ * @srot_map: pointer to SROT register address space
+ * @tm_offset: deal with old device trees that don't address TM and SROT
+ *             address space separately
+ * @rf: array of regmap_fields used to store value of the field
+ * @ctx: registers to be saved and restored during suspend/resume
+ * @feat: features of the IP
+ * @fields: bitfield locations
+ * @ops: pointer to list of callbacks supported by this device
+ * @sensor: list of sensors attached to this device
+ */
+struct tsens_priv {
        struct device                   *dev;
        u32                             num_sensors;
        struct regmap                   *tm_map;
        struct regmap                   *srot_map;
        u32                             tm_offset;
-       u16                             reg_offsets[REG_ARRAY_SIZE];
+       struct regmap_field             *rf[MAX_REGFIELDS];
        struct tsens_context            ctx;
+       const struct tsens_features     *feat;
+       const struct reg_field          *fields;
        const struct tsens_ops          *ops;
        struct tsens_sensor             sensor[0];
 };
 
-char *qfprom_read(struct device *, const char *);
-void compute_intercept_slope(struct tsens_device *, u32 *, u32 *, u32);
-int init_common(struct tsens_device *);
-int get_temp_common(struct tsens_device *, int, int *);
+char *qfprom_read(struct device *dev, const char *cname);
+void compute_intercept_slope(struct tsens_priv *priv, u32 *pt1, u32 *pt2, u32 mode);
+int init_common(struct tsens_priv *priv);
+int get_temp_tsens_valid(struct tsens_priv *priv, int i, int *temp);
+int get_temp_common(struct tsens_priv *priv, int i, int *temp);
+bool is_sensor_enabled(struct tsens_priv *priv, u32 hw_id);
+
+/* TSENS target */
+extern const struct tsens_plat_data data_8960;
+
+/* TSENS v0.1 targets */
+extern const struct tsens_plat_data data_8916, data_8974;
 
 /* TSENS v1 targets */
-extern const struct tsens_data data_8916, data_8974, data_8960;
+extern const struct tsens_plat_data data_tsens_v1;
+
 /* TSENS v2 targets */
-extern const struct tsens_data data_8996, data_tsens_v2;
+extern const struct tsens_plat_data data_8996, data_tsens_v2;
 
 #endif /* __QCOM_TSENS_H__ */
index 3b5f5b3..7b36493 100644 (file)
@@ -193,11 +193,6 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
        struct qoriq_tmu_data *data;
        struct device_node *np = pdev->dev.of_node;
 
-       if (!np) {
-               dev_err(&pdev->dev, "Device OF-Node is NULL");
-               return -ENODEV;
-       }
-
        data = devm_kzalloc(&pdev->dev, sizeof(struct qoriq_tmu_data),
                            GFP_KERNEL);
        if (!data)
index 88fa41c..83f3062 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-#include <linux/spinlock.h>
 #include <linux/sys_soc.h>
 #include <linux/thermal.h>
 
@@ -82,7 +81,6 @@ struct rcar_gen3_thermal_tsc {
 struct rcar_gen3_thermal_priv {
        struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM];
        unsigned int num_tscs;
-       spinlock_t lock; /* Protect interrupts on and off */
        void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc);
 };
 
@@ -232,38 +230,16 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data)
 {
        struct rcar_gen3_thermal_priv *priv = data;
        u32 status;
-       int i, ret = IRQ_HANDLED;
+       int i;
 
-       spin_lock(&priv->lock);
        for (i = 0; i < priv->num_tscs; i++) {
                status = rcar_gen3_thermal_read(priv->tscs[i], REG_GEN3_IRQSTR);
                rcar_gen3_thermal_write(priv->tscs[i], REG_GEN3_IRQSTR, 0);
                if (status)
-                       ret = IRQ_WAKE_THREAD;
+                       thermal_zone_device_update(priv->tscs[i]->zone,
+                                                  THERMAL_EVENT_UNSPECIFIED);
        }
 
-       if (ret == IRQ_WAKE_THREAD)
-               rcar_thermal_irq_set(priv, false);
-
-       spin_unlock(&priv->lock);
-
-       return ret;
-}
-
-static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data)
-{
-       struct rcar_gen3_thermal_priv *priv = data;
-       unsigned long flags;
-       int i;
-
-       for (i = 0; i < priv->num_tscs; i++)
-               thermal_zone_device_update(priv->tscs[i]->zone,
-                                          THERMAL_EVENT_UNSPECIFIED);
-
-       spin_lock_irqsave(&priv->lock, flags);
-       rcar_thermal_irq_set(priv, true);
-       spin_unlock_irqrestore(&priv->lock, flags);
-
        return IRQ_HANDLED;
 }
 
@@ -307,7 +283,7 @@ static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
 
        usleep_range(1000, 2000);
 
-       rcar_gen3_thermal_write(tsc, REG_GEN3_IRQCTL, 0x3F);
+       rcar_gen3_thermal_write(tsc, REG_GEN3_IRQCTL, 0);
        rcar_gen3_thermal_write(tsc, REG_GEN3_IRQMSK, 0);
        rcar_gen3_thermal_write(tsc, REG_GEN3_IRQEN, IRQ_TEMPD1 | IRQ_TEMP2);
 
@@ -331,6 +307,9 @@ MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids);
 static int rcar_gen3_thermal_remove(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
+       struct rcar_gen3_thermal_priv *priv = dev_get_drvdata(dev);
+
+       rcar_thermal_irq_set(priv, false);
 
        pm_runtime_put(dev);
        pm_runtime_disable(dev);
@@ -371,8 +350,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
        if (soc_device_match(r8a7795es1))
                priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1;
 
-       spin_lock_init(&priv->lock);
-
        platform_set_drvdata(pdev, priv);
 
        /*
@@ -390,9 +367,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
                if (!irqname)
                        return -ENOMEM;
 
-               ret = devm_request_threaded_irq(dev, irq, rcar_gen3_thermal_irq,
-                                               rcar_gen3_thermal_irq_thread,
-                                               IRQF_SHARED, irqname, priv);
+               ret = devm_request_threaded_irq(dev, irq, NULL,
+                                               rcar_gen3_thermal_irq,
+                                               IRQF_ONESHOT, irqname, priv);
                if (ret)
                        return ret;
        }
@@ -433,10 +410,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
                }
                tsc->zone = zone;
 
-               ret = of_thermal_get_ntrips(tsc->zone);
-               if (ret < 0)
-                       goto error_unregister;
-
                tsc->zone->tzp->no_hwmon = false;
                ret = thermal_add_hwmon_sysfs(tsc->zone);
                if (ret)
@@ -448,6 +421,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
                        goto error_unregister;
                }
 
+               ret = of_thermal_get_ntrips(tsc->zone);
+               if (ret < 0)
+                       goto error_unregister;
+
                dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
        }
 
index 97462e9..d0873de 100644 (file)
@@ -52,6 +52,7 @@ struct rcar_thermal_chip {
        unsigned int irq_per_ch : 1;
        unsigned int needs_suspend_resume : 1;
        unsigned int nirqs;
+       unsigned int ctemp_bands;
 };
 
 static const struct rcar_thermal_chip rcar_thermal = {
@@ -60,6 +61,7 @@ static const struct rcar_thermal_chip rcar_thermal = {
        .irq_per_ch = 0,
        .needs_suspend_resume = 0,
        .nirqs = 1,
+       .ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen2_thermal = {
@@ -68,6 +70,7 @@ static const struct rcar_thermal_chip rcar_gen2_thermal = {
        .irq_per_ch = 0,
        .needs_suspend_resume = 0,
        .nirqs = 1,
+       .ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen3_thermal = {
@@ -80,6 +83,7 @@ static const struct rcar_thermal_chip rcar_gen3_thermal = {
         * interrupts to detect a temperature change, rise or fall.
         */
        .nirqs = 2,
+       .ctemp_bands = 2,
 };
 
 struct rcar_thermal_priv {
@@ -263,7 +267,12 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
                return ret;
 
        mutex_lock(&priv->lock);
-       tmp =  MCELSIUS((priv->ctemp * 5) - 65);
+       if (priv->chip->ctemp_bands == 1)
+               tmp = MCELSIUS((priv->ctemp * 5) - 65);
+       else if (priv->ctemp < 24)
+               tmp = MCELSIUS(((priv->ctemp * 55) - 720) / 10);
+       else
+               tmp = MCELSIUS((priv->ctemp * 5) - 60);
        mutex_unlock(&priv->lock);
 
        if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
index 9c7643d..bda1ca1 100644 (file)
@@ -172,6 +172,9 @@ struct rockchip_thermal_data {
        int tshut_temp;
        enum tshut_mode tshut_mode;
        enum tshut_polarity tshut_polarity;
+       struct pinctrl *pinctrl;
+       struct pinctrl_state *gpio_state;
+       struct pinctrl_state *otp_state;
 };
 
 /**
@@ -222,11 +225,15 @@ struct rockchip_thermal_data {
 #define GRF_TSADC_TESTBIT_L                    0x0e648
 #define GRF_TSADC_TESTBIT_H                    0x0e64c
 
+#define PX30_GRF_SOC_CON2                      0x0408
+
 #define GRF_SARADC_TESTBIT_ON                  (0x10001 << 2)
 #define GRF_TSADC_TESTBIT_H_ON                 (0x10001 << 2)
 #define GRF_TSADC_VCM_EN_L                     (0x10001 << 7)
 #define GRF_TSADC_VCM_EN_H                     (0x10001 << 7)
 
+#define GRF_CON_TSADC_CH_INV                   (0x10001 << 1)
+
 /**
  * struct tsadc_table - code to temperature conversion table
  * @code: the value of adc channel
@@ -689,6 +696,13 @@ static void rk_tsadcv3_initialize(struct regmap *grf, void __iomem *regs,
                               regs + TSADCV2_AUTO_CON);
 }
 
+static void rk_tsadcv4_initialize(struct regmap *grf, void __iomem *regs,
+                                 enum tshut_polarity tshut_polarity)
+{
+       rk_tsadcv2_initialize(grf, regs, tshut_polarity);
+       regmap_write(grf, PX30_GRF_SOC_CON2, GRF_CON_TSADC_CH_INV);
+}
+
 static void rk_tsadcv2_irq_ack(void __iomem *regs)
 {
        u32 val;
@@ -818,6 +832,30 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs,
        writel_relaxed(val, regs + TSADCV2_INT_EN);
 }
 
+static const struct rockchip_tsadc_chip px30_tsadc_data = {
+       .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
+       .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
+       .chn_num = 2, /* 2 channels for tsadc */
+
+       .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
+       .tshut_temp = 95000,
+
+       .initialize = rk_tsadcv4_initialize,
+       .irq_ack = rk_tsadcv3_irq_ack,
+       .control = rk_tsadcv3_control,
+       .get_temp = rk_tsadcv2_get_temp,
+       .set_alarm_temp = rk_tsadcv2_alarm_temp,
+       .set_tshut_temp = rk_tsadcv2_tshut_temp,
+       .set_tshut_mode = rk_tsadcv2_tshut_mode,
+
+       .table = {
+               .id = rk3328_code_table,
+               .length = ARRAY_SIZE(rk3328_code_table),
+               .data_mask = TSADCV2_DATA_MASK,
+               .mode = ADC_INCREMENT,
+       },
+};
+
 static const struct rockchip_tsadc_chip rv1108_tsadc_data = {
        .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
        .chn_num = 1, /* one channel for tsadc */
@@ -990,6 +1028,9 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 };
 
 static const struct of_device_id of_rockchip_thermal_match[] = {
+       {       .compatible = "rockchip,px30-tsadc",
+               .data = (void *)&px30_tsadc_data,
+       },
        {
                .compatible = "rockchip,rv1108-tsadc",
                .data = (void *)&rv1108_tsadc_data,
@@ -1242,6 +1283,8 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
                return error;
        }
 
+       thermal->chip->control(thermal->regs, false);
+
        error = clk_prepare_enable(thermal->clk);
        if (error) {
                dev_err(&pdev->dev, "failed to enable converter clock: %d\n",
@@ -1267,6 +1310,30 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
        thermal->chip->initialize(thermal->grf, thermal->regs,
                                  thermal->tshut_polarity);
 
+       if (thermal->tshut_mode == TSHUT_MODE_GPIO) {
+               thermal->pinctrl = devm_pinctrl_get(&pdev->dev);
+               if (IS_ERR(thermal->pinctrl)) {
+                       dev_err(&pdev->dev, "failed to find thermal pinctrl\n");
+                       return PTR_ERR(thermal->pinctrl);
+               }
+
+               thermal->gpio_state = pinctrl_lookup_state(thermal->pinctrl,
+                                                          "gpio");
+               if (IS_ERR_OR_NULL(thermal->gpio_state)) {
+                       dev_err(&pdev->dev, "failed to find thermal gpio state\n");
+                       return -EINVAL;
+               }
+
+               thermal->otp_state = pinctrl_lookup_state(thermal->pinctrl,
+                                                         "otpout");
+               if (IS_ERR_OR_NULL(thermal->otp_state)) {
+                       dev_err(&pdev->dev, "failed to find thermal otpout state\n");
+                       return -EINVAL;
+               }
+
+               pinctrl_select_state(thermal->pinctrl, thermal->otp_state);
+       }
+
        for (i = 0; i < thermal->chip->chn_num; i++) {
                error = rockchip_thermal_register_sensor(pdev, thermal,
                                                &thermal->sensors[i],
@@ -1337,8 +1404,8 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
 
        clk_disable(thermal->pclk);
        clk_disable(thermal->clk);
-
-       pinctrl_pm_select_sleep_state(dev);
+       if (thermal->tshut_mode == TSHUT_MODE_GPIO)
+               pinctrl_select_state(thermal->pinctrl, thermal->gpio_state);
 
        return 0;
 }
@@ -1383,7 +1450,8 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
        for (i = 0; i < thermal->chip->chn_num; i++)
                rockchip_thermal_toggle_sensor(&thermal->sensors[i], true);
 
-       pinctrl_pm_select_default_state(dev);
+       if (thermal->tshut_mode == TSHUT_MODE_GPIO)
+               pinctrl_select_state(thermal->pinctrl, thermal->otp_state);
 
        return 0;
 }
index 222e644..fe0d2ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config EXYNOS_THERMAL
        tristate "Exynos thermal management unit driver"
        depends on THERMAL_OF
index 1e47d0d..f139407 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Samsung thermal specific Makefile
 #
index b80f9a9..3c3b695 100644 (file)
@@ -1,11 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STMicroelectronics thermal drivers configuration
 #
 
 config ST_THERMAL
-       tristate "Thermal sensors on STMicroelectronics STi series of SoCs"
-       help
-         Support for thermal sensors on STMicroelectronics STi series of SoCs.
+       tristate "Thermal sensors on STMicroelectronics STi series of SoCs"
+       help
+         Support for thermal sensors on STMicroelectronics STi series of SoCs.
 
 config ST_THERMAL_SYSCFG
        select ST_THERMAL
@@ -16,11 +17,11 @@ config ST_THERMAL_MEMMAP
        tristate "STi series memory mapped access based thermal sensors"
 
 config STM32_THERMAL
-       tristate "Thermal framework support on STMicroelectronics STM32 series of SoCs"
-       depends on MACH_STM32MP157
-       default y
-       help
-       Support for thermal framework on STMicroelectronics STM32 series of
-       SoCs. This thermal driver allows to access to general thermal framework
-       functionalities and to acces to SoC sensor functionalities. This
-       configuration is fully dependent of MACH_STM32MP157.
+       tristate "Thermal framework support on STMicroelectronics STM32 series of SoCs"
+       depends on MACH_STM32MP157
+       default y
+       help
+         Support for thermal framework on STMicroelectronics STM32 series of
+         SoCs. This thermal driver allows to access to general thermal framework
+         functionalities and to acces to SoC sensor functionalities. This
+         configuration is fully dependent of MACH_STM32MP157.
index 243ca78..c4cfa3c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ST_THERMAL)               := st_thermal.o
 obj-$(CONFIG_ST_THERMAL_SYSCFG)                += st_thermal_syscfg.o
 obj-$(CONFIG_ST_THERMAL_MEMMAP)                += st_thermal_memmap.o
index bbd73c5..cf9ddc5 100644 (file)
@@ -570,8 +570,7 @@ thermal_unprepare:
 static int stm_thermal_suspend(struct device *dev)
 {
        int ret;
-       struct platform_device *pdev = to_platform_device(dev);
-       struct stm_thermal_sensor *sensor = platform_get_drvdata(pdev);
+       struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
 
        ret = stm_thermal_sensor_off(sensor);
        if (ret)
@@ -585,8 +584,7 @@ static int stm_thermal_suspend(struct device *dev)
 static int stm_thermal_resume(struct device *dev)
 {
        int ret;
-       struct platform_device *pdev = to_platform_device(dev);
-       struct stm_thermal_sensor *sensor = platform_get_drvdata(pdev);
+       struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
 
        ret = stm_thermal_prepare(sensor);
        if (ret)
index 4e67795..304b461 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/io.h>
 #include <linux/delay.h>
 #include <linux/module.h>
index f8740f7..46c2215 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "NVIDIA Tegra thermal drivers"
 depends on ARCH_TEGRA
 
@@ -14,7 +15,7 @@ config TEGRA_BPMP_THERMAL
        tristate "Tegra BPMP thermal sensing"
        depends on TEGRA_BPMP || COMPILE_TEST
        help
-        Enable this option for support for sensing system temperature of NVIDIA
-        Tegra systems-on-chip with the BPMP coprocessor (Tegra186).
+         Enable this option for support for sensing system temperature of NVIDIA
+         Tegra systems-on-chip with the BPMP coprocessor (Tegra186).
 
 endmenu
index 70043a2..fcf70a3 100644 (file)
@@ -1,5 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014 - 2018, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  *     Mikko Perttunen <mperttunen@nvidia.com>
@@ -22,6 +23,8 @@
 #include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #define THERMCTL_LVL0_UP_STATS                 0x10
 #define THERMCTL_LVL0_DN_STATS                 0x14
 
+#define THERMCTL_INTR_STATUS                   0x84
+
+#define TH_INTR_MD0_MASK                       BIT(25)
+#define TH_INTR_MU0_MASK                       BIT(24)
+#define TH_INTR_GD0_MASK                       BIT(17)
+#define TH_INTR_GU0_MASK                       BIT(16)
+#define TH_INTR_CD0_MASK                       BIT(9)
+#define TH_INTR_CU0_MASK                       BIT(8)
+#define TH_INTR_PD0_MASK                       BIT(1)
+#define TH_INTR_PU0_MASK                       BIT(0)
+#define TH_INTR_IGNORE_MASK                    0xFCFCFCFC
+
 #define THERMCTL_STATS_CTL                     0x94
 #define STATS_CTL_CLR_DN                       0x8
 #define STATS_CTL_EN_DN                                0x4
 #define STATS_CTL_CLR_UP                       0x2
 #define STATS_CTL_EN_UP                                0x1
 
+#define OC1_CFG                                        0x310
+#define OC1_CFG_LONG_LATENCY_MASK              BIT(6)
+#define OC1_CFG_HW_RESTORE_MASK                        BIT(5)
+#define OC1_CFG_PWR_GOOD_MASK_MASK             BIT(4)
+#define OC1_CFG_THROTTLE_MODE_MASK             (0x3 << 2)
+#define OC1_CFG_ALARM_POLARITY_MASK            BIT(1)
+#define OC1_CFG_EN_THROTTLE_MASK               BIT(0)
+
+#define OC1_CNT_THRESHOLD                      0x314
+#define OC1_THROTTLE_PERIOD                    0x318
+#define OC1_ALARM_COUNT                                0x31c
+#define OC1_FILTER                             0x320
+#define OC1_STATS                              0x3a8
+
+#define OC_INTR_STATUS                         0x39c
+#define OC_INTR_ENABLE                         0x3a0
+#define OC_INTR_DISABLE                                0x3a4
+#define OC_STATS_CTL                           0x3c4
+#define OC_STATS_CTL_CLR_ALL                   0x2
+#define OC_STATS_CTL_EN_ALL                    0x1
+
+#define OC_INTR_OC1_MASK                       BIT(0)
+#define OC_INTR_OC2_MASK                       BIT(1)
+#define OC_INTR_OC3_MASK                       BIT(2)
+#define OC_INTR_OC4_MASK                       BIT(3)
+#define OC_INTR_OC5_MASK                       BIT(4)
+
 #define THROT_GLOBAL_CFG                       0x400
 #define THROT_GLOBAL_ENB_MASK                  BIT(0)
 
 /* get dividend from the depth */
 #define THROT_DEPTH_DIVIDEND(depth)    ((256 * (100 - (depth)) / 100) - 1)
 
+/* gk20a nv_therm interface N:3 Mapping. Levels defined in tegra124-sochterm.h
+ * level       vector
+ * NONE                3'b000
+ * LOW         3'b001
+ * MED         3'b011
+ * HIGH                3'b111
+ */
+#define THROT_LEVEL_TO_DEPTH(level)    ((0x1 << (level)) - 1)
+
 /* get THROT_PSKIP_xxx offset per LIGHT/HEAVY throt and CPU/GPU dev */
 #define THROT_OFFSET                   0x30
 #define THROT_PSKIP_CTRL(throt, dev)   (THROT_PSKIP_CTRL_LITE_CPU + \
 #define THROT_DELAY_CTRL(throt)                (THROT_DELAY_LITE + \
                                        (THROT_OFFSET * throt))
 
+#define ALARM_OFFSET                   0x14
+#define ALARM_CFG(throt)               (OC1_CFG + \
+                                       (ALARM_OFFSET * (throt - THROTTLE_OC1)))
+
+#define ALARM_CNT_THRESHOLD(throt)     (OC1_CNT_THRESHOLD + \
+                                       (ALARM_OFFSET * (throt - THROTTLE_OC1)))
+
+#define ALARM_THROTTLE_PERIOD(throt)   (OC1_THROTTLE_PERIOD + \
+                                       (ALARM_OFFSET * (throt - THROTTLE_OC1)))
+
+#define ALARM_ALARM_COUNT(throt)       (OC1_ALARM_COUNT + \
+                                       (ALARM_OFFSET * (throt - THROTTLE_OC1)))
+
+#define ALARM_FILTER(throt)            (OC1_FILTER + \
+                                       (ALARM_OFFSET * (throt - THROTTLE_OC1)))
+
+#define ALARM_STATS(throt)             (OC1_STATS + \
+                                       (4 * (throt - THROTTLE_OC1)))
+
 /* get CCROC_THROT_PSKIP_xxx offset per HIGH/MED/LOW vect*/
 #define CCROC_THROT_OFFSET                     0x0c
 #define CCROC_THROT_PSKIP_CTRL_CPU_REG(vect)    (CCROC_THROT_PSKIP_CTRL_CPU + \
 #define THERMCTL_LVL_REGS_SIZE         0x20
 #define THERMCTL_LVL_REG(rg, lv)       ((rg) + ((lv) * THERMCTL_LVL_REGS_SIZE))
 
+#define OC_THROTTLE_MODE_DISABLED      0
+#define OC_THROTTLE_MODE_BRIEF         2
+
 static const int min_low_temp = -127000;
 static const int max_high_temp = 127000;
 
 enum soctherm_throttle_id {
        THROTTLE_LIGHT = 0,
        THROTTLE_HEAVY,
+       THROTTLE_OC1,
+       THROTTLE_OC2,
+       THROTTLE_OC3,
+       THROTTLE_OC4,
+       THROTTLE_OC5, /* OC5 is reserved */
        THROTTLE_SIZE,
 };
 
+enum soctherm_oc_irq_id {
+       TEGRA_SOC_OC_IRQ_1,
+       TEGRA_SOC_OC_IRQ_2,
+       TEGRA_SOC_OC_IRQ_3,
+       TEGRA_SOC_OC_IRQ_4,
+       TEGRA_SOC_OC_IRQ_5,
+       TEGRA_SOC_OC_IRQ_MAX,
+};
+
 enum soctherm_throttle_dev_id {
        THROTTLE_DEV_CPU = 0,
        THROTTLE_DEV_GPU,
@@ -202,6 +289,11 @@ enum soctherm_throttle_dev_id {
 static const char *const throt_names[] = {
        [THROTTLE_LIGHT] = "light",
        [THROTTLE_HEAVY] = "heavy",
+       [THROTTLE_OC1]   = "oc1",
+       [THROTTLE_OC2]   = "oc2",
+       [THROTTLE_OC3]   = "oc3",
+       [THROTTLE_OC4]   = "oc4",
+       [THROTTLE_OC5]   = "oc5",
 };
 
 struct tegra_soctherm;
@@ -213,12 +305,23 @@ struct tegra_thermctl_zone {
        const struct tegra_tsensor_group *sg;
 };
 
+struct soctherm_oc_cfg {
+       u32 active_low;
+       u32 throt_period;
+       u32 alarm_cnt_thresh;
+       u32 alarm_filter;
+       u32 mode;
+       bool intr_en;
+};
+
 struct soctherm_throt_cfg {
        const char *name;
        unsigned int id;
        u8 priority;
        u8 cpu_throt_level;
        u32 cpu_throt_depth;
+       u32 gpu_throt_level;
+       struct soctherm_oc_cfg oc_cfg;
        struct thermal_cooling_device *cdev;
        bool init;
 };
@@ -231,6 +334,9 @@ struct tegra_soctherm {
        void __iomem *clk_regs;
        void __iomem *ccroc_regs;
 
+       int thermal_irq;
+       int edp_irq;
+
        u32 *calib;
        struct thermal_zone_device **thermctl_tzs;
        struct tegra_soctherm_soc *soc;
@@ -238,8 +344,19 @@ struct tegra_soctherm {
        struct soctherm_throt_cfg throt_cfgs[THROTTLE_SIZE];
 
        struct dentry *debugfs_dir;
+
+       struct mutex thermctl_lock;
 };
 
+struct soctherm_oc_irq_chip_data {
+       struct mutex            irq_lock; /* serialize OC IRQs */
+       struct irq_chip         irq_chip;
+       struct irq_domain       *domain;
+       int                     irq_enable;
+};
+
+static struct soctherm_oc_irq_chip_data soc_irq_cdata;
+
 /**
  * ccroc_writel() - writes a value to a CCROC register
  * @ts: pointer to a struct tegra_soctherm
@@ -446,6 +563,24 @@ find_throttle_cfg_by_name(struct tegra_soctherm *ts, const char *name)
        return NULL;
 }
 
+static int tsensor_group_thermtrip_get(struct tegra_soctherm *ts, int id)
+{
+       int i, temp = min_low_temp;
+       struct tsensor_group_thermtrips *tt = ts->soc->thermtrips;
+
+       if (id >= TEGRA124_SOCTHERM_SENSOR_NUM)
+               return temp;
+
+       if (tt) {
+               for (i = 0; i < ts->soc->num_ttgs; i++) {
+                       if (tt[i].id == id)
+                               return tt[i].temp;
+               }
+       }
+
+       return temp;
+}
+
 static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
 {
        struct tegra_thermctl_zone *zone = data;
@@ -464,7 +599,16 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
                return ret;
 
        if (type == THERMAL_TRIP_CRITICAL) {
-               return thermtrip_program(dev, sg, temp);
+               /*
+                * If thermtrips property is set in DT,
+                * doesn't need to program critical type trip to HW,
+                * if not, program critical trip to HW.
+                */
+               if (min_low_temp == tsensor_group_thermtrip_get(ts, sg->id))
+                       return thermtrip_program(dev, sg, temp);
+               else
+                       return 0;
+
        } else if (type == THERMAL_TRIP_HOT) {
                int i;
 
@@ -519,10 +663,60 @@ static int tegra_thermctl_get_trend(void *data, int trip,
        return 0;
 }
 
+static void thermal_irq_enable(struct tegra_thermctl_zone *zn)
+{
+       u32 r;
+
+       /* multiple zones could be handling and setting trips at once */
+       mutex_lock(&zn->ts->thermctl_lock);
+       r = readl(zn->ts->regs + THERMCTL_INTR_ENABLE);
+       r = REG_SET_MASK(r, zn->sg->thermctl_isr_mask, TH_INTR_UP_DN_EN);
+       writel(r, zn->ts->regs + THERMCTL_INTR_ENABLE);
+       mutex_unlock(&zn->ts->thermctl_lock);
+}
+
+static void thermal_irq_disable(struct tegra_thermctl_zone *zn)
+{
+       u32 r;
+
+       /* multiple zones could be handling and setting trips at once */
+       mutex_lock(&zn->ts->thermctl_lock);
+       r = readl(zn->ts->regs + THERMCTL_INTR_DISABLE);
+       r = REG_SET_MASK(r, zn->sg->thermctl_isr_mask, 0);
+       writel(r, zn->ts->regs + THERMCTL_INTR_DISABLE);
+       mutex_unlock(&zn->ts->thermctl_lock);
+}
+
+static int tegra_thermctl_set_trips(void *data, int lo, int hi)
+{
+       struct tegra_thermctl_zone *zone = data;
+       u32 r;
+
+       thermal_irq_disable(zone);
+
+       r = readl(zone->ts->regs + zone->sg->thermctl_lvl0_offset);
+       r = REG_SET_MASK(r, THERMCTL_LVL0_CPU0_EN_MASK, 0);
+       writel(r, zone->ts->regs + zone->sg->thermctl_lvl0_offset);
+
+       lo = enforce_temp_range(zone->dev, lo) / zone->ts->soc->thresh_grain;
+       hi = enforce_temp_range(zone->dev, hi) / zone->ts->soc->thresh_grain;
+       dev_dbg(zone->dev, "%s hi:%d, lo:%d\n", __func__, hi, lo);
+
+       r = REG_SET_MASK(r, zone->sg->thermctl_lvl0_up_thresh_mask, hi);
+       r = REG_SET_MASK(r, zone->sg->thermctl_lvl0_dn_thresh_mask, lo);
+       r = REG_SET_MASK(r, THERMCTL_LVL0_CPU0_EN_MASK, 1);
+       writel(r, zone->ts->regs + zone->sg->thermctl_lvl0_offset);
+
+       thermal_irq_enable(zone);
+
+       return 0;
+}
+
 static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = {
        .get_temp = tegra_thermctl_get_temp,
        .set_trip_temp = tegra_thermctl_set_trip_temp,
        .get_trend = tegra_thermctl_get_trend,
+       .set_trips = tegra_thermctl_set_trips,
 };
 
 static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)
@@ -555,7 +749,8 @@ static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)
  * @dev: struct device * of the SOC_THERM instance
  *
  * Configure the SOC_THERM HW trip points, setting "THERMTRIP"
- * "THROTTLE" trip points , using "critical" or "hot" type trip_temp
+ * "THROTTLE" trip points , using "thermtrips", "critical" or "hot"
+ * type trip_temp
  * from thermal zone.
  * After they have been configured, THERMTRIP or THROTTLE will take
  * action when the configured SoC thermal sensor group reaches a
@@ -577,28 +772,23 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
 {
        struct tegra_soctherm *ts = dev_get_drvdata(dev);
        struct soctherm_throt_cfg *stc;
-       int i, trip, temperature;
-       int ret;
+       int i, trip, temperature, ret;
 
-       ret = tz->ops->get_crit_temp(tz, &temperature);
-       if (ret) {
-               dev_warn(dev, "thermtrip: %s: missing critical temperature\n",
-                        sg->name);
-               goto set_throttle;
-       }
+       /* Get thermtrips. If missing, try to get critical trips. */
+       temperature = tsensor_group_thermtrip_get(ts, sg->id);
+       if (min_low_temp == temperature)
+               if (tz->ops->get_crit_temp(tz, &temperature))
+                       temperature = max_high_temp;
 
        ret = thermtrip_program(dev, sg, temperature);
        if (ret) {
-               dev_err(dev, "thermtrip: %s: error during enable\n",
-                       sg->name);
+               dev_err(dev, "thermtrip: %s: error during enable\n", sg->name);
                return ret;
        }
 
-       dev_info(dev,
-                "thermtrip: will shut down when %s reaches %d mC\n",
+       dev_info(dev, "thermtrip: will shut down when %s reaches %d mC\n",
                 sg->name, temperature);
 
-set_throttle:
        ret = get_hot_temp(tz, &trip, &temperature);
        if (ret) {
                dev_info(dev, "throttrip: %s: missing hot temperature\n",
@@ -606,7 +796,7 @@ set_throttle:
                return 0;
        }
 
-       for (i = 0; i < THROTTLE_SIZE; i++) {
+       for (i = 0; i < THROTTLE_OC1; i++) {
                struct thermal_cooling_device *cdev;
 
                if (!ts->throt_cfgs[i].init)
@@ -638,6 +828,461 @@ set_throttle:
        return 0;
 }
 
+static irqreturn_t soctherm_thermal_isr(int irq, void *dev_id)
+{
+       struct tegra_soctherm *ts = dev_id;
+       u32 r;
+
+       /* Case for no lock:
+        * Although interrupts are enabled in set_trips, there is still no need
+        * to lock here because the interrupts are disabled before programming
+        * new trip points. Hence there cant be a interrupt on the same sensor.
+        * An interrupt can however occur on a sensor while trips are being
+        * programmed on a different one. This beign a LEVEL interrupt won't
+        * cause a new interrupt but this is taken care of by the re-reading of
+        * the STATUS register in the thread function.
+        */
+       r = readl(ts->regs + THERMCTL_INTR_STATUS);
+       writel(r, ts->regs + THERMCTL_INTR_DISABLE);
+
+       return IRQ_WAKE_THREAD;
+}
+
+/**
+ * soctherm_thermal_isr_thread() - Handles a thermal interrupt request
+ * @irq:       The interrupt number being requested; not used
+ * @dev_id:    Opaque pointer to tegra_soctherm;
+ *
+ * Clears the interrupt status register if there are expected
+ * interrupt bits set.
+ * The interrupt(s) are then handled by updating the corresponding
+ * thermal zones.
+ *
+ * An error is logged if any unexpected interrupt bits are set.
+ *
+ * Disabled interrupts are re-enabled.
+ *
+ * Return: %IRQ_HANDLED. Interrupt was handled and no further processing
+ * is needed.
+ */
+static irqreturn_t soctherm_thermal_isr_thread(int irq, void *dev_id)
+{
+       struct tegra_soctherm *ts = dev_id;
+       struct thermal_zone_device *tz;
+       u32 st, ex = 0, cp = 0, gp = 0, pl = 0, me = 0;
+
+       st = readl(ts->regs + THERMCTL_INTR_STATUS);
+
+       /* deliberately clear expected interrupts handled in SW */
+       cp |= st & TH_INTR_CD0_MASK;
+       cp |= st & TH_INTR_CU0_MASK;
+
+       gp |= st & TH_INTR_GD0_MASK;
+       gp |= st & TH_INTR_GU0_MASK;
+
+       pl |= st & TH_INTR_PD0_MASK;
+       pl |= st & TH_INTR_PU0_MASK;
+
+       me |= st & TH_INTR_MD0_MASK;
+       me |= st & TH_INTR_MU0_MASK;
+
+       ex |= cp | gp | pl | me;
+       if (ex) {
+               writel(ex, ts->regs + THERMCTL_INTR_STATUS);
+               st &= ~ex;
+
+               if (cp) {
+                       tz = ts->thermctl_tzs[TEGRA124_SOCTHERM_SENSOR_CPU];
+                       thermal_zone_device_update(tz,
+                                                  THERMAL_EVENT_UNSPECIFIED);
+               }
+
+               if (gp) {
+                       tz = ts->thermctl_tzs[TEGRA124_SOCTHERM_SENSOR_GPU];
+                       thermal_zone_device_update(tz,
+                                                  THERMAL_EVENT_UNSPECIFIED);
+               }
+
+               if (pl) {
+                       tz = ts->thermctl_tzs[TEGRA124_SOCTHERM_SENSOR_PLLX];
+                       thermal_zone_device_update(tz,
+                                                  THERMAL_EVENT_UNSPECIFIED);
+               }
+
+               if (me) {
+                       tz = ts->thermctl_tzs[TEGRA124_SOCTHERM_SENSOR_MEM];
+                       thermal_zone_device_update(tz,
+                                                  THERMAL_EVENT_UNSPECIFIED);
+               }
+       }
+
+       /* deliberately ignore expected interrupts NOT handled in SW */
+       ex |= TH_INTR_IGNORE_MASK;
+       st &= ~ex;
+
+       if (st) {
+               /* Whine about any other unexpected INTR bits still set */
+               pr_err("soctherm: Ignored unexpected INTRs 0x%08x\n", st);
+               writel(st, ts->regs + THERMCTL_INTR_STATUS);
+       }
+
+       return IRQ_HANDLED;
+}
+
+/**
+ * soctherm_oc_intr_enable() - Enables the soctherm over-current interrupt
+ * @alarm:             The soctherm throttle id
+ * @enable:            Flag indicating enable the soctherm over-current
+ *                     interrupt or disable it
+ *
+ * Enables a specific over-current pins @alarm to raise an interrupt if the flag
+ * is set and the alarm corresponds to OC1, OC2, OC3, or OC4.
+ */
+static void soctherm_oc_intr_enable(struct tegra_soctherm *ts,
+                                   enum soctherm_throttle_id alarm,
+                                   bool enable)
+{
+       u32 r;
+
+       if (!enable)
+               return;
+
+       r = readl(ts->regs + OC_INTR_ENABLE);
+       switch (alarm) {
+       case THROTTLE_OC1:
+               r = REG_SET_MASK(r, OC_INTR_OC1_MASK, 1);
+               break;
+       case THROTTLE_OC2:
+               r = REG_SET_MASK(r, OC_INTR_OC2_MASK, 1);
+               break;
+       case THROTTLE_OC3:
+               r = REG_SET_MASK(r, OC_INTR_OC3_MASK, 1);
+               break;
+       case THROTTLE_OC4:
+               r = REG_SET_MASK(r, OC_INTR_OC4_MASK, 1);
+               break;
+       default:
+               r = 0;
+               break;
+       }
+       writel(r, ts->regs + OC_INTR_ENABLE);
+}
+
+/**
+ * soctherm_handle_alarm() - Handles soctherm alarms
+ * @alarm:             The soctherm throttle id
+ *
+ * "Handles" over-current alarms (OC1, OC2, OC3, and OC4) by printing
+ * a warning or informative message.
+ *
+ * Return: -EINVAL for @alarm = THROTTLE_OC3, otherwise 0 (success).
+ */
+static int soctherm_handle_alarm(enum soctherm_throttle_id alarm)
+{
+       int rv = -EINVAL;
+
+       switch (alarm) {
+       case THROTTLE_OC1:
+               pr_debug("soctherm: Successfully handled OC1 alarm\n");
+               rv = 0;
+               break;
+
+       case THROTTLE_OC2:
+               pr_debug("soctherm: Successfully handled OC2 alarm\n");
+               rv = 0;
+               break;
+
+       case THROTTLE_OC3:
+               pr_debug("soctherm: Successfully handled OC3 alarm\n");
+               rv = 0;
+               break;
+
+       case THROTTLE_OC4:
+               pr_debug("soctherm: Successfully handled OC4 alarm\n");
+               rv = 0;
+               break;
+
+       default:
+               break;
+       }
+
+       if (rv)
+               pr_err("soctherm: ERROR in handling %s alarm\n",
+                      throt_names[alarm]);
+
+       return rv;
+}
+
+/**
+ * soctherm_edp_isr_thread() - log an over-current interrupt request
+ * @irq:       OC irq number. Currently not being used. See description
+ * @arg:       a void pointer for callback, currently not being used
+ *
+ * Over-current events are handled in hardware. This function is called to log
+ * and handle any OC events that happened. Additionally, it checks every
+ * over-current interrupt registers for registers are set but
+ * was not expected (i.e. any discrepancy in interrupt status) by the function,
+ * the discrepancy will logged.
+ *
+ * Return: %IRQ_HANDLED
+ */
+static irqreturn_t soctherm_edp_isr_thread(int irq, void *arg)
+{
+       struct tegra_soctherm *ts = arg;
+       u32 st, ex, oc1, oc2, oc3, oc4;
+
+       st = readl(ts->regs + OC_INTR_STATUS);
+
+       /* deliberately clear expected interrupts handled in SW */
+       oc1 = st & OC_INTR_OC1_MASK;
+       oc2 = st & OC_INTR_OC2_MASK;
+       oc3 = st & OC_INTR_OC3_MASK;
+       oc4 = st & OC_INTR_OC4_MASK;
+       ex = oc1 | oc2 | oc3 | oc4;
+
+       pr_err("soctherm: OC ALARM 0x%08x\n", ex);
+       if (ex) {
+               writel(st, ts->regs + OC_INTR_STATUS);
+               st &= ~ex;
+
+               if (oc1 && !soctherm_handle_alarm(THROTTLE_OC1))
+                       soctherm_oc_intr_enable(ts, THROTTLE_OC1, true);
+
+               if (oc2 && !soctherm_handle_alarm(THROTTLE_OC2))
+                       soctherm_oc_intr_enable(ts, THROTTLE_OC2, true);
+
+               if (oc3 && !soctherm_handle_alarm(THROTTLE_OC3))
+                       soctherm_oc_intr_enable(ts, THROTTLE_OC3, true);
+
+               if (oc4 && !soctherm_handle_alarm(THROTTLE_OC4))
+                       soctherm_oc_intr_enable(ts, THROTTLE_OC4, true);
+
+               if (oc1 && soc_irq_cdata.irq_enable & BIT(0))
+                       handle_nested_irq(
+                               irq_find_mapping(soc_irq_cdata.domain, 0));
+
+               if (oc2 && soc_irq_cdata.irq_enable & BIT(1))
+                       handle_nested_irq(
+                               irq_find_mapping(soc_irq_cdata.domain, 1));
+
+               if (oc3 && soc_irq_cdata.irq_enable & BIT(2))
+                       handle_nested_irq(
+                               irq_find_mapping(soc_irq_cdata.domain, 2));
+
+               if (oc4 && soc_irq_cdata.irq_enable & BIT(3))
+                       handle_nested_irq(
+                               irq_find_mapping(soc_irq_cdata.domain, 3));
+       }
+
+       if (st) {
+               pr_err("soctherm: Ignored unexpected OC ALARM 0x%08x\n", st);
+               writel(st, ts->regs + OC_INTR_STATUS);
+       }
+
+       return IRQ_HANDLED;
+}
+
+/**
+ * soctherm_edp_isr() - Disables any active interrupts
+ * @irq:       The interrupt request number
+ * @arg:       Opaque pointer to an argument
+ *
+ * Writes to the OC_INTR_DISABLE register the over current interrupt status,
+ * masking any asserted interrupts. Doing this prevents the same interrupts
+ * from triggering this isr repeatedly. The thread woken by this isr will
+ * handle asserted interrupts and subsequently unmask/re-enable them.
+ *
+ * The OC_INTR_DISABLE register indicates which OC interrupts
+ * have been disabled.
+ *
+ * Return: %IRQ_WAKE_THREAD, handler requests to wake the handler thread
+ */
+static irqreturn_t soctherm_edp_isr(int irq, void *arg)
+{
+       struct tegra_soctherm *ts = arg;
+       u32 r;
+
+       if (!ts)
+               return IRQ_NONE;
+
+       r = readl(ts->regs + OC_INTR_STATUS);
+       writel(r, ts->regs + OC_INTR_DISABLE);
+
+       return IRQ_WAKE_THREAD;
+}
+
+/**
+ * soctherm_oc_irq_lock() - locks the over-current interrupt request
+ * @data:      Interrupt request data
+ *
+ * Looks up the chip data from @data and locks the mutex associated with
+ * a particular over-current interrupt request.
+ */
+static void soctherm_oc_irq_lock(struct irq_data *data)
+{
+       struct soctherm_oc_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+
+       mutex_lock(&d->irq_lock);
+}
+
+/**
+ * soctherm_oc_irq_sync_unlock() - Unlocks the OC interrupt request
+ * @data:              Interrupt request data
+ *
+ * Looks up the interrupt request data @data and unlocks the mutex associated
+ * with a particular over-current interrupt request.
+ */
+static void soctherm_oc_irq_sync_unlock(struct irq_data *data)
+{
+       struct soctherm_oc_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+
+       mutex_unlock(&d->irq_lock);
+}
+
+/**
+ * soctherm_oc_irq_enable() - Enables the SOC_THERM over-current interrupt queue
+ * @data:       irq_data structure of the chip
+ *
+ * Sets the irq_enable bit of SOC_THERM allowing SOC_THERM
+ * to respond to over-current interrupts.
+ *
+ */
+static void soctherm_oc_irq_enable(struct irq_data *data)
+{
+       struct soctherm_oc_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+
+       d->irq_enable |= BIT(data->hwirq);
+}
+
+/**
+ * soctherm_oc_irq_disable() - Disables overcurrent interrupt requests
+ * @irq_data:  The interrupt request information
+ *
+ * Clears the interrupt request enable bit of the overcurrent
+ * interrupt request chip data.
+ *
+ * Return: Nothing is returned (void)
+ */
+static void soctherm_oc_irq_disable(struct irq_data *data)
+{
+       struct soctherm_oc_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+
+       d->irq_enable &= ~BIT(data->hwirq);
+}
+
+static int soctherm_oc_irq_set_type(struct irq_data *data, unsigned int type)
+{
+       return 0;
+}
+
+/**
+ * soctherm_oc_irq_map() - SOC_THERM interrupt request domain mapper
+ * @h:         Interrupt request domain
+ * @virq:      Virtual interrupt request number
+ * @hw:                Hardware interrupt request number
+ *
+ * Mapping callback function for SOC_THERM's irq_domain. When a SOC_THERM
+ * interrupt request is called, the irq_domain takes the request's virtual
+ * request number (much like a virtual memory address) and maps it to a
+ * physical hardware request number.
+ *
+ * When a mapping doesn't already exist for a virtual request number, the
+ * irq_domain calls this function to associate the virtual request number with
+ * a hardware request number.
+ *
+ * Return: 0
+ */
+static int soctherm_oc_irq_map(struct irq_domain *h, unsigned int virq,
+               irq_hw_number_t hw)
+{
+       struct soctherm_oc_irq_chip_data *data = h->host_data;
+
+       irq_set_chip_data(virq, data);
+       irq_set_chip(virq, &data->irq_chip);
+       irq_set_nested_thread(virq, 1);
+       return 0;
+}
+
+/**
+ * soctherm_irq_domain_xlate_twocell() - xlate for soctherm interrupts
+ * @d:      Interrupt request domain
+ * @intspec:    Array of u32s from DTs "interrupt" property
+ * @intsize:    Number of values inside the intspec array
+ * @out_hwirq:  HW IRQ value associated with this interrupt
+ * @out_type:   The IRQ SENSE type for this interrupt.
+ *
+ * This Device Tree IRQ specifier translation function will translate a
+ * specific "interrupt" as defined by 2 DT values where the cell values map
+ * the hwirq number + 1 and linux irq flags. Since the output is the hwirq
+ * number, this function will subtract 1 from the value listed in DT.
+ *
+ * Return: 0
+ */
+static int soctherm_irq_domain_xlate_twocell(struct irq_domain *d,
+       struct device_node *ctrlr, const u32 *intspec, unsigned int intsize,
+       irq_hw_number_t *out_hwirq, unsigned int *out_type)
+{
+       if (WARN_ON(intsize < 2))
+               return -EINVAL;
+
+       /*
+        * The HW value is 1 index less than the DT IRQ values.
+        * i.e. OC4 goes to HW index 3.
+        */
+       *out_hwirq = intspec[0] - 1;
+       *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK;
+       return 0;
+}
+
+static const struct irq_domain_ops soctherm_oc_domain_ops = {
+       .map    = soctherm_oc_irq_map,
+       .xlate  = soctherm_irq_domain_xlate_twocell,
+};
+
+/**
+ * soctherm_oc_int_init() - Initial enabling of the over
+ * current interrupts
+ * @np:        The devicetree node for soctherm
+ * @num_irqs:  The number of new interrupt requests
+ *
+ * Sets the over current interrupt request chip data
+ *
+ * Return: 0 on success or if overcurrent interrupts are not enabled,
+ * -ENOMEM (out of memory), or irq_base if the function failed to
+ * allocate the irqs
+ */
+static int soctherm_oc_int_init(struct device_node *np, int num_irqs)
+{
+       if (!num_irqs) {
+               pr_info("%s(): OC interrupts are not enabled\n", __func__);
+               return 0;
+       }
+
+       mutex_init(&soc_irq_cdata.irq_lock);
+       soc_irq_cdata.irq_enable = 0;
+
+       soc_irq_cdata.irq_chip.name = "soc_therm_oc";
+       soc_irq_cdata.irq_chip.irq_bus_lock = soctherm_oc_irq_lock;
+       soc_irq_cdata.irq_chip.irq_bus_sync_unlock =
+               soctherm_oc_irq_sync_unlock;
+       soc_irq_cdata.irq_chip.irq_disable = soctherm_oc_irq_disable;
+       soc_irq_cdata.irq_chip.irq_enable = soctherm_oc_irq_enable;
+       soc_irq_cdata.irq_chip.irq_set_type = soctherm_oc_irq_set_type;
+       soc_irq_cdata.irq_chip.irq_set_wake = NULL;
+
+       soc_irq_cdata.domain = irq_domain_add_linear(np, num_irqs,
+                                                    &soctherm_oc_domain_ops,
+                                                    &soc_irq_cdata);
+
+       if (!soc_irq_cdata.domain) {
+               pr_err("%s: Failed to create IRQ domain\n", __func__);
+               return -ENOMEM;
+       }
+
+       pr_debug("%s(): OC interrupts enabled successful\n", __func__);
+       return 0;
+}
+
 #ifdef CONFIG_DEBUG_FS
 static int regs_show(struct seq_file *s, void *data)
 {
@@ -929,6 +1574,120 @@ static const struct thermal_cooling_device_ops throt_cooling_ops = {
        .set_cur_state = throt_set_cdev_state,
 };
 
+static int soctherm_thermtrips_parse(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct tegra_soctherm *ts = dev_get_drvdata(dev);
+       struct tsensor_group_thermtrips *tt = ts->soc->thermtrips;
+       const int max_num_prop = ts->soc->num_ttgs * 2;
+       u32 *tlb;
+       int i, j, n, ret;
+
+       if (!tt)
+               return -ENOMEM;
+
+       n = of_property_count_u32_elems(dev->of_node, "nvidia,thermtrips");
+       if (n <= 0) {
+               dev_info(dev,
+                        "missing thermtrips, will use critical trips as shut down temp\n");
+               return n;
+       }
+
+       n = min(max_num_prop, n);
+
+       tlb = devm_kcalloc(&pdev->dev, max_num_prop, sizeof(u32), GFP_KERNEL);
+       if (!tlb)
+               return -ENOMEM;
+       ret = of_property_read_u32_array(dev->of_node, "nvidia,thermtrips",
+                                        tlb, n);
+       if (ret) {
+               dev_err(dev, "invalid num ele: thermtrips:%d\n", ret);
+               return ret;
+       }
+
+       i = 0;
+       for (j = 0; j < n; j = j + 2) {
+               if (tlb[j] >= TEGRA124_SOCTHERM_SENSOR_NUM)
+                       continue;
+
+               tt[i].id = tlb[j];
+               tt[i].temp = tlb[j + 1];
+               i++;
+       }
+
+       return 0;
+}
+
+static void soctherm_oc_cfg_parse(struct device *dev,
+                               struct device_node *np_oc,
+                               struct soctherm_throt_cfg *stc)
+{
+       u32 val;
+
+       if (of_property_read_bool(np_oc, "nvidia,polarity-active-low"))
+               stc->oc_cfg.active_low = 1;
+       else
+               stc->oc_cfg.active_low = 0;
+
+       if (!of_property_read_u32(np_oc, "nvidia,count-threshold", &val)) {
+               stc->oc_cfg.intr_en = 1;
+               stc->oc_cfg.alarm_cnt_thresh = val;
+       }
+
+       if (!of_property_read_u32(np_oc, "nvidia,throttle-period-us", &val))
+               stc->oc_cfg.throt_period = val;
+
+       if (!of_property_read_u32(np_oc, "nvidia,alarm-filter", &val))
+               stc->oc_cfg.alarm_filter = val;
+
+       /* BRIEF throttling by default, do not support STICKY */
+       stc->oc_cfg.mode = OC_THROTTLE_MODE_BRIEF;
+}
+
+static int soctherm_throt_cfg_parse(struct device *dev,
+                                   struct device_node *np,
+                                   struct soctherm_throt_cfg *stc)
+{
+       struct tegra_soctherm *ts = dev_get_drvdata(dev);
+       int ret;
+       u32 val;
+
+       ret = of_property_read_u32(np, "nvidia,priority", &val);
+       if (ret) {
+               dev_err(dev, "throttle-cfg: %s: invalid priority\n", stc->name);
+               return -EINVAL;
+       }
+       stc->priority = val;
+
+       ret = of_property_read_u32(np, ts->soc->use_ccroc ?
+                                  "nvidia,cpu-throt-level" :
+                                  "nvidia,cpu-throt-percent", &val);
+       if (!ret) {
+               if (ts->soc->use_ccroc &&
+                   val <= TEGRA_SOCTHERM_THROT_LEVEL_HIGH)
+                       stc->cpu_throt_level = val;
+               else if (!ts->soc->use_ccroc && val <= 100)
+                       stc->cpu_throt_depth = val;
+               else
+                       goto err;
+       } else {
+               goto err;
+       }
+
+       ret = of_property_read_u32(np, "nvidia,gpu-throt-level", &val);
+       if (!ret && val <= TEGRA_SOCTHERM_THROT_LEVEL_HIGH)
+               stc->gpu_throt_level = val;
+       else
+               goto err;
+
+       return 0;
+
+err:
+       dev_err(dev, "throttle-cfg: %s: no throt prop or invalid prop\n",
+               stc->name);
+       return -EINVAL;
+}
+
 /**
  * soctherm_init_hw_throt_cdev() - Parse the HW throttle configurations
  * and register them as cooling devices.
@@ -939,8 +1698,7 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
        struct tegra_soctherm *ts = dev_get_drvdata(dev);
        struct device_node *np_stc, *np_stcc;
        const char *name;
-       u32 val;
-       int i, r;
+       int i;
 
        for (i = 0; i < THROTTLE_SIZE; i++) {
                ts->throt_cfgs[i].name = throt_names[i];
@@ -958,6 +1716,7 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
        for_each_child_of_node(np_stc, np_stcc) {
                struct soctherm_throt_cfg *stc;
                struct thermal_cooling_device *tcd;
+               int err;
 
                name = np_stcc->name;
                stc = find_throttle_cfg_by_name(ts, name);
@@ -967,51 +1726,34 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
                        continue;
                }
 
-               r = of_property_read_u32(np_stcc, "nvidia,priority", &val);
-               if (r) {
-                       dev_info(dev,
-                                "throttle-cfg: %s: missing priority\n", name);
-                       continue;
+               if (stc->init) {
+                       dev_err(dev, "throttle-cfg: %s: redefined!\n", name);
+                       of_node_put(np_stcc);
+                       break;
                }
-               stc->priority = val;
-
-               if (ts->soc->use_ccroc) {
-                       r = of_property_read_u32(np_stcc,
-                                                "nvidia,cpu-throt-level",
-                                                &val);
-                       if (r) {
-                               dev_info(dev,
-                                        "throttle-cfg: %s: missing cpu-throt-level\n",
-                                        name);
-                               continue;
-                       }
-                       stc->cpu_throt_level = val;
+
+               err = soctherm_throt_cfg_parse(dev, np_stcc, stc);
+               if (err)
+                       continue;
+
+               if (stc->id >= THROTTLE_OC1) {
+                       soctherm_oc_cfg_parse(dev, np_stcc, stc);
+                       stc->init = true;
                } else {
-                       r = of_property_read_u32(np_stcc,
-                                                "nvidia,cpu-throt-percent",
-                                                &val);
-                       if (r) {
-                               dev_info(dev,
-                                        "throttle-cfg: %s: missing cpu-throt-percent\n",
-                                        name);
-                               continue;
-                       }
-                       stc->cpu_throt_depth = val;
-               }
 
-               tcd = thermal_of_cooling_device_register(np_stcc,
+                       tcd = thermal_of_cooling_device_register(np_stcc,
                                                         (char *)name, ts,
                                                         &throt_cooling_ops);
-               of_node_put(np_stcc);
-               if (IS_ERR_OR_NULL(tcd)) {
-                       dev_err(dev,
-                               "throttle-cfg: %s: failed to register cooling device\n",
-                               name);
-                       continue;
+                       if (IS_ERR_OR_NULL(tcd)) {
+                               dev_err(dev,
+                                       "throttle-cfg: %s: failed to register cooling device\n",
+                                       name);
+                               continue;
+                       }
+                       stc->cdev = tcd;
+                       stc->init = true;
                }
 
-               stc->cdev = tcd;
-               stc->init = true;
        }
 
        of_node_put(np_stc);
@@ -1141,6 +1883,50 @@ static void throttlectl_cpu_mn(struct tegra_soctherm *ts,
 }
 
 /**
+ * throttlectl_gpu_level_select() - selects throttling level for GPU
+ * @throt: the LIGHT/HEAVY of throttle event id
+ *
+ * This function programs soctherm's interface to GK20a NV_THERM to select
+ * pre-configured "Low", "Medium" or "Heavy" throttle levels.
+ *
+ * Return: boolean true if HW was programmed
+ */
+static void throttlectl_gpu_level_select(struct tegra_soctherm *ts,
+                                        enum soctherm_throttle_id throt)
+{
+       u32 r, level, throt_vect;
+
+       level = ts->throt_cfgs[throt].gpu_throt_level;
+       throt_vect = THROT_LEVEL_TO_DEPTH(level);
+       r = readl(ts->regs + THROT_PSKIP_CTRL(throt, THROTTLE_DEV_GPU));
+       r = REG_SET_MASK(r, THROT_PSKIP_CTRL_ENABLE_MASK, 1);
+       r = REG_SET_MASK(r, THROT_PSKIP_CTRL_VECT_GPU_MASK, throt_vect);
+       writel(r, ts->regs + THROT_PSKIP_CTRL(throt, THROTTLE_DEV_GPU));
+}
+
+static int soctherm_oc_cfg_program(struct tegra_soctherm *ts,
+                                     enum soctherm_throttle_id throt)
+{
+       u32 r;
+       struct soctherm_oc_cfg *oc = &ts->throt_cfgs[throt].oc_cfg;
+
+       if (oc->mode == OC_THROTTLE_MODE_DISABLED)
+               return -EINVAL;
+
+       r = REG_SET_MASK(0, OC1_CFG_HW_RESTORE_MASK, 1);
+       r = REG_SET_MASK(r, OC1_CFG_THROTTLE_MODE_MASK, oc->mode);
+       r = REG_SET_MASK(r, OC1_CFG_ALARM_POLARITY_MASK, oc->active_low);
+       r = REG_SET_MASK(r, OC1_CFG_EN_THROTTLE_MASK, 1);
+       writel(r, ts->regs + ALARM_CFG(throt));
+       writel(oc->throt_period, ts->regs + ALARM_THROTTLE_PERIOD(throt));
+       writel(oc->alarm_cnt_thresh, ts->regs + ALARM_CNT_THRESHOLD(throt));
+       writel(oc->alarm_filter, ts->regs + ALARM_FILTER(throt));
+       soctherm_oc_intr_enable(ts, throt, oc->intr_en);
+
+       return 0;
+}
+
+/**
  * soctherm_throttle_program() - programs pulse skippers' configuration
  * @throt: the LIGHT/HEAVY of the throttle event id.
  *
@@ -1156,12 +1942,17 @@ static void soctherm_throttle_program(struct tegra_soctherm *ts,
        if (!stc.init)
                return;
 
+       if ((throt >= THROTTLE_OC1) && (soctherm_oc_cfg_program(ts, throt)))
+               return;
+
        /* Setup PSKIP parameters */
        if (ts->soc->use_ccroc)
                throttlectl_cpu_level_select(ts, throt);
        else
                throttlectl_cpu_mn(ts, throt);
 
+       throttlectl_gpu_level_select(ts, throt);
+
        r = REG_SET_MASK(0, THROT_PRIORITY_LITE_PRIO_MASK, stc.priority);
        writel(r, ts->regs + THROT_PRIORITY_CTRL(throt));
 
@@ -1215,6 +2006,57 @@ static void tegra_soctherm_throttle(struct device *dev)
        writel(v, ts->regs + THERMCTL_STATS_CTL);
 }
 
+static int soctherm_interrupts_init(struct platform_device *pdev,
+                                   struct tegra_soctherm *tegra)
+{
+       struct device_node *np = pdev->dev.of_node;
+       int ret;
+
+       ret = soctherm_oc_int_init(np, TEGRA_SOC_OC_IRQ_MAX);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "soctherm_oc_int_init failed\n");
+               return ret;
+       }
+
+       tegra->thermal_irq = platform_get_irq(pdev, 0);
+       if (tegra->thermal_irq < 0) {
+               dev_dbg(&pdev->dev, "get 'thermal_irq' failed.\n");
+               return 0;
+       }
+
+       tegra->edp_irq = platform_get_irq(pdev, 1);
+       if (tegra->edp_irq < 0) {
+               dev_dbg(&pdev->dev, "get 'edp_irq' failed.\n");
+               return 0;
+       }
+
+       ret = devm_request_threaded_irq(&pdev->dev,
+                                       tegra->thermal_irq,
+                                       soctherm_thermal_isr,
+                                       soctherm_thermal_isr_thread,
+                                       IRQF_ONESHOT,
+                                       dev_name(&pdev->dev),
+                                       tegra);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "request_irq 'thermal_irq' failed.\n");
+               return ret;
+       }
+
+       ret = devm_request_threaded_irq(&pdev->dev,
+                                       tegra->edp_irq,
+                                       soctherm_edp_isr,
+                                       soctherm_edp_isr_thread,
+                                       IRQF_ONESHOT,
+                                       "soctherm_edp",
+                                       tegra);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
+               return ret;
+       }
+
+       return 0;
+}
+
 static void soctherm_init(struct platform_device *pdev)
 {
        struct tegra_soctherm *tegra = platform_get_drvdata(pdev);
@@ -1292,6 +2134,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
        if (!tegra)
                return -ENOMEM;
 
+       mutex_init(&tegra->thermctl_lock);
        dev_set_drvdata(&pdev->dev, tegra);
 
        tegra->soc = soc;
@@ -1370,6 +2213,8 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
        if (err)
                return err;
 
+       soctherm_thermtrips_parse(pdev);
+
        soctherm_init_hw_throt_cdev(pdev);
 
        soctherm_init(pdev);
@@ -1406,6 +2251,8 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
                        goto disable_clocks;
        }
 
+       err = soctherm_interrupts_init(pdev, tegra);
+
        soctherm_debug_init(pdev);
 
        return 0;
index e96ca73..70501e7 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
  *
 #define THERMCTL_THERMTRIP_CTL                 0x80
 /* BITs are defined in device file */
 
+#define THERMCTL_INTR_ENABLE                   0x88
+#define THERMCTL_INTR_DISABLE                  0x8c
+#define TH_INTR_UP_DN_EN                       0x3
+#define THERM_IRQ_MEM_MASK                     (TH_INTR_UP_DN_EN << 24)
+#define THERM_IRQ_GPU_MASK                     (TH_INTR_UP_DN_EN << 16)
+#define THERM_IRQ_CPU_MASK                     (TH_INTR_UP_DN_EN << 8)
+#define THERM_IRQ_TSENSE_MASK                  (TH_INTR_UP_DN_EN << 0)
+
 #define SENSOR_PDIV                            0x1c0
 #define SENSOR_PDIV_CPU_MASK                   (0xf << 12)
 #define SENSOR_PDIV_GPU_MASK                   (0xf << 8)
@@ -70,6 +79,7 @@ struct tegra_tsensor_group {
        u32 thermtrip_enable_mask;
        u32 thermtrip_any_en_mask;
        u32 thermtrip_threshold_mask;
+       u32 thermctl_isr_mask;
        u16 thermctl_lvl0_offset;
        u32 thermctl_lvl0_up_thresh_mask;
        u32 thermctl_lvl0_dn_thresh_mask;
@@ -92,6 +102,11 @@ struct tegra_tsensor {
        const struct tegra_tsensor_group *group;
 };
 
+struct tsensor_group_thermtrips {
+       u8 id;
+       u32 temp;
+};
+
 struct tegra_soctherm_fuse {
        u32 fuse_base_cp_mask, fuse_base_cp_shift;
        u32 fuse_base_ft_mask, fuse_base_ft_shift;
@@ -113,6 +128,7 @@ struct tegra_soctherm_soc {
        const int thresh_grain;
        const unsigned int bptt;
        const bool use_ccroc;
+       struct tsensor_group_thermtrips *thermtrips;
 };
 
 int tegra_calc_shared_calib(const struct tegra_soctherm_fuse *tfuse,
index 3676863..20ad27f 100644 (file)
@@ -1,5 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -55,6 +56,7 @@ static const struct tegra_tsensor_group tegra124_tsensor_group_cpu = {
        .thermtrip_any_en_mask = TEGRA124_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA124_THERMTRIP_CPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA124_THERMTRIP_CPU_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_CPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_CPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA124_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA124_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -73,6 +75,7 @@ static const struct tegra_tsensor_group tegra124_tsensor_group_gpu = {
        .thermtrip_any_en_mask = TEGRA124_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA124_THERMTRIP_GPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA124_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_GPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_GPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA124_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA124_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -89,6 +92,7 @@ static const struct tegra_tsensor_group tegra124_tsensor_group_pll = {
        .thermtrip_any_en_mask = TEGRA124_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA124_THERMTRIP_TSENSE_EN_MASK,
        .thermtrip_threshold_mask = TEGRA124_THERMTRIP_TSENSE_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_TSENSE_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_TSENSE,
        .thermctl_lvl0_up_thresh_mask = TEGRA124_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA124_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -107,6 +111,7 @@ static const struct tegra_tsensor_group tegra124_tsensor_group_mem = {
        .thermtrip_any_en_mask = TEGRA124_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA124_THERMTRIP_MEM_EN_MASK,
        .thermtrip_threshold_mask = TEGRA124_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_MEM_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_MEM,
        .thermctl_lvl0_up_thresh_mask = TEGRA124_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA124_THERMCTL_LVL0_DN_THRESH_MASK,
index 97fa305..b76308f 100644 (file)
@@ -1,5 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -55,6 +56,7 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_cpu = {
        .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA132_THERMTRIP_CPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA132_THERMTRIP_CPU_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_CPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_CPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -73,6 +75,7 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_gpu = {
        .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA132_THERMTRIP_GPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_GPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_GPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -89,6 +92,7 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_pll = {
        .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA132_THERMTRIP_TSENSE_EN_MASK,
        .thermtrip_threshold_mask = TEGRA132_THERMTRIP_TSENSE_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_TSENSE_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_TSENSE,
        .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -107,6 +111,7 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_mem = {
        .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA132_THERMTRIP_MEM_EN_MASK,
        .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_MEM_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_MEM,
        .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
index ad53169..d31b500 100644 (file)
@@ -1,5 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -56,6 +57,7 @@ static const struct tegra_tsensor_group tegra210_tsensor_group_cpu = {
        .thermtrip_any_en_mask = TEGRA210_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA210_THERMTRIP_CPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA210_THERMTRIP_CPU_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_CPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_CPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA210_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA210_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -74,6 +76,7 @@ static const struct tegra_tsensor_group tegra210_tsensor_group_gpu = {
        .thermtrip_any_en_mask = TEGRA210_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA210_THERMTRIP_GPU_EN_MASK,
        .thermtrip_threshold_mask = TEGRA210_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_GPU_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_GPU,
        .thermctl_lvl0_up_thresh_mask = TEGRA210_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA210_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -90,6 +93,7 @@ static const struct tegra_tsensor_group tegra210_tsensor_group_pll = {
        .thermtrip_any_en_mask = TEGRA210_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA210_THERMTRIP_TSENSE_EN_MASK,
        .thermtrip_threshold_mask = TEGRA210_THERMTRIP_TSENSE_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_TSENSE_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_TSENSE,
        .thermctl_lvl0_up_thresh_mask = TEGRA210_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA210_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -108,6 +112,7 @@ static const struct tegra_tsensor_group tegra210_tsensor_group_mem = {
        .thermtrip_any_en_mask = TEGRA210_THERMTRIP_ANY_EN_MASK,
        .thermtrip_enable_mask = TEGRA210_THERMTRIP_MEM_EN_MASK,
        .thermtrip_threshold_mask = TEGRA210_THERMTRIP_GPUMEM_THRESH_MASK,
+       .thermctl_isr_mask = THERM_IRQ_MEM_MASK,
        .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_MEM,
        .thermctl_lvl0_up_thresh_mask = TEGRA210_THERMCTL_LVL0_UP_THRESH_MASK,
        .thermctl_lvl0_dn_thresh_mask = TEGRA210_THERMCTL_LVL0_DN_THRESH_MASK,
@@ -203,6 +208,13 @@ static const struct tegra_soctherm_fuse tegra210_soctherm_fuse = {
        .fuse_spare_realignment = 0,
 };
 
+struct tsensor_group_thermtrips tegra210_tsensor_thermtrips[] = {
+       {.id = TEGRA124_SOCTHERM_SENSOR_NUM},
+       {.id = TEGRA124_SOCTHERM_SENSOR_NUM},
+       {.id = TEGRA124_SOCTHERM_SENSOR_NUM},
+       {.id = TEGRA124_SOCTHERM_SENSOR_NUM},
+};
+
 const struct tegra_soctherm_soc tegra210_soctherm = {
        .tsensors = tegra210_tsensors,
        .num_tsensors = ARRAY_SIZE(tegra210_tsensors),
@@ -212,4 +224,5 @@ const struct tegra_soctherm_soc tegra210_soctherm = {
        .thresh_grain = TEGRA210_THRESH_GRAIN,
        .bptt = TEGRA210_BPTT,
        .use_ccroc = false,
+       .thermtrips = tegra210_tsensor_thermtrips,
 };
index e22fc60..deb244f 100644 (file)
@@ -29,6 +29,9 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
        int temp, temp_hi, temp_lo, adc_hi, adc_lo;
        int i;
 
+       if (!gti->lookup_table)
+               return val;
+
        for (i = 0; i < gti->nlookup_table; i++) {
                if (val >= gti->lookup_table[2 * i + 1])
                        break;
@@ -81,9 +84,9 @@ static int gadc_thermal_read_linear_lookup_table(struct device *dev,
 
        ntable = of_property_count_elems_of_size(np, "temperature-lookup-table",
                                                 sizeof(u32));
-       if (ntable < 0) {
-               dev_err(dev, "Lookup table is not provided\n");
-               return ntable;
+       if (ntable <= 0) {
+               dev_notice(dev, "no lookup table, assuming DAC channel returns milliCelcius\n");
+               return 0;
        }
 
        if (ntable % 2) {
index 6590bb5..46cfb7d 100644 (file)
@@ -266,7 +266,7 @@ static int __init thermal_register_governors(void)
        return thermal_gov_power_allocator_register();
 }
 
-static void thermal_unregister_governors(void)
+static void __init thermal_unregister_governors(void)
 {
        thermal_gov_step_wise_unregister();
        thermal_gov_fair_share_unregister();
@@ -941,7 +941,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
  */
 static struct thermal_cooling_device *
 __thermal_cooling_device_register(struct device_node *np,
-                                 char *type, void *devdata,
+                                 const char *type, void *devdata,
                                  const struct thermal_cooling_device_ops *ops)
 {
        struct thermal_cooling_device *cdev;
@@ -1015,7 +1015,7 @@ __thermal_cooling_device_register(struct device_node *np,
  * ERR_PTR. Caller must check return value with IS_ERR*() helpers.
  */
 struct thermal_cooling_device *
-thermal_cooling_device_register(char *type, void *devdata,
+thermal_cooling_device_register(const char *type, void *devdata,
                                const struct thermal_cooling_device_ops *ops)
 {
        return __thermal_cooling_device_register(NULL, type, devdata, ops);
@@ -1039,13 +1039,62 @@ EXPORT_SYMBOL_GPL(thermal_cooling_device_register);
  */
 struct thermal_cooling_device *
 thermal_of_cooling_device_register(struct device_node *np,
-                                  char *type, void *devdata,
+                                  const char *type, void *devdata,
                                   const struct thermal_cooling_device_ops *ops)
 {
        return __thermal_cooling_device_register(np, type, devdata, ops);
 }
 EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register);
 
+static void thermal_cooling_device_release(struct device *dev, void *res)
+{
+       thermal_cooling_device_unregister(
+                               *(struct thermal_cooling_device **)res);
+}
+
+/**
+ * devm_thermal_of_cooling_device_register() - register an OF thermal cooling
+ *                                            device
+ * @dev:       a valid struct device pointer of a sensor device.
+ * @np:                a pointer to a device tree node.
+ * @type:      the thermal cooling device type.
+ * @devdata:   device private data.
+ * @ops:       standard thermal cooling devices callbacks.
+ *
+ * This function will register a cooling device with device tree node reference.
+ * This interface function adds a new thermal cooling device (fan/processor/...)
+ * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself
+ * to all the thermal zone devices registered at the same time.
+ *
+ * Return: a pointer to the created struct thermal_cooling_device or an
+ * ERR_PTR. Caller must check return value with IS_ERR*() helpers.
+ */
+struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev,
+                               struct device_node *np,
+                               char *type, void *devdata,
+                               const struct thermal_cooling_device_ops *ops)
+{
+       struct thermal_cooling_device **ptr, *tcd;
+
+       ptr = devres_alloc(thermal_cooling_device_release, sizeof(*ptr),
+                          GFP_KERNEL);
+       if (!ptr)
+               return ERR_PTR(-ENOMEM);
+
+       tcd = __thermal_cooling_device_register(np, type, devdata, ops);
+       if (IS_ERR(tcd)) {
+               devres_free(ptr);
+               return tcd;
+       }
+
+       *ptr = tcd;
+       devres_add(dev, ptr);
+
+       return tcd;
+}
+EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register);
+
 static void __unbind(struct thermal_zone_device *tz, int mask,
                     struct thermal_cooling_device *cdev)
 {
@@ -1494,6 +1543,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
                             unsigned long mode, void *_unused)
 {
        struct thermal_zone_device *tz;
+       enum thermal_device_mode tz_mode;
 
        switch (mode) {
        case PM_HIBERNATION_PREPARE:
@@ -1506,6 +1556,13 @@ static int thermal_pm_notify(struct notifier_block *nb,
        case PM_POST_SUSPEND:
                atomic_set(&in_suspend, 0);
                list_for_each_entry(tz, &thermal_tz_list, node) {
+                       tz_mode = THERMAL_DEVICE_ENABLED;
+                       if (tz->ops->get_mode)
+                               tz->ops->get_mode(tz, &tz_mode);
+
+                       if (tz_mode == THERMAL_DEVICE_DISABLED)
+                               continue;
+
                        thermal_zone_device_init(tz);
                        thermal_zone_device_update(tz,
                                                   THERMAL_EVENT_UNSPECIFIED);
@@ -1563,19 +1620,4 @@ error:
        mutex_destroy(&poweroff_lock);
        return result;
 }
-
-static void __exit thermal_exit(void)
-{
-       unregister_pm_notifier(&thermal_pm_nb);
-       of_thermal_destroy_zones();
-       genetlink_exit();
-       class_unregister(&thermal_class);
-       thermal_unregister_governors();
-       ida_destroy(&thermal_tz_ida);
-       ida_destroy(&thermal_cdev_ida);
-       mutex_destroy(&thermal_list_lock);
-       mutex_destroy(&thermal_governor_lock);
-}
-
 fs_initcall(thermal_init);
-module_exit(thermal_exit);
diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
new file mode 100644 (file)
index 0000000..de3ccee
--- /dev/null
@@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ */
+
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/thermal.h>
+
+struct thermal_mmio {
+       void __iomem *mmio_base;
+       u32 (*read_mmio)(void __iomem *mmio_base);
+       u32 mask;
+       int factor;
+};
+
+static u32 thermal_mmio_readb(void __iomem *mmio_base)
+{
+       return readb(mmio_base);
+}
+
+static int thermal_mmio_get_temperature(void *private, int *temp)
+{
+       int t;
+       struct thermal_mmio *sensor =
+               (struct thermal_mmio *)private;
+
+       t = sensor->read_mmio(sensor->mmio_base) & sensor->mask;
+       t *= sensor->factor;
+
+       *temp = t;
+
+       return 0;
+}
+
+static struct thermal_zone_of_device_ops thermal_mmio_ops = {
+       .get_temp = thermal_mmio_get_temperature,
+};
+
+static int thermal_mmio_probe(struct platform_device *pdev)
+{
+       struct resource *resource;
+       struct thermal_mmio *sensor;
+       int (*sensor_init_func)(struct platform_device *pdev,
+                               struct thermal_mmio *sensor);
+       struct thermal_zone_device *thermal_zone;
+       int ret;
+       int temperature;
+
+       sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL);
+       if (!sensor)
+               return -ENOMEM;
+
+       resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (IS_ERR(resource)) {
+               dev_err(&pdev->dev,
+                       "fail to get platform memory resource (%ld)\n",
+                       PTR_ERR(resource));
+               return PTR_ERR(resource);
+       }
+
+       sensor->mmio_base = devm_ioremap_resource(&pdev->dev, resource);
+       if (IS_ERR(sensor->mmio_base)) {
+               dev_err(&pdev->dev, "failed to ioremap memory (%ld)\n",
+                       PTR_ERR(sensor->mmio_base));
+               return PTR_ERR(sensor->mmio_base);
+       }
+
+       sensor_init_func = device_get_match_data(&pdev->dev);
+       if (sensor_init_func) {
+               ret = sensor_init_func(pdev, sensor);
+               if (ret) {
+                       dev_err(&pdev->dev,
+                               "failed to initialize sensor (%d)\n",
+                               ret);
+                       return ret;
+               }
+       }
+
+       thermal_zone = devm_thermal_zone_of_sensor_register(&pdev->dev,
+                                                           0,
+                                                           sensor,
+                                                           &thermal_mmio_ops);
+       if (IS_ERR(thermal_zone)) {
+               dev_err(&pdev->dev,
+                       "failed to register sensor (%ld)\n",
+                       PTR_ERR(thermal_zone));
+               return PTR_ERR(thermal_zone);
+       }
+
+       thermal_mmio_get_temperature(sensor, &temperature);
+       dev_info(&pdev->dev,
+                "thermal mmio sensor %s registered, current temperature: %d\n",
+                pdev->name, temperature);
+
+       return 0;
+}
+
+static int al_thermal_init(struct platform_device *pdev,
+                          struct thermal_mmio *sensor)
+{
+       sensor->read_mmio = thermal_mmio_readb;
+       sensor->mask = 0xff;
+       sensor->factor = 1000;
+
+       return 0;
+}
+
+static const struct of_device_id thermal_mmio_id_table[] = {
+       { .compatible = "amazon,al-thermal", .data = al_thermal_init},
+       {}
+};
+MODULE_DEVICE_TABLE(of, thermal_mmio_id_table);
+
+static struct platform_driver thermal_mmio_driver = {
+       .probe = thermal_mmio_probe,
+       .driver = {
+               .name = "thermal-mmio",
+               .owner = THIS_MODULE,
+               .of_match_table = of_match_ptr(thermal_mmio_id_table),
+       },
+};
+
+module_platform_driver(thermal_mmio_driver);
+
+MODULE_AUTHOR("Talel Shenhar <talel@amazon.com>");
+MODULE_DESCRIPTION("Thermal MMIO Driver");
+MODULE_LICENSE("GPL v2");
index fe0e877..683a702 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config TI_SOC_THERMAL
        tristate "Texas Instruments SoCs temperature sensor driver"
        help
index f4869c3..fd9adca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig THUNDERBOLT
        tristate "Thunderbolt support"
        depends on PCI
index 833bdee..3f55cb3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-${CONFIG_THUNDERBOLT} := thunderbolt.o
 thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel.o eeprom.o
 thunderbolt-objs += domain.o dma_port.o icm.o property.o xdomain.o lc.o
index cac1ead..27fbe62 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Thunderbolt driver - NHI driver
  *
index 75155bd..31f53fa 100644 (file)
@@ -53,7 +53,6 @@ device_initcall(hvc_sbi_init);
 static int __init hvc_sbi_console_init(void)
 {
        hvc_instantiate(0, 0, &hvc_sbi_ops);
-       add_preferred_console("hvc", 0, NULL);
 
        return 0;
 }
index 59e82e6..573b205 100644 (file)
@@ -527,8 +527,12 @@ void __handle_sysrq(int key, bool check_mask)
 {
        struct sysrq_key_op *op_p;
        int orig_log_level;
+       int orig_suppress_printk;
        int i;
 
+       orig_suppress_printk = suppress_printk;
+       suppress_printk = 0;
+
        rcu_sysrq_start();
        rcu_read_lock();
        /*
@@ -574,6 +578,8 @@ void __handle_sysrq(int key, bool check_mask)
        }
        rcu_read_unlock();
        rcu_sysrq_end();
+
+       suppress_printk = orig_suppress_printk;
 }
 
 void handle_sysrq(int key)
index 7e8dc78..202ee81 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig UIO
        tristate "Userspace I/O drivers"
        depends on MMU
index ca8a94f..38183ac 100644 (file)
@@ -40,8 +40,6 @@ struct da8xx_ohci_hcd {
        struct phy *usb11_phy;
        struct regulator *vbus_reg;
        struct notifier_block nb;
-       unsigned int reg_enabled;
-       struct gpio_desc *vbus_gpio;
        struct gpio_desc *oc_gpio;
 };
 
@@ -92,29 +90,21 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on)
        struct device *dev = hcd->self.controller;
        int ret;
 
-       if (da8xx_ohci->vbus_gpio) {
-               gpiod_set_value_cansleep(da8xx_ohci->vbus_gpio, on);
-               return 0;
-       }
-
        if (!da8xx_ohci->vbus_reg)
                return 0;
 
-       if (on && !da8xx_ohci->reg_enabled) {
+       if (on) {
                ret = regulator_enable(da8xx_ohci->vbus_reg);
                if (ret) {
                        dev_err(dev, "Failed to enable regulator: %d\n", ret);
                        return ret;
                }
-               da8xx_ohci->reg_enabled = 1;
-
-       } else if (!on && da8xx_ohci->reg_enabled) {
+       } else {
                ret = regulator_disable(da8xx_ohci->vbus_reg);
                if (ret) {
                        dev_err(dev, "Failed  to disable regulator: %d\n", ret);
                        return ret;
                }
-               da8xx_ohci->reg_enabled = 0;
        }
 
        return 0;
@@ -124,9 +114,6 @@ static int ohci_da8xx_get_power(struct usb_hcd *hcd)
 {
        struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd);
 
-       if (da8xx_ohci->vbus_gpio)
-               return gpiod_get_value_cansleep(da8xx_ohci->vbus_gpio);
-
        if (da8xx_ohci->vbus_reg)
                return regulator_is_enabled(da8xx_ohci->vbus_reg);
 
@@ -159,9 +146,6 @@ static int ohci_da8xx_has_set_power(struct usb_hcd *hcd)
 {
        struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd);
 
-       if (da8xx_ohci->vbus_gpio)
-               return 1;
-
        if (da8xx_ohci->vbus_reg)
                return 1;
 
@@ -206,12 +190,18 @@ static int ohci_da8xx_regulator_event(struct notifier_block *nb,
        return 0;
 }
 
-static irqreturn_t ohci_da8xx_oc_handler(int irq, void *data)
+static irqreturn_t ohci_da8xx_oc_thread(int irq, void *data)
 {
        struct da8xx_ohci_hcd *da8xx_ohci = data;
+       struct device *dev = da8xx_ohci->hcd->self.controller;
+       int ret;
 
-       if (gpiod_get_value(da8xx_ohci->oc_gpio))
-               gpiod_set_value(da8xx_ohci->vbus_gpio, 0);
+       if (gpiod_get_value_cansleep(da8xx_ohci->oc_gpio) &&
+           da8xx_ohci->vbus_reg) {
+               ret = regulator_disable(da8xx_ohci->vbus_reg);
+               if (ret)
+                       dev_err(dev, "Failed to disable regulator: %d\n", ret);
+       }
 
        return IRQ_HANDLED;
 }
@@ -424,11 +414,6 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
                }
        }
 
-       da8xx_ohci->vbus_gpio = devm_gpiod_get_optional(dev, "vbus",
-                                                       GPIOD_OUT_HIGH);
-       if (IS_ERR(da8xx_ohci->vbus_gpio))
-               goto err;
-
        da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN);
        if (IS_ERR(da8xx_ohci->oc_gpio))
                goto err;
@@ -438,8 +423,9 @@ static int ohci_da8xx_probe(struct platform_device *pdev)
                if (oc_irq < 0)
                        goto err;
 
-               error = devm_request_irq(dev, oc_irq, ohci_da8xx_oc_handler,
-                               IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+               error = devm_request_threaded_irq(dev, oc_irq, NULL,
+                               ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING |
+                               IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                                "OHCI over-current indicator", da8xx_ohci);
                if (error)
                        goto err;
index c5126a4..a67ddcb 100644 (file)
@@ -6,7 +6,7 @@
 # Rewritten to use lists instead of if-statements.
 #
 
-ccflags-y := -Idrivers/scsi
+ccflags-y := -I $(srctree)/drivers/scsi
 
 obj-$(CONFIG_USB_UAS)          += uas.o
 obj-$(CONFIG_USB_STORAGE)      += usb-storage.o
index afac258..259e053 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # UWB device configuration
 #
index d69da16..d26fb9b 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_UWB_I1480U)       += dfu/ i1480-est.o
index 3798d77..e5a7a45 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VFIO_IOMMU_TYPE1
        tristate
        depends on VFIO
index 14fdb10..ba94a07 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config VFIO_MDEV
        tristate "Mediated device driver framework"
index fa2d5ea..101516f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o
 
index d0f8e4f..ac3c1dd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VFIO_PCI
        tristate "VFIO support for PCI devices"
        depends on VFIO && PCI && EVENTFD
index 9662c06..f027f8a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o
 vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
index bb30128..dc1a3c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VFIO_PLATFORM
        tristate "VFIO support for platform devices"
        depends on VFIO && EVENTFD && (ARM || ARM64)
index 392e3c0..1edbe9e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VFIO_PLATFORM_CALXEDAXGMAC_RESET
        tristate "VFIO support for calxeda xgmac reset"
        depends on VFIO_PLATFORM
index b580885..3d03ccb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VHOST_NET
        tristate "Host kernel accelerator for virtio net"
        depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP)
index 6a4490c..c1fe36a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VHOST_RING
        tristate
        ---help---
index a94d700..08ad0d1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Helpers for the host side of a virtio ring.
  *
index 83d3d27..427a993 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Video configuration
 #
index 3ed1d90..8b081d6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Backlight & LCD drivers configuration
 #
index deb824b..1ef8b6f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Backlight Lowlevel Control Abstraction
  *
index 4b40c6a..151b187 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * LCD Lowlevel Control Abstraction
  *
index 53b8cee..fb45f86 100644 (file)
@@ -155,21 +155,6 @@ static const struct backlight_ops pwm_backlight_ops = {
 #ifdef CONFIG_OF
 #define PWM_LUMINANCE_SCALE    10000 /* luminance scale */
 
-/* An integer based power function */
-static u64 int_pow(u64 base, int exp)
-{
-       u64 result = 1;
-
-       while (exp) {
-               if (exp & 1)
-                       result *= base;
-               exp >>= 1;
-               base *= base;
-       }
-
-       return result;
-}
-
 /*
  * CIE lightness to PWM conversion.
  *
index 787792c..c10e17f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Video configuration
 #
index 45ad925..ff886e9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/drivers/video/dummycon.c -- A dummy console driver
  *
index 7f2526b..00dddf6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * newport_con.c: Abscon for newport hardware
  * 
index ff45dca..84c3ca3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/drivers/video/console/sticore.c -
  *     core code for console driver using HP's STI firmware
index bf6b77b..1b2f5f3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # fbdev configuration
 #
index 6cc4686..7944348 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* $Id: aty128fb.c,v 1.1.1.1.36.1 1999/12/11 09:03:05 Exp $
  *  linux/drivers/video/aty128fb.c -- Frame buffer device for ATI Rage128
  *
index 7aa9720..436f10f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* bw2.c: BWTWO frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 65f7c15..9f3be02 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Frame buffer driver for the Carmine GPU.
  *
index a6dce1a..d80d99d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* cg14.c: CGFOURTEEN frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 6d42def..09f616d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* cg3.c: CGTHREE frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 0296c21..d5888ae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* cg6.c: CGSIX (GX, GXplus, TGX) frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 0ef633e..5449469 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Cobalt/SEAD3 LCD frame buffer driver.
  *
  *  Copyright (C) 2008  Yoichi Yuasa <yuasa@linux-mips.org>
  *  Copyright (C) 2012  MIPS Technologies, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This 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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <linux/delay.h>
 #include <linux/fb.h>
index 5505fa0..8da517e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/string.h>
index 9e529cc..9f39f0c 100644 (file)
@@ -477,8 +477,12 @@ static int efifb_probe(struct platform_device *dev)
                 * If the UEFI memory map covers the efifb region, we may only
                 * remap it using the attributes the memory map prescribes.
                 */
-               mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB;
-               mem_flags &= md.attribute;
+               md.attribute &= EFI_MEMORY_UC | EFI_MEMORY_WC |
+                               EFI_MEMORY_WT | EFI_MEMORY_WB;
+               if (md.attribute) {
+                       mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB;
+                       mem_flags &= md.attribute;
+               }
        }
        if (mem_flags & EFI_MEMORY_WC)
                info->screen_base = ioremap_wc(efifb_fix.smem_start,
index d9e816d..1bddcc2 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/console.h>
 #include <linux/mm.h>
 
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 #include <asm/pgtable.h>
 #include <mach/hardware.h>
 
index b7aee0c..cd2d1db 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* ffb.c: Creator/Elite3D frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 1e85552..b36b94b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Geode family framebuffer configuration
 #
index f438546..37527a1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Frame buffer device for IBM GXT4500P/6500P and GXT4000P/6000P
  * display adaptors
index 9230db9..a79af8f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     HP300 Topcat framebuffer support (derived from macfb of all things)
  *     Phil Blundell <philb@gnu.org> 1998
index f6d7b04..24d3280 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * i740fb - framebuffer driver for Intel740
  * Copyright (c) 2011 Ondrej Zary
index 2fd66f5..b05abe6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Kyro framebuffer driver
 #
index 446ac33..5b1141a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* leo.c: LEO frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index f9c00eb..f39088e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the Linux video drivers.
 # 5 Aug 1999, James Simmons, <mailto:jsimmons@edgeglobal.com>
 # Rewritten to use lists instead of if-statements.
index 0fb280e..34e2659 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
index b380a39..765e805 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
index 9ff9be8..5617c01 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400
index 0d5cb85..9cb0685 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400
index d11b5e6..c76bef0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400
index f64e1d5..d2a81a2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
index f108ae6..df3309f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
index bf5ce04..eda893b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
index 9948ca2..c7aaca1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400
index 5707ed0..6496a66 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the MB862xx framebuffer driver
 #
index d7ae5a9..3e8e7ff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the 2700G controller driver.
 
 obj-y                  += mbxfb.o
index 1b5e80c..9041ffd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig MMP_DISP
        tristate "Marvell MMP Display Subsystem support"
        depends on CPU_PXA910 || CPU_MMP2
index 924dd09..84204c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MMP_DISP) += mmp_disp.o hw/ panel/ fb/
 
 mmp_disp-y             += core.o
index 3a6bb65..0ffc1b7 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/drivers/video/mmp/common.c
  * This driver is a common framework for Marvell Display Controller
  *
  * Copyright (C) 2012 Marvell Technology Group Ltd.
  * Authors: Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/slab.h>
index 985e1a7..39944eb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if MMP_DISP
 
 config MMP_FB
index 709fd1f..b1b1386 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MMP_FB)  += mmpfb.o
index ee212be..e5b56f2 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/drivers/video/mmp/fb/mmpfb.c
  * Framebuffer driver for Marvell Display controller.
  *
  * Copyright (C) 2012 Marvell Technology Group Ltd.
  * Authors: Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
index 88c23c1..a6111d1 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * linux/drivers/video/mmp/fb/mmpfb.h
  * Framebuffer driver for Marvell Display controller.
  *
  * Copyright (C) 2012 Marvell Technology Group Ltd.
  * Authors: Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _MMP_FB_H_
index fcb7111..4d018cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if MMP_DISP
 
 config MMP_DISP_CONTROLLER
index 0000a71..5a7c6be 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MMP_DISP_CONTROLLER)  += mmp_ctrl.o
 obj-$(CONFIG_MMP_DISP_SPI)        += mmp_spi.o
index fcdbb2d..87d943f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/drivers/video/mmp/hw/mmp_ctrl.c
  * Marvell MMP series Display Controller support
@@ -6,20 +7,6 @@
  * Authors:  Guoqing Li <ligq@marvell.com>
  *          Lisa Du <cldu@marvell.com>
  *          Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <linux/module.h>
 #include <linux/moduleparam.h>
index 56fdeab..e9ec45c 100644 (file)
@@ -1,25 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * drivers/video/mmp/hw/mmp_ctrl.h
  *
- *
  * Copyright (C) 2012 Marvell Technology Group Ltd.
  * Authors:  Guoqing Li <ligq@marvell.com>
  *          Lisa Du <cldu@marvell.com>
  *          Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _MMP_CTRL_H_
index e62ca7b..bbb75de 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/drivers/video/mmp/hw/mmp_spi.c
  * using the spi in LCD controler for commands send
@@ -6,20 +7,6 @@
  * Authors:  Guoqing Li <ligq@marvell.com>
  *          Lisa Du <cldu@marvell.com>
  *          Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 #include <linux/errno.h>
 #include <linux/delay.h>
index 2f91611..6a21aee 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MMP_PANEL_TPOHVGA)    += tpo_tj032md01bw.o
index f7e85d1..34fae58 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/drivers/video/mmp/panel/tpo_tj032md01bw.c
  * active panel using spi interface to do init
@@ -6,20 +7,6 @@
  * Authors:  Guoqing Li <ligq@marvell.com>
  *          Lisa Du <cldu@marvell.com>
  *          Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/module.h>
index ca14793..df2a5d0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FB_OMAP
        tristate "OMAP frame buffer support"
        depends on FB
index 4de381f..cd5dc27 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 if OF && (ARCH_OMAP2PLUS || COMPILE_TEST)
 
 source "drivers/video/fbdev/omap2/omapfb/Kconfig"
index 71ab5ac..c31cc48 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += omapfb/
index 0410e07..69f9cb0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config OMAP2_VRFB
        bool
 
index 3df8736..8c1c5a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "OMAPFB Panel and Encoder Drivers"
        depends on FB_OMAP2_DSS
 
index c4283e9..8c18cc5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* p9100.c: P9100 frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index 4e4d6a0..73d92d8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * drivers/video/pvr2fb.c
  *
index e09770f..3f6fcce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the S3 Savage framebuffer driver
 #
index f7c0046..3d53fb8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SiS framebuffer device driver
 #
index f0cb279..4e22ae3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/drivers/video/sstfb.c -- voodoo graphics frame buffer
  *
index c98d8a5..7897f86 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* tcx.c: TCX frame buffer driver
  *
  * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
index fbbf26b..fdbb1ea 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  * tdfxfb.c
index f4b7455..da74bf6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Frame buffer driver for Trident TGUI, Blade and Image series
  *
index d707fdb..439565c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * A framebuffer driver for VBE 2.0+ compliant video cards
  *
index cc21a65..22e9e46 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_FB_LE80578) += vmlfb.o
 obj-$(CONFIG_FB_CARILLO_RANCH) += crvml.o
 
index dc1f9cf..d9c08f6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * framebuffer driver for VBE 2.0 compliant graphic boards
  *
index b041eb2..e2b2062 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
  * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
index d1f6196..6d6f8c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Logo configuration
 #
index 36aa050..141f15a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 /*
  *  Linux logo to be displayed on boot
index 8d9cdfb..363af2e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Virtualization support drivers
 #
index d3f7b25..fd33124 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for drivers that support virtualization
 #
index 6446bca..93d5beb 100644 (file)
@@ -215,6 +215,9 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
         * hypervisor.
         */
        lb_offset = param.local_vaddr & (PAGE_SIZE - 1);
+       if (param.count == 0 ||
+           param.count > U64_MAX - lb_offset - PAGE_SIZE + 1)
+               return -EINVAL;
        num_pages = (param.count + lb_offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
        /* Allocate the buffers we need */
@@ -331,8 +334,8 @@ static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
        struct fsl_hv_ioctl_prop param;
        char __user *upath, *upropname;
        void __user *upropval;
-       char *path = NULL, *propname = NULL;
-       void *propval = NULL;
+       char *path, *propname;
+       void *propval;
        int ret = 0;
 
        /* Get the parameters from the user. */
@@ -344,32 +347,30 @@ static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
        upropval = (void __user *)(uintptr_t)param.propval;
 
        path = strndup_user(upath, FH_DTPROP_MAX_PATHLEN);
-       if (IS_ERR(path)) {
-               ret = PTR_ERR(path);
-               goto out;
-       }
+       if (IS_ERR(path))
+               return PTR_ERR(path);
 
        propname = strndup_user(upropname, FH_DTPROP_MAX_PATHLEN);
        if (IS_ERR(propname)) {
                ret = PTR_ERR(propname);
-               goto out;
+               goto err_free_path;
        }
 
        if (param.proplen > FH_DTPROP_MAX_PROPLEN) {
                ret = -EINVAL;
-               goto out;
+               goto err_free_propname;
        }
 
        propval = kmalloc(param.proplen, GFP_KERNEL);
        if (!propval) {
                ret = -ENOMEM;
-               goto out;
+               goto err_free_propname;
        }
 
        if (set) {
                if (copy_from_user(propval, upropval, param.proplen)) {
                        ret = -EFAULT;
-                       goto out;
+                       goto err_free_propval;
                }
 
                param.ret = fh_partition_set_dtprop(param.handle,
@@ -388,7 +389,7 @@ static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
                        if (copy_to_user(upropval, propval, param.proplen) ||
                            put_user(param.proplen, &p->proplen)) {
                                ret = -EFAULT;
-                               goto out;
+                               goto err_free_propval;
                        }
                }
        }
@@ -396,10 +397,12 @@ static long ioctl_dtprop(struct fsl_hv_ioctl_prop __user *p, int set)
        if (put_user(param.ret, &p->ret))
                ret = -EFAULT;
 
-out:
-       kfree(path);
+err_free_propval:
        kfree(propval);
+err_free_propname:
        kfree(propname);
+err_free_path:
+       kfree(path);
 
        return ret;
 }
index fffd318..cc32988 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VBOXGUEST
        tristate "Virtual Box Guest integration support"
        depends on X86 && PCI && INPUT
index 203b8f4..8042792 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 vboxguest-y := vboxguest_linux.o vboxguest_core.o vboxguest_utils.o
 
 obj-$(CONFIG_VBOXGUEST) += vboxguest.o
index 3589764..9aea44e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VIRTIO
        tristate
        ---help---
index 98b30f5..a977e32 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/virtio.h>
 #include <linux/spinlock.h>
 #include <linux/virtio_config.h>
index 3a0468f..5ae5296 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/virtio.h>
 #include <linux/virtio_config.h>
index 1f5812b..d702c44 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Unisys visorbus configuration
 #
index e011620..e7f9492 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "TI VLYNQ"
        depends on AR7
 
index b3f6114..d9ce5b2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for kernel vlynq drivers
 #
index a6a6f95..7cb9ec6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # VME configuration.
 #
index d7bfcb9..8bfe4b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the VME bridge device drivers.
 #
index 7616313..7a255f7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 comment "VME Board Drivers"
 
 config VMIVME_7805
index 4365834..8712238 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the VME board drivers.
 #
index f6ddc37..cb3baed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 comment "VME Bridge Drivers"
 
 config VME_CA91CX42
index b074542..0a6cf84 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VME_CA91CX42)     += vme_ca91cx42.o
 obj-$(CONFIG_VME_TSI148)       += vme_tsi148.o
 obj-$(CONFIG_VME_FAKE)         += vme_fake.o
index dbb41f4..03dd575 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig W1
        tristate "Dallas's 1-wire support"
        depends on HAS_IOMEM
index 6bb0b54..1ff0d42 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Dallas's 1-wire bus.
 #
index 00827d2..7ae2605 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 1-wire bus master configuration
 #
index e22fded..37aaad2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 1-wire slaves configuration
 #
index 7ea6037..ffe7545 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 #
 # Watchdog device configuration
index 689b8a0..c8e3ab0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     ALi M7101 PMU Computer Watchdog Timer driver
  *
index c5b9aae..45047e5 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Watchdog driver for Alphascale ASM9260.
  *
  * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/bitops.h>
index b5b078b..b973b31 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* cpwd.c - driver implementation for hardware watchdog
  * timers found on Sun Microsystems CP1400 and CP1500 boards.
  *
index 806a04a..181440b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Watchdog driver for z/VM and LPAR using the diag 288 interface.
  *
index dd139cd..9067998 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
+#include <linux/of.h>
 #include <linux/watchdog.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
@@ -176,6 +177,14 @@ static int __init ixp4xx_wdt_init(void)
 {
        int ret;
 
+       /*
+        * FIXME: we bail out on device tree boot but this really needs
+        * to be fixed in a nicer way: this registers the MDIO bus before
+        * even matching the driver infrastructure, we should only probe
+        * detected hardware.
+        */
+       if (of_have_populated_dt())
+               return -ENODEV;
        if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) {
                pr_err("Rev. A0 IXP42x CPU detected - watchdog disabled\n");
 
index a3415cf..1b2cf5b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PC Watchdog Driver
  * by Ken Hollis (khollis@bitgate.com)
index 8938b3f..205c3c6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PIKA FPGA based Watchdog Timer
  *
index f7f7a7a..41a2a11 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* riowd.c - driver for hw watchdog inside Super I/O of RIO
  *
  * Copyright (C) 2001, 2008 David S. Miller (davem@davemloft.net)
index e79a409..734cf29 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Watchdog driver for CSR SiRFprimaII and SiRFatlasVI
  *
  * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index 838b66a..ec6558b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Xen driver support"
        depends on XEN
 
index 8145a59..cfb5de3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/pci.h>
 #include <linux/usb.h>
 #include <linux/usb/ehci_def.h>
index 9243a90..89d60f8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * EFI support for Xen.
  *
index 62be55c..92508d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y += events.o
 
 events-y += events_base.o
index 084e458..ff9b510 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Xen event channels
  *
index d7d34fd..25c053b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /******************************************************************************
  * features.c
  *
index 5bb01a6..cd04668 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Handle extern requests for shutdown, reboot and sysrq
  */
index b24ddac..1ff38d8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /******************************************************************************
  * privcmd.c
  *
index 04e7b3b..64d7479 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Xen implementation for transcendent memory (tmem)
  *
index fdc9e67..00ab1ec 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012 Intel Corporation
  *    Author: Liu Jinsong <jinsong.liu@intel.com>
  *    Author: Jiang Yunhong <yunhong.jiang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 4fc886c..7457213 100644 (file)
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012 Intel Corporation
  *    Author: Liu Jinsong <jinsong.liu@intel.com>
  *    Author: Jiang Yunhong <yunhong.jiang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 23f7f6e..833b2d2 100644 (file)
@@ -697,7 +697,7 @@ static int xen_pcibk_xenbus_probe(struct xenbus_device *dev,
        /* We need to force a call to our callback here in case
         * xend already configured us!
         */
-       xen_pcibk_be_watch(&pdev->be_watch, NULL, 0);
+       xen_pcibk_be_watch(&pdev->be_watch, NULL, NULL);
 
 out:
        return err;
index bbef194..3be4e74 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * xen-stub.c - stub drivers to reserve space for Xen
  *
@@ -7,17 +8,6 @@
  *
  * Copyright (C) 2012 Oracle Inc
  *    Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This 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, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
  */
 
 #include <linux/kernel.h>
index 0782ff3..faf452d 100644 (file)
@@ -465,7 +465,6 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
        struct watch_adapter *watch;
        char *path, *token;
        int err, rc;
-       LIST_HEAD(staging_q);
 
        path = u->u.buffer + sizeof(u->u.msg);
        token = memchr(path, 0, u->u.msg.len);
@@ -523,7 +522,6 @@ static ssize_t xenbus_file_write(struct file *filp,
        uint32_t msg_type;
        int rc = len;
        int ret;
-       LIST_HEAD(staging_q);
 
        /*
         * We're expecting usermode to be writing properly formed
index 07896f4..a7d90a7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #define DPRINTK(fmt, ...)                              \
index 1a83010..8490644 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XENFS) += xenfs.o
 
 xenfs-y                          = super.o
index 71ddfb4..20c1448 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  xenfs.c - a filesystem for passing info between the a domain and
  *  the hypervisor.
index 19bc753..2b6ed29 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Zorro configuration
 #
index 11045d8..ac2ec45 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config 9P_FS
        tristate "Plan 9 Resource Sharing Support (9P2000)"
        depends on INET && NET_9P
index cbbffc8..f1046cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # File system configuration
 #
index b795f8d..f87ddd1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menu "Executable file formats"
 
index c5a7787..df4650d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ADFS_FS
        tristate "ADFS file system support"
        depends on BLOCK
index 9b2d71a..cf7de6e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux adfs filesystem routines.
 #
index a04d9e8..84c46b9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config AFFS_FS
        tristate "Amiga FFS file system support"
        depends on BLOCK
index 3988b4a..f2c8114 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux affs filesystem routines.
 #
index 7370228..e7d036e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/affs/inode.c
  *
index 701aaa9..3fb1f55 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config AFS_FS
        tristate "Andrew File System support (AFS)"
        depends on INET
index 967db33..9eaff55 100644 (file)
@@ -251,7 +251,7 @@ struct afs_vlserver_list *afs_dns_query(struct afs_cell *cell, time64_t *_expiry
        _enter("%s", cell->name);
 
        ret = dns_query("afsdb", cell->name, cell->name_len, "srv=1",
-                       &result, _expiry);
+                       &result, _expiry, true);
        if (ret < 0) {
                _leave(" = %d [dns]", ret);
                return ERR_PTR(ret);
index d12ffb4..3f4e460 100644 (file)
@@ -23,6 +23,9 @@
 #define AFSPATHMAX             1024    /* Maximum length of a pathname plus NUL */
 #define AFSOPAQUEMAX           1024    /* Maximum length of an opaque field */
 
+#define AFS_VL_MAX_LIFESPAN    (120 * HZ)
+#define AFS_PROBE_MAX_LIFESPAN (30 * HZ)
+
 typedef u64                    afs_volid_t;
 typedef u64                    afs_vnodeid_t;
 typedef u64                    afs_dataversion_t;
@@ -69,8 +72,8 @@ typedef enum {
 
 struct afs_callback {
        time64_t                expires_at;     /* Time at which expires */
-       unsigned                version;        /* Callback version */
-       afs_callback_type_t     type;           /* Type of callback */
+       //unsigned              version;        /* Callback version */
+       //afs_callback_type_t   type;           /* Type of callback */
 };
 
 struct afs_callback_break {
@@ -144,6 +147,15 @@ struct afs_file_status {
        u32                     abort_code;     /* Abort if bulk-fetching this failed */
 };
 
+struct afs_status_cb {
+       struct afs_file_status  status;
+       struct afs_callback     callback;
+       unsigned int            cb_break;       /* Pre-op callback break counter */
+       bool                    have_status;    /* True if status record was retrieved */
+       bool                    have_cb;        /* True if cb record was retrieved */
+       bool                    have_error;     /* True if status.abort_code indicates an error */
+};
+
 /*
  * AFS file status change request
  */
index 128f2db..d441bef 100644 (file)
@@ -94,15 +94,15 @@ int afs_register_server_cb_interest(struct afs_vnode *vnode,
        struct afs_server *server = entry->server;
 
 again:
-       if (vnode->cb_interest &&
-           likely(vnode->cb_interest == entry->cb_interest))
+       vcbi = rcu_dereference_protected(vnode->cb_interest,
+                                        lockdep_is_held(&vnode->io_lock));
+       if (vcbi && likely(vcbi == entry->cb_interest))
                return 0;
 
        read_lock(&slist->lock);
        cbi = afs_get_cb_interest(entry->cb_interest);
        read_unlock(&slist->lock);
 
-       vcbi = vnode->cb_interest;
        if (vcbi) {
                if (vcbi == cbi) {
                        afs_put_cb_interest(afs_v2net(vnode), cbi);
@@ -114,8 +114,9 @@ again:
                 */
                if (cbi && vcbi->server == cbi->server) {
                        write_seqlock(&vnode->cb_lock);
-                       old = vnode->cb_interest;
-                       vnode->cb_interest = cbi;
+                       old = rcu_dereference_protected(vnode->cb_interest,
+                                                       lockdep_is_held(&vnode->cb_lock.lock));
+                       rcu_assign_pointer(vnode->cb_interest, cbi);
                        write_sequnlock(&vnode->cb_lock);
                        afs_put_cb_interest(afs_v2net(vnode), old);
                        return 0;
@@ -160,8 +161,9 @@ again:
         */
        write_seqlock(&vnode->cb_lock);
 
-       old = vnode->cb_interest;
-       vnode->cb_interest = cbi;
+       old = rcu_dereference_protected(vnode->cb_interest,
+                                       lockdep_is_held(&vnode->cb_lock.lock));
+       rcu_assign_pointer(vnode->cb_interest, cbi);
        vnode->cb_s_break = cbi->server->cb_s_break;
        vnode->cb_v_break = vnode->volume->cb_v_break;
        clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
@@ -191,10 +193,11 @@ void afs_put_cb_interest(struct afs_net *net, struct afs_cb_interest *cbi)
                                vi = NULL;
 
                        write_unlock(&cbi->server->cb_break_lock);
-                       kfree(vi);
+                       if (vi)
+                               kfree_rcu(vi, rcu);
                        afs_put_server(net, cbi->server);
                }
-               kfree(cbi);
+               kfree_rcu(cbi, rcu);
        }
 }
 
@@ -218,14 +221,8 @@ void __afs_break_callback(struct afs_vnode *vnode)
                vnode->cb_break++;
                afs_clear_permits(vnode);
 
-               spin_lock(&vnode->lock);
-
-               _debug("break callback");
-
-               if (list_empty(&vnode->granted_locks) &&
-                   !list_empty(&vnode->pending_locks))
+               if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
                        afs_lock_may_be_available(vnode);
-               spin_unlock(&vnode->lock);
        }
 }
 
index 9de4611..9c3b07b 100644 (file)
@@ -123,6 +123,7 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
                                       const char *name, unsigned int namelen,
                                       const char *addresses)
 {
+       struct afs_vlserver_list *vllist;
        struct afs_cell *cell;
        int i, ret;
 
@@ -151,18 +152,14 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
 
        atomic_set(&cell->usage, 2);
        INIT_WORK(&cell->manager, afs_manage_cell);
-       cell->flags = ((1 << AFS_CELL_FL_NOT_READY) |
-                      (1 << AFS_CELL_FL_NO_LOOKUP_YET));
        INIT_LIST_HEAD(&cell->proc_volumes);
        rwlock_init(&cell->proc_lock);
        rwlock_init(&cell->vl_servers_lock);
 
-       /* Fill in the VL server list if we were given a list of addresses to
-        * use.
+       /* Provide a VL server list, filling it in if we were given a list of
+        * addresses to use.
         */
        if (addresses) {
-               struct afs_vlserver_list *vllist;
-
                vllist = afs_parse_text_addrs(net,
                                              addresses, strlen(addresses), ':',
                                              VL_SERVICE, AFS_VL_PORT);
@@ -171,19 +168,32 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
                        goto parse_failed;
                }
 
-               rcu_assign_pointer(cell->vl_servers, vllist);
+               vllist->source = DNS_RECORD_FROM_CONFIG;
+               vllist->status = DNS_LOOKUP_NOT_DONE;
                cell->dns_expiry = TIME64_MAX;
-               __clear_bit(AFS_CELL_FL_NO_LOOKUP_YET, &cell->flags);
        } else {
+               ret = -ENOMEM;
+               vllist = afs_alloc_vlserver_list(0);
+               if (!vllist)
+                       goto error;
+               vllist->source = DNS_RECORD_UNAVAILABLE;
+               vllist->status = DNS_LOOKUP_NOT_DONE;
                cell->dns_expiry = ktime_get_real_seconds();
        }
 
+       rcu_assign_pointer(cell->vl_servers, vllist);
+
+       cell->dns_source = vllist->source;
+       cell->dns_status = vllist->status;
+       smp_store_release(&cell->dns_lookup_count, 1); /* vs source/status */
+
        _leave(" = %p", cell);
        return cell;
 
 parse_failed:
        if (ret == -EINVAL)
                printk(KERN_ERR "kAFS: bad VL server IP address\n");
+error:
        kfree(cell);
        _leave(" = %d", ret);
        return ERR_PTR(ret);
@@ -208,6 +218,7 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,
 {
        struct afs_cell *cell, *candidate, *cursor;
        struct rb_node *parent, **pp;
+       enum afs_cell_state state;
        int ret, n;
 
        _enter("%s,%s", name, vllist);
@@ -267,18 +278,16 @@ struct afs_cell *afs_lookup_cell(struct afs_net *net,
 
 wait_for_cell:
        _debug("wait_for_cell");
-       ret = wait_on_bit(&cell->flags, AFS_CELL_FL_NOT_READY, TASK_INTERRUPTIBLE);
-       smp_rmb();
-
-       switch (READ_ONCE(cell->state)) {
-       case AFS_CELL_FAILED:
+       wait_var_event(&cell->state,
+                      ({
+                              state = smp_load_acquire(&cell->state); /* vs error */
+                              state == AFS_CELL_ACTIVE || state == AFS_CELL_FAILED;
+                      }));
+
+       /* Check the state obtained from the wait check. */
+       if (state == AFS_CELL_FAILED) {
                ret = cell->error;
                goto error;
-       default:
-               _debug("weird %u %d", cell->state, cell->error);
-               goto error;
-       case AFS_CELL_ACTIVE:
-               break;
        }
 
        _leave(" = %p [cell]", cell);
@@ -360,16 +369,46 @@ int afs_cell_init(struct afs_net *net, const char *rootcell)
 /*
  * Update a cell's VL server address list from the DNS.
  */
-static void afs_update_cell(struct afs_cell *cell)
+static int afs_update_cell(struct afs_cell *cell)
 {
-       struct afs_vlserver_list *vllist, *old;
+       struct afs_vlserver_list *vllist, *old = NULL, *p;
        unsigned int min_ttl = READ_ONCE(afs_cell_min_ttl);
        unsigned int max_ttl = READ_ONCE(afs_cell_max_ttl);
        time64_t now, expiry = 0;
+       int ret = 0;
 
        _enter("%s", cell->name);
 
        vllist = afs_dns_query(cell, &expiry);
+       if (IS_ERR(vllist)) {
+               ret = PTR_ERR(vllist);
+
+               _debug("%s: fail %d", cell->name, ret);
+               if (ret == -ENOMEM)
+                       goto out_wake;
+
+               ret = -ENOMEM;
+               vllist = afs_alloc_vlserver_list(0);
+               if (!vllist)
+                       goto out_wake;
+
+               switch (ret) {
+               case -ENODATA:
+               case -EDESTADDRREQ:
+                       vllist->status = DNS_LOOKUP_GOT_NOT_FOUND;
+                       break;
+               case -EAGAIN:
+               case -ECONNREFUSED:
+                       vllist->status = DNS_LOOKUP_GOT_TEMP_FAILURE;
+                       break;
+               default:
+                       vllist->status = DNS_LOOKUP_GOT_LOCAL_FAILURE;
+                       break;
+               }
+       }
+
+       _debug("%s: got list %d %d", cell->name, vllist->source, vllist->status);
+       cell->dns_status = vllist->status;
 
        now = ktime_get_real_seconds();
        if (min_ttl > max_ttl)
@@ -379,48 +418,47 @@ static void afs_update_cell(struct afs_cell *cell)
        else if (expiry > now + max_ttl)
                expiry = now + max_ttl;
 
-       if (IS_ERR(vllist)) {
-               switch (PTR_ERR(vllist)) {
-               case -ENODATA:
-               case -EDESTADDRREQ:
+       _debug("%s: status %d", cell->name, vllist->status);
+       if (vllist->source == DNS_RECORD_UNAVAILABLE) {
+               switch (vllist->status) {
+               case DNS_LOOKUP_GOT_NOT_FOUND:
                        /* The DNS said that the cell does not exist or there
                         * weren't any addresses to be had.
                         */
-                       set_bit(AFS_CELL_FL_NOT_FOUND, &cell->flags);
-                       clear_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags);
                        cell->dns_expiry = expiry;
                        break;
 
-               case -EAGAIN:
-               case -ECONNREFUSED:
+               case DNS_LOOKUP_BAD:
+               case DNS_LOOKUP_GOT_LOCAL_FAILURE:
+               case DNS_LOOKUP_GOT_TEMP_FAILURE:
+               case DNS_LOOKUP_GOT_NS_FAILURE:
                default:
-                       set_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags);
                        cell->dns_expiry = now + 10;
                        break;
                }
-
-               cell->error = -EDESTADDRREQ;
        } else {
-               clear_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags);
-               clear_bit(AFS_CELL_FL_NOT_FOUND, &cell->flags);
-
-               /* Exclusion on changing vl_addrs is achieved by a
-                * non-reentrant work item.
-                */
-               old = rcu_dereference_protected(cell->vl_servers, true);
-               rcu_assign_pointer(cell->vl_servers, vllist);
                cell->dns_expiry = expiry;
-
-               if (old)
-                       afs_put_vlserverlist(cell->net, old);
        }
 
-       if (test_and_clear_bit(AFS_CELL_FL_NO_LOOKUP_YET, &cell->flags))
-               wake_up_bit(&cell->flags, AFS_CELL_FL_NO_LOOKUP_YET);
+       /* Replace the VL server list if the new record has servers or the old
+        * record doesn't.
+        */
+       write_lock(&cell->vl_servers_lock);
+       p = rcu_dereference_protected(cell->vl_servers, true);
+       if (vllist->nr_servers > 0 || p->nr_servers == 0) {
+               rcu_assign_pointer(cell->vl_servers, vllist);
+               cell->dns_source = vllist->source;
+               old = p;
+       }
+       write_unlock(&cell->vl_servers_lock);
+       afs_put_vlserverlist(cell->net, old);
 
-       now = ktime_get_real_seconds();
-       afs_set_cell_timer(cell->net, cell->dns_expiry - now);
-       _leave("");
+out_wake:
+       smp_store_release(&cell->dns_lookup_count,
+                         cell->dns_lookup_count + 1); /* vs source/status */
+       wake_up_var(&cell->dns_lookup_count);
+       _leave(" = %d", ret);
+       return ret;
 }
 
 /*
@@ -491,8 +529,7 @@ void afs_put_cell(struct afs_net *net, struct afs_cell *cell)
        now = ktime_get_real_seconds();
        cell->last_inactive = now;
        expire_delay = 0;
-       if (!test_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags) &&
-           !test_bit(AFS_CELL_FL_NOT_FOUND, &cell->flags))
+       if (cell->vl_servers->nr_servers)
                expire_delay = afs_cell_gc_delay;
 
        if (atomic_dec_return(&cell->usage) > 1)
@@ -623,11 +660,13 @@ again:
                        goto final_destruction;
                if (cell->state == AFS_CELL_FAILED)
                        goto done;
-               cell->state = AFS_CELL_UNSET;
+               smp_store_release(&cell->state, AFS_CELL_UNSET);
+               wake_up_var(&cell->state);
                goto again;
 
        case AFS_CELL_UNSET:
-               cell->state = AFS_CELL_ACTIVATING;
+               smp_store_release(&cell->state, AFS_CELL_ACTIVATING);
+               wake_up_var(&cell->state);
                goto again;
 
        case AFS_CELL_ACTIVATING:
@@ -635,28 +674,29 @@ again:
                if (ret < 0)
                        goto activation_failed;
 
-               cell->state = AFS_CELL_ACTIVE;
-               smp_wmb();
-               clear_bit(AFS_CELL_FL_NOT_READY, &cell->flags);
-               wake_up_bit(&cell->flags, AFS_CELL_FL_NOT_READY);
+               smp_store_release(&cell->state, AFS_CELL_ACTIVE);
+               wake_up_var(&cell->state);
                goto again;
 
        case AFS_CELL_ACTIVE:
                if (atomic_read(&cell->usage) > 1) {
-                       time64_t now = ktime_get_real_seconds();
-                       if (cell->dns_expiry <= now && net->live)
-                               afs_update_cell(cell);
+                       if (test_and_clear_bit(AFS_CELL_FL_DO_LOOKUP, &cell->flags)) {
+                               ret = afs_update_cell(cell);
+                               if (ret < 0)
+                                       cell->error = ret;
+                       }
                        goto done;
                }
-               cell->state = AFS_CELL_DEACTIVATING;
+               smp_store_release(&cell->state, AFS_CELL_DEACTIVATING);
+               wake_up_var(&cell->state);
                goto again;
 
        case AFS_CELL_DEACTIVATING:
-               set_bit(AFS_CELL_FL_NOT_READY, &cell->flags);
                if (atomic_read(&cell->usage) > 1)
                        goto reverse_deactivation;
                afs_deactivate_cell(net, cell);
-               cell->state = AFS_CELL_INACTIVE;
+               smp_store_release(&cell->state, AFS_CELL_INACTIVE);
+               wake_up_var(&cell->state);
                goto again;
 
        default:
@@ -669,17 +709,13 @@ activation_failed:
        cell->error = ret;
        afs_deactivate_cell(net, cell);
 
-       cell->state = AFS_CELL_FAILED;
-       smp_wmb();
-       if (test_and_clear_bit(AFS_CELL_FL_NOT_READY, &cell->flags))
-               wake_up_bit(&cell->flags, AFS_CELL_FL_NOT_READY);
+       smp_store_release(&cell->state, AFS_CELL_FAILED); /* vs error */
+       wake_up_var(&cell->state);
        goto again;
 
 reverse_deactivation:
-       cell->state = AFS_CELL_ACTIVE;
-       smp_wmb();
-       clear_bit(AFS_CELL_FL_NOT_READY, &cell->flags);
-       wake_up_bit(&cell->flags, AFS_CELL_FL_NOT_READY);
+       smp_store_release(&cell->state, AFS_CELL_ACTIVE);
+       wake_up_var(&cell->state);
        _leave(" [deact->act]");
        return;
 
@@ -739,11 +775,16 @@ void afs_manage_cells(struct work_struct *work)
                }
 
                if (usage == 1) {
+                       struct afs_vlserver_list *vllist;
                        time64_t expire_at = cell->last_inactive;
 
-                       if (!test_bit(AFS_CELL_FL_DNS_FAIL, &cell->flags) &&
-                           !test_bit(AFS_CELL_FL_NOT_FOUND, &cell->flags))
+                       read_lock(&cell->vl_servers_lock);
+                       vllist = rcu_dereference_protected(
+                               cell->vl_servers,
+                               lockdep_is_held(&cell->vl_servers_lock));
+                       if (vllist->nr_servers > 0)
                                expire_at += afs_cell_gc_delay;
+                       read_unlock(&cell->vl_servers_lock);
                        if (purging || expire_at <= now)
                                sched_cell = true;
                        else if (expire_at < next_manage)
@@ -751,10 +792,8 @@ void afs_manage_cells(struct work_struct *work)
                }
 
                if (!purging) {
-                       if (cell->dns_expiry <= now)
+                       if (test_bit(AFS_CELL_FL_DO_LOOKUP, &cell->flags))
                                sched_cell = true;
-                       else if (cell->dns_expiry <= next_manage)
-                               next_manage = cell->dns_expiry;
                }
 
                if (sched_cell)
index 7480900..01437cf 100644 (file)
@@ -213,7 +213,7 @@ static int afs_find_cm_server_by_peer(struct afs_call *call)
                return 0;
        }
 
-       call->cm_server = server;
+       call->server = server;
        return afs_record_cm_probe(call, server);
 }
 
@@ -234,7 +234,7 @@ static int afs_find_cm_server_by_uuid(struct afs_call *call,
                return 0;
        }
 
-       call->cm_server = server;
+       call->server = server;
        return afs_record_cm_probe(call, server);
 }
 
@@ -260,8 +260,8 @@ static void SRXAFSCB_CallBack(struct work_struct *work)
         * server holds up change visibility till it receives our reply so as
         * to maintain cache coherency.
         */
-       if (call->cm_server)
-               afs_break_callbacks(call->cm_server, call->count, call->request);
+       if (call->server)
+               afs_break_callbacks(call->server, call->count, call->request);
 
        afs_send_empty_reply(call);
        afs_put_call(call);
@@ -376,10 +376,10 @@ static void SRXAFSCB_InitCallBackState(struct work_struct *work)
 {
        struct afs_call *call = container_of(work, struct afs_call, work);
 
-       _enter("{%p}", call->cm_server);
+       _enter("{%p}", call->server);
 
-       if (call->cm_server)
-               afs_init_callback_state(call->cm_server);
+       if (call->server)
+               afs_init_callback_state(call->server);
        afs_send_empty_reply(call);
        afs_put_call(call);
        _leave("");
index 9a466be..79d93a2 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/sched.h>
 #include <linux/task_io_accounting_ops.h>
 #include "internal.h"
+#include "afs_fs.h"
 #include "xdr_fs.h"
 
 static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
@@ -102,8 +103,8 @@ struct afs_lookup_cookie {
        bool                    found;
        bool                    one_only;
        unsigned short          nr_fids;
-       struct afs_file_status  *statuses;
-       struct afs_callback     *callbacks;
+       struct inode            **inodes;
+       struct afs_status_cb    *statuses;
        struct afs_fid          fids[50];
 };
 
@@ -638,12 +639,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
                                   struct key *key)
 {
        struct afs_lookup_cookie *cookie;
-       struct afs_cb_interest *cbi = NULL;
+       struct afs_cb_interest *dcbi, *cbi = NULL;
        struct afs_super_info *as = dir->i_sb->s_fs_info;
-       struct afs_iget_data data;
+       struct afs_status_cb *scb;
+       struct afs_iget_data iget_data;
        struct afs_fs_cursor fc;
-       struct afs_vnode *dvnode = AFS_FS_I(dir);
-       struct inode *inode = NULL;
+       struct afs_server *server;
+       struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode;
+       struct inode *inode = NULL, *ti;
        int ret, i;
 
        _enter("{%lu},%p{%pd},", dir->i_ino, dentry, dentry);
@@ -657,10 +660,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
        cookie->nr_fids = 1; /* slot 0 is saved for the fid we actually want */
 
        read_seqlock_excl(&dvnode->cb_lock);
-       if (dvnode->cb_interest &&
-           dvnode->cb_interest->server &&
-           test_bit(AFS_SERVER_FL_NO_IBULK, &dvnode->cb_interest->server->flags))
-               cookie->one_only = true;
+       dcbi = rcu_dereference_protected(dvnode->cb_interest,
+                                        lockdep_is_held(&dvnode->cb_lock.lock));
+       if (dcbi) {
+               server = dcbi->server;
+               if (server &&
+                   test_bit(AFS_SERVER_FL_NO_IBULK, &server->flags))
+                       cookie->one_only = true;
+       }
        read_sequnlock_excl(&dvnode->cb_lock);
 
        for (i = 0; i < 50; i++)
@@ -678,24 +685,43 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
                goto out;
 
        /* Check to see if we already have an inode for the primary fid. */
-       data.volume = dvnode->volume;
-       data.fid = cookie->fids[0];
-       inode = ilookup5(dir->i_sb, cookie->fids[0].vnode, afs_iget5_test, &data);
+       iget_data.fid = cookie->fids[0];
+       iget_data.volume = dvnode->volume;
+       iget_data.cb_v_break = dvnode->volume->cb_v_break;
+       iget_data.cb_s_break = 0;
+       inode = ilookup5(dir->i_sb, cookie->fids[0].vnode,
+                        afs_iget5_test, &iget_data);
        if (inode)
                goto out;
 
        /* Need space for examining all the selected files */
        inode = ERR_PTR(-ENOMEM);
-       cookie->statuses = kcalloc(cookie->nr_fids, sizeof(struct afs_file_status),
-                                  GFP_KERNEL);
+       cookie->statuses = kvcalloc(cookie->nr_fids, sizeof(struct afs_status_cb),
+                                   GFP_KERNEL);
        if (!cookie->statuses)
                goto out;
 
-       cookie->callbacks = kcalloc(cookie->nr_fids, sizeof(struct afs_callback),
-                                   GFP_KERNEL);
-       if (!cookie->callbacks)
+       cookie->inodes = kcalloc(cookie->nr_fids, sizeof(struct inode *),
+                                GFP_KERNEL);
+       if (!cookie->inodes)
                goto out_s;
 
+       for (i = 1; i < cookie->nr_fids; i++) {
+               scb = &cookie->statuses[i];
+
+               /* Find any inodes that already exist and get their
+                * callback counters.
+                */
+               iget_data.fid = cookie->fids[i];
+               ti = ilookup5_nowait(dir->i_sb, iget_data.fid.vnode,
+                                    afs_iget5_test, &iget_data);
+               if (!IS_ERR_OR_NULL(ti)) {
+                       vnode = AFS_FS_I(ti);
+                       scb->cb_break = afs_calc_vnode_cb_break(vnode);
+                       cookie->inodes[i] = ti;
+               }
+       }
+
        /* Try FS.InlineBulkStatus first.  Abort codes for the individual
         * lookups contained therein are stored in the reply without aborting
         * the whole operation.
@@ -704,7 +730,7 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
                goto no_inline_bulk_status;
 
        inode = ERR_PTR(-ERESTARTSYS);
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
                while (afs_select_fileserver(&fc)) {
                        if (test_bit(AFS_SERVER_FL_NO_IBULK,
                                      &fc.cbi->server->flags)) {
@@ -712,11 +738,12 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
                                fc.ac.error = -ECONNABORTED;
                                break;
                        }
+                       iget_data.cb_v_break = dvnode->volume->cb_v_break;
+                       iget_data.cb_s_break = fc.cbi->server->cb_s_break;
                        afs_fs_inline_bulk_status(&fc,
                                                  afs_v2net(dvnode),
                                                  cookie->fids,
                                                  cookie->statuses,
-                                                 cookie->callbacks,
                                                  cookie->nr_fids, NULL);
                }
 
@@ -737,15 +764,16 @@ no_inline_bulk_status:
         * any of the lookups fails - so, for the moment, revert to
         * FS.FetchStatus for just the primary fid.
         */
-       cookie->nr_fids = 1;
        inode = ERR_PTR(-ERESTARTSYS);
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
                while (afs_select_fileserver(&fc)) {
+                       iget_data.cb_v_break = dvnode->volume->cb_v_break;
+                       iget_data.cb_s_break = fc.cbi->server->cb_s_break;
+                       scb = &cookie->statuses[0];
                        afs_fs_fetch_status(&fc,
                                            afs_v2net(dvnode),
                                            cookie->fids,
-                                           cookie->statuses,
-                                           cookie->callbacks,
+                                           scb,
                                            NULL);
                }
 
@@ -757,26 +785,36 @@ no_inline_bulk_status:
        if (IS_ERR(inode))
                goto out_c;
 
-       for (i = 0; i < cookie->nr_fids; i++)
-               cookie->statuses[i].abort_code = 0;
-
 success:
        /* Turn all the files into inodes and save the first one - which is the
         * one we actually want.
         */
-       if (cookie->statuses[0].abort_code != 0)
-               inode = ERR_PTR(afs_abort_to_error(cookie->statuses[0].abort_code));
+       scb = &cookie->statuses[0];
+       if (scb->status.abort_code != 0)
+               inode = ERR_PTR(afs_abort_to_error(scb->status.abort_code));
 
        for (i = 0; i < cookie->nr_fids; i++) {
-               struct inode *ti;
+               struct afs_status_cb *scb = &cookie->statuses[i];
+
+               if (!scb->have_status && !scb->have_error)
+                       continue;
+
+               if (cookie->inodes[i]) {
+                       afs_vnode_commit_status(&fc, AFS_FS_I(cookie->inodes[i]),
+                                               scb->cb_break, NULL, scb);
+                       continue;
+               }
 
-               if (cookie->statuses[i].abort_code != 0)
+               if (scb->status.abort_code != 0)
                        continue;
 
-               ti = afs_iget(dir->i_sb, key, &cookie->fids[i],
-                             &cookie->statuses[i],
-                             &cookie->callbacks[i],
-                             cbi, dvnode);
+               iget_data.fid = cookie->fids[i];
+               ti = afs_iget(dir->i_sb, key, &iget_data, scb, cbi, dvnode);
+               if (!IS_ERR(ti))
+                       afs_cache_permit(AFS_FS_I(ti), key,
+                                        0 /* Assume vnode->cb_break is 0 */ +
+                                        iget_data.cb_v_break,
+                                        scb);
                if (i == 0) {
                        inode = ti;
                } else {
@@ -787,9 +825,13 @@ success:
 
 out_c:
        afs_put_cb_interest(afs_v2net(dvnode), cbi);
-       kfree(cookie->callbacks);
+       if (cookie->inodes) {
+               for (i = 0; i < cookie->nr_fids; i++)
+                       iput(cookie->inodes[i]);
+               kfree(cookie->inodes);
+       }
 out_s:
-       kfree(cookie->statuses);
+       kvfree(cookie->statuses);
 out:
        kfree(cookie);
        return inode;
@@ -1114,9 +1156,8 @@ void afs_d_release(struct dentry *dentry)
  */
 static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
                                struct dentry *new_dentry,
-                               struct afs_fid *newfid,
-                               struct afs_file_status *newstatus,
-                               struct afs_callback *newcb)
+                               struct afs_iget_data *new_data,
+                               struct afs_status_cb *new_scb)
 {
        struct afs_vnode *vnode;
        struct inode *inode;
@@ -1125,7 +1166,7 @@ static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
                return;
 
        inode = afs_iget(fc->vnode->vfs_inode.i_sb, fc->key,
-                        newfid, newstatus, newcb, fc->cbi, fc->vnode);
+                        new_data, new_scb, fc->cbi, fc->vnode);
        if (IS_ERR(inode)) {
                /* ENOMEM or EINTR at a really inconvenient time - just abandon
                 * the new directory on the server.
@@ -1136,22 +1177,29 @@ static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
 
        vnode = AFS_FS_I(inode);
        set_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
-       afs_vnode_commit_status(fc, vnode, 0);
+       if (fc->ac.error == 0)
+               afs_cache_permit(vnode, fc->key, vnode->cb_break, new_scb);
        d_instantiate(new_dentry, inode);
 }
 
+static void afs_prep_for_new_inode(struct afs_fs_cursor *fc,
+                                  struct afs_iget_data *iget_data)
+{
+       iget_data->volume = fc->vnode->volume;
+       iget_data->cb_v_break = fc->vnode->volume->cb_v_break;
+       iget_data->cb_s_break = fc->cbi->server->cb_s_break;
+}
+
 /*
  * create a directory on an AFS filesystem
  */
 static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
-       struct afs_file_status newstatus;
+       struct afs_iget_data iget_data;
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
-       struct afs_callback newcb;
        struct afs_vnode *dvnode = AFS_FS_I(dir);
-       struct afs_fid newfid;
        struct key *key;
-       u64 data_version = dvnode->status.data_version;
        int ret;
 
        mode |= S_IFDIR;
@@ -1159,23 +1207,32 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
        _enter("{%llx:%llu},{%pd},%ho",
               dvnode->fid.vid, dvnode->fid.vnode, dentry, mode);
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
-               goto error;
+               goto error_scb;
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
-                       afs_fs_create(&fc, dentry->d_name.name, mode, data_version,
-                                     &newfid, &newstatus, &newcb);
+                       afs_prep_for_new_inode(&fc, &iget_data);
+                       afs_fs_create(&fc, dentry->d_name.name, mode,
+                                     &scb[0], &iget_data.fid, &scb[1]);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
-               afs_vnode_new_inode(&fc, dentry, &newfid, &newstatus, &newcb);
+               afs_check_for_remote_deletion(&fc, dvnode);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, &scb[0]);
+               afs_vnode_new_inode(&fc, dentry, &iget_data, &scb[1]);
                ret = afs_end_vnode_operation(&fc);
                if (ret < 0)
                        goto error_key;
@@ -1185,15 +1242,18 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 
        if (ret == 0 &&
            test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
-               afs_edit_dir_add(dvnode, &dentry->d_name, &newfid,
+               afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid,
                                 afs_edit_dir_for_create);
 
        key_put(key);
+       kfree(scb);
        _leave(" = 0");
        return 0;
 
 error_key:
        key_put(key);
+error_scb:
+       kfree(scb);
 error:
        d_drop(dentry);
        _leave(" = %d", ret);
@@ -1220,15 +1280,19 @@ static void afs_dir_remove_subdir(struct dentry *dentry)
  */
 static int afs_rmdir(struct inode *dir, struct dentry *dentry)
 {
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
        struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
        struct key *key;
-       u64 data_version = dvnode->status.data_version;
        int ret;
 
        _enter("{%llx:%llu},{%pd}",
               dvnode->fid.vid, dvnode->fid.vnode, dentry);
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
@@ -1250,14 +1314,16 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
-                       afs_fs_remove(&fc, vnode, dentry->d_name.name, true,
-                                     data_version);
+                       afs_fs_remove(&fc, vnode, dentry->d_name.name, true, scb);
                }
 
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
                if (ret == 0) {
                        afs_dir_remove_subdir(dentry);
@@ -1272,6 +1338,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
 error_key:
        key_put(key);
 error:
+       kfree(scb);
        return ret;
 }
 
@@ -1285,32 +1352,27 @@ error:
  * However, if we didn't have a callback promise outstanding, or it was
  * outstanding on a different server, then it won't break it either...
  */
-int afs_dir_remove_link(struct dentry *dentry, struct key *key,
-                       unsigned long d_version_before,
-                       unsigned long d_version_after)
+static int afs_dir_remove_link(struct afs_vnode *dvnode, struct dentry *dentry,
+                              struct key *key)
 {
-       bool dir_valid;
        int ret = 0;
 
-       /* There were no intervening changes on the server if the version
-        * number we got back was incremented by exactly 1.
-        */
-       dir_valid = (d_version_after == d_version_before + 1);
-
        if (d_really_is_positive(dentry)) {
                struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
 
                if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
                        /* Already done */
-               } else if (dir_valid) {
+               } else if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) {
+                       write_seqlock(&vnode->cb_lock);
                        drop_nlink(&vnode->vfs_inode);
                        if (vnode->vfs_inode.i_nlink == 0) {
                                set_bit(AFS_VNODE_DELETED, &vnode->flags);
-                               clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
+                               __afs_break_callback(vnode);
                        }
+                       write_sequnlock(&vnode->cb_lock);
                        ret = 0;
                } else {
-                       clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
+                       afs_break_callback(vnode);
 
                        if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
                                kdebug("AFS_VNODE_DELETED");
@@ -1331,11 +1393,10 @@ int afs_dir_remove_link(struct dentry *dentry, struct key *key,
 static int afs_unlink(struct inode *dir, struct dentry *dentry)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
        struct key *key;
-       unsigned long d_version = (unsigned long)dentry->d_fsdata;
        bool need_rehash = false;
-       u64 data_version = dvnode->status.data_version;
        int ret;
 
        _enter("{%llx:%llu},{%pd}",
@@ -1344,10 +1405,15 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
        if (dentry->d_name.len >= AFSNAMEMAX)
                return -ENAMETOOLONG;
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
-               goto error;
+               goto error_scb;
        }
 
        /* Try to make sure we have a callback promise on the victim. */
@@ -1374,30 +1440,34 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
        spin_unlock(&dentry->d_lock);
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+               afs_dataversion_t data_version_2 = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
+                       fc.cb_break_2 = afs_calc_vnode_cb_break(vnode);
 
                        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc.cbi->server->flags) &&
                            !test_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags)) {
                                yfs_fs_remove_file2(&fc, vnode, dentry->d_name.name,
-                                                   data_version);
+                                                   &scb[0], &scb[1]);
                                if (fc.ac.error != -ECONNABORTED ||
                                    fc.ac.abort_code != RXGEN_OPCODE)
                                        continue;
                                set_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags);
                        }
 
-                       afs_fs_remove(&fc, vnode, dentry->d_name.name, false,
-                                     data_version);
+                       afs_fs_remove(&fc, vnode, dentry->d_name.name, false, &scb[0]);
                }
 
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, &scb[0]);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break_2,
+                                       &data_version_2, &scb[1]);
                ret = afs_end_vnode_operation(&fc);
-               if (ret == 0)
-                       ret = afs_dir_remove_link(
-                               dentry, key, d_version,
-                               (unsigned long)dvnode->status.data_version);
+               if (ret == 0 && !(scb[1].have_status || scb[1].have_error))
+                       ret = afs_dir_remove_link(dvnode, dentry, key);
                if (ret == 0 &&
                    test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
                        afs_edit_dir_remove(dvnode, &dentry->d_name,
@@ -1409,6 +1479,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
 
 error_key:
        key_put(key);
+error_scb:
+       kfree(scb);
 error:
        _leave(" = %d", ret);
        return ret;
@@ -1420,13 +1492,11 @@ error:
 static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
                      bool excl)
 {
+       struct afs_iget_data iget_data;
        struct afs_fs_cursor fc;
-       struct afs_file_status newstatus;
-       struct afs_callback newcb;
+       struct afs_status_cb *scb;
        struct afs_vnode *dvnode = AFS_FS_I(dir);
-       struct afs_fid newfid;
        struct key *key;
-       u64 data_version = dvnode->status.data_version;
        int ret;
 
        mode |= S_IFREG;
@@ -1444,17 +1514,26 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
                goto error;
        }
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error_scb;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
-                       afs_fs_create(&fc, dentry->d_name.name, mode, data_version,
-                                     &newfid, &newstatus, &newcb);
+                       afs_prep_for_new_inode(&fc, &iget_data);
+                       afs_fs_create(&fc, dentry->d_name.name, mode,
+                                     &scb[0], &iget_data.fid, &scb[1]);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
-               afs_vnode_new_inode(&fc, dentry, &newfid, &newstatus, &newcb);
+               afs_check_for_remote_deletion(&fc, dvnode);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, &scb[0]);
+               afs_vnode_new_inode(&fc, dentry, &iget_data, &scb[1]);
                ret = afs_end_vnode_operation(&fc);
                if (ret < 0)
                        goto error_key;
@@ -1463,13 +1542,16 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
        }
 
        if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
-               afs_edit_dir_add(dvnode, &dentry->d_name, &newfid,
+               afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid,
                                 afs_edit_dir_for_create);
 
+       kfree(scb);
        key_put(key);
        _leave(" = 0");
        return 0;
 
+error_scb:
+       kfree(scb);
 error_key:
        key_put(key);
 error:
@@ -1485,15 +1567,12 @@ static int afs_link(struct dentry *from, struct inode *dir,
                    struct dentry *dentry)
 {
        struct afs_fs_cursor fc;
-       struct afs_vnode *dvnode, *vnode;
+       struct afs_status_cb *scb;
+       struct afs_vnode *dvnode = AFS_FS_I(dir);
+       struct afs_vnode *vnode = AFS_FS_I(d_inode(from));
        struct key *key;
-       u64 data_version;
        int ret;
 
-       vnode = AFS_FS_I(d_inode(from));
-       dvnode = AFS_FS_I(dir);
-       data_version = dvnode->status.data_version;
-
        _enter("{%llx:%llu},{%llx:%llu},{%pd}",
               vnode->fid.vid, vnode->fid.vnode,
               dvnode->fid.vid, dvnode->fid.vnode,
@@ -1503,14 +1582,21 @@ static int afs_link(struct dentry *from, struct inode *dir,
        if (dentry->d_name.len >= AFSNAMEMAX)
                goto error;
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
-               goto error;
+               goto error_scb;
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+
                if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) {
                        afs_end_vnode_operation(&fc);
                        goto error_key;
@@ -1519,11 +1605,14 @@ static int afs_link(struct dentry *from, struct inode *dir,
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
                        fc.cb_break_2 = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_link(&fc, vnode, dentry->d_name.name, data_version);
+                       afs_fs_link(&fc, vnode, dentry->d_name.name,
+                                   &scb[0], &scb[1]);
                }
 
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break_2);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, &scb[0]);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break_2,
+                                       NULL, &scb[1]);
                ihold(&vnode->vfs_inode);
                d_instantiate(dentry, &vnode->vfs_inode);
 
@@ -1540,11 +1629,14 @@ static int afs_link(struct dentry *from, struct inode *dir,
                                 afs_edit_dir_for_link);
 
        key_put(key);
+       kfree(scb);
        _leave(" = 0");
        return 0;
 
 error_key:
        key_put(key);
+error_scb:
+       kfree(scb);
 error:
        d_drop(dentry);
        _leave(" = %d", ret);
@@ -1557,12 +1649,11 @@ error:
 static int afs_symlink(struct inode *dir, struct dentry *dentry,
                       const char *content)
 {
+       struct afs_iget_data iget_data;
        struct afs_fs_cursor fc;
-       struct afs_file_status newstatus;
+       struct afs_status_cb *scb;
        struct afs_vnode *dvnode = AFS_FS_I(dir);
-       struct afs_fid newfid;
        struct key *key;
-       u64 data_version = dvnode->status.data_version;
        int ret;
 
        _enter("{%llx:%llu},{%pd},%s",
@@ -1577,24 +1668,32 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
        if (strlen(content) >= AFSPATHMAX)
                goto error;
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        key = afs_request_key(dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
-               goto error;
+               goto error_scb;
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
-                       afs_fs_symlink(&fc, dentry->d_name.name,
-                                      content, data_version,
-                                      &newfid, &newstatus);
+                       afs_prep_for_new_inode(&fc, &iget_data);
+                       afs_fs_symlink(&fc, dentry->d_name.name, content,
+                                      &scb[0], &iget_data.fid, &scb[1]);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
-               afs_vnode_new_inode(&fc, dentry, &newfid, &newstatus, NULL);
+               afs_check_for_remote_deletion(&fc, dvnode);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &data_version, &scb[0]);
+               afs_vnode_new_inode(&fc, dentry, &iget_data, &scb[1]);
                ret = afs_end_vnode_operation(&fc);
                if (ret < 0)
                        goto error_key;
@@ -1603,15 +1702,18 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
        }
 
        if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags))
-               afs_edit_dir_add(dvnode, &dentry->d_name, &newfid,
+               afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid,
                                 afs_edit_dir_for_symlink);
 
        key_put(key);
+       kfree(scb);
        _leave(" = 0");
        return 0;
 
 error_key:
        key_put(key);
+error_scb:
+       kfree(scb);
 error:
        d_drop(dentry);
        _leave(" = %d", ret);
@@ -1626,11 +1728,11 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
                      unsigned int flags)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;
        struct dentry *tmp = NULL, *rehash = NULL;
        struct inode *new_inode;
        struct key *key;
-       u64 orig_data_version, new_data_version;
        bool new_negative = d_is_negative(new_dentry);
        int ret;
 
@@ -1644,8 +1746,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
        vnode = AFS_FS_I(d_inode(old_dentry));
        orig_dvnode = AFS_FS_I(old_dir);
        new_dvnode = AFS_FS_I(new_dir);
-       orig_data_version = orig_dvnode->status.data_version;
-       new_data_version = new_dvnode->status.data_version;
 
        _enter("{%llx:%llu},{%llx:%llu},{%llx:%llu},{%pd}",
               orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
@@ -1653,10 +1753,15 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
               new_dvnode->fid.vid, new_dvnode->fid.vnode,
               new_dentry);
 
+       ret = -ENOMEM;
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        key = afs_request_key(orig_dvnode->volume->cell);
        if (IS_ERR(key)) {
                ret = PTR_ERR(key);
-               goto error;
+               goto error_scb;
        }
 
        /* For non-directories, check whether the target is busy and if so,
@@ -1690,31 +1795,43 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        new_dentry = tmp;
                        rehash = NULL;
                        new_negative = true;
-                       orig_data_version = orig_dvnode->status.data_version;
-                       new_data_version = new_dvnode->status.data_version;
                }
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, orig_dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) {
+               afs_dataversion_t orig_data_version;
+               afs_dataversion_t new_data_version;
+               struct afs_status_cb *new_scb = &scb[1];
+
+               orig_data_version = orig_dvnode->status.data_version + 1;
+
                if (orig_dvnode != new_dvnode) {
                        if (mutex_lock_interruptible_nested(&new_dvnode->io_lock, 1) < 0) {
                                afs_end_vnode_operation(&fc);
                                goto error_rehash;
                        }
+                       new_data_version = new_dvnode->status.data_version;
+               } else {
+                       new_data_version = orig_data_version;
+                       new_scb = &scb[0];
                }
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(orig_dvnode);
                        fc.cb_break_2 = afs_calc_vnode_cb_break(new_dvnode);
                        afs_fs_rename(&fc, old_dentry->d_name.name,
                                      new_dvnode, new_dentry->d_name.name,
-                                     orig_data_version, new_data_version);
+                                     &scb[0], new_scb);
                }
 
-               afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break);
-               afs_vnode_commit_status(&fc, new_dvnode, fc.cb_break_2);
-               if (orig_dvnode != new_dvnode)
+               afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break,
+                                       &orig_data_version, &scb[0]);
+               if (new_dvnode != orig_dvnode) {
+                       afs_vnode_commit_status(&fc, new_dvnode, fc.cb_break_2,
+                                               &new_data_version, &scb[1]);
                        mutex_unlock(&new_dvnode->io_lock);
+               }
                ret = afs_end_vnode_operation(&fc);
                if (ret < 0)
                        goto error_rehash;
@@ -1754,6 +1871,8 @@ error_tmp:
        if (tmp)
                dput(tmp);
        key_put(key);
+error_scb:
+       kfree(scb);
 error:
        _leave(" = %d", ret);
        return ret;
index f6f89fd..28f4aa0 100644 (file)
@@ -24,21 +24,28 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode
                               struct key *key)
 {
        struct afs_fs_cursor fc;
-       u64 dir_data_version = dvnode->status.data_version;
+       struct afs_status_cb *scb;
        int ret = -ERESTARTSYS;
 
        _enter("%pd,%pd", old, new);
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        trace_afs_silly_rename(vnode, false);
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
+               afs_dataversion_t dir_data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
                        afs_fs_rename(&fc, old->d_name.name,
                                      dvnode, new->d_name.name,
-                                     dir_data_version, dir_data_version);
+                                     scb, scb);
                }
 
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &dir_data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
@@ -64,6 +71,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode
                fsnotify_nameremove(old, 0);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -143,31 +151,37 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode
                               struct dentry *dentry, struct key *key)
 {
        struct afs_fs_cursor fc;
-       u64 dir_data_version = dvnode->status.data_version;
+       struct afs_status_cb *scb;
        int ret = -ERESTARTSYS;
 
        _enter("");
 
+       scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        trace_afs_silly_rename(vnode, true);
-       if (afs_begin_vnode_operation(&fc, dvnode, key)) {
+       if (afs_begin_vnode_operation(&fc, dvnode, key, false)) {
+               afs_dataversion_t dir_data_version = dvnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(dvnode);
 
                        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc.cbi->server->flags) &&
                            !test_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags)) {
                                yfs_fs_remove_file2(&fc, vnode, dentry->d_name.name,
-                                                   dir_data_version);
+                                                   &scb[0], &scb[1]);
                                if (fc.ac.error != -ECONNABORTED ||
                                    fc.ac.abort_code != RXGEN_OPCODE)
                                        continue;
                                set_bit(AFS_SERVER_FL_NO_RM2, &fc.cbi->server->flags);
                        }
 
-                       afs_fs_remove(&fc, vnode, dentry->d_name.name, false,
-                                     dir_data_version);
+                       afs_fs_remove(&fc, vnode, dentry->d_name.name, false, &scb[0]);
                }
 
-               afs_vnode_commit_status(&fc, dvnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, dvnode, fc.cb_break,
+                                       &dir_data_version, &scb[0]);
                ret = afs_end_vnode_operation(&fc);
                if (ret == 0) {
                        drop_nlink(&vnode->vfs_inode);
@@ -182,6 +196,7 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode
                                            afs_edit_dir_for_unlink);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
index a9ba81d..af1689d 100644 (file)
@@ -46,7 +46,7 @@ static int afs_probe_cell_name(struct dentry *dentry)
                return 0;
        }
 
-       ret = dns_query("afsdb", name, len, "srv=1", NULL, NULL);
+       ret = dns_query("afsdb", name, len, "srv=1", NULL, NULL, false);
        if (ret == -ENODATA)
                ret = -EDESTADDRREQ;
        return ret;
@@ -261,8 +261,7 @@ int afs_dynroot_populate(struct super_block *sb)
        struct afs_net *net = afs_sb2net(sb);
        int ret;
 
-       if (mutex_lock_interruptible(&net->proc_cells_lock) < 0)
-               return -ERESTARTSYS;
+       mutex_lock(&net->proc_cells_lock);
 
        net->dynroot_sb = sb;
        hlist_for_each_entry(cell, &net->proc_cells, proc_link) {
index e8d6619..11e69c5 100644 (file)
@@ -170,11 +170,12 @@ int afs_release(struct inode *inode, struct file *file)
 {
        struct afs_vnode *vnode = AFS_FS_I(inode);
        struct afs_file *af = file->private_data;
+       int ret = 0;
 
        _enter("{%llx:%llu},", vnode->fid.vid, vnode->fid.vnode);
 
        if ((file->f_mode & FMODE_WRITE))
-               return vfs_fsync(file, 0);
+               ret = vfs_fsync(file, 0);
 
        file->private_data = NULL;
        if (af->wb)
@@ -182,8 +183,8 @@ int afs_release(struct inode *inode, struct file *file)
        key_put(af->key);
        kfree(af);
        afs_prune_wb_keys(vnode);
-       _leave(" = 0");
-       return 0;
+       _leave(" = %d", ret);
+       return ret;
 }
 
 /*
@@ -227,6 +228,7 @@ static void afs_file_readpage_read_complete(struct page *page,
 int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *desc)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        int ret;
 
        _enter("%s{%llx:%llu.%u},%x,,,",
@@ -236,15 +238,22 @@ int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *de
               vnode->fid.unique,
               key_serial(key));
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_fetch_data(&fc, desc);
+                       afs_fs_fetch_data(&fc, scb, desc);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
@@ -254,6 +263,7 @@ int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *de
                                &afs_v2net(vnode)->n_fetch_bytes);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -404,10 +414,10 @@ static int afs_readpage(struct file *file, struct page *page)
 /*
  * Make pages available as they're filled.
  */
-static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req)
+static void afs_readpages_page_done(struct afs_read *req)
 {
 #ifdef CONFIG_AFS_FSCACHE
-       struct afs_vnode *vnode = call->reply[0];
+       struct afs_vnode *vnode = req->vnode;
 #endif
        struct page *page = req->pages[req->index];
 
@@ -461,6 +471,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping,
                return -ENOMEM;
 
        refcount_set(&req->usage, 1);
+       req->vnode = vnode;
        req->page_done = afs_readpages_page_done;
        req->pos = first->index;
        req->pos <<= PAGE_SHIFT;
index adc88ef..ed3ac03 100644 (file)
@@ -41,9 +41,6 @@ void afs_lock_may_be_available(struct afs_vnode *vnode)
 {
        _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
 
-       if (vnode->lock_state != AFS_VNODE_LOCK_WAITING_FOR_CB)
-               return;
-
        spin_lock(&vnode->lock);
        if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
                afs_next_locker(vnode, 0);
@@ -77,7 +74,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
  */
 void afs_lock_op_done(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
+       struct afs_vnode *vnode = call->lvnode;
 
        if (call->error == 0) {
                spin_lock(&vnode->lock);
@@ -185,6 +182,7 @@ static void afs_kill_lockers_enoent(struct afs_vnode *vnode)
 static int afs_set_lock(struct afs_vnode *vnode, struct key *key,
                        afs_lock_type_t type)
 {
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
        int ret;
 
@@ -195,18 +193,23 @@ static int afs_set_lock(struct afs_vnode *vnode, struct key *key,
               vnode->fid.unique,
               key_serial(key), type);
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_set_lock(&fc, type);
+                       afs_fs_set_lock(&fc, type, scb);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break, NULL, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -216,6 +219,7 @@ static int afs_set_lock(struct afs_vnode *vnode, struct key *key,
  */
 static int afs_extend_lock(struct afs_vnode *vnode, struct key *key)
 {
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
        int ret;
 
@@ -226,18 +230,23 @@ static int afs_extend_lock(struct afs_vnode *vnode, struct key *key)
               vnode->fid.unique,
               key_serial(key));
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
                while (afs_select_current_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_extend_lock(&fc);
+                       afs_fs_extend_lock(&fc, scb);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break, NULL, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -247,6 +256,7 @@ static int afs_extend_lock(struct afs_vnode *vnode, struct key *key)
  */
 static int afs_release_lock(struct afs_vnode *vnode, struct key *key)
 {
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
        int ret;
 
@@ -257,18 +267,23 @@ static int afs_release_lock(struct afs_vnode *vnode, struct key *key)
               vnode->fid.unique,
               key_serial(key));
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
                while (afs_select_current_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_release_lock(&fc);
+                       afs_fs_release_lock(&fc, scb);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break, NULL, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -736,7 +751,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl)
        posix_test_lock(file, fl);
        if (fl->fl_type == F_UNLCK) {
                /* no local locks; consult the server */
-               ret = afs_fetch_status(vnode, key, false);
+               ret = afs_fetch_status(vnode, key, false, NULL);
                if (ret < 0)
                        goto error;
 
index 5d3abde..9b72662 100644 (file)
@@ -33,8 +33,8 @@ static bool afs_fs_probe_done(struct afs_server *server)
 void afs_fileserver_probe_result(struct afs_call *call)
 {
        struct afs_addr_list *alist = call->alist;
-       struct afs_server *server = call->reply[0];
-       unsigned int server_index = (long)call->reply[1];
+       struct afs_server *server = call->server;
+       unsigned int server_index = call->server_index;
        unsigned int index = call->addr_ix;
        unsigned int rtt = UINT_MAX;
        bool have_result = false;
index 1296f5d..4829840 100644 (file)
@@ -60,78 +60,17 @@ static void xdr_dump_bad(const __be32 *bp)
 }
 
 /*
- * Update the core inode struct from a returned status record.
- */
-void afs_update_inode_from_status(struct afs_vnode *vnode,
-                                 struct afs_file_status *status,
-                                 const afs_dataversion_t *expected_version,
-                                 u8 flags)
-{
-       struct timespec64 t;
-       umode_t mode;
-
-       t = status->mtime_client;
-       vnode->vfs_inode.i_ctime = t;
-       vnode->vfs_inode.i_mtime = t;
-       vnode->vfs_inode.i_atime = t;
-
-       if (flags & (AFS_VNODE_META_CHANGED | AFS_VNODE_NOT_YET_SET)) {
-               vnode->vfs_inode.i_uid = make_kuid(&init_user_ns, status->owner);
-               vnode->vfs_inode.i_gid = make_kgid(&init_user_ns, status->group);
-               set_nlink(&vnode->vfs_inode, status->nlink);
-
-               mode = vnode->vfs_inode.i_mode;
-               mode &= ~S_IALLUGO;
-               mode |= status->mode;
-               barrier();
-               vnode->vfs_inode.i_mode = mode;
-       }
-
-       if (!(flags & AFS_VNODE_NOT_YET_SET)) {
-               if (expected_version &&
-                   *expected_version != status->data_version) {
-                       _debug("vnode modified %llx on {%llx:%llu} [exp %llx]",
-                              (unsigned long long) status->data_version,
-                              vnode->fid.vid, vnode->fid.vnode,
-                              (unsigned long long) *expected_version);
-                       vnode->invalid_before = status->data_version;
-                       if (vnode->status.type == AFS_FTYPE_DIR) {
-                               if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
-                                       afs_stat_v(vnode, n_inval);
-                       } else {
-                               set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags);
-                       }
-               } else if (vnode->status.type == AFS_FTYPE_DIR) {
-                       /* Expected directory change is handled elsewhere so
-                        * that we can locally edit the directory and save on a
-                        * download.
-                        */
-                       if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
-                               flags &= ~AFS_VNODE_DATA_CHANGED;
-               }
-       }
-
-       if (flags & (AFS_VNODE_DATA_CHANGED | AFS_VNODE_NOT_YET_SET)) {
-               inode_set_iversion_raw(&vnode->vfs_inode, status->data_version);
-               i_size_write(&vnode->vfs_inode, status->size);
-       }
-}
-
-/*
  * decode an AFSFetchStatus block
  */
-static int xdr_decode_AFSFetchStatus(struct afs_call *call,
-                                    const __be32 **_bp,
-                                    struct afs_file_status *status,
-                                    struct afs_vnode *vnode,
-                                    const afs_dataversion_t *expected_version,
-                                    struct afs_read *read_req)
+static int xdr_decode_AFSFetchStatus(const __be32 **_bp,
+                                    struct afs_call *call,
+                                    struct afs_status_cb *scb)
 {
        const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp;
+       struct afs_file_status *status = &scb->status;
        bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus);
        u64 data_version, size;
        u32 type, abort_code;
-       u8 flags = 0;
 
        abort_code = ntohl(xdr->abort_code);
 
@@ -144,6 +83,7 @@ static int xdr_decode_AFSFetchStatus(struct afs_call *call,
                         * case.
                         */
                        status->abort_code = abort_code;
+                       scb->have_error = true;
                        return 0;
                }
 
@@ -161,44 +101,25 @@ static int xdr_decode_AFSFetchStatus(struct afs_call *call,
        case AFS_FTYPE_FILE:
        case AFS_FTYPE_DIR:
        case AFS_FTYPE_SYMLINK:
-               if (type != status->type &&
-                   vnode &&
-                   !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
-                       pr_warning("Vnode %llx:%llx:%x changed type %u to %u\n",
-                                  vnode->fid.vid,
-                                  vnode->fid.vnode,
-                                  vnode->fid.unique,
-                                  status->type, type);
-                       goto bad;
-               }
                status->type = type;
                break;
        default:
                goto bad;
        }
 
-#define EXTRACT_M(FIELD)                                       \
-       do {                                                    \
-               u32 x = ntohl(xdr->FIELD);                      \
-               if (status->FIELD != x) {                       \
-                       flags |= AFS_VNODE_META_CHANGED;        \
-                       status->FIELD = x;                      \
-               }                                               \
-       } while (0)
-
-       EXTRACT_M(nlink);
-       EXTRACT_M(author);
-       EXTRACT_M(owner);
-       EXTRACT_M(caller_access); /* call ticket dependent */
-       EXTRACT_M(anon_access);
-       EXTRACT_M(mode);
-       EXTRACT_M(group);
+       status->nlink           = ntohl(xdr->nlink);
+       status->author          = ntohl(xdr->author);
+       status->owner           = ntohl(xdr->owner);
+       status->caller_access   = ntohl(xdr->caller_access); /* Ticket dependent */
+       status->anon_access     = ntohl(xdr->anon_access);
+       status->mode            = ntohl(xdr->mode) & S_IALLUGO;
+       status->group           = ntohl(xdr->group);
+       status->lock_count      = ntohl(xdr->lock_count);
 
        status->mtime_client.tv_sec = ntohl(xdr->mtime_client);
        status->mtime_client.tv_nsec = 0;
        status->mtime_server.tv_sec = ntohl(xdr->mtime_server);
        status->mtime_server.tv_nsec = 0;
-       status->lock_count   = ntohl(xdr->lock_count);
 
        size  = (u64)ntohl(xdr->size_lo);
        size |= (u64)ntohl(xdr->size_hi) << 32;
@@ -206,25 +127,10 @@ static int xdr_decode_AFSFetchStatus(struct afs_call *call,
 
        data_version  = (u64)ntohl(xdr->data_version_lo);
        data_version |= (u64)ntohl(xdr->data_version_hi) << 32;
-       if (data_version != status->data_version) {
-               status->data_version = data_version;
-               flags |= AFS_VNODE_DATA_CHANGED;
-       }
-
-       if (read_req) {
-               read_req->data_version = data_version;
-               read_req->file_size = size;
-       }
+       status->data_version = data_version;
+       scb->have_status = true;
 
        *_bp = (const void *)*_bp + sizeof(*xdr);
-
-       if (vnode) {
-               if (test_bit(AFS_VNODE_UNSET, &vnode->flags))
-                       flags |= AFS_VNODE_NOT_YET_SET;
-               afs_update_inode_from_status(vnode, status, expected_version,
-                                            flags);
-       }
-
        return 0;
 
 bad:
@@ -232,77 +138,22 @@ bad:
        return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status);
 }
 
-/*
- * Decode the file status.  We need to lock the target vnode if we're going to
- * update its status so that stat() sees the attributes update atomically.
- */
-static int afs_decode_status(struct afs_call *call,
-                            const __be32 **_bp,
-                            struct afs_file_status *status,
-                            struct afs_vnode *vnode,
-                            const afs_dataversion_t *expected_version,
-                            struct afs_read *read_req)
+static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry)
 {
-       int ret;
-
-       if (!vnode)
-               return xdr_decode_AFSFetchStatus(call, _bp, status, vnode,
-                                                expected_version, read_req);
-
-       write_seqlock(&vnode->cb_lock);
-       ret = xdr_decode_AFSFetchStatus(call, _bp, status, vnode,
-                                       expected_version, read_req);
-       write_sequnlock(&vnode->cb_lock);
-       return ret;
+       return ktime_divns(call->reply_time, NSEC_PER_SEC) + expiry;
 }
 
-/*
- * decode an AFSCallBack block
- */
-static void xdr_decode_AFSCallBack(struct afs_call *call,
-                                  struct afs_vnode *vnode,
-                                  const __be32 **_bp)
+static void xdr_decode_AFSCallBack(const __be32 **_bp,
+                                  struct afs_call *call,
+                                  struct afs_status_cb *scb)
 {
-       struct afs_cb_interest *old, *cbi = call->cbi;
+       struct afs_callback *cb = &scb->callback;
        const __be32 *bp = *_bp;
-       u32 cb_expiry;
-
-       write_seqlock(&vnode->cb_lock);
-
-       if (!afs_cb_is_broken(call->cb_break, vnode, cbi)) {
-               vnode->cb_version       = ntohl(*bp++);
-               cb_expiry               = ntohl(*bp++);
-               vnode->cb_type          = ntohl(*bp++);
-               vnode->cb_expires_at    = cb_expiry + ktime_get_real_seconds();
-               old = vnode->cb_interest;
-               if (old != call->cbi) {
-                       vnode->cb_interest = cbi;
-                       cbi = old;
-               }
-               set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
-       } else {
-               bp += 3;
-       }
 
-       write_sequnlock(&vnode->cb_lock);
-       call->cbi = cbi;
-       *_bp = bp;
-}
-
-static ktime_t xdr_decode_expiry(struct afs_call *call, u32 expiry)
-{
-       return ktime_add_ns(call->reply_time, expiry * NSEC_PER_SEC);
-}
-
-static void xdr_decode_AFSCallBack_raw(struct afs_call *call,
-                                      const __be32 **_bp,
-                                      struct afs_callback *cb)
-{
-       const __be32 *bp = *_bp;
-
-       cb->version     = ntohl(*bp++);
+       bp++; /* version */
        cb->expires_at  = xdr_decode_expiry(call, ntohl(*bp++));
-       cb->type        = ntohl(*bp++);
+       bp++; /* type */
+       scb->have_cb    = true;
        *_bp = bp;
 }
 
@@ -395,7 +246,6 @@ static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp,
  */
 static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -403,16 +253,13 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
-
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_AFSCallBack(call, vnode, &bp);
-       xdr_decode_AFSVolSync(&bp, call->reply[1]);
+       xdr_decode_AFSCallBack(&bp, call, call->out_scb);
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -431,8 +278,8 @@ static const struct afs_call_type afs_RXFSFetchStatus_vnode = {
 /*
  * fetch the status information for a file
  */
-int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsync,
-                            bool new_inode)
+int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_status_cb *scb,
+                            struct afs_volsync *volsync)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -440,7 +287,7 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_fetch_file_status(fc, volsync, new_inode);
+               return yfs_fs_fetch_file_status(fc, scb, volsync);
 
        _enter(",%x,{%llx:%llu},,",
               key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
@@ -453,10 +300,8 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
        }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = volsync;
-       call->expected_version = new_inode ? 1 : vnode->status.data_version;
-       call->want_reply_time = true;
+       call->out_scb = scb;
+       call->out_volsync = volsync;
 
        /* marshall the parameters */
        bp = call->request;
@@ -465,10 +310,10 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
        bp[2] = htonl(vnode->fid.vnode);
        bp[3] = htonl(vnode->fid.unique);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
 
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -478,8 +323,7 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
  */
 static int afs_deliver_fs_fetch_data(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
-       struct afs_read *req = call->reply[2];
+       struct afs_read *req = call->read_request;
        const __be32 *bp;
        unsigned int size;
        int ret;
@@ -541,7 +385,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                if (req->offset == PAGE_SIZE) {
                        req->offset = 0;
                        if (req->page_done)
-                               req->page_done(call, req);
+                               req->page_done(req);
                        req->index++;
                        if (req->remain > 0)
                                goto begin_page;
@@ -575,12 +419,14 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                                       &vnode->status.data_version, req);
+               ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
-               xdr_decode_AFSCallBack(call, vnode, &bp);
-               xdr_decode_AFSVolSync(&bp, call->reply[1]);
+               xdr_decode_AFSCallBack(&bp, call, call->out_scb);
+               xdr_decode_AFSVolSync(&bp, call->out_volsync);
+
+               req->data_version = call->out_scb->status.data_version;
+               req->file_size = call->out_scb->status.size;
 
                call->unmarshall++;
 
@@ -593,7 +439,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                        zero_user_segment(req->pages[req->index],
                                          req->offset, PAGE_SIZE);
                if (req->page_done)
-                       req->page_done(call, req);
+                       req->page_done(req);
                req->offset = 0;
        }
 
@@ -603,7 +449,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
 
 static void afs_fetch_data_destructor(struct afs_call *call)
 {
-       struct afs_read *req = call->reply[2];
+       struct afs_read *req = call->read_request;
 
        afs_put_read(req);
        afs_flat_call_destructor(call);
@@ -629,7 +475,9 @@ static const struct afs_call_type afs_RXFSFetchData64 = {
 /*
  * fetch data from a very large file
  */
-static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
+static int afs_fs_fetch_data64(struct afs_fs_cursor *fc,
+                              struct afs_status_cb *scb,
+                              struct afs_read *req)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -643,11 +491,9 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = NULL; /* volsync */
-       call->reply[2] = req;
-       call->expected_version = vnode->status.data_version;
-       call->want_reply_time = true;
+       call->out_scb = scb;
+       call->out_volsync = NULL;
+       call->read_request = req;
 
        /* marshall the parameters */
        bp = call->request;
@@ -661,9 +507,9 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
        bp[7] = htonl(lower_32_bits(req->len));
 
        refcount_inc(&req->usage);
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -671,7 +517,9 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
 /*
  * fetch data from a file
  */
-int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
+int afs_fs_fetch_data(struct afs_fs_cursor *fc,
+                     struct afs_status_cb *scb,
+                     struct afs_read *req)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -679,12 +527,12 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_fetch_data(fc, req);
+               return yfs_fs_fetch_data(fc, scb, req);
 
        if (upper_32_bits(req->pos) ||
            upper_32_bits(req->len) ||
            upper_32_bits(req->pos + req->len))
-               return afs_fs_fetch_data64(fc, req);
+               return afs_fs_fetch_data64(fc, scb, req);
 
        _enter("");
 
@@ -693,11 +541,9 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = NULL; /* volsync */
-       call->reply[2] = req;
-       call->expected_version = vnode->status.data_version;
-       call->want_reply_time = true;
+       call->out_scb = scb;
+       call->out_volsync = NULL;
+       call->read_request = req;
 
        /* marshall the parameters */
        bp = call->request;
@@ -709,9 +555,9 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
        bp[5] = htonl(lower_32_bits(req->len));
 
        refcount_inc(&req->usage);
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -721,28 +567,24 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
  */
 static int afs_deliver_fs_create_vnode(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
-       _enter("{%u}", call->unmarshall);
-
        ret = afs_transfer_reply(call);
        if (ret < 0)
                return ret;
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       xdr_decode_AFSFid(&bp, call->reply[1]);
-       ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
+       xdr_decode_AFSFid(&bp, call->out_fid);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_AFSCallBack_raw(call, &bp, call->reply[3]);
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSCallBack(&bp, call, call->out_scb);
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -771,24 +613,23 @@ static const struct afs_call_type afs_RXFSMakeDir = {
 int afs_fs_create(struct afs_fs_cursor *fc,
                  const char *name,
                  umode_t mode,
-                 u64 current_data_version,
+                 struct afs_status_cb *dvnode_scb,
                  struct afs_fid *newfid,
-                 struct afs_file_status *newstatus,
-                 struct afs_callback *newcb)
+                 struct afs_status_cb *new_scb)
 {
-       struct afs_vnode *vnode = fc->vnode;
+       struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
-       struct afs_net *net = afs_v2net(vnode);
+       struct afs_net *net = afs_v2net(dvnode);
        size_t namesz, reqsz, padsz;
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)){
                if (S_ISDIR(mode))
-                       return yfs_fs_make_dir(fc, name, mode, current_data_version,
-                                              newfid, newstatus, newcb);
+                       return yfs_fs_make_dir(fc, name, mode, dvnode_scb,
+                                              newfid, new_scb);
                else
-                       return yfs_fs_create_file(fc, name, mode, current_data_version,
-                                                 newfid, newstatus, newcb);
+                       return yfs_fs_create_file(fc, name, mode, dvnode_scb,
+                                                 newfid, new_scb);
        }
 
        _enter("");
@@ -804,19 +645,16 @@ int afs_fs_create(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = newfid;
-       call->reply[2] = newstatus;
-       call->reply[3] = newcb;
-       call->expected_version = current_data_version + 1;
-       call->want_reply_time = true;
+       call->out_dir_scb = dvnode_scb;
+       call->out_fid = newfid;
+       call->out_scb = new_scb;
 
        /* marshall the parameters */
        bp = call->request;
        *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE);
-       *bp++ = htonl(vnode->fid.vid);
-       *bp++ = htonl(vnode->fid.vnode);
-       *bp++ = htonl(vnode->fid.unique);
+       *bp++ = htonl(dvnode->fid.vid);
+       *bp++ = htonl(dvnode->fid.vnode);
+       *bp++ = htonl(dvnode->fid.unique);
        *bp++ = htonl(namesz);
        memcpy(bp, name, namesz);
        bp = (void *) bp + namesz;
@@ -825,41 +663,38 @@ int afs_fs_create(struct afs_fs_cursor *fc,
                bp = (void *) bp + padsz;
        }
        *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
-       *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
+       *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */
        *bp++ = 0; /* owner */
        *bp++ = 0; /* group */
        *bp++ = htonl(mode & S_IALLUGO); /* unix mode */
        *bp++ = 0; /* segment size */
 
        afs_use_fs_server(call, fc->cbi);
-       trace_afs_make_fs_call1(call, &vnode->fid, name);
+       trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
 
 /*
- * Deliver reply data to any operation that returns file status and volume
+ * Deliver reply data to any operation that returns directory status and volume
  * sync.
  */
-static int afs_deliver_fs_status_and_vol(struct afs_call *call)
+static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
-       _enter("{%u}", call->unmarshall);
-
        ret = afs_transfer_reply(call);
        if (ret < 0)
                return ret;
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -871,14 +706,14 @@ static int afs_deliver_fs_status_and_vol(struct afs_call *call)
 static const struct afs_call_type afs_RXFSRemoveFile = {
        .name           = "FS.RemoveFile",
        .op             = afs_FS_RemoveFile,
-       .deliver        = afs_deliver_fs_status_and_vol,
+       .deliver        = afs_deliver_fs_dir_status_and_vol,
        .destructor     = afs_flat_call_destructor,
 };
 
 static const struct afs_call_type afs_RXFSRemoveDir = {
        .name           = "FS.RemoveDir",
        .op             = afs_FS_RemoveDir,
-       .deliver        = afs_deliver_fs_status_and_vol,
+       .deliver        = afs_deliver_fs_dir_status_and_vol,
        .destructor     = afs_flat_call_destructor,
 };
 
@@ -886,7 +721,7 @@ static const struct afs_call_type afs_RXFSRemoveDir = {
  * remove a file or directory
  */
 int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-                 const char *name, bool isdir, u64 current_data_version)
+                 const char *name, bool isdir, struct afs_status_cb *dvnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -895,7 +730,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_remove(fc, vnode, name, isdir, current_data_version);
+               return yfs_fs_remove(fc, vnode, name, isdir, dvnode_scb);
 
        _enter("");
 
@@ -910,9 +745,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = vnode;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -930,6 +763,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -939,7 +773,6 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
  */
 static int afs_deliver_fs_link(struct afs_call *call)
 {
-       struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1];
        const __be32 *bp;
        int ret;
 
@@ -951,14 +784,13 @@ static int afs_deliver_fs_link(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = afs_decode_status(call, &bp, &dvnode->status, dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -978,7 +810,9 @@ static const struct afs_call_type afs_RXFSLink = {
  * make a hard link
  */
 int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-               const char *name, u64 current_data_version)
+               const char *name,
+               struct afs_status_cb *dvnode_scb,
+               struct afs_status_cb *vnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -987,7 +821,7 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_link(fc, vnode, name, current_data_version);
+               return yfs_fs_link(fc, vnode, name, dvnode_scb, vnode_scb);
 
        _enter("");
 
@@ -1000,9 +834,8 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = vnode;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_scb = vnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1023,6 +856,7 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &vnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1032,7 +866,6 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
  */
 static int afs_deliver_fs_symlink(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -1044,15 +877,14 @@ static int afs_deliver_fs_symlink(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       xdr_decode_AFSFid(&bp, call->reply[1]);
-       ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
+       xdr_decode_AFSFid(&bp, call->out_fid);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1074,19 +906,19 @@ static const struct afs_call_type afs_RXFSSymlink = {
 int afs_fs_symlink(struct afs_fs_cursor *fc,
                   const char *name,
                   const char *contents,
-                  u64 current_data_version,
+                  struct afs_status_cb *dvnode_scb,
                   struct afs_fid *newfid,
-                  struct afs_file_status *newstatus)
+                  struct afs_status_cb *new_scb)
 {
-       struct afs_vnode *vnode = fc->vnode;
+       struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
-       struct afs_net *net = afs_v2net(vnode);
+       struct afs_net *net = afs_v2net(dvnode);
        size_t namesz, reqsz, padsz, c_namesz, c_padsz;
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_symlink(fc, name, contents, current_data_version,
-                                     newfid, newstatus);
+               return yfs_fs_symlink(fc, name, contents, dvnode_scb,
+                                     newfid, new_scb);
 
        _enter("");
 
@@ -1104,17 +936,16 @@ int afs_fs_symlink(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = newfid;
-       call->reply[2] = newstatus;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_fid = newfid;
+       call->out_scb = new_scb;
 
        /* marshall the parameters */
        bp = call->request;
        *bp++ = htonl(FSSYMLINK);
-       *bp++ = htonl(vnode->fid.vid);
-       *bp++ = htonl(vnode->fid.vnode);
-       *bp++ = htonl(vnode->fid.unique);
+       *bp++ = htonl(dvnode->fid.vid);
+       *bp++ = htonl(dvnode->fid.vnode);
+       *bp++ = htonl(dvnode->fid.unique);
        *bp++ = htonl(namesz);
        memcpy(bp, name, namesz);
        bp = (void *) bp + namesz;
@@ -1130,14 +961,15 @@ int afs_fs_symlink(struct afs_fs_cursor *fc,
                bp = (void *) bp + c_padsz;
        }
        *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
-       *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
+       *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */
        *bp++ = 0; /* owner */
        *bp++ = 0; /* group */
        *bp++ = htonl(S_IRWXUGO); /* unix mode */
        *bp++ = 0; /* segment size */
 
        afs_use_fs_server(call, fc->cbi);
-       trace_afs_make_fs_call1(call, &vnode->fid, name);
+       trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1147,29 +979,24 @@ int afs_fs_symlink(struct afs_fs_cursor *fc,
  */
 static int afs_deliver_fs_rename(struct afs_call *call)
 {
-       struct afs_vnode *orig_dvnode = call->reply[0], *new_dvnode = call->reply[1];
        const __be32 *bp;
        int ret;
 
-       _enter("{%u}", call->unmarshall);
-
        ret = afs_transfer_reply(call);
        if (ret < 0)
                return ret;
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &orig_dvnode->status, orig_dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       if (new_dvnode != orig_dvnode) {
-               ret = afs_decode_status(call, &bp, &new_dvnode->status, new_dvnode,
-                                       &call->expected_version_2, NULL);
+       if (call->out_dir_scb != call->out_scb) {
+               ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
        }
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1186,14 +1013,14 @@ static const struct afs_call_type afs_RXFSRename = {
 };
 
 /*
- * create a symbolic link
+ * Rename/move a file or directory.
  */
 int afs_fs_rename(struct afs_fs_cursor *fc,
                  const char *orig_name,
                  struct afs_vnode *new_dvnode,
                  const char *new_name,
-                 u64 current_orig_data_version,
-                 u64 current_new_data_version)
+                 struct afs_status_cb *orig_dvnode_scb,
+                 struct afs_status_cb *new_dvnode_scb)
 {
        struct afs_vnode *orig_dvnode = fc->vnode;
        struct afs_call *call;
@@ -1204,8 +1031,8 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
                return yfs_fs_rename(fc, orig_name,
                                     new_dvnode, new_name,
-                                    current_orig_data_version,
-                                    current_new_data_version);
+                                    orig_dvnode_scb,
+                                    new_dvnode_scb);
 
        _enter("");
 
@@ -1225,10 +1052,8 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = orig_dvnode;
-       call->reply[1] = new_dvnode;
-       call->expected_version = current_orig_data_version + 1;
-       call->expected_version_2 = current_new_data_version + 1;
+       call->out_dir_scb = orig_dvnode_scb;
+       call->out_scb = new_dvnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1257,6 +1082,7 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call2(call, &orig_dvnode->fid, orig_name, new_name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1266,7 +1092,6 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
  */
 static int afs_deliver_fs_store_data(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -1278,13 +1103,10 @@ static int afs_deliver_fs_store_data(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
-
-       afs_pages_written_back(vnode, call);
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1314,7 +1136,8 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc,
                               struct address_space *mapping,
                               pgoff_t first, pgoff_t last,
                               unsigned offset, unsigned to,
-                              loff_t size, loff_t pos, loff_t i_size)
+                              loff_t size, loff_t pos, loff_t i_size,
+                              struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1332,13 +1155,12 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc,
 
        call->key = fc->key;
        call->mapping = mapping;
-       call->reply[0] = vnode;
        call->first = first;
        call->last = last;
        call->first_offset = offset;
        call->last_to = to;
        call->send_pages = true;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1362,6 +1184,7 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc,
        *bp++ = htonl((u32) i_size);
 
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1371,7 +1194,8 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc,
  */
 int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
                      pgoff_t first, pgoff_t last,
-                     unsigned offset, unsigned to)
+                     unsigned offset, unsigned to,
+                     struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1380,7 +1204,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_store_data(fc, mapping, first, last, offset, to);
+               return yfs_fs_store_data(fc, mapping, first, last, offset, to, scb);
 
        _enter(",%x,{%llx:%llu},,",
               key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
@@ -1401,7 +1225,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
 
        if (pos >> 32 || i_size >> 32 || size >> 32 || (pos + size) >> 32)
                return afs_fs_store_data64(fc, mapping, first, last, offset, to,
-                                          size, pos, i_size);
+                                          size, pos, i_size, scb);
 
        call = afs_alloc_flat_call(net, &afs_RXFSStoreData,
                                   (4 + 6 + 3) * 4,
@@ -1411,13 +1235,12 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
 
        call->key = fc->key;
        call->mapping = mapping;
-       call->reply[0] = vnode;
        call->first = first;
        call->last = last;
        call->first_offset = offset;
        call->last_to = to;
        call->send_pages = true;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1439,6 +1262,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1448,7 +1272,6 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
  */
 static int afs_deliver_fs_store_status(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -1460,11 +1283,10 @@ static int afs_deliver_fs_store_status(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1498,7 +1320,8 @@ static const struct afs_call_type afs_RXFSStoreData64_as_Status = {
  * set the attributes on a very large file, using FS.StoreData rather than
  * FS.StoreStatus so as to alter the file size also
  */
-static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
+static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr,
+                                struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1517,8 +1340,7 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1538,6 +1360,7 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1546,7 +1369,8 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
  * set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
  * so as to alter the file size also
  */
-static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
+static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr,
+                              struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1558,7 +1382,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
 
        ASSERT(attr->ia_valid & ATTR_SIZE);
        if (attr->ia_size >> 32)
-               return afs_fs_setattr_size64(fc, attr);
+               return afs_fs_setattr_size64(fc, attr, scb);
 
        call = afs_alloc_flat_call(net, &afs_RXFSStoreData_as_Status,
                                   (4 + 6 + 3) * 4,
@@ -1567,8 +1391,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1585,6 +1408,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1593,7 +1417,8 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
  * set the attributes on a file, using FS.StoreData if there's a change in file
  * size, and FS.StoreStatus otherwise
  */
-int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
+int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr,
+                  struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1601,10 +1426,10 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_setattr(fc, attr);
+               return yfs_fs_setattr(fc, attr, scb);
 
        if (attr->ia_valid & ATTR_SIZE)
-               return afs_fs_setattr_size(fc, attr);
+               return afs_fs_setattr_size(fc, attr, scb);
 
        _enter(",%x,{%llx:%llu},,",
               key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
@@ -1616,8 +1441,7 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->expected_version = vnode->status.data_version;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1630,6 +1454,7 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1659,7 +1484,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               xdr_decode_AFSFetchVolumeStatus(&bp, call->reply[1]);
+               xdr_decode_AFSFetchVolumeStatus(&bp, call->out_volstatus);
                call->unmarshall++;
                afs_extract_to_tmp(call);
 
@@ -1675,7 +1500,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_volname_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the volume name */
@@ -1685,7 +1510,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
@@ -1703,7 +1528,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_offline_msg_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the offline message */
@@ -1713,7 +1538,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("offline '%s'", p);
 
@@ -1732,7 +1557,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_motd_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the message of the day */
@@ -1742,7 +1567,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("motd '%s'", p);
 
@@ -1757,23 +1582,13 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
 }
 
 /*
- * destroy an FS.GetVolumeStatus call
- */
-static void afs_get_volume_status_call_destructor(struct afs_call *call)
-{
-       kfree(call->reply[2]);
-       call->reply[2] = NULL;
-       afs_flat_call_destructor(call);
-}
-
-/*
  * FS.GetVolumeStatus operation type
  */
 static const struct afs_call_type afs_RXFSGetVolumeStatus = {
        .name           = "FS.GetVolumeStatus",
        .op             = afs_FS_GetVolumeStatus,
        .deliver        = afs_deliver_fs_get_volume_status,
-       .destructor     = afs_get_volume_status_call_destructor,
+       .destructor     = afs_flat_call_destructor,
 };
 
 /*
@@ -1786,27 +1601,19 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc,
        struct afs_call *call;
        struct afs_net *net = afs_v2net(vnode);
        __be32 *bp;
-       void *tmpbuf;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
                return yfs_fs_get_volume_status(fc, vs);
 
        _enter("");
 
-       tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL);
-       if (!tmpbuf)
-               return -ENOMEM;
-
-       call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, 12 * 4);
-       if (!call) {
-               kfree(tmpbuf);
+       call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4,
+                                  max(12 * 4, AFSOPAQUEMAX + 1));
+       if (!call)
                return -ENOMEM;
-       }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = vs;
-       call->reply[2] = tmpbuf;
+       call->out_volstatus = vs;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1815,6 +1622,7 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1835,7 +1643,7 @@ static int afs_deliver_fs_xxxx_lock(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1876,7 +1684,8 @@ static const struct afs_call_type afs_RXFSReleaseLock = {
 /*
  * Set a lock on a file
  */
-int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
+int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type,
+                   struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1884,7 +1693,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_set_lock(fc, type);
+               return yfs_fs_set_lock(fc, type, scb);
 
        _enter("");
 
@@ -1893,8 +1702,8 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->want_reply_time = true;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1906,6 +1715,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_calli(call, &vnode->fid, type);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1913,7 +1723,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
 /*
  * extend a lock on a file
  */
-int afs_fs_extend_lock(struct afs_fs_cursor *fc)
+int afs_fs_extend_lock(struct afs_fs_cursor *fc, struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1921,7 +1731,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_extend_lock(fc);
+               return yfs_fs_extend_lock(fc, scb);
 
        _enter("");
 
@@ -1930,8 +1740,8 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->want_reply_time = true;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1942,6 +1752,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1949,7 +1760,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
 /*
  * release a lock on a file
  */
-int afs_fs_release_lock(struct afs_fs_cursor *fc)
+int afs_fs_release_lock(struct afs_fs_cursor *fc, struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1957,7 +1768,7 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc)
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_release_lock(fc);
+               return yfs_fs_release_lock(fc, scb);
 
        _enter("");
 
@@ -1966,7 +1777,8 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1977,6 +1789,7 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -2071,14 +1884,6 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
        return 0;
 }
 
-static void afs_destroy_fs_get_capabilities(struct afs_call *call)
-{
-       struct afs_server *server = call->reply[0];
-
-       afs_put_server(call->net, server);
-       afs_flat_call_destructor(call);
-}
-
 /*
  * FS.GetCapabilities operation type
  */
@@ -2087,7 +1892,7 @@ static const struct afs_call_type afs_RXFSGetCapabilities = {
        .op             = afs_FS_GetCapabilities,
        .deliver        = afs_deliver_fs_get_capabilities,
        .done           = afs_fileserver_probe_result,
-       .destructor     = afs_destroy_fs_get_capabilities,
+       .destructor     = afs_flat_call_destructor,
 };
 
 /*
@@ -2110,11 +1915,11 @@ struct afs_call *afs_fs_get_capabilities(struct afs_net *net,
                return ERR_PTR(-ENOMEM);
 
        call->key = key;
-       call->reply[0] = afs_get_server(server);
-       call->reply[1] = (void *)(long)server_index;
+       call->server = afs_get_server(server);
+       call->server_index = server_index;
        call->upgrade = true;
-       call->want_reply_time = true;
        call->async = true;
+       call->max_lifespan = AFS_PROBE_MAX_LIFESPAN;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2131,10 +1936,6 @@ struct afs_call *afs_fs_get_capabilities(struct afs_net *net,
  */
 static int afs_deliver_fs_fetch_status(struct afs_call *call)
 {
-       struct afs_file_status *status = call->reply[1];
-       struct afs_callback *callback = call->reply[2];
-       struct afs_volsync *volsync = call->reply[3];
-       struct afs_fid *fid = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -2142,16 +1943,13 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       _enter("{%llx:%llu}", fid->vid, fid->vnode);
-
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = afs_decode_status(call, &bp, status, NULL,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_AFSCallBack_raw(call, &bp, callback);
-       xdr_decode_AFSVolSync(&bp, volsync);
+       xdr_decode_AFSCallBack(&bp, call, call->out_scb);
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -2173,15 +1971,14 @@ static const struct afs_call_type afs_RXFSFetchStatus = {
 int afs_fs_fetch_status(struct afs_fs_cursor *fc,
                        struct afs_net *net,
                        struct afs_fid *fid,
-                       struct afs_file_status *status,
-                       struct afs_callback *callback,
+                       struct afs_status_cb *scb,
                        struct afs_volsync *volsync)
 {
        struct afs_call *call;
        __be32 *bp;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_fetch_status(fc, net, fid, status, callback, volsync);
+               return yfs_fs_fetch_status(fc, net, fid, scb, volsync);
 
        _enter(",%x,{%llx:%llu},,",
               key_serial(fc->key), fid->vid, fid->vnode);
@@ -2193,12 +1990,9 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc,
        }
 
        call->key = fc->key;
-       call->reply[0] = fid;
-       call->reply[1] = status;
-       call->reply[2] = callback;
-       call->reply[3] = volsync;
-       call->expected_version = 1; /* vnode->status.data_version */
-       call->want_reply_time = true;
+       call->out_fid = fid;
+       call->out_scb = scb;
+       call->out_volsync = volsync;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2207,9 +2001,9 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc,
        bp[2] = htonl(fid->vnode);
        bp[3] = htonl(fid->unique);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -2219,9 +2013,7 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc,
  */
 static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
 {
-       struct afs_file_status *statuses;
-       struct afs_callback *callbacks;
-       struct afs_vnode *vnode = call->reply[0];
+       struct afs_status_cb *scb;
        const __be32 *bp;
        u32 tmp;
        int ret;
@@ -2260,10 +2052,8 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               statuses = call->reply[1];
-               ret = afs_decode_status(call, &bp, &statuses[call->count],
-                                       call->count == 0 ? vnode : NULL,
-                                       NULL, NULL);
+               scb = &call->out_scb[call->count];
+               ret = xdr_decode_AFSFetchStatus(&bp, call, scb);
                if (ret < 0)
                        return ret;
 
@@ -2302,13 +2092,8 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                _debug("unmarshall CB array");
                bp = call->buffer;
-               callbacks = call->reply[2];
-               callbacks[call->count].version  = ntohl(bp[0]);
-               callbacks[call->count].expires_at = xdr_decode_expiry(call, ntohl(bp[1]));
-               callbacks[call->count].type     = ntohl(bp[2]);
-               statuses = call->reply[1];
-               if (call->count == 0 && vnode && statuses[0].abort_code == 0)
-                       xdr_decode_AFSCallBack(call, vnode, &bp);
+               scb = &call->out_scb[call->count];
+               xdr_decode_AFSCallBack(&bp, call, scb);
                call->count++;
                if (call->count < call->count2)
                        goto more_cbs;
@@ -2323,7 +2108,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               xdr_decode_AFSVolSync(&bp, call->reply[3]);
+               xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
                call->unmarshall++;
 
@@ -2351,8 +2136,7 @@ static const struct afs_call_type afs_RXFSInlineBulkStatus = {
 int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
                              struct afs_net *net,
                              struct afs_fid *fids,
-                             struct afs_file_status *statuses,
-                             struct afs_callback *callbacks,
+                             struct afs_status_cb *statuses,
                              unsigned int nr_fids,
                              struct afs_volsync *volsync)
 {
@@ -2361,7 +2145,7 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
        int i;
 
        if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
-               return yfs_fs_inline_bulk_status(fc, net, fids, statuses, callbacks,
+               return yfs_fs_inline_bulk_status(fc, net, fids, statuses,
                                                 nr_fids, volsync);
 
        _enter(",%x,{%llx:%llu},%u",
@@ -2376,12 +2160,9 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
        }
 
        call->key = fc->key;
-       call->reply[0] = NULL; /* vnode for fid[0] */
-       call->reply[1] = statuses;
-       call->reply[2] = callbacks;
-       call->reply[3] = volsync;
+       call->out_scb = statuses;
+       call->out_volsync = volsync;
        call->count2 = nr_fids;
-       call->want_reply_time = true;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2393,9 +2174,9 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
                *bp++ = htonl(fids[i].unique);
        }
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &fids[0]);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -2405,7 +2186,6 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
  */
 static int afs_deliver_fs_fetch_acl(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[1];
        struct afs_acl *acl;
        const __be32 *bp;
        unsigned int size;
@@ -2430,7 +2210,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
                acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL);
                if (!acl)
                        return -ENOMEM;
-               call->reply[0] = acl;
+               call->ret_acl = acl;
                acl->size = call->count2;
                afs_extract_begin(call, acl->data, size);
                call->unmarshall++;
@@ -2451,11 +2231,10 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               ret = afs_decode_status(call, &bp, &vnode->status, vnode,
-                                       &vnode->status.data_version, NULL);
+               ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
-               xdr_decode_AFSVolSync(&bp, call->reply[2]);
+               xdr_decode_AFSVolSync(&bp, call->out_volsync);
 
                call->unmarshall++;
 
@@ -2469,7 +2248,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
 
 static void afs_destroy_fs_fetch_acl(struct afs_call *call)
 {
-       kfree(call->reply[0]);
+       kfree(call->ret_acl);
        afs_flat_call_destructor(call);
 }
 
@@ -2486,7 +2265,8 @@ static const struct afs_call_type afs_RXFSFetchACL = {
 /*
  * Fetch the ACL for a file.
  */
-struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc)
+struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc,
+                                struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -2503,10 +2283,9 @@ struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc)
        }
 
        call->key = fc->key;
-       call->reply[0] = NULL;
-       call->reply[1] = vnode;
-       call->reply[2] = NULL; /* volsync */
-       call->ret_reply0 = true;
+       call->ret_acl = NULL;
+       call->out_scb = scb;
+       call->out_volsync = NULL;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2515,7 +2294,6 @@ struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc)
        bp[2] = htonl(vnode->fid.vnode);
        bp[3] = htonl(vnode->fid.unique);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
        afs_make_call(&fc->ac, call, GFP_KERNEL);
@@ -2523,19 +2301,43 @@ struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc)
 }
 
 /*
+ * Deliver reply data to any operation that returns file status and volume
+ * sync.
+ */
+static int afs_deliver_fs_file_status_and_vol(struct afs_call *call)
+{
+       const __be32 *bp;
+       int ret;
+
+       ret = afs_transfer_reply(call);
+       if (ret < 0)
+               return ret;
+
+       bp = call->buffer;
+       ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb);
+       if (ret < 0)
+               return ret;
+       xdr_decode_AFSVolSync(&bp, call->out_volsync);
+
+       _leave(" = 0 [done]");
+       return 0;
+}
+
+/*
  * FS.StoreACL operation type
  */
 static const struct afs_call_type afs_RXFSStoreACL = {
        .name           = "FS.StoreACL",
        .op             = afs_FS_StoreACL,
-       .deliver        = afs_deliver_fs_status_and_vol,
+       .deliver        = afs_deliver_fs_file_status_and_vol,
        .destructor     = afs_flat_call_destructor,
 };
 
 /*
  * Fetch the ACL for a file.
  */
-int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl)
+int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl,
+                    struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -2555,8 +2357,8 @@ int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl)
        }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[2] = NULL; /* volsync */
+       call->out_scb = scb;
+       call->out_volsync = NULL;
 
        /* marshall the parameters */
        bp = call->request;
index c4652b4..b42d9d0 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/namei.h>
 #include <linux/iversion.h>
 #include "internal.h"
+#include "afs_fs.h"
 
 static const struct inode_operations afs_symlink_inode_operations = {
        .get_link       = page_get_link,
@@ -58,38 +59,50 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren
  * Initialise an inode from the vnode status.
  */
 static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
-                                     struct afs_vnode *parent_vnode)
+                                     struct afs_cb_interest *cbi,
+                                     struct afs_vnode *parent_vnode,
+                                     struct afs_status_cb *scb)
 {
+       struct afs_cb_interest *old_cbi = NULL;
+       struct afs_file_status *status = &scb->status;
        struct inode *inode = AFS_VNODE_TO_I(vnode);
+       struct timespec64 t;
 
        _debug("FS: ft=%d lk=%d sz=%llu ver=%Lu mod=%hu",
-              vnode->status.type,
-              vnode->status.nlink,
-              (unsigned long long) vnode->status.size,
-              vnode->status.data_version,
-              vnode->status.mode);
+              status->type,
+              status->nlink,
+              (unsigned long long) status->size,
+              status->data_version,
+              status->mode);
 
-       read_seqlock_excl(&vnode->cb_lock);
+       write_seqlock(&vnode->cb_lock);
 
-       afs_update_inode_from_status(vnode, &vnode->status, NULL,
-                                    AFS_VNODE_NOT_YET_SET);
+       vnode->status = *status;
 
-       switch (vnode->status.type) {
+       t = status->mtime_client;
+       inode->i_ctime = t;
+       inode->i_mtime = t;
+       inode->i_atime = t;
+       inode->i_uid = make_kuid(&init_user_ns, status->owner);
+       inode->i_gid = make_kgid(&init_user_ns, status->group);
+       set_nlink(&vnode->vfs_inode, status->nlink);
+
+       switch (status->type) {
        case AFS_FTYPE_FILE:
-               inode->i_mode   = S_IFREG | vnode->status.mode;
+               inode->i_mode   = S_IFREG | status->mode;
                inode->i_op     = &afs_file_inode_operations;
                inode->i_fop    = &afs_file_operations;
                inode->i_mapping->a_ops = &afs_fs_aops;
                break;
        case AFS_FTYPE_DIR:
-               inode->i_mode   = S_IFDIR | vnode->status.mode;
+               inode->i_mode   = S_IFDIR | status->mode;
                inode->i_op     = &afs_dir_inode_operations;
                inode->i_fop    = &afs_dir_file_operations;
                inode->i_mapping->a_ops = &afs_dir_aops;
                break;
        case AFS_FTYPE_SYMLINK:
                /* Symlinks with a mode of 0644 are actually mountpoints. */
-               if ((vnode->status.mode & 0777) == 0644) {
+               if ((status->mode & 0777) == 0644) {
                        inode->i_flags |= S_AUTOMOUNT;
 
                        set_bit(AFS_VNODE_MOUNTPOINT, &vnode->flags);
@@ -99,7 +112,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
                        inode->i_fop    = &afs_mntpt_file_operations;
                        inode->i_mapping->a_ops = &afs_fs_aops;
                } else {
-                       inode->i_mode   = S_IFLNK | vnode->status.mode;
+                       inode->i_mode   = S_IFLNK | status->mode;
                        inode->i_op     = &afs_symlink_inode_operations;
                        inode->i_mapping->a_ops = &afs_fs_aops;
                }
@@ -107,7 +120,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
                break;
        default:
                dump_vnode(vnode, parent_vnode);
-               read_sequnlock_excl(&vnode->cb_lock);
+               write_sequnlock(&vnode->cb_lock);
                return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
        }
 
@@ -116,17 +129,175 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
         * for consistency with other AFS clients.
         */
        inode->i_blocks         = ((i_size_read(inode) + 1023) >> 10) << 1;
-       vnode->invalid_before   = vnode->status.data_version;
+       i_size_write(&vnode->vfs_inode, status->size);
+
+       vnode->invalid_before   = status->data_version;
+       inode_set_iversion_raw(&vnode->vfs_inode, status->data_version);
+
+       if (!scb->have_cb) {
+               /* it's a symlink we just created (the fileserver
+                * didn't give us a callback) */
+               vnode->cb_expires_at = ktime_get_real_seconds();
+       } else {
+               vnode->cb_expires_at = scb->callback.expires_at;
+               old_cbi = rcu_dereference_protected(vnode->cb_interest,
+                                                   lockdep_is_held(&vnode->cb_lock.lock));
+               if (cbi != old_cbi)
+                       rcu_assign_pointer(vnode->cb_interest, afs_get_cb_interest(cbi));
+               else
+                       old_cbi = NULL;
+               set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
+       }
 
-       read_sequnlock_excl(&vnode->cb_lock);
+       write_sequnlock(&vnode->cb_lock);
+       afs_put_cb_interest(afs_v2net(vnode), old_cbi);
        return 0;
 }
 
 /*
+ * Update the core inode struct from a returned status record.
+ */
+static void afs_apply_status(struct afs_fs_cursor *fc,
+                            struct afs_vnode *vnode,
+                            struct afs_status_cb *scb,
+                            const afs_dataversion_t *expected_version)
+{
+       struct afs_file_status *status = &scb->status;
+       struct timespec64 t;
+       umode_t mode;
+       bool data_changed = false;
+
+       BUG_ON(test_bit(AFS_VNODE_UNSET, &vnode->flags));
+
+       if (status->type != vnode->status.type) {
+               pr_warning("Vnode %llx:%llx:%x changed type %u to %u\n",
+                          vnode->fid.vid,
+                          vnode->fid.vnode,
+                          vnode->fid.unique,
+                          status->type, vnode->status.type);
+               afs_protocol_error(NULL, -EBADMSG, afs_eproto_bad_status);
+               return;
+       }
+
+       if (status->nlink != vnode->status.nlink)
+               set_nlink(&vnode->vfs_inode, status->nlink);
+
+       if (status->owner != vnode->status.owner)
+               vnode->vfs_inode.i_uid = make_kuid(&init_user_ns, status->owner);
+
+       if (status->group != vnode->status.group)
+               vnode->vfs_inode.i_gid = make_kgid(&init_user_ns, status->group);
+
+       if (status->mode != vnode->status.mode) {
+               mode = vnode->vfs_inode.i_mode;
+               mode &= ~S_IALLUGO;
+               mode |= status->mode;
+               WRITE_ONCE(vnode->vfs_inode.i_mode, mode);
+       }
+
+       t = status->mtime_client;
+       vnode->vfs_inode.i_ctime = t;
+       vnode->vfs_inode.i_mtime = t;
+       vnode->vfs_inode.i_atime = t;
+
+       if (vnode->status.data_version != status->data_version)
+               data_changed = true;
+
+       vnode->status = *status;
+
+       if (expected_version &&
+           *expected_version != status->data_version) {
+               kdebug("vnode modified %llx on {%llx:%llu} [exp %llx] %s",
+                      (unsigned long long) status->data_version,
+                      vnode->fid.vid, vnode->fid.vnode,
+                      (unsigned long long) *expected_version,
+                      fc->type ? fc->type->name : "???");
+               vnode->invalid_before = status->data_version;
+               if (vnode->status.type == AFS_FTYPE_DIR) {
+                       if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
+                               afs_stat_v(vnode, n_inval);
+               } else {
+                       set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags);
+               }
+       } else if (vnode->status.type == AFS_FTYPE_DIR) {
+               /* Expected directory change is handled elsewhere so
+                * that we can locally edit the directory and save on a
+                * download.
+                */
+               if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
+                       data_changed = false;
+       }
+
+       if (data_changed) {
+               inode_set_iversion_raw(&vnode->vfs_inode, status->data_version);
+               i_size_write(&vnode->vfs_inode, status->size);
+       }
+}
+
+/*
+ * Apply a callback to a vnode.
+ */
+static void afs_apply_callback(struct afs_fs_cursor *fc,
+                              struct afs_vnode *vnode,
+                              struct afs_status_cb *scb,
+                              unsigned int cb_break)
+{
+       struct afs_cb_interest *old;
+       struct afs_callback *cb = &scb->callback;
+
+       if (!afs_cb_is_broken(cb_break, vnode, fc->cbi)) {
+               vnode->cb_expires_at    = cb->expires_at;
+               old = rcu_dereference_protected(vnode->cb_interest,
+                                               lockdep_is_held(&vnode->cb_lock.lock));
+               if (old != fc->cbi) {
+                       rcu_assign_pointer(vnode->cb_interest, afs_get_cb_interest(fc->cbi));
+                       afs_put_cb_interest(afs_v2net(vnode), old);
+               }
+               set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
+       }
+}
+
+/*
+ * Apply the received status and callback to an inode all in the same critical
+ * section to avoid races with afs_validate().
+ */
+void afs_vnode_commit_status(struct afs_fs_cursor *fc,
+                            struct afs_vnode *vnode,
+                            unsigned int cb_break,
+                            const afs_dataversion_t *expected_version,
+                            struct afs_status_cb *scb)
+{
+       if (fc->ac.error != 0)
+               return;
+
+       write_seqlock(&vnode->cb_lock);
+
+       if (scb->have_error) {
+               if (scb->status.abort_code == VNOVNODE) {
+                       set_bit(AFS_VNODE_DELETED, &vnode->flags);
+                       clear_nlink(&vnode->vfs_inode);
+                       __afs_break_callback(vnode);
+               }
+       } else {
+               if (scb->have_status)
+                       afs_apply_status(fc, vnode, scb, expected_version);
+               if (scb->have_cb)
+                       afs_apply_callback(fc, vnode, scb, cb_break);
+       }
+
+       write_sequnlock(&vnode->cb_lock);
+
+       if (fc->ac.error == 0 && scb->have_status)
+               afs_cache_permit(vnode, fc->key, cb_break, scb);
+}
+
+/*
  * Fetch file status from the volume.
  */
-int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode)
+int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool is_new,
+                    afs_access_t *_caller_access)
 {
+       struct afs_status_cb *scb;
        struct afs_fs_cursor fc;
        int ret;
 
@@ -135,18 +306,38 @@ int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode)
               vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique,
               vnode->flags);
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               return -ENOMEM;
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_fetch_file_status(&fc, NULL, new_inode);
+                       afs_fs_fetch_file_status(&fc, scb, NULL);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               if (fc.error) {
+                       /* Do nothing. */
+               } else if (is_new) {
+                       ret = afs_inode_init_from_status(vnode, key, fc.cbi,
+                                                        NULL, scb);
+                       fc.error = ret;
+                       if (ret == 0)
+                               afs_cache_permit(vnode, key, fc.cb_break, scb);
+               } else {
+                       afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                               &data_version, scb);
+               }
+               afs_check_for_remote_deletion(&fc, vnode);
                ret = afs_end_vnode_operation(&fc);
        }
 
+       if (ret == 0 && _caller_access)
+               *_caller_access = scb->status.caller_access;
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -156,10 +347,10 @@ int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode)
  */
 int afs_iget5_test(struct inode *inode, void *opaque)
 {
-       struct afs_iget_data *data = opaque;
+       struct afs_iget_data *iget_data = opaque;
        struct afs_vnode *vnode = AFS_FS_I(inode);
 
-       return memcmp(&vnode->fid, &data->fid, sizeof(data->fid)) == 0;
+       return memcmp(&vnode->fid, &iget_data->fid, sizeof(iget_data->fid)) == 0;
 }
 
 /*
@@ -177,17 +368,19 @@ static int afs_iget5_pseudo_dir_test(struct inode *inode, void *opaque)
  */
 static int afs_iget5_set(struct inode *inode, void *opaque)
 {
-       struct afs_iget_data *data = opaque;
+       struct afs_iget_data *iget_data = opaque;
        struct afs_vnode *vnode = AFS_FS_I(inode);
 
-       vnode->fid = data->fid;
-       vnode->volume = data->volume;
+       vnode->fid              = iget_data->fid;
+       vnode->volume           = iget_data->volume;
+       vnode->cb_v_break       = iget_data->cb_v_break;
+       vnode->cb_s_break       = iget_data->cb_s_break;
 
        /* YFS supports 96-bit vnode IDs, but Linux only supports
         * 64-bit inode numbers.
         */
-       inode->i_ino data->fid.vnode;
-       inode->i_generation data->fid.unique;
+       inode->i_ino            = iget_data->fid.vnode;
+       inode->i_generation     = iget_data->fid.unique;
        return 0;
 }
 
@@ -197,38 +390,42 @@ static int afs_iget5_set(struct inode *inode, void *opaque)
  */
 struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root)
 {
-       struct afs_iget_data data;
        struct afs_super_info *as;
        struct afs_vnode *vnode;
        struct inode *inode;
        static atomic_t afs_autocell_ino;
 
+       struct afs_iget_data iget_data = {
+               .cb_v_break = 0,
+               .cb_s_break = 0,
+       };
+
        _enter("");
 
        as = sb->s_fs_info;
        if (as->volume) {
-               data.volume = as->volume;
-               data.fid.vid = as->volume->vid;
+               iget_data.volume = as->volume;
+               iget_data.fid.vid = as->volume->vid;
        }
        if (root) {
-               data.fid.vnode = 1;
-               data.fid.unique = 1;
+               iget_data.fid.vnode = 1;
+               iget_data.fid.unique = 1;
        } else {
-               data.fid.vnode = atomic_inc_return(&afs_autocell_ino);
-               data.fid.unique = 0;
+               iget_data.fid.vnode = atomic_inc_return(&afs_autocell_ino);
+               iget_data.fid.unique = 0;
        }
 
-       inode = iget5_locked(sb, data.fid.vnode,
+       inode = iget5_locked(sb, iget_data.fid.vnode,
                             afs_iget5_pseudo_dir_test, afs_iget5_set,
-                            &data);
+                            &iget_data);
        if (!inode) {
                _leave(" = -ENOMEM");
                return ERR_PTR(-ENOMEM);
        }
 
        _debug("GOT INODE %p { ino=%lu, vl=%llx, vn=%llx, u=%x }",
-              inode, inode->i_ino, data.fid.vid, data.fid.vnode,
-              data.fid.unique);
+              inode, inode->i_ino, iget_data.fid.vid, iget_data.fid.vnode,
+              iget_data.fid.unique);
 
        vnode = AFS_FS_I(inode);
 
@@ -299,23 +496,24 @@ static void afs_get_inode_cache(struct afs_vnode *vnode)
  * inode retrieval
  */
 struct inode *afs_iget(struct super_block *sb, struct key *key,
-                      struct afs_fid *fid, struct afs_file_status *status,
-                      struct afs_callback *cb, struct afs_cb_interest *cbi,
+                      struct afs_iget_data *iget_data,
+                      struct afs_status_cb *scb,
+                      struct afs_cb_interest *cbi,
                       struct afs_vnode *parent_vnode)
 {
-       struct afs_iget_data data = { .fid = *fid };
        struct afs_super_info *as;
        struct afs_vnode *vnode;
+       struct afs_fid *fid = &iget_data->fid;
        struct inode *inode;
        int ret;
 
        _enter(",{%llx:%llu.%u},,", fid->vid, fid->vnode, fid->unique);
 
        as = sb->s_fs_info;
-       data.volume = as->volume;
+       iget_data->volume = as->volume;
 
        inode = iget5_locked(sb, fid->vnode, afs_iget5_test, afs_iget5_set,
-                            &data);
+                            iget_data);
        if (!inode) {
                _leave(" = -ENOMEM");
                return ERR_PTR(-ENOMEM);
@@ -332,43 +530,25 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
                return inode;
        }
 
-       if (!status) {
+       if (!scb) {
                /* it's a remotely extant inode */
-               ret = afs_fetch_status(vnode, key, true);
+               ret = afs_fetch_status(vnode, key, true, NULL);
                if (ret < 0)
                        goto bad_inode;
        } else {
-               /* it's an inode we just created */
-               memcpy(&vnode->status, status, sizeof(vnode->status));
-
-               if (!cb) {
-                       /* it's a symlink we just created (the fileserver
-                        * didn't give us a callback) */
-                       vnode->cb_version = 0;
-                       vnode->cb_type = 0;
-                       vnode->cb_expires_at = ktime_get();
-               } else {
-                       vnode->cb_version = cb->version;
-                       vnode->cb_type = cb->type;
-                       vnode->cb_expires_at = cb->expires_at;
-                       vnode->cb_interest = afs_get_cb_interest(cbi);
-                       set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
-               }
-
-               vnode->cb_expires_at += ktime_get_real_seconds();
+               ret = afs_inode_init_from_status(vnode, key, cbi, parent_vnode,
+                                                scb);
+               if (ret < 0)
+                       goto bad_inode;
        }
 
-       ret = afs_inode_init_from_status(vnode, key, parent_vnode);
-       if (ret < 0)
-               goto bad_inode;
-
        afs_get_inode_cache(vnode);
 
        /* success */
        clear_bit(AFS_VNODE_UNSET, &vnode->flags);
        inode->i_flags |= S_NOATIME;
        unlock_new_inode(inode);
-       _leave(" = %p [CB { v=%u t=%u }]", inode, vnode->cb_version, vnode->cb_type);
+       _leave(" = %p", inode);
        return inode;
 
        /* failure */
@@ -400,6 +580,66 @@ void afs_zap_data(struct afs_vnode *vnode)
 }
 
 /*
+ * Check the validity of a vnode/inode.
+ */
+bool afs_check_validity(struct afs_vnode *vnode)
+{
+       struct afs_cb_interest *cbi;
+       struct afs_server *server;
+       struct afs_volume *volume = vnode->volume;
+       time64_t now = ktime_get_real_seconds();
+       bool valid, need_clear = false;
+       unsigned int cb_break, cb_s_break, cb_v_break;
+       int seq = 0;
+
+       do {
+               read_seqbegin_or_lock(&vnode->cb_lock, &seq);
+               cb_v_break = READ_ONCE(volume->cb_v_break);
+               cb_break = vnode->cb_break;
+
+               if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
+                       cbi = rcu_dereference(vnode->cb_interest);
+                       server = rcu_dereference(cbi->server);
+                       cb_s_break = READ_ONCE(server->cb_s_break);
+
+                       if (vnode->cb_s_break != cb_s_break ||
+                           vnode->cb_v_break != cb_v_break) {
+                               vnode->cb_s_break = cb_s_break;
+                               vnode->cb_v_break = cb_v_break;
+                               need_clear = true;
+                               valid = false;
+                       } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {
+                               need_clear = true;
+                               valid = false;
+                       } else if (vnode->cb_expires_at - 10 <= now) {
+                               need_clear = true;
+                               valid = false;
+                       } else {
+                               valid = true;
+                       }
+               } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
+                       valid = true;
+               } else {
+                       vnode->cb_v_break = cb_v_break;
+                       valid = false;
+               }
+
+       } while (need_seqretry(&vnode->cb_lock, seq));
+
+       done_seqretry(&vnode->cb_lock, seq);
+
+       if (need_clear) {
+               write_seqlock(&vnode->cb_lock);
+               if (cb_break == vnode->cb_break)
+                       __afs_break_callback(vnode);
+               write_sequnlock(&vnode->cb_lock);
+               valid = false;
+       }
+
+       return valid;
+}
+
+/*
  * validate a vnode/inode
  * - there are several things we need to check
  *   - parent dir data changes (rm, rmdir, rename, mkdir, create, link,
@@ -410,7 +650,6 @@ void afs_zap_data(struct afs_vnode *vnode)
  */
 int afs_validate(struct afs_vnode *vnode, struct key *key)
 {
-       time64_t now = ktime_get_real_seconds();
        bool valid;
        int ret;
 
@@ -418,36 +657,9 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
               vnode->fid.vid, vnode->fid.vnode, vnode->flags,
               key_serial(key));
 
-       /* Quickly check the callback state.  Ideally, we'd use read_seqbegin
-        * here, but we have no way to pass the net namespace to the RCU
-        * cleanup for the server record.
-        */
-       read_seqlock_excl(&vnode->cb_lock);
-
-       if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
-               if (vnode->cb_s_break != vnode->cb_interest->server->cb_s_break ||
-                   vnode->cb_v_break != vnode->volume->cb_v_break) {
-                       vnode->cb_s_break = vnode->cb_interest->server->cb_s_break;
-                       vnode->cb_v_break = vnode->volume->cb_v_break;
-                       valid = false;
-               } else if (vnode->status.type == AFS_FTYPE_DIR &&
-                          (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags) ||
-                           vnode->cb_expires_at - 10 <= now)) {
-                       valid = false;
-               } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags) ||
-                          vnode->cb_expires_at - 10 <= now) {
-                       valid = false;
-               } else {
-                       valid = true;
-               }
-       } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
-               valid = true;
-       } else {
-               vnode->cb_v_break = vnode->volume->cb_v_break;
-               valid = false;
-       }
-
-       read_sequnlock_excl(&vnode->cb_lock);
+       rcu_read_lock();
+       valid = afs_check_validity(vnode);
+       rcu_read_unlock();
 
        if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
                clear_nlink(&vnode->vfs_inode);
@@ -463,7 +675,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
         * access */
        if (!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
                _debug("not promised");
-               ret = afs_fetch_status(vnode, key, false);
+               ret = afs_fetch_status(vnode, key, false, NULL);
                if (ret < 0) {
                        if (ret == -ENOENT) {
                                set_bit(AFS_VNODE_DELETED, &vnode->flags);
@@ -534,6 +746,7 @@ int afs_drop_inode(struct inode *inode)
  */
 void afs_evict_inode(struct inode *inode)
 {
+       struct afs_cb_interest *cbi;
        struct afs_vnode *vnode;
 
        vnode = AFS_FS_I(inode);
@@ -550,10 +763,14 @@ void afs_evict_inode(struct inode *inode)
        truncate_inode_pages_final(&inode->i_data);
        clear_inode(inode);
 
-       if (vnode->cb_interest) {
-               afs_put_cb_interest(afs_i2net(inode), vnode->cb_interest);
-               vnode->cb_interest = NULL;
+       write_seqlock(&vnode->cb_lock);
+       cbi = rcu_dereference_protected(vnode->cb_interest,
+                                       lockdep_is_held(&vnode->cb_lock.lock));
+       if (cbi) {
+               afs_put_cb_interest(afs_i2net(inode), cbi);
+               rcu_assign_pointer(vnode->cb_interest, NULL);
        }
+       write_sequnlock(&vnode->cb_lock);
 
        while (!list_empty(&vnode->wb_keys)) {
                struct afs_wb_key *wbk = list_entry(vnode->wb_keys.next,
@@ -573,6 +790,7 @@ void afs_evict_inode(struct inode *inode)
        }
 #endif
 
+       afs_prune_wb_keys(vnode);
        afs_put_permits(rcu_access_pointer(vnode->permit_cache));
        key_put(vnode->silly_key);
        vnode->silly_key = NULL;
@@ -587,9 +805,10 @@ void afs_evict_inode(struct inode *inode)
 int afs_setattr(struct dentry *dentry, struct iattr *attr)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));
        struct key *key;
-       int ret;
+       int ret = -ENOMEM;
 
        _enter("{%llx:%llu},{n=%pd},%x",
               vnode->fid.vid, vnode->fid.vnode, dentry,
@@ -601,6 +820,10 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr)
                return 0;
        }
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_KERNEL);
+       if (!scb)
+               goto error;
+
        /* flush any dirty data outstanding on a regular file */
        if (S_ISREG(vnode->vfs_inode.i_mode))
                filemap_write_and_wait(vnode->vfs_inode.i_mapping);
@@ -611,25 +834,33 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr)
                key = afs_request_key(vnode->volume->cell);
                if (IS_ERR(key)) {
                        ret = PTR_ERR(key);
-                       goto error;
+                       goto error_scb;
                }
        }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
+               if (attr->ia_valid & ATTR_SIZE)
+                       data_version++;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_setattr(&fc, attr);
+                       afs_fs_setattr(&fc, attr, scb);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
        if (!(attr->ia_valid & ATTR_FILE))
                key_put(key);
 
+error_scb:
+       kfree(scb);
 error:
        _leave(" = %d", ret);
        return ret;
index b3cd6e8..2073c1a 100644 (file)
@@ -66,6 +66,8 @@ struct afs_fs_context {
 struct afs_iget_data {
        struct afs_fid          fid;
        struct afs_volume       *volume;        /* volume on which resides */
+       unsigned int            cb_v_break;     /* Pre-fetch volume break count */
+       unsigned int            cb_s_break;     /* Pre-fetch server break count */
 };
 
 enum afs_call_state {
@@ -111,8 +113,12 @@ struct afs_call {
        struct rxrpc_call       *rxcall;        /* RxRPC call handle */
        struct key              *key;           /* security for this call */
        struct afs_net          *net;           /* The network namespace */
-       struct afs_server       *cm_server;     /* Server affected by incoming CM call */
+       union {
+               struct afs_server       *server;
+               struct afs_vlserver     *vlserver;
+       };
        struct afs_cb_interest  *cbi;           /* Callback interest for server used */
+       struct afs_vnode        *lvnode;        /* vnode being locked */
        void                    *request;       /* request data (first part) */
        struct address_space    *mapping;       /* Pages being written from */
        struct iov_iter         iter;           /* Buffer iterator */
@@ -122,7 +128,20 @@ struct afs_call {
                struct bio_vec  bvec[1];
        };
        void                    *buffer;        /* reply receive buffer */
-       void                    *reply[4];      /* Where to put the reply */
+       union {
+               long                    ret0;   /* Value to reply with instead of 0 */
+               struct afs_addr_list    *ret_alist;
+               struct afs_vldb_entry   *ret_vldb;
+               struct afs_acl          *ret_acl;
+       };
+       struct afs_fid          *out_fid;
+       struct afs_status_cb    *out_dir_scb;
+       struct afs_status_cb    *out_scb;
+       struct yfs_acl          *out_yacl;
+       struct afs_volsync      *out_volsync;
+       struct afs_volume_status *out_volstatus;
+       struct afs_read         *read_request;
+       unsigned int            server_index;
        pgoff_t                 first;          /* first page in mapping to deal with */
        pgoff_t                 last;           /* last page in mapping to deal with */
        atomic_t                usage;
@@ -131,10 +150,10 @@ struct afs_call {
        int                     error;          /* error code */
        u32                     abort_code;     /* Remote abort ID or 0 */
        u32                     epoch;
+       unsigned int            max_lifespan;   /* Maximum lifespan to set if not 0 */
        unsigned                request_size;   /* size of request data */
        unsigned                reply_max;      /* maximum size of reply */
        unsigned                first_offset;   /* offset into mapping[first] */
-       unsigned int            cb_break;       /* cb_break + cb_s_break before the call */
        union {
                unsigned        last_to;        /* amount of mapping[last] */
                unsigned        count2;         /* count used in unmarshalling */
@@ -145,9 +164,9 @@ struct afs_call {
        bool                    send_pages;     /* T if data from mapping should be sent */
        bool                    need_attention; /* T if RxRPC poked us */
        bool                    async;          /* T if asynchronous */
-       bool                    ret_reply0;     /* T if should return reply[0] on success */
        bool                    upgrade;        /* T to request service upgrade */
-       bool                    want_reply_time; /* T if want reply_time */
+       bool                    have_reply_time; /* T if have got reply_time */
+       bool                    intr;           /* T if interruptible */
        u16                     service_id;     /* Actual service ID (after upgrade) */
        unsigned int            debug_id;       /* Trace ID */
        u32                     operation_ID;   /* operation ID for an incoming call */
@@ -159,8 +178,6 @@ struct afs_call {
                } __attribute__((packed));
                __be64          tmp64;
        };
-       afs_dataversion_t       expected_version; /* Updated version expected from store */
-       afs_dataversion_t       expected_version_2; /* 2nd updated version expected from store */
        ktime_t                 reply_time;     /* Time of first reply packet */
 };
 
@@ -221,7 +238,8 @@ struct afs_read {
        unsigned int            index;          /* Which page we're reading into */
        unsigned int            nr_pages;
        unsigned int            offset;         /* offset into current page */
-       void (*page_done)(struct afs_call *, struct afs_read *);
+       struct afs_vnode        *vnode;
+       void (*page_done)(struct afs_read *);
        struct page             **pages;
        struct page             *array[];
 };
@@ -367,13 +385,13 @@ struct afs_cell {
        time64_t                last_inactive;  /* Time of last drop of usage count */
        atomic_t                usage;
        unsigned long           flags;
-#define AFS_CELL_FL_NOT_READY  0               /* The cell record is not ready for use */
-#define AFS_CELL_FL_NO_GC      1               /* The cell was added manually, don't auto-gc */
-#define AFS_CELL_FL_NOT_FOUND  2               /* Permanent DNS error */
-#define AFS_CELL_FL_DNS_FAIL   3               /* Failed to access DNS */
-#define AFS_CELL_FL_NO_LOOKUP_YET 4            /* Not completed first DNS lookup yet */
+#define AFS_CELL_FL_NO_GC      0               /* The cell was added manually, don't auto-gc */
+#define AFS_CELL_FL_DO_LOOKUP  1               /* DNS lookup requested */
        enum afs_cell_state     state;
        short                   error;
+       enum dns_record_source  dns_source:8;   /* Latest source of data from lookup */
+       enum dns_lookup_status  dns_status:8;   /* Latest status of data from lookup */
+       unsigned int            dns_lookup_count; /* Counter of DNS lookups */
 
        /* Active fileserver interaction state. */
        struct list_head        proc_volumes;   /* procfs volume list */
@@ -538,7 +556,10 @@ struct afs_server {
 struct afs_vol_interest {
        struct hlist_node       srv_link;       /* Link in server->cb_volumes */
        struct hlist_head       cb_interests;   /* List of callback interests on the server */
-       afs_volid_t             vid;            /* Volume ID to match */
+       union {
+               struct rcu_head rcu;
+               afs_volid_t     vid;            /* Volume ID to match */
+       };
        unsigned int            usage;
 };
 
@@ -550,7 +571,10 @@ struct afs_cb_interest {
        struct afs_vol_interest *vol_interest;
        struct afs_server       *server;        /* Server on which this interest resides */
        struct super_block      *sb;            /* Superblock on which inodes reside */
-       afs_volid_t             vid;            /* Volume ID to match */
+       union {
+               struct rcu_head rcu;
+               afs_volid_t     vid;            /* Volume ID to match */
+       };
        refcount_t              usage;
 };
 
@@ -660,15 +684,13 @@ struct afs_vnode {
        afs_lock_type_t         lock_type : 8;
 
        /* outstanding callback notification on this file */
-       struct afs_cb_interest  *cb_interest;   /* Server on which this resides */
+       struct afs_cb_interest __rcu *cb_interest; /* Server on which this resides */
        unsigned int            cb_s_break;     /* Mass break counter on ->server */
        unsigned int            cb_v_break;     /* Mass break counter on ->volume */
        unsigned int            cb_break;       /* Break counter on vnode */
        seqlock_t               cb_lock;        /* Lock for ->cb_interest, ->status, ->cb_*break */
 
        time64_t                cb_expires_at;  /* time at which callback expires */
-       unsigned                cb_version;     /* callback version */
-       afs_callback_type_t     cb_type;        /* type of callback */
 };
 
 static inline struct fscache_cookie *afs_vnode_cache(struct afs_vnode *vnode)
@@ -755,6 +777,7 @@ struct afs_vl_cursor {
  * Cursor for iterating over a set of fileservers.
  */
 struct afs_fs_cursor {
+       const struct afs_call_type *type;       /* Type of call done */
        struct afs_addr_cursor  ac;
        struct afs_vnode        *vnode;
        struct afs_server_list  *server_list;   /* Current server list (pins ref) */
@@ -772,6 +795,7 @@ struct afs_fs_cursor {
 #define AFS_FS_CURSOR_VNOVOL   0x0008          /* Set if seen VNOVOL */
 #define AFS_FS_CURSOR_CUR_ONLY 0x0010          /* Set if current server only (file lock held) */
 #define AFS_FS_CURSOR_NO_VSLEEP        0x0020          /* Set to prevent sleep on VBUSY, VOFFLINE, ... */
+#define AFS_FS_CURSOR_INTR     0x0040          /* Set if op is interruptible */
        unsigned short          nr_iterations;  /* Number of server iterations */
 };
 
@@ -882,7 +906,6 @@ extern const struct address_space_operations afs_dir_aops;
 extern const struct dentry_operations afs_fs_dentry_operations;
 
 extern void afs_d_release(struct dentry *);
-extern int afs_dir_remove_link(struct dentry *, struct key *, unsigned long, unsigned long);
 
 /*
  * dir_edit.c
@@ -940,50 +963,48 @@ extern int afs_flock(struct file *, int, struct file_lock *);
 /*
  * fsclient.c
  */
-#define AFS_VNODE_NOT_YET_SET  0x01
-#define AFS_VNODE_META_CHANGED 0x02
-#define AFS_VNODE_DATA_CHANGED 0x04
-extern void afs_update_inode_from_status(struct afs_vnode *, struct afs_file_status *,
-                                        const afs_dataversion_t *, u8);
-
-extern int afs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *, bool);
+extern int afs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_status_cb *,
+                                   struct afs_volsync *);
 extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *);
-extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
-extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t, u64,
-                        struct afs_fid *, struct afs_file_status *, struct afs_callback *);
-extern int afs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool, u64);
-extern int afs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
-extern int afs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64,
-                         struct afs_fid *, struct afs_file_status *);
+extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_status_cb *, struct afs_read *);
+extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t,
+                        struct afs_status_cb *, struct afs_fid *, struct afs_status_cb *);
+extern int afs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool,
+                        struct afs_status_cb *);
+extern int afs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *,
+                      struct afs_status_cb *, struct afs_status_cb *);
+extern int afs_fs_symlink(struct afs_fs_cursor *, const char *, const char *,
+                         struct afs_status_cb *, struct afs_fid *, struct afs_status_cb *);
 extern int afs_fs_rename(struct afs_fs_cursor *, const char *,
-                        struct afs_vnode *, const char *, u64, u64);
+                        struct afs_vnode *, const char *,
+                        struct afs_status_cb *, struct afs_status_cb *);
 extern int afs_fs_store_data(struct afs_fs_cursor *, struct address_space *,
-                            pgoff_t, pgoff_t, unsigned, unsigned);
-extern int afs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
+                            pgoff_t, pgoff_t, unsigned, unsigned, struct afs_status_cb *);
+extern int afs_fs_setattr(struct afs_fs_cursor *, struct iattr *, struct afs_status_cb *);
 extern int afs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
-extern int afs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
-extern int afs_fs_extend_lock(struct afs_fs_cursor *);
-extern int afs_fs_release_lock(struct afs_fs_cursor *);
+extern int afs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t, struct afs_status_cb *);
+extern int afs_fs_extend_lock(struct afs_fs_cursor *, struct afs_status_cb *);
+extern int afs_fs_release_lock(struct afs_fs_cursor *, struct afs_status_cb *);
 extern int afs_fs_give_up_all_callbacks(struct afs_net *, struct afs_server *,
                                        struct afs_addr_cursor *, struct key *);
 extern struct afs_call *afs_fs_get_capabilities(struct afs_net *, struct afs_server *,
                                                struct afs_addr_cursor *, struct key *,
                                                unsigned int);
 extern int afs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
-                                    struct afs_fid *, struct afs_file_status *,
-                                    struct afs_callback *, unsigned int,
-                                    struct afs_volsync *);
+                                    struct afs_fid *, struct afs_status_cb *,
+                                    unsigned int, struct afs_volsync *);
 extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
-                              struct afs_fid *, struct afs_file_status *,
-                              struct afs_callback *, struct afs_volsync *);
+                              struct afs_fid *, struct afs_status_cb *,
+                              struct afs_volsync *);
 
 struct afs_acl {
        u32     size;
        u8      data[];
 };
 
-extern struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *);
-extern int afs_fs_store_acl(struct afs_fs_cursor *, const struct afs_acl *);
+extern struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *, struct afs_status_cb *);
+extern int afs_fs_store_acl(struct afs_fs_cursor *, const struct afs_acl *,
+                           struct afs_status_cb *);
 
 /*
  * fs_probe.c
@@ -995,15 +1016,20 @@ extern int afs_wait_for_fs_probes(struct afs_server_list *, unsigned long);
 /*
  * inode.c
  */
-extern int afs_fetch_status(struct afs_vnode *, struct key *, bool);
+extern void afs_vnode_commit_status(struct afs_fs_cursor *,
+                                   struct afs_vnode *,
+                                   unsigned int,
+                                   const afs_dataversion_t *,
+                                   struct afs_status_cb *);
+extern int afs_fetch_status(struct afs_vnode *, struct key *, bool, afs_access_t *);
 extern int afs_iget5_test(struct inode *, void *);
 extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
 extern struct inode *afs_iget(struct super_block *, struct key *,
-                             struct afs_fid *, struct afs_file_status *,
-                             struct afs_callback *,
+                             struct afs_iget_data *, struct afs_status_cb *,
                              struct afs_cb_interest *,
                              struct afs_vnode *);
 extern void afs_zap_data(struct afs_vnode *);
+extern bool afs_check_validity(struct afs_vnode *);
 extern int afs_validate(struct afs_vnode *, struct key *);
 extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
 extern int afs_setattr(struct dentry *, struct iattr *);
@@ -1096,7 +1122,7 @@ static inline void afs_put_sysnames(struct afs_sysnames *sysnames) {}
  * rotate.c
  */
 extern bool afs_begin_vnode_operation(struct afs_fs_cursor *, struct afs_vnode *,
-                                     struct key *);
+                                     struct key *, bool);
 extern bool afs_select_fileserver(struct afs_fs_cursor *);
 extern bool afs_select_current_fileserver(struct afs_fs_cursor *);
 extern int afs_end_vnode_operation(struct afs_fs_cursor *);
@@ -1121,6 +1147,12 @@ extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
 extern int afs_extract_data(struct afs_call *, bool);
 extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause);
 
+static inline void afs_set_fc_call(struct afs_call *call, struct afs_fs_cursor *fc)
+{
+       call->intr = fc->flags & AFS_FS_CURSOR_INTR;
+       fc->type = call->type;
+}
+
 static inline void afs_extract_begin(struct afs_call *call, void *buf, size_t size)
 {
        call->kvec[0].iov_base = buf;
@@ -1201,7 +1233,8 @@ static inline void afs_set_call_complete(struct afs_call *call,
  */
 extern void afs_put_permits(struct afs_permits *);
 extern void afs_clear_permits(struct afs_vnode *);
-extern void afs_cache_permit(struct afs_vnode *, struct key *, unsigned int);
+extern void afs_cache_permit(struct afs_vnode *, struct key *, unsigned int,
+                            struct afs_status_cb *);
 extern void afs_zap_permits(struct rcu_head *);
 extern struct key *afs_request_key(struct afs_cell *);
 extern int afs_check_permit(struct afs_vnode *, struct key *, afs_access_t *);
@@ -1327,7 +1360,6 @@ extern int afs_write_end(struct file *file, struct address_space *mapping,
                        struct page *page, void *fsdata);
 extern int afs_writepage(struct page *, struct writeback_control *);
 extern int afs_writepages(struct address_space *, struct writeback_control *);
-extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *);
 extern ssize_t afs_file_write(struct kiocb *, struct iov_iter *);
 extern int afs_fsync(struct file *, loff_t, loff_t, int);
 extern vm_fault_t afs_page_mkwrite(struct vm_fault *vmf);
@@ -1343,33 +1375,36 @@ extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
 /*
  * yfsclient.c
  */
-extern int yfs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *, bool);
-extern int yfs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
-extern int yfs_fs_create_file(struct afs_fs_cursor *, const char *, umode_t, u64,
-                             struct afs_fid *, struct afs_file_status *, struct afs_callback *);
-extern int yfs_fs_make_dir(struct afs_fs_cursor *, const char *, umode_t, u64,
-                        struct afs_fid *, struct afs_file_status *, struct afs_callback *);
-extern int yfs_fs_remove_file2(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
-extern int yfs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool, u64);
-extern int yfs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
-extern int yfs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64,
-                         struct afs_fid *, struct afs_file_status *);
-extern int yfs_fs_rename(struct afs_fs_cursor *, const char *,
-                        struct afs_vnode *, const char *, u64, u64);
+extern int yfs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_status_cb *,
+                                   struct afs_volsync *);
+extern int yfs_fs_fetch_data(struct afs_fs_cursor *, struct afs_status_cb *, struct afs_read *);
+extern int yfs_fs_create_file(struct afs_fs_cursor *, const char *, umode_t, struct afs_status_cb *,
+                             struct afs_fid *, struct afs_status_cb *);
+extern int yfs_fs_make_dir(struct afs_fs_cursor *, const char *, umode_t, struct afs_status_cb *,
+                          struct afs_fid *, struct afs_status_cb *);
+extern int yfs_fs_remove_file2(struct afs_fs_cursor *, struct afs_vnode *, const char *,
+                              struct afs_status_cb *, struct afs_status_cb *);
+extern int yfs_fs_remove(struct afs_fs_cursor *, struct afs_vnode *, const char *, bool,
+                        struct afs_status_cb *);
+extern int yfs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *,
+                      struct afs_status_cb *, struct afs_status_cb *);
+extern int yfs_fs_symlink(struct afs_fs_cursor *, const char *, const char *,
+                         struct afs_status_cb *, struct afs_fid *, struct afs_status_cb *);
+extern int yfs_fs_rename(struct afs_fs_cursor *, const char *, struct afs_vnode *, const char *,
+                        struct afs_status_cb *, struct afs_status_cb *);
 extern int yfs_fs_store_data(struct afs_fs_cursor *, struct address_space *,
-                            pgoff_t, pgoff_t, unsigned, unsigned);
-extern int yfs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
+                            pgoff_t, pgoff_t, unsigned, unsigned, struct afs_status_cb *);
+extern int yfs_fs_setattr(struct afs_fs_cursor *, struct iattr *, struct afs_status_cb *);
 extern int yfs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
-extern int yfs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
-extern int yfs_fs_extend_lock(struct afs_fs_cursor *);
-extern int yfs_fs_release_lock(struct afs_fs_cursor *);
+extern int yfs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t, struct afs_status_cb *);
+extern int yfs_fs_extend_lock(struct afs_fs_cursor *, struct afs_status_cb *);
+extern int yfs_fs_release_lock(struct afs_fs_cursor *, struct afs_status_cb *);
 extern int yfs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
-                              struct afs_fid *, struct afs_file_status *,
-                              struct afs_callback *, struct afs_volsync *);
+                              struct afs_fid *, struct afs_status_cb *,
+                              struct afs_volsync *);
 extern int yfs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
-                                    struct afs_fid *, struct afs_file_status *,
-                                    struct afs_callback *, unsigned int,
-                                    struct afs_volsync *);
+                                    struct afs_fid *, struct afs_status_cb *,
+                                    unsigned int, struct afs_volsync *);
 
 struct yfs_acl {
        struct afs_acl  *acl;           /* Dir/file/symlink ACL */
@@ -1382,8 +1417,10 @@ struct yfs_acl {
 };
 
 extern void yfs_free_opaque_acl(struct yfs_acl *);
-extern struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *, unsigned int);
-extern int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *, const struct afs_acl *);
+extern struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *, struct yfs_acl *,
+                                              struct afs_status_cb *);
+extern int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *, const struct afs_acl *,
+                                   struct afs_status_cb *);
 
 /*
  * Miscellaneous inline functions.
@@ -1398,14 +1435,6 @@ static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
        return &vnode->vfs_inode;
 }
 
-static inline void afs_vnode_commit_status(struct afs_fs_cursor *fc,
-                                          struct afs_vnode *vnode,
-                                          unsigned int cb_break)
-{
-       if (fc->ac.error == 0)
-               afs_cache_permit(vnode, fc->key, cb_break);
-}
-
 static inline void afs_check_for_remote_deletion(struct afs_fs_cursor *fc,
                                                 struct afs_vnode *vnode)
 {
index be2ee3b..371501d 100644 (file)
@@ -53,7 +53,7 @@ static int afs_proc_cells_show(struct seq_file *m, void *v)
        seq_printf(m, "%3u %6lld %2u %s\n",
                   atomic_read(&cell->usage),
                   cell->dns_expiry - ktime_get_real_seconds(),
-                  vllist ? vllist->nr_servers : 0,
+                  vllist->nr_servers,
                   cell->name);
        return 0;
 }
@@ -296,8 +296,8 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
 
        if (v == SEQ_START_TOKEN) {
                seq_printf(m, "# source %s, status %s\n",
-                          dns_record_sources[vllist->source],
-                          dns_lookup_statuses[vllist->status]);
+                          dns_record_sources[vllist ? vllist->source : 0],
+                          dns_lookup_statuses[vllist ? vllist->status : 0]);
                return 0;
        }
 
@@ -336,7 +336,7 @@ static void *afs_proc_cell_vlservers_start(struct seq_file *m, loff_t *_pos)
        if (pos == 0)
                return SEQ_START_TOKEN;
 
-       if (!vllist || pos - 1 >= vllist->nr_servers)
+       if (pos - 1 >= vllist->nr_servers)
                return NULL;
 
        return &vllist->servers[pos - 1];
index c3ae324..b00c739 100644 (file)
@@ -25,7 +25,7 @@
  * them here also using the io_lock.
  */
 bool afs_begin_vnode_operation(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-                              struct key *key)
+                              struct key *key, bool intr)
 {
        memset(fc, 0, sizeof(*fc));
        fc->vnode = vnode;
@@ -33,10 +33,15 @@ bool afs_begin_vnode_operation(struct afs_fs_cursor *fc, struct afs_vnode *vnode
        fc->ac.error = SHRT_MAX;
        fc->error = -EDESTADDRREQ;
 
-       if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
-               fc->error = -EINTR;
-               fc->flags |= AFS_FS_CURSOR_STOP;
-               return false;
+       if (intr) {
+               fc->flags |= AFS_FS_CURSOR_INTR;
+               if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
+                       fc->error = -EINTR;
+                       fc->flags |= AFS_FS_CURSOR_STOP;
+                       return false;
+               }
+       } else {
+               mutex_lock(&vnode->io_lock);
        }
 
        if (vnode->lock_state != AFS_VNODE_LOCK_NONE)
@@ -61,7 +66,8 @@ static bool afs_start_fs_iteration(struct afs_fs_cursor *fc,
        fc->untried = (1UL << fc->server_list->nr_servers) - 1;
        fc->index = READ_ONCE(fc->server_list->preferred);
 
-       cbi = vnode->cb_interest;
+       cbi = rcu_dereference_protected(vnode->cb_interest,
+                                       lockdep_is_held(&vnode->io_lock));
        if (cbi) {
                /* See if the vnode's preferred record is still available */
                for (i = 0; i < fc->server_list->nr_servers; i++) {
@@ -82,8 +88,8 @@ static bool afs_start_fs_iteration(struct afs_fs_cursor *fc,
 
                /* Note that the callback promise is effectively broken */
                write_seqlock(&vnode->cb_lock);
-               ASSERTCMP(cbi, ==, vnode->cb_interest);
-               vnode->cb_interest = NULL;
+               ASSERTCMP(cbi, ==, rcu_access_pointer(vnode->cb_interest));
+               rcu_assign_pointer(vnode->cb_interest, NULL);
                if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags))
                        vnode->cb_break++;
                write_sequnlock(&vnode->cb_lock);
@@ -118,10 +124,14 @@ static void afs_busy(struct afs_volume *volume, u32 abort_code)
  */
 static bool afs_sleep_and_retry(struct afs_fs_cursor *fc)
 {
-       msleep_interruptible(1000);
-       if (signal_pending(current)) {
-               fc->error = -ERESTARTSYS;
-               return false;
+       if (fc->flags & AFS_FS_CURSOR_INTR) {
+               msleep_interruptible(1000);
+               if (signal_pending(current)) {
+                       fc->error = -ERESTARTSYS;
+                       return false;
+               }
+       } else {
+               msleep(1000);
        }
 
        return true;
@@ -408,7 +418,9 @@ selected_server:
        if (error < 0)
                goto failed_set_error;
 
-       fc->cbi = afs_get_cb_interest(vnode->cb_interest);
+       fc->cbi = afs_get_cb_interest(
+               rcu_dereference_protected(vnode->cb_interest,
+                                         lockdep_is_held(&vnode->io_lock)));
 
        read_lock(&server->fs_lock);
        alist = rcu_dereference_protected(server->addresses,
@@ -459,6 +471,8 @@ no_more_servers:
                                     s->probe.abort_code);
        }
 
+       error = e.error;
+
 failed_set_error:
        fc->error = error;
 failed:
@@ -476,12 +490,15 @@ failed:
 bool afs_select_current_fileserver(struct afs_fs_cursor *fc)
 {
        struct afs_vnode *vnode = fc->vnode;
-       struct afs_cb_interest *cbi = vnode->cb_interest;
+       struct afs_cb_interest *cbi;
        struct afs_addr_list *alist;
        int error = fc->ac.error;
 
        _enter("");
 
+       cbi = rcu_dereference_protected(vnode->cb_interest,
+                                       lockdep_is_held(&vnode->io_lock));
+
        switch (error) {
        case SHRT_MAX:
                if (!cbi) {
@@ -490,7 +507,7 @@ bool afs_select_current_fileserver(struct afs_fs_cursor *fc)
                        return false;
                }
 
-               fc->cbi = afs_get_cb_interest(vnode->cb_interest);
+               fc->cbi = afs_get_cb_interest(cbi);
 
                read_lock(&cbi->server->fs_lock);
                alist = rcu_dereference_protected(cbi->server->addresses,
index a34a89c..4fa5ce9 100644 (file)
@@ -188,7 +188,7 @@ void afs_put_call(struct afs_call *call)
                if (call->type->destructor)
                        call->type->destructor(call);
 
-               afs_put_server(call->net, call->cm_server);
+               afs_put_server(call->net, call->server);
                afs_put_cb_interest(call->net, call->cbi);
                afs_put_addrlist(call->alist);
                kfree(call->request);
@@ -417,6 +417,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
                                          afs_wake_up_async_call :
                                          afs_wake_up_call_waiter),
                                         call->upgrade,
+                                        call->intr,
                                         call->debug_id);
        if (IS_ERR(rxcall)) {
                ret = PTR_ERR(rxcall);
@@ -426,6 +427,10 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
 
        call->rxcall = rxcall;
 
+       if (call->max_lifespan)
+               rxrpc_kernel_set_max_life(call->net->socket, rxcall,
+                                         call->max_lifespan);
+
        /* send the request */
        iov[0].iov_base = call->request;
        iov[0].iov_len  = call->request_size;
@@ -529,11 +534,11 @@ static void afs_deliver_to_call(struct afs_call *call)
                        return;
                }
 
-               if (call->want_reply_time &&
+               if (!call->have_reply_time &&
                    rxrpc_kernel_get_reply_time(call->net->socket,
                                                call->rxcall,
                                                &call->reply_time))
-                       call->want_reply_time = false;
+                       call->have_reply_time = true;
 
                ret = call->type->deliver(call);
                state = READ_ONCE(call->state);
@@ -648,7 +653,7 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
                        break;
                }
 
-               if (timeout == 0 &&
+               if (call->intr && timeout == 0 &&
                    life == last_life && signal_pending(current)) {
                        if (stalled)
                                break;
@@ -691,10 +696,9 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
        ret = ac->error;
        switch (ret) {
        case 0:
-               if (call->ret_reply0) {
-                       ret = (long)call->reply[0];
-                       call->reply[0] = NULL;
-               }
+               ret = call->ret0;
+               call->ret0 = 0;
+
                /* Fall through */
        case -ECONNABORTED:
                ac->responded = true;
index 5f58a9a..5d8ece9 100644 (file)
@@ -87,11 +87,9 @@ void afs_clear_permits(struct afs_vnode *vnode)
        permits = rcu_dereference_protected(vnode->permit_cache,
                                            lockdep_is_held(&vnode->lock));
        RCU_INIT_POINTER(vnode->permit_cache, NULL);
-       vnode->cb_break++;
        spin_unlock(&vnode->lock);
 
-       if (permits)
-               afs_put_permits(permits);
+       afs_put_permits(permits);
 }
 
 /*
@@ -118,10 +116,10 @@ static void afs_hash_permits(struct afs_permits *permits)
  * as the ACL *may* have changed.
  */
 void afs_cache_permit(struct afs_vnode *vnode, struct key *key,
-                     unsigned int cb_break)
+                     unsigned int cb_break, struct afs_status_cb *scb)
 {
        struct afs_permits *permits, *xpermits, *replacement, *zap, *new = NULL;
-       afs_access_t caller_access = READ_ONCE(vnode->status.caller_access);
+       afs_access_t caller_access = scb->status.caller_access;
        size_t size = 0;
        bool changed = false;
        int i, j;
@@ -148,7 +146,7 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key,
                                }
 
                                if (afs_cb_is_broken(cb_break, vnode,
-                                                    vnode->cb_interest)) {
+                                                    rcu_dereference(vnode->cb_interest))) {
                                        changed = true;
                                        break;
                                }
@@ -178,7 +176,7 @@ void afs_cache_permit(struct afs_vnode *vnode, struct key *key,
                }
        }
 
-       if (afs_cb_is_broken(cb_break, vnode, vnode->cb_interest))
+       if (afs_cb_is_broken(cb_break, vnode, rcu_dereference(vnode->cb_interest)))
                goto someone_else_changed_it;
 
        /* We need a ref on any permits list we want to copy as we'll have to
@@ -255,14 +253,16 @@ found:
 
        kfree(new);
 
+       rcu_read_lock();
        spin_lock(&vnode->lock);
        zap = rcu_access_pointer(vnode->permit_cache);
-       if (!afs_cb_is_broken(cb_break, vnode, vnode->cb_interest) &&
+       if (!afs_cb_is_broken(cb_break, vnode, rcu_dereference(vnode->cb_interest)) &&
            zap == permits)
                rcu_assign_pointer(vnode->permit_cache, replacement);
        else
                zap = replacement;
        spin_unlock(&vnode->lock);
+       rcu_read_unlock();
        afs_put_permits(zap);
 out_put:
        afs_put_permits(permits);
@@ -322,13 +322,12 @@ int afs_check_permit(struct afs_vnode *vnode, struct key *key,
                 */
                _debug("no valid permit");
 
-               ret = afs_fetch_status(vnode, key, false);
+               ret = afs_fetch_status(vnode, key, false, _access);
                if (ret < 0) {
                        *_access = 0;
                        _leave(" = %d", ret);
                        return ret;
                }
-               *_access = vnode->status.caller_access;
        }
 
        _leave(" = 0 [access %x]", *_access);
index 65b33b6..52c170b 100644 (file)
@@ -521,8 +521,15 @@ static noinline bool afs_update_server_record(struct afs_fs_cursor *fc, struct a
        alist = afs_vl_lookup_addrs(fc->vnode->volume->cell, fc->key,
                                    &server->uuid);
        if (IS_ERR(alist)) {
-               fc->ac.error = PTR_ERR(alist);
-               _leave(" = f [%d]", fc->ac.error);
+               if ((PTR_ERR(alist) == -ERESTARTSYS ||
+                    PTR_ERR(alist) == -EINTR) &&
+                   !(fc->flags & AFS_FS_CURSOR_INTR) &&
+                   server->addresses) {
+                       _leave(" = t [intr]");
+                       return true;
+               }
+               fc->error = PTR_ERR(alist);
+               _leave(" = f [%d]", fc->error);
                return false;
        }
 
@@ -574,7 +581,11 @@ retry:
        ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING,
                          TASK_INTERRUPTIBLE);
        if (ret == -ERESTARTSYS) {
-               fc->ac.error = ret;
+               if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
+                       _leave(" = t [intr]");
+                       return true;
+               }
+               fc->error = ret;
                _leave(" = f [intr]");
                return false;
        }
index 783c68c..f18911e 100644 (file)
@@ -426,7 +426,7 @@ static int afs_set_super(struct super_block *sb, struct fs_context *fc)
 static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx)
 {
        struct afs_super_info *as = AFS_FS_S(sb);
-       struct afs_fid fid;
+       struct afs_iget_data iget_data;
        struct inode *inode = NULL;
        int ret;
 
@@ -451,11 +451,13 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx)
        } else {
                sprintf(sb->s_id, "%llu", as->volume->vid);
                afs_activate_volume(as->volume);
-               fid.vid         = as->volume->vid;
-               fid.vnode       = 1;
-               fid.vnode_hi    = 0;
-               fid.unique      = 1;
-               inode = afs_iget(sb, ctx->key, &fid, NULL, NULL, NULL, NULL);
+               iget_data.fid.vid       = as->volume->vid;
+               iget_data.fid.vnode     = 1;
+               iget_data.fid.vnode_hi  = 0;
+               iget_data.fid.unique    = 1;
+               iget_data.cb_v_break    = as->volume->cb_v_break;
+               iget_data.cb_s_break    = 0;
+               inode = afs_iget(sb, ctx->key, &iget_data, NULL, NULL, NULL);
        }
 
        if (IS_ERR(inode))
@@ -677,13 +679,12 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
        vnode->volume           = NULL;
        vnode->lock_key         = NULL;
        vnode->permit_cache     = NULL;
-       vnode->cb_interest      = NULL;
+       RCU_INIT_POINTER(vnode->cb_interest, NULL);
 #ifdef CONFIG_AFS_FSCACHE
        vnode->cache            = NULL;
 #endif
 
        vnode->flags            = 1 << AFS_VNODE_UNSET;
-       vnode->cb_type          = 0;
        vnode->lock_state       = AFS_VNODE_LOCK_NONE;
 
        init_rwsem(&vnode->rmdir_lock);
@@ -708,7 +709,7 @@ static void afs_destroy_inode(struct inode *inode)
 
        _debug("DESTROY INODE %p", inode);
 
-       ASSERTCMP(vnode->cb_interest, ==, NULL);
+       ASSERTCMP(rcu_access_pointer(vnode->cb_interest), ==, NULL);
 
        atomic_dec(&afs_count_active_inodes);
 }
@@ -741,7 +742,7 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
                return PTR_ERR(key);
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
                fc.flags |= AFS_FS_CURSOR_NO_VSLEEP;
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
@@ -749,7 +750,6 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
                }
 
                afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
                ret = afs_end_vnode_operation(&fc);
        }
 
index b4f1a84..61e2501 100644 (file)
@@ -232,18 +232,16 @@ struct afs_vlserver_list *afs_extract_vlserver_list(struct afs_cell *cell,
                if (bs.status > NR__dns_lookup_status)
                        bs.status = NR__dns_lookup_status;
 
+               /* See if we can update an old server record */
                server = NULL;
-               if (previous) {
-                       /* See if we can update an old server record */
-                       for (i = 0; i < previous->nr_servers; i++) {
-                               struct afs_vlserver *p = previous->servers[i].server;
-
-                               if (p->name_len == bs.name_len &&
-                                   p->port == bs.port &&
-                                   strncasecmp(b, p->name, bs.name_len) == 0) {
-                                       server = afs_get_vlserver(p);
-                                       break;
-                               }
+               for (i = 0; i < previous->nr_servers; i++) {
+                       struct afs_vlserver *p = previous->servers[i].server;
+
+                       if (p->name_len == bs.name_len &&
+                           p->port == bs.port &&
+                           strncasecmp(b, p->name, bs.name_len) == 0) {
+                               server = afs_get_vlserver(p);
+                               break;
                        }
                }
 
index b05e0de..beb9915 100644 (file)
@@ -33,8 +33,8 @@ static bool afs_vl_probe_done(struct afs_vlserver *server)
 void afs_vlserver_probe_result(struct afs_call *call)
 {
        struct afs_addr_list *alist = call->alist;
-       struct afs_vlserver *server = call->reply[0];
-       unsigned int server_index = (long)call->reply[1];
+       struct afs_vlserver *server = call->vlserver;
+       unsigned int server_index = call->server_index;
        unsigned int index = call->addr_ix;
        unsigned int rtt = UINT_MAX;
        bool have_result = false;
index 7adde83..3f84548 100644 (file)
@@ -43,11 +43,29 @@ bool afs_begin_vlserver_operation(struct afs_vl_cursor *vc, struct afs_cell *cel
 static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
 {
        struct afs_cell *cell = vc->cell;
+       unsigned int dns_lookup_count;
+
+       if (cell->dns_source == DNS_RECORD_UNAVAILABLE ||
+           cell->dns_expiry <= ktime_get_real_seconds()) {
+               dns_lookup_count = smp_load_acquire(&cell->dns_lookup_count);
+               set_bit(AFS_CELL_FL_DO_LOOKUP, &cell->flags);
+               queue_work(afs_wq, &cell->manager);
+
+               if (cell->dns_source == DNS_RECORD_UNAVAILABLE) {
+                       if (wait_var_event_interruptible(
+                                   &cell->dns_lookup_count,
+                                   smp_load_acquire(&cell->dns_lookup_count)
+                                   != dns_lookup_count) < 0) {
+                               vc->error = -ERESTARTSYS;
+                               return false;
+                       }
+               }
 
-       if (wait_on_bit(&cell->flags, AFS_CELL_FL_NO_LOOKUP_YET,
-                       TASK_INTERRUPTIBLE)) {
-               vc->error = -ERESTARTSYS;
-               return false;
+               /* Status load is ordered after lookup counter load */
+               if (cell->dns_source == DNS_RECORD_UNAVAILABLE) {
+                       vc->error = -EDESTADDRREQ;
+                       return false;
+               }
        }
 
        read_lock(&cell->vl_servers_lock);
@@ -55,7 +73,7 @@ static bool afs_start_vl_iteration(struct afs_vl_cursor *vc)
                rcu_dereference_protected(cell->vl_servers,
                                          lockdep_is_held(&cell->vl_servers_lock)));
        read_unlock(&cell->vl_servers_lock);
-       if (!vc->server_list || !vc->server_list->nr_servers)
+       if (!vc->server_list->nr_servers)
                return false;
 
        vc->untried = (1UL << vc->server_list->nr_servers) - 1;
index dd9ba4e..3d4b983 100644 (file)
@@ -34,7 +34,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        uvldb = call->buffer;
-       entry = call->reply[0];
+       entry = call->ret_vldb;
 
        nr_servers = ntohl(uvldb->nServers);
        if (nr_servers > AFS_NMAXNSERVERS)
@@ -110,7 +110,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
 
 static void afs_destroy_vl_get_entry_by_name_u(struct afs_call *call)
 {
-       kfree(call->reply[0]);
+       kfree(call->ret_vldb);
        afs_flat_call_destructor(call);
 }
 
@@ -155,8 +155,8 @@ struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_vl_cursor *vc,
        }
 
        call->key = vc->key;
-       call->reply[0] = entry;
-       call->ret_reply0 = true;
+       call->ret_vldb = entry;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;
@@ -214,7 +214,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
                if (!alist)
                        return -ENOMEM;
                alist->version = uniquifier;
-               call->reply[0] = alist;
+               call->ret_alist = alist;
                call->count = count;
                call->count2 = nentries;
                call->unmarshall++;
@@ -229,7 +229,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               alist = call->reply[0];
+               alist = call->ret_alist;
                bp = call->buffer;
                count = min(call->count, 4U);
                for (i = 0; i < count; i++)
@@ -249,8 +249,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
 
 static void afs_vl_get_addrs_u_destructor(struct afs_call *call)
 {
-       afs_put_server(call->net, (struct afs_server *)call->reply[0]);
-       kfree(call->reply[1]);
+       afs_put_addrlist(call->ret_alist);
        return afs_flat_call_destructor(call);
 }
 
@@ -287,8 +286,8 @@ struct afs_addr_list *afs_vl_get_addrs_u(struct afs_vl_cursor *vc,
                return ERR_PTR(-ENOMEM);
 
        call->key = vc->key;
-       call->reply[0] = NULL;
-       call->ret_reply0 = true;
+       call->ret_alist = NULL;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;
@@ -358,9 +357,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call)
 
 static void afs_destroy_vl_get_capabilities(struct afs_call *call)
 {
-       struct afs_vlserver *server = call->reply[0];
-
-       afs_put_vlserver(call->net, server);
+       afs_put_vlserver(call->net, call->vlserver);
        afs_flat_call_destructor(call);
 }
 
@@ -398,11 +395,11 @@ struct afs_call *afs_vl_get_capabilities(struct afs_net *net,
                return ERR_PTR(-ENOMEM);
 
        call->key = key;
-       call->reply[0] = afs_get_vlserver(server);
-       call->reply[1] = (void *)(long)server_index;
+       call->vlserver = afs_get_vlserver(server);
+       call->server_index = server_index;
        call->upgrade = true;
-       call->want_reply_time = true;
        call->async = true;
+       call->max_lifespan = AFS_PROBE_MAX_LIFESPAN;
 
        /* marshall the parameters */
        bp = call->request;
@@ -460,7 +457,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                if (!alist)
                        return -ENOMEM;
                alist->version = uniquifier;
-               call->reply[0] = alist;
+               call->ret_alist = alist;
 
                if (call->count == 0)
                        goto extract_volendpoints;
@@ -488,7 +485,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               alist = call->reply[0];
+               alist = call->ret_alist;
                bp = call->buffer;
                switch (call->count2) {
                case YFS_ENDPOINT_IPV4:
@@ -609,7 +606,6 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                break;
        }
 
-       alist = call->reply[0];
        _leave(" = 0 [done]");
        return 0;
 }
@@ -644,8 +640,8 @@ struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_vl_cursor *vc,
                return ERR_PTR(-ENOMEM);
 
        call->key = vc->key;
-       call->reply[0] = NULL;
-       call->ret_reply0 = true;
+       call->ret_alist = NULL;
+       call->max_lifespan = AFS_VL_MAX_LIFESPAN;
 
        /* Marshall the parameters */
        bp = call->request;
index 0122d74..8bcab95 100644 (file)
@@ -314,6 +314,46 @@ static void afs_redirty_pages(struct writeback_control *wbc,
 }
 
 /*
+ * completion of write to server
+ */
+static void afs_pages_written_back(struct afs_vnode *vnode,
+                                  pgoff_t first, pgoff_t last)
+{
+       struct pagevec pv;
+       unsigned long priv;
+       unsigned count, loop;
+
+       _enter("{%llx:%llu},{%lx-%lx}",
+              vnode->fid.vid, vnode->fid.vnode, first, last);
+
+       pagevec_init(&pv);
+
+       do {
+               _debug("done %lx-%lx", first, last);
+
+               count = last - first + 1;
+               if (count > PAGEVEC_SIZE)
+                       count = PAGEVEC_SIZE;
+               pv.nr = find_get_pages_contig(vnode->vfs_inode.i_mapping,
+                                             first, count, pv.pages);
+               ASSERTCMP(pv.nr, ==, count);
+
+               for (loop = 0; loop < count; loop++) {
+                       priv = 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;
+               __pagevec_release(&pv);
+       } while (first <= last);
+
+       afs_prune_wb_keys(vnode);
+       _leave("");
+}
+
+/*
  * write to a file
  */
 static int afs_store_data(struct address_space *mapping,
@@ -322,6 +362,7 @@ static int afs_store_data(struct address_space *mapping,
 {
        struct afs_vnode *vnode = AFS_FS_I(mapping->host);
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_wb_key *wbk = NULL;
        struct list_head *p;
        int ret = -ENOKEY, ret2;
@@ -333,6 +374,10 @@ static int afs_store_data(struct address_space *mapping,
               vnode->fid.unique,
               first, last, offset, to);
 
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_NOFS);
+       if (!scb)
+               return -ENOMEM;
+
        spin_lock(&vnode->wb_lock);
        p = vnode->wb_keys.next;
 
@@ -351,6 +396,7 @@ try_next_key:
 
        spin_unlock(&vnode->wb_lock);
        afs_put_wb_key(wbk);
+       kfree(scb);
        _leave(" = %d [no keys]", ret);
        return ret;
 
@@ -361,14 +407,19 @@ found_key:
        _debug("USE WB KEY %u", key_serial(wbk->key));
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, wbk->key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, wbk->key, false)) {
+               afs_dataversion_t data_version = vnode->status.data_version + 1;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_store_data(&fc, mapping, first, last, offset, to);
+                       afs_fs_store_data(&fc, mapping, first, last, offset, to, scb);
                }
 
-               afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_check_for_remote_deletion(&fc, vnode);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
+               if (fc.ac.error == 0)
+                       afs_pages_written_back(vnode, first, last);
                ret = afs_end_vnode_operation(&fc);
        }
 
@@ -393,6 +444,7 @@ found_key:
        }
 
        afs_put_wb_key(wbk);
+       kfree(scb);
        _leave(" = %d", ret);
        return ret;
 }
@@ -679,46 +731,6 @@ int afs_writepages(struct address_space *mapping,
 }
 
 /*
- * completion of write to server
- */
-void afs_pages_written_back(struct afs_vnode *vnode, struct afs_call *call)
-{
-       struct pagevec pv;
-       unsigned long priv;
-       unsigned count, loop;
-       pgoff_t first = call->first, last = call->last;
-
-       _enter("{%llx:%llu},{%lx-%lx}",
-              vnode->fid.vid, vnode->fid.vnode, first, last);
-
-       pagevec_init(&pv);
-
-       do {
-               _debug("done %lx-%lx", first, last);
-
-               count = last - first + 1;
-               if (count > PAGEVEC_SIZE)
-                       count = PAGEVEC_SIZE;
-               pv.nr = find_get_pages_contig(vnode->vfs_inode.i_mapping,
-                                             first, count, pv.pages);
-               ASSERTCMP(pv.nr, ==, count);
-
-               for (loop = 0; loop < count; loop++) {
-                       priv = 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;
-               __pagevec_release(&pv);
-       } while (first <= last);
-
-       afs_prune_wb_keys(vnode);
-       _leave("");
-}
-
-/*
  * write to an AFS file
  */
 ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from)
index c81f850..17f58fe 100644 (file)
@@ -47,40 +47,52 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler,
                             void *buffer, size_t size)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *vnode = AFS_FS_I(inode);
        struct afs_acl *acl = NULL;
        struct key *key;
-       int ret;
+       int ret = -ENOMEM;
+
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_NOFS);
+       if (!scb)
+               goto error;
 
        key = afs_request_key(vnode->volume->cell);
-       if (IS_ERR(key))
-               return PTR_ERR(key);
+       if (IS_ERR(key)) {
+               ret = PTR_ERR(key);
+               goto error_scb;
+       }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       acl = afs_fs_fetch_acl(&fc);
+                       acl = afs_fs_fetch_acl(&fc, scb);
                }
 
                afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
        if (ret == 0) {
                ret = acl->size;
                if (size > 0) {
-                       ret = -ERANGE;
-                       if (acl->size > size)
-                               return -ERANGE;
-                       memcpy(buffer, acl->data, acl->size);
-                       ret = acl->size;
+                       if (acl->size <= size)
+                               memcpy(buffer, acl->data, acl->size);
+                       else
+                               ret = -ERANGE;
                }
                kfree(acl);
        }
 
        key_put(key);
+error_scb:
+       kfree(scb);
+error:
        return ret;
 }
 
@@ -93,41 +105,53 @@ static int afs_xattr_set_acl(const struct xattr_handler *handler,
                              const void *buffer, size_t size, int flags)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *vnode = AFS_FS_I(inode);
        struct afs_acl *acl = NULL;
        struct key *key;
-       int ret;
+       int ret = -ENOMEM;
 
        if (flags == XATTR_CREATE)
                return -EINVAL;
 
-       key = afs_request_key(vnode->volume->cell);
-       if (IS_ERR(key))
-               return PTR_ERR(key);
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_NOFS);
+       if (!scb)
+               goto error;
 
        acl = kmalloc(sizeof(*acl) + size, GFP_KERNEL);
-       if (!acl) {
-               key_put(key);
-               return -ENOMEM;
+       if (!acl)
+               goto error_scb;
+
+       key = afs_request_key(vnode->volume->cell);
+       if (IS_ERR(key)) {
+               ret = PTR_ERR(key);
+               goto error_acl;
        }
 
        acl->size = size;
        memcpy(acl->data, buffer, size);
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       afs_fs_store_acl(&fc, acl);
+                       afs_fs_store_acl(&fc, acl, scb);
                }
 
                afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
-       kfree(acl);
        key_put(key);
+error_acl:
+       kfree(acl);
+error_scb:
+       kfree(scb);
+error:
        return ret;
 }
 
@@ -146,12 +170,12 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
                             void *buffer, size_t size)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *vnode = AFS_FS_I(inode);
        struct yfs_acl *yacl = NULL;
        struct key *key;
-       unsigned int flags = 0;
        char buf[16], *data;
-       int which = 0, dsize, ret;
+       int which = 0, dsize, ret = -ENOMEM;
 
        if (strcmp(name, "acl") == 0)
                which = 0;
@@ -164,65 +188,81 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
        else
                return -EOPNOTSUPP;
 
+       yacl = kzalloc(sizeof(struct yfs_acl), GFP_KERNEL);
+       if (!yacl)
+               goto error;
+
        if (which == 0)
-               flags |= YFS_ACL_WANT_ACL;
+               yacl->flags |= YFS_ACL_WANT_ACL;
        else if (which == 3)
-               flags |= YFS_ACL_WANT_VOL_ACL;
+               yacl->flags |= YFS_ACL_WANT_VOL_ACL;
+
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_NOFS);
+       if (!scb)
+               goto error_yacl;
 
        key = afs_request_key(vnode->volume->cell);
-       if (IS_ERR(key))
-               return PTR_ERR(key);
+       if (IS_ERR(key)) {
+               ret = PTR_ERR(key);
+               goto error_scb;
+       }
 
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       yacl = yfs_fs_fetch_opaque_acl(&fc, flags);
+                       yfs_fs_fetch_opaque_acl(&fc, yacl, scb);
                }
 
                afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
-       if (ret == 0) {
-               switch (which) {
-               case 0:
-                       data = yacl->acl->data;
-                       dsize = yacl->acl->size;
-                       break;
-               case 1:
-                       data = buf;
-                       dsize = snprintf(buf, sizeof(buf), "%u",
-                                        yacl->inherit_flag);
-                       break;
-               case 2:
-                       data = buf;
-                       dsize = snprintf(buf, sizeof(buf), "%u",
-                                        yacl->num_cleaned);
-                       break;
-               case 3:
-                       data = yacl->vol_acl->data;
-                       dsize = yacl->vol_acl->size;
-                       break;
-               default:
-                       ret = -EOPNOTSUPP;
-                       goto out;
-               }
+       if (ret < 0)
+               goto error_key;
+
+       switch (which) {
+       case 0:
+               data = yacl->acl->data;
+               dsize = yacl->acl->size;
+               break;
+       case 1:
+               data = buf;
+               dsize = snprintf(buf, sizeof(buf), "%u", yacl->inherit_flag);
+               break;
+       case 2:
+               data = buf;
+               dsize = snprintf(buf, sizeof(buf), "%u", yacl->num_cleaned);
+               break;
+       case 3:
+               data = yacl->vol_acl->data;
+               dsize = yacl->vol_acl->size;
+               break;
+       default:
+               ret = -EOPNOTSUPP;
+               goto error_key;
+       }
 
-               ret = dsize;
-               if (size > 0) {
-                       if (dsize > size) {
-                               ret = -ERANGE;
-                               goto out;
-                       }
-                       memcpy(buffer, data, dsize);
+       ret = dsize;
+       if (size > 0) {
+               if (dsize > size) {
+                       ret = -ERANGE;
+                       goto error_key;
                }
+               memcpy(buffer, data, dsize);
        }
 
-out:
-       yfs_free_opaque_acl(yacl);
+error_key:
        key_put(key);
+error_scb:
+       kfree(scb);
+error_yacl:
+       yfs_free_opaque_acl(yacl);
+error:
        return ret;
 }
 
@@ -235,42 +275,54 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
                              const void *buffer, size_t size, int flags)
 {
        struct afs_fs_cursor fc;
+       struct afs_status_cb *scb;
        struct afs_vnode *vnode = AFS_FS_I(inode);
        struct afs_acl *acl = NULL;
        struct key *key;
-       int ret;
+       int ret = -ENOMEM;
 
        if (flags == XATTR_CREATE ||
            strcmp(name, "acl") != 0)
                return -EINVAL;
 
-       key = afs_request_key(vnode->volume->cell);
-       if (IS_ERR(key))
-               return PTR_ERR(key);
+       scb = kzalloc(sizeof(struct afs_status_cb), GFP_NOFS);
+       if (!scb)
+               goto error;
 
        acl = kmalloc(sizeof(*acl) + size, GFP_KERNEL);
-       if (!acl) {
-               key_put(key);
-               return -ENOMEM;
-       }
+       if (!acl)
+               goto error_scb;
 
        acl->size = size;
        memcpy(acl->data, buffer, size);
 
+       key = afs_request_key(vnode->volume->cell);
+       if (IS_ERR(key)) {
+               ret = PTR_ERR(key);
+               goto error_acl;
+       }
+
        ret = -ERESTARTSYS;
-       if (afs_begin_vnode_operation(&fc, vnode, key)) {
+       if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
+               afs_dataversion_t data_version = vnode->status.data_version;
+
                while (afs_select_fileserver(&fc)) {
                        fc.cb_break = afs_calc_vnode_cb_break(vnode);
-                       yfs_fs_store_opaque_acl2(&fc, acl);
+                       yfs_fs_store_opaque_acl2(&fc, acl, scb);
                }
 
                afs_check_for_remote_deletion(&fc, fc.vnode);
-               afs_vnode_commit_status(&fc, vnode, fc.cb_break);
+               afs_vnode_commit_status(&fc, vnode, fc.cb_break,
+                                       &data_version, scb);
                ret = afs_end_vnode_operation(&fc);
        }
 
+error_acl:
        kfree(acl);
        key_put(key);
+error_scb:
+       kfree(scb);
+error:
        return ret;
 }
 
index 6cf7d16..10de675 100644 (file)
@@ -183,24 +183,19 @@ static void xdr_dump_bad(const __be32 *bp)
 /*
  * Decode a YFSFetchStatus block
  */
-static int xdr_decode_YFSFetchStatus(struct afs_call *call,
-                                    const __be32 **_bp,
-                                    struct afs_file_status *status,
-                                    struct afs_vnode *vnode,
-                                    const afs_dataversion_t *expected_version,
-                                    struct afs_read *read_req)
+static int xdr_decode_YFSFetchStatus(const __be32 **_bp,
+                                    struct afs_call *call,
+                                    struct afs_status_cb *scb)
 {
        const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp;
+       struct afs_file_status *status = &scb->status;
        u32 type;
-       u8 flags = 0;
 
        status->abort_code = ntohl(xdr->abort_code);
        if (status->abort_code != 0) {
-               if (vnode && status->abort_code == VNOVNODE) {
-                       set_bit(AFS_VNODE_DELETED, &vnode->flags);
+               if (status->abort_code == VNOVNODE)
                        status->nlink = 0;
-                       __afs_break_callback(vnode);
-               }
+               scb->have_error = true;
                return 0;
        }
 
@@ -209,77 +204,28 @@ static int xdr_decode_YFSFetchStatus(struct afs_call *call,
        case AFS_FTYPE_FILE:
        case AFS_FTYPE_DIR:
        case AFS_FTYPE_SYMLINK:
-               if (type != status->type &&
-                   vnode &&
-                   !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
-                       pr_warning("Vnode %llx:%llx:%x changed type %u to %u\n",
-                                  vnode->fid.vid,
-                                  vnode->fid.vnode,
-                                  vnode->fid.unique,
-                                  status->type, type);
-                       goto bad;
-               }
                status->type = type;
                break;
        default:
                goto bad;
        }
 
-#define EXTRACT_M4(FIELD)                                      \
-       do {                                                    \
-               u32 x = ntohl(xdr->FIELD);                      \
-               if (status->FIELD != x) {                       \
-                       flags |= AFS_VNODE_META_CHANGED;        \
-                       status->FIELD = x;                      \
-               }                                               \
-       } while (0)
-
-#define EXTRACT_M8(FIELD)                                      \
-       do {                                                    \
-               u64 x = xdr_to_u64(xdr->FIELD);                 \
-               if (status->FIELD != x) {                       \
-                       flags |= AFS_VNODE_META_CHANGED;        \
-                       status->FIELD = x;                      \
-               }                                               \
-       } while (0)
-
-#define EXTRACT_D8(FIELD)                                      \
-       do {                                                    \
-               u64 x = xdr_to_u64(xdr->FIELD);                 \
-               if (status->FIELD != x) {                       \
-                       flags |= AFS_VNODE_DATA_CHANGED;        \
-                       status->FIELD = x;                      \
-               }                                               \
-       } while (0)
-
-       EXTRACT_M4(nlink);
-       EXTRACT_D8(size);
-       EXTRACT_D8(data_version);
-       EXTRACT_M8(author);
-       EXTRACT_M8(owner);
-       EXTRACT_M8(group);
-       EXTRACT_M4(mode);
-       EXTRACT_M4(caller_access); /* call ticket dependent */
-       EXTRACT_M4(anon_access);
-
-       status->mtime_client = xdr_to_time(xdr->mtime_client);
-       status->mtime_server = xdr_to_time(xdr->mtime_server);
-       status->lock_count   = ntohl(xdr->lock_count);
-
-       if (read_req) {
-               read_req->data_version = status->data_version;
-               read_req->file_size = status->size;
-       }
+       status->nlink           = ntohl(xdr->nlink);
+       status->author          = xdr_to_u64(xdr->author);
+       status->owner           = xdr_to_u64(xdr->owner);
+       status->caller_access   = ntohl(xdr->caller_access); /* Ticket dependent */
+       status->anon_access     = ntohl(xdr->anon_access);
+       status->mode            = ntohl(xdr->mode) & S_IALLUGO;
+       status->group           = xdr_to_u64(xdr->group);
+       status->lock_count      = ntohl(xdr->lock_count);
+
+       status->mtime_client    = xdr_to_time(xdr->mtime_client);
+       status->mtime_server    = xdr_to_time(xdr->mtime_server);
+       status->size            = xdr_to_u64(xdr->size);
+       status->data_version    = xdr_to_u64(xdr->data_version);
+       scb->have_status        = true;
 
        *_bp += xdr_size(xdr);
-
-       if (vnode) {
-               if (test_bit(AFS_VNODE_UNSET, &vnode->flags))
-                       flags |= AFS_VNODE_NOT_YET_SET;
-               afs_update_inode_from_status(vnode, status, expected_version,
-                                            flags);
-       }
-
        return 0;
 
 bad:
@@ -288,73 +234,20 @@ bad:
 }
 
 /*
- * Decode the file status.  We need to lock the target vnode if we're going to
- * update its status so that stat() sees the attributes update atomically.
- */
-static int yfs_decode_status(struct afs_call *call,
-                            const __be32 **_bp,
-                            struct afs_file_status *status,
-                            struct afs_vnode *vnode,
-                            const afs_dataversion_t *expected_version,
-                            struct afs_read *read_req)
-{
-       int ret;
-
-       if (!vnode)
-               return xdr_decode_YFSFetchStatus(call, _bp, status, vnode,
-                                                expected_version, read_req);
-
-       write_seqlock(&vnode->cb_lock);
-       ret = xdr_decode_YFSFetchStatus(call, _bp, status, vnode,
-                                       expected_version, read_req);
-       write_sequnlock(&vnode->cb_lock);
-       return ret;
-}
-
-/*
  * Decode a YFSCallBack block
  */
-static void xdr_decode_YFSCallBack(struct afs_call *call,
-                                  struct afs_vnode *vnode,
-                                  const __be32 **_bp)
-{
-       struct yfs_xdr_YFSCallBack *xdr = (void *)*_bp;
-       struct afs_cb_interest *old, *cbi = call->cbi;
-       u64 cb_expiry;
-
-       write_seqlock(&vnode->cb_lock);
-
-       if (!afs_cb_is_broken(call->cb_break, vnode, cbi)) {
-               cb_expiry = xdr_to_u64(xdr->expiration_time);
-               do_div(cb_expiry, 10 * 1000 * 1000);
-               vnode->cb_version       = ntohl(xdr->version);
-               vnode->cb_type          = ntohl(xdr->type);
-               vnode->cb_expires_at    = cb_expiry + ktime_get_real_seconds();
-               old = vnode->cb_interest;
-               if (old != call->cbi) {
-                       vnode->cb_interest = cbi;
-                       cbi = old;
-               }
-               set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
-       }
-
-       write_sequnlock(&vnode->cb_lock);
-       call->cbi = cbi;
-       *_bp += xdr_size(xdr);
-}
-
-static void xdr_decode_YFSCallBack_raw(const __be32 **_bp,
-                                      struct afs_callback *cb)
+static void xdr_decode_YFSCallBack(const __be32 **_bp,
+                                  struct afs_call *call,
+                                  struct afs_status_cb *scb)
 {
        struct yfs_xdr_YFSCallBack *x = (void *)*_bp;
-       u64 cb_expiry;
-
-       cb_expiry = xdr_to_u64(x->expiration_time);
-       do_div(cb_expiry, 10 * 1000 * 1000);
-       cb->version     = ntohl(x->version);
-       cb->type        = ntohl(x->type);
-       cb->expires_at  = cb_expiry + ktime_get_real_seconds();
+       struct afs_callback *cb = &scb->callback;
+       ktime_t cb_expiry;
 
+       cb_expiry = call->reply_time;
+       cb_expiry = ktime_add(cb_expiry, xdr_to_u64(x->expiration_time) * 100);
+       cb->expires_at  = ktime_divns(cb_expiry, NSEC_PER_SEC);
+       scb->have_cb    = true;
        *_bp += xdr_size(x);
 }
 
@@ -442,11 +335,10 @@ static void xdr_decode_YFSFetchVolumeStatus(const __be32 **_bp,
 }
 
 /*
- * deliver reply data to an FS.FetchStatus
+ * Deliver a reply that's a status, callback and volsync.
  */
-static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call)
+static int yfs_deliver_fs_status_cb_and_volsync(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -454,16 +346,36 @@ static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
-
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_YFSCallBack(call, vnode, &bp);
-       xdr_decode_YFSVolSync(&bp, call->reply[1]);
+       xdr_decode_YFSCallBack(&bp, call, call->out_scb);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
+
+       _leave(" = 0 [done]");
+       return 0;
+}
+
+/*
+ * Deliver reply data to operations that just return a file status and a volume
+ * sync record.
+ */
+static int yfs_deliver_status_and_volsync(struct afs_call *call)
+{
+       const __be32 *bp;
+       int ret;
+
+       ret = afs_transfer_reply(call);
+       if (ret < 0)
+               return ret;
+
+       bp = call->buffer;
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
+       if (ret < 0)
+               return ret;
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -475,15 +387,15 @@ static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call)
 static const struct afs_call_type yfs_RXYFSFetchStatus_vnode = {
        .name           = "YFS.FetchStatus(vnode)",
        .op             = yfs_FS_FetchStatus,
-       .deliver        = yfs_deliver_fs_fetch_status_vnode,
+       .deliver        = yfs_deliver_fs_status_cb_and_volsync,
        .destructor     = afs_flat_call_destructor,
 };
 
 /*
  * Fetch the status information for a file.
  */
-int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsync,
-                            bool new_inode)
+int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_status_cb *scb,
+                            struct afs_volsync *volsync)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -505,9 +417,8 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
        }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = volsync;
-       call->expected_version = new_inode ? 1 : vnode->status.data_version;
+       call->out_scb = scb;
+       call->out_volsync = volsync;
 
        /* marshall the parameters */
        bp = call->request;
@@ -516,9 +427,9 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
        bp = xdr_encode_YFSFid(bp, &vnode->fid);
        yfs_check_req(call, bp);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -528,8 +439,7 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
  */
 static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
-       struct afs_read *req = call->reply[2];
+       struct afs_read *req = call->read_request;
        const __be32 *bp;
        unsigned int size;
        int ret;
@@ -586,7 +496,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                if (req->offset == PAGE_SIZE) {
                        req->offset = 0;
                        if (req->page_done)
-                               req->page_done(call, req);
+                               req->page_done(req);
                        req->index++;
                        if (req->remain > 0)
                                goto begin_page;
@@ -623,12 +533,14 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                                       &vnode->status.data_version, req);
+               ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
-               xdr_decode_YFSCallBack(call, vnode, &bp);
-               xdr_decode_YFSVolSync(&bp, call->reply[1]);
+               xdr_decode_YFSCallBack(&bp, call, call->out_scb);
+               xdr_decode_YFSVolSync(&bp, call->out_volsync);
+
+               req->data_version = call->out_scb->status.data_version;
+               req->file_size = call->out_scb->status.size;
 
                call->unmarshall++;
 
@@ -642,7 +554,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                        zero_user_segment(req->pages[req->index],
                                          req->offset, PAGE_SIZE);
                if (req->page_done)
-                       req->page_done(call, req);
+                       req->page_done(req);
                req->offset = 0;
        }
 
@@ -652,9 +564,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
 
 static void yfs_fetch_data_destructor(struct afs_call *call)
 {
-       struct afs_read *req = call->reply[2];
-
-       afs_put_read(req);
+       afs_put_read(call->read_request);
        afs_flat_call_destructor(call);
 }
 
@@ -671,7 +581,8 @@ static const struct afs_call_type yfs_RXYFSFetchData64 = {
 /*
  * Fetch data from a file.
  */
-int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
+int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_status_cb *scb,
+                     struct afs_read *req)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -693,11 +604,9 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = NULL; /* volsync */
-       call->reply[2] = req;
-       call->expected_version = vnode->status.data_version;
-       call->want_reply_time = true;
+       call->out_scb = scb;
+       call->out_volsync = NULL;
+       call->read_request = req;
 
        /* marshall the parameters */
        bp = call->request;
@@ -709,9 +618,9 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
        yfs_check_req(call, bp);
 
        refcount_inc(&req->usage);
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -721,7 +630,6 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
  */
 static int yfs_deliver_fs_create_vnode(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -733,16 +641,15 @@ static int yfs_deliver_fs_create_vnode(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       xdr_decode_YFSFid(&bp, call->reply[1]);
-       ret = yfs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
+       xdr_decode_YFSFid(&bp, call->out_fid);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_YFSCallBack_raw(&bp, call->reply[3]);
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSCallBack(&bp, call, call->out_scb);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -764,14 +671,13 @@ static const struct afs_call_type afs_RXFSCreateFile = {
 int yfs_fs_create_file(struct afs_fs_cursor *fc,
                       const char *name,
                       umode_t mode,
-                      u64 current_data_version,
+                      struct afs_status_cb *dvnode_scb,
                       struct afs_fid *newfid,
-                      struct afs_file_status *newstatus,
-                      struct afs_callback *newcb)
+                      struct afs_status_cb *new_scb)
 {
-       struct afs_vnode *vnode = fc->vnode;
+       struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
-       struct afs_net *net = afs_v2net(vnode);
+       struct afs_net *net = afs_v2net(dvnode);
        size_t namesz, reqsz, rplsz;
        __be32 *bp;
 
@@ -795,24 +701,23 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = newfid;
-       call->reply[2] = newstatus;
-       call->reply[3] = newcb;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_fid = newfid;
+       call->out_scb = new_scb;
 
        /* marshall the parameters */
        bp = call->request;
        bp = xdr_encode_u32(bp, YFSCREATEFILE);
        bp = xdr_encode_u32(bp, 0); /* RPC flags */
-       bp = xdr_encode_YFSFid(bp, &vnode->fid);
+       bp = xdr_encode_YFSFid(bp, &dvnode->fid);
        bp = xdr_encode_string(bp, name, namesz);
        bp = xdr_encode_YFSStoreStatus_mode(bp, mode);
        bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */
        yfs_check_req(call, bp);
 
        afs_use_fs_server(call, fc->cbi);
-       trace_afs_make_fs_call1(call, &vnode->fid, name);
+       trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -830,14 +735,13 @@ static const struct afs_call_type yfs_RXFSMakeDir = {
 int yfs_fs_make_dir(struct afs_fs_cursor *fc,
                    const char *name,
                    umode_t mode,
-                   u64 current_data_version,
+                   struct afs_status_cb *dvnode_scb,
                    struct afs_fid *newfid,
-                   struct afs_file_status *newstatus,
-                   struct afs_callback *newcb)
+                   struct afs_status_cb *new_scb)
 {
-       struct afs_vnode *vnode = fc->vnode;
+       struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
-       struct afs_net *net = afs_v2net(vnode);
+       struct afs_net *net = afs_v2net(dvnode);
        size_t namesz, reqsz, rplsz;
        __be32 *bp;
 
@@ -860,23 +764,22 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = newfid;
-       call->reply[2] = newstatus;
-       call->reply[3] = newcb;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_fid = newfid;
+       call->out_scb = new_scb;
 
        /* marshall the parameters */
        bp = call->request;
        bp = xdr_encode_u32(bp, YFSMAKEDIR);
        bp = xdr_encode_u32(bp, 0); /* RPC flags */
-       bp = xdr_encode_YFSFid(bp, &vnode->fid);
+       bp = xdr_encode_YFSFid(bp, &dvnode->fid);
        bp = xdr_encode_string(bp, name, namesz);
        bp = xdr_encode_YFSStoreStatus_mode(bp, mode);
        yfs_check_req(call, bp);
 
        afs_use_fs_server(call, fc->cbi);
-       trace_afs_make_fs_call1(call, &vnode->fid, name);
+       trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -886,8 +789,6 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc,
  */
 static int yfs_deliver_fs_remove_file2(struct afs_call *call)
 {
-       struct afs_vnode *dvnode = call->reply[0];
-       struct afs_vnode *vnode = call->reply[1];
        struct afs_fid fid;
        const __be32 *bp;
        int ret;
@@ -898,20 +799,18 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &dvnode->status, dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
 
        xdr_decode_YFSFid(&bp, &fid);
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
        /* Was deleted if vnode->status.abort_code == VNOVNODE. */
 
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
        return 0;
 }
 
@@ -929,7 +828,8 @@ static const struct afs_call_type yfs_RXYFSRemoveFile2 = {
  * Remove a file and retrieve new file status.
  */
 int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-                       const char *name, u64 current_data_version)
+                       const char *name, struct afs_status_cb *dvnode_scb,
+                       struct afs_status_cb *vnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -954,9 +854,8 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = vnode;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_scb = vnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -968,6 +867,7 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -977,7 +877,6 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
  */
 static int yfs_deliver_fs_remove(struct afs_call *call)
 {
-       struct afs_vnode *dvnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -987,14 +886,12 @@ static int yfs_deliver_fs_remove(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &dvnode->status, dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
 
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
        return 0;
 }
 
@@ -1019,7 +916,8 @@ static const struct afs_call_type yfs_RXYFSRemoveDir = {
  * remove a file or directory
  */
 int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-                 const char *name, bool isdir, u64 current_data_version)
+                 const char *name, bool isdir,
+                 struct afs_status_cb *dvnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -1042,9 +940,7 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = vnode;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1056,6 +952,7 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1065,7 +962,6 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
  */
 static int yfs_deliver_fs_link(struct afs_call *call)
 {
-       struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1];
        const __be32 *bp;
        int ret;
 
@@ -1075,16 +971,14 @@ static int yfs_deliver_fs_link(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = yfs_decode_status(call, &bp, &dvnode->status, dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
        _leave(" = 0 [done]");
        return 0;
 }
@@ -1103,7 +997,9 @@ static const struct afs_call_type yfs_RXYFSLink = {
  * Make a hard link.
  */
 int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
-               const char *name, u64 current_data_version)
+               const char *name,
+               struct afs_status_cb *dvnode_scb,
+               struct afs_status_cb *vnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -1127,9 +1023,8 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = vnode;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_scb = vnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1142,6 +1037,7 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &vnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1151,7 +1047,6 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
  */
 static int yfs_deliver_fs_symlink(struct afs_call *call)
 {
-       struct afs_vnode *vnode = call->reply[0];
        const __be32 *bp;
        int ret;
 
@@ -1163,15 +1058,14 @@ static int yfs_deliver_fs_symlink(struct afs_call *call)
 
        /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       xdr_decode_YFSFid(&bp, call->reply[1]);
-       ret = yfs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
+       xdr_decode_YFSFid(&bp, call->out_fid);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
        if (ret < 0)
                return ret;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
 
        _leave(" = 0 [done]");
        return 0;
@@ -1193,9 +1087,9 @@ static const struct afs_call_type yfs_RXYFSSymlink = {
 int yfs_fs_symlink(struct afs_fs_cursor *fc,
                   const char *name,
                   const char *contents,
-                  u64 current_data_version,
+                  struct afs_status_cb *dvnode_scb,
                   struct afs_fid *newfid,
-                  struct afs_file_status *newstatus)
+                  struct afs_status_cb *vnode_scb)
 {
        struct afs_vnode *dvnode = fc->vnode;
        struct afs_call *call;
@@ -1222,10 +1116,9 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = dvnode;
-       call->reply[1] = newfid;
-       call->reply[2] = newstatus;
-       call->expected_version = current_data_version + 1;
+       call->out_dir_scb = dvnode_scb;
+       call->out_fid = newfid;
+       call->out_scb = vnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1239,6 +1132,7 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call1(call, &dvnode->fid, name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1248,8 +1142,6 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc,
  */
 static int yfs_deliver_fs_rename(struct afs_call *call)
 {
-       struct afs_vnode *orig_dvnode = call->reply[0];
-       struct afs_vnode *new_dvnode = call->reply[1];
        const __be32 *bp;
        int ret;
 
@@ -1259,20 +1151,17 @@ static int yfs_deliver_fs_rename(struct afs_call *call)
        if (ret < 0)
                return ret;
 
-       /* unmarshall the reply once we've received all of it */
        bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &orig_dvnode->status, orig_dvnode,
-                               &call->expected_version, NULL);
+       ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb);
        if (ret < 0)
                return ret;
-       if (new_dvnode != orig_dvnode) {
-               ret = yfs_decode_status(call, &bp, &new_dvnode->status, new_dvnode,
-                                       &call->expected_version_2, NULL);
+       if (call->out_dir_scb != call->out_scb) {
+               ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
        }
 
-       xdr_decode_YFSVolSync(&bp, NULL);
+       xdr_decode_YFSVolSync(&bp, call->out_volsync);
        _leave(" = 0 [done]");
        return 0;
 }
@@ -1294,8 +1183,8 @@ int yfs_fs_rename(struct afs_fs_cursor *fc,
                  const char *orig_name,
                  struct afs_vnode *new_dvnode,
                  const char *new_name,
-                 u64 current_orig_data_version,
-                 u64 current_new_data_version)
+                 struct afs_status_cb *orig_dvnode_scb,
+                 struct afs_status_cb *new_dvnode_scb)
 {
        struct afs_vnode *orig_dvnode = fc->vnode;
        struct afs_call *call;
@@ -1321,10 +1210,8 @@ int yfs_fs_rename(struct afs_fs_cursor *fc,
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = orig_dvnode;
-       call->reply[1] = new_dvnode;
-       call->expected_version = current_orig_data_version + 1;
-       call->expected_version_2 = current_new_data_version + 1;
+       call->out_dir_scb = orig_dvnode_scb;
+       call->out_scb = new_dvnode_scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1338,46 +1225,18 @@ int yfs_fs_rename(struct afs_fs_cursor *fc,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call2(call, &orig_dvnode->fid, orig_name, new_name);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
 
 /*
- * Deliver reply data to a YFS.StoreData64 operation.
- */
-static int yfs_deliver_fs_store_data(struct afs_call *call)
-{
-       struct afs_vnode *vnode = call->reply[0];
-       const __be32 *bp;
-       int ret;
-
-       _enter("");
-
-       ret = afs_transfer_reply(call);
-       if (ret < 0)
-               return ret;
-
-       /* unmarshall the reply once we've received all of it */
-       bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
-       if (ret < 0)
-               return ret;
-       xdr_decode_YFSVolSync(&bp, NULL);
-
-       afs_pages_written_back(vnode, call);
-
-       _leave(" = 0 [done]");
-       return 0;
-}
-
-/*
  * YFS.StoreData64 operation type.
  */
 static const struct afs_call_type yfs_RXYFSStoreData64 = {
        .name           = "YFS.StoreData64",
        .op             = yfs_FS_StoreData64,
-       .deliver        = yfs_deliver_fs_store_data,
+       .deliver        = yfs_deliver_status_and_volsync,
        .destructor     = afs_flat_call_destructor,
 };
 
@@ -1386,7 +1245,8 @@ static const struct afs_call_type yfs_RXYFSStoreData64 = {
  */
 int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
                      pgoff_t first, pgoff_t last,
-                     unsigned offset, unsigned to)
+                     unsigned offset, unsigned to,
+                     struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1424,13 +1284,12 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
 
        call->key = fc->key;
        call->mapping = mapping;
-       call->reply[0] = vnode;
        call->first = first;
        call->last = last;
        call->first_offset = offset;
        call->last_to = to;
        call->send_pages = true;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1445,51 +1304,25 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
 
 /*
- * deliver reply data to an FS.StoreStatus
- */
-static int yfs_deliver_fs_store_status(struct afs_call *call)
-{
-       struct afs_vnode *vnode = call->reply[0];
-       const __be32 *bp;
-       int ret;
-
-       _enter("");
-
-       ret = afs_transfer_reply(call);
-       if (ret < 0)
-               return ret;
-
-       /* unmarshall the reply once we've received all of it */
-       bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
-       if (ret < 0)
-               return ret;
-       xdr_decode_YFSVolSync(&bp, NULL);
-
-       _leave(" = 0 [done]");
-       return 0;
-}
-
-/*
  * YFS.StoreStatus operation type
  */
 static const struct afs_call_type yfs_RXYFSStoreStatus = {
        .name           = "YFS.StoreStatus",
        .op             = yfs_FS_StoreStatus,
-       .deliver        = yfs_deliver_fs_store_status,
+       .deliver        = yfs_deliver_status_and_volsync,
        .destructor     = afs_flat_call_destructor,
 };
 
 static const struct afs_call_type yfs_RXYFSStoreData64_as_Status = {
        .name           = "YFS.StoreData64",
        .op             = yfs_FS_StoreData64,
-       .deliver        = yfs_deliver_fs_store_status,
+       .deliver        = yfs_deliver_status_and_volsync,
        .destructor     = afs_flat_call_destructor,
 };
 
@@ -1497,7 +1330,8 @@ static const struct afs_call_type yfs_RXYFSStoreData64_as_Status = {
  * Set the attributes on a file, using YFS.StoreData64 rather than
  * YFS.StoreStatus so as to alter the file size also.
  */
-static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
+static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr,
+                              struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1518,8 +1352,7 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->expected_version = vnode->status.data_version + 1;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1534,6 +1367,7 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1542,7 +1376,8 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
  * Set the attributes on a file, using YFS.StoreData64 if there's a change in
  * file size, and YFS.StoreStatus otherwise.
  */
-int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
+int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr,
+                  struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1550,7 +1385,7 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
        __be32 *bp;
 
        if (attr->ia_valid & ATTR_SIZE)
-               return yfs_fs_setattr_size(fc, attr);
+               return yfs_fs_setattr_size(fc, attr, scb);
 
        _enter(",%x,{%llx:%llu},,",
               key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
@@ -1565,8 +1400,7 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->expected_version = vnode->status.data_version;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1578,6 +1412,7 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1607,7 +1442,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               xdr_decode_YFSFetchVolumeStatus(&bp, call->reply[1]);
+               xdr_decode_YFSFetchVolumeStatus(&bp, call->out_volstatus);
                call->unmarshall++;
                afs_extract_to_tmp(call);
 
@@ -1623,7 +1458,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_volname_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the volume name */
@@ -1633,7 +1468,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
@@ -1651,7 +1486,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_offline_msg_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the offline message */
@@ -1661,7 +1496,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("offline '%s'", p);
 
@@ -1680,7 +1515,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                        return afs_protocol_error(call, -EBADMSG,
                                                  afs_eproto_motd_len);
                size = (call->count + 3) & ~3; /* It's padded */
-               afs_extract_begin(call, call->reply[2], size);
+               afs_extract_to_buf(call, size);
                call->unmarshall++;
 
                /* Fall through - and extract the message of the day */
@@ -1690,7 +1525,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                if (ret < 0)
                        return ret;
 
-               p = call->reply[2];
+               p = call->buffer;
                p[call->count] = 0;
                _debug("motd '%s'", p);
 
@@ -1706,23 +1541,13 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
 }
 
 /*
- * Destroy a YFS.GetVolumeStatus call.
- */
-static void yfs_get_volume_status_call_destructor(struct afs_call *call)
-{
-       kfree(call->reply[2]);
-       call->reply[2] = NULL;
-       afs_flat_call_destructor(call);
-}
-
-/*
  * YFS.GetVolumeStatus operation type
  */
 static const struct afs_call_type yfs_RXYFSGetVolumeStatus = {
        .name           = "YFS.GetVolumeStatus",
        .op             = yfs_FS_GetVolumeStatus,
        .deliver        = yfs_deliver_fs_get_volume_status,
-       .destructor     = yfs_get_volume_status_call_destructor,
+       .destructor     = afs_flat_call_destructor,
 };
 
 /*
@@ -1735,28 +1560,21 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc,
        struct afs_call *call;
        struct afs_net *net = afs_v2net(vnode);
        __be32 *bp;
-       void *tmpbuf;
 
        _enter("");
 
-       tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL);
-       if (!tmpbuf)
-               return -ENOMEM;
-
        call = afs_alloc_flat_call(net, &yfs_RXYFSGetVolumeStatus,
                                   sizeof(__be32) * 2 +
                                   sizeof(struct yfs_xdr_u64),
-                                  sizeof(struct yfs_xdr_YFSFetchVolumeStatus) +
-                                  sizeof(__be32));
-       if (!call) {
-               kfree(tmpbuf);
+                                  max_t(size_t,
+                                        sizeof(struct yfs_xdr_YFSFetchVolumeStatus) +
+                                        sizeof(__be32),
+                                        AFSOPAQUEMAX + 1));
+       if (!call)
                return -ENOMEM;
-       }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[1] = vs;
-       call->reply[2] = tmpbuf;
+       call->out_volstatus = vs;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1767,39 +1585,12 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc,
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
 
 /*
- * Deliver reply data to operations that just return a file status and a volume
- * sync record.
- */
-static int yfs_deliver_status_and_volsync(struct afs_call *call)
-{
-       struct afs_vnode *vnode = call->reply[0];
-       const __be32 *bp;
-       int ret;
-
-       _enter("{%u}", call->unmarshall);
-
-       ret = afs_transfer_reply(call);
-       if (ret < 0)
-               return ret;
-
-       /* unmarshall the reply once we've received all of it */
-       bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                               &call->expected_version, NULL);
-       if (ret < 0)
-               return ret;
-       xdr_decode_YFSVolSync(&bp, NULL);
-
-       _leave(" = 0 [done]");
-       return 0;
-}
-
-/*
  * YFS.SetLock operation type
  */
 static const struct afs_call_type yfs_RXYFSSetLock = {
@@ -1834,7 +1625,8 @@ static const struct afs_call_type yfs_RXYFSReleaseLock = {
 /*
  * Set a lock on a file
  */
-int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
+int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type,
+                   struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1853,8 +1645,8 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->want_reply_time = true;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1866,6 +1658,7 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_calli(call, &vnode->fid, type);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1873,7 +1666,7 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
 /*
  * extend a lock on a file
  */
-int yfs_fs_extend_lock(struct afs_fs_cursor *fc)
+int yfs_fs_extend_lock(struct afs_fs_cursor *fc, struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1891,8 +1684,8 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->want_reply_time = true;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1903,6 +1696,7 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -1910,7 +1704,7 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc)
 /*
  * release a lock on a file
  */
-int yfs_fs_release_lock(struct afs_fs_cursor *fc)
+int yfs_fs_release_lock(struct afs_fs_cursor *fc, struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -1928,7 +1722,8 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc)
                return -ENOMEM;
 
        call->key = fc->key;
-       call->reply[0] = vnode;
+       call->lvnode = vnode;
+       call->out_scb = scb;
 
        /* marshall the parameters */
        bp = call->request;
@@ -1939,48 +1734,18 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc)
 
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
 
 /*
- * Deliver reply data to an FS.FetchStatus with no vnode.
- */
-static int yfs_deliver_fs_fetch_status(struct afs_call *call)
-{
-       struct afs_file_status *status = call->reply[1];
-       struct afs_callback *callback = call->reply[2];
-       struct afs_volsync *volsync = call->reply[3];
-       struct afs_vnode *vnode = call->reply[0];
-       const __be32 *bp;
-       int ret;
-
-       ret = afs_transfer_reply(call);
-       if (ret < 0)
-               return ret;
-
-       _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
-
-       /* unmarshall the reply once we've received all of it */
-       bp = call->buffer;
-       ret = yfs_decode_status(call, &bp, status, vnode,
-                               &call->expected_version, NULL);
-       if (ret < 0)
-               return ret;
-       xdr_decode_YFSCallBack_raw(&bp, callback);
-       xdr_decode_YFSVolSync(&bp, volsync);
-
-       _leave(" = 0 [done]");
-       return 0;
-}
-
-/*
  * YFS.FetchStatus operation type
  */
 static const struct afs_call_type yfs_RXYFSFetchStatus = {
        .name           = "YFS.FetchStatus",
        .op             = yfs_FS_FetchStatus,
-       .deliver        = yfs_deliver_fs_fetch_status,
+       .deliver        = yfs_deliver_fs_status_cb_and_volsync,
        .destructor     = afs_flat_call_destructor,
 };
 
@@ -1990,8 +1755,7 @@ static const struct afs_call_type yfs_RXYFSFetchStatus = {
 int yfs_fs_fetch_status(struct afs_fs_cursor *fc,
                        struct afs_net *net,
                        struct afs_fid *fid,
-                       struct afs_file_status *status,
-                       struct afs_callback *callback,
+                       struct afs_status_cb *scb,
                        struct afs_volsync *volsync)
 {
        struct afs_call *call;
@@ -2012,11 +1776,8 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc,
        }
 
        call->key = fc->key;
-       call->reply[0] = NULL; /* vnode for fid[0] */
-       call->reply[1] = status;
-       call->reply[2] = callback;
-       call->reply[3] = volsync;
-       call->expected_version = 1; /* vnode->status.data_version */
+       call->out_scb = scb;
+       call->out_volsync = volsync;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2025,9 +1786,9 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc,
        bp = xdr_encode_YFSFid(bp, fid);
        yfs_check_req(call, bp);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, fid);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -2037,9 +1798,7 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc,
  */
 static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
 {
-       struct afs_file_status *statuses;
-       struct afs_callback *callbacks;
-       struct afs_vnode *vnode = call->reply[0];
+       struct afs_status_cb *scb;
        const __be32 *bp;
        u32 tmp;
        int ret;
@@ -2078,10 +1837,8 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               statuses = call->reply[1];
-               ret = yfs_decode_status(call, &bp, &statuses[call->count],
-                                       call->count == 0 ? vnode : NULL,
-                                       NULL, NULL);
+               scb = &call->out_scb[call->count];
+               ret = xdr_decode_YFSFetchStatus(&bp, call, scb);
                if (ret < 0)
                        return ret;
 
@@ -2120,13 +1877,8 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                _debug("unmarshall CB array");
                bp = call->buffer;
-               callbacks = call->reply[2];
-               xdr_decode_YFSCallBack_raw(&bp, &callbacks[call->count]);
-               statuses = call->reply[1];
-               if (call->count == 0 && vnode && statuses[0].abort_code == 0) {
-                       bp = call->buffer;
-                       xdr_decode_YFSCallBack(call, vnode, &bp);
-               }
+               scb = &call->out_scb[call->count];
+               xdr_decode_YFSCallBack(&bp, call, scb);
                call->count++;
                if (call->count < call->count2)
                        goto more_cbs;
@@ -2141,7 +1893,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                        return ret;
 
                bp = call->buffer;
-               xdr_decode_YFSVolSync(&bp, call->reply[3]);
+               xdr_decode_YFSVolSync(&bp, call->out_volsync);
 
                call->unmarshall++;
 
@@ -2170,8 +1922,7 @@ static const struct afs_call_type yfs_RXYFSInlineBulkStatus = {
 int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
                              struct afs_net *net,
                              struct afs_fid *fids,
-                             struct afs_file_status *statuses,
-                             struct afs_callback *callbacks,
+                             struct afs_status_cb *statuses,
                              unsigned int nr_fids,
                              struct afs_volsync *volsync)
 {
@@ -2194,10 +1945,8 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
        }
 
        call->key = fc->key;
-       call->reply[0] = NULL; /* vnode for fid[0] */
-       call->reply[1] = statuses;
-       call->reply[2] = callbacks;
-       call->reply[3] = volsync;
+       call->out_scb = statuses;
+       call->out_volsync = volsync;
        call->count2 = nr_fids;
 
        /* marshall the parameters */
@@ -2209,9 +1958,9 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
                bp = xdr_encode_YFSFid(bp, &fids[i]);
        yfs_check_req(call, bp);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &fids[0]);
+       afs_set_fc_call(call, fc);
        afs_make_call(&fc->ac, call, GFP_NOFS);
        return afs_wait_for_call_to_complete(call, &fc->ac);
 }
@@ -2221,9 +1970,7 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
  */
 static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
 {
-       struct afs_volsync *volsync = call->reply[2];
-       struct afs_vnode *vnode = call->reply[1];
-       struct yfs_acl *yacl =  call->reply[0];
+       struct yfs_acl *yacl = call->out_yacl;
        struct afs_acl *acl;
        const __be32 *bp;
        unsigned int size;
@@ -2308,11 +2055,10 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                bp = call->buffer;
                yacl->inherit_flag = ntohl(*bp++);
                yacl->num_cleaned = ntohl(*bp++);
-               ret = yfs_decode_status(call, &bp, &vnode->status, vnode,
-                                       &call->expected_version, NULL);
+               ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb);
                if (ret < 0)
                        return ret;
-               xdr_decode_YFSVolSync(&bp, volsync);
+               xdr_decode_YFSVolSync(&bp, call->out_volsync);
 
                call->unmarshall++;
 
@@ -2333,12 +2079,6 @@ void yfs_free_opaque_acl(struct yfs_acl *yacl)
        }
 }
 
-static void yfs_destroy_fs_fetch_opaque_acl(struct afs_call *call)
-{
-       yfs_free_opaque_acl(call->reply[0]);
-       afs_flat_call_destructor(call);
-}
-
 /*
  * YFS.FetchOpaqueACL operation type
  */
@@ -2346,18 +2086,18 @@ static const struct afs_call_type yfs_RXYFSFetchOpaqueACL = {
        .name           = "YFS.FetchOpaqueACL",
        .op             = yfs_FS_FetchOpaqueACL,
        .deliver        = yfs_deliver_fs_fetch_opaque_acl,
-       .destructor     = yfs_destroy_fs_fetch_opaque_acl,
+       .destructor     = afs_flat_call_destructor,
 };
 
 /*
  * Fetch the YFS advanced ACLs for a file.
  */
 struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *fc,
-                                       unsigned int flags)
+                                       struct yfs_acl *yacl,
+                                       struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
-       struct yfs_acl *yacl;
        struct afs_net *net = afs_v2net(vnode);
        __be32 *bp;
 
@@ -2370,19 +2110,15 @@ struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *fc,
                                   sizeof(__be32) * 2 +
                                   sizeof(struct yfs_xdr_YFSFetchStatus) +
                                   sizeof(struct yfs_xdr_YFSVolSync));
-       if (!call)
-               goto nomem;
-
-       yacl = kzalloc(sizeof(struct yfs_acl), GFP_KERNEL);
-       if (!yacl)
-               goto nomem_call;
+       if (!call) {
+               fc->ac.error = -ENOMEM;
+               return ERR_PTR(-ENOMEM);
+       }
 
-       yacl->flags = flags;
        call->key = fc->key;
-       call->reply[0] = yacl;
-       call->reply[1] = vnode;
-       call->reply[2] = NULL; /* volsync */
-       call->ret_reply0 = true;
+       call->out_yacl = yacl;
+       call->out_scb = scb;
+       call->out_volsync = NULL;
 
        /* marshall the parameters */
        bp = call->request;
@@ -2391,17 +2127,10 @@ struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *fc,
        bp = xdr_encode_YFSFid(bp, &vnode->fid);
        yfs_check_req(call, bp);
 
-       call->cb_break = fc->cb_break;
        afs_use_fs_server(call, fc->cbi);
        trace_afs_make_fs_call(call, &vnode->fid);
        afs_make_call(&fc->ac, call, GFP_KERNEL);
        return (struct yfs_acl *)afs_wait_for_call_to_complete(call, &fc->ac);
-
-nomem_call:
-       afs_put_call(call);
-nomem:
-       fc->ac.error = -ENOMEM;
-       return ERR_PTR(-ENOMEM);
 }
 
 /*
@@ -2417,7 +2146,8 @@ static const struct afs_call_type yfs_RXYFSStoreOpaqueACL2 = {
 /*
  * Fetch the YFS ACL for a file.
  */
-int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *fc, const struct afs_acl *acl)
+int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *fc, const struct afs_acl *acl,
+                            struct afs_status_cb *scb)
 {
        struct afs_vnode *vnode = fc->vnode;
        struct afs_call *call;
@@ -2441,8 +2171,8 @@ int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *fc, const struct afs_acl *acl
        }
 
        call->key = fc->key;
-       call->reply[0] = vnode;
-       call->reply[2] = NULL; /* volsync */
+       call->out_scb = scb;
+       call->out_volsync = NULL;
 
        /* marshall the parameters */
        bp = call->request;
index 91262c3..c2b8663 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  fs/anon_inodes.c
  *
index eaebcd4..3b3a6b1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config AUTOFS4_FS
        tristate "Old Kconfig name for Kernel automounter support"
        select AUTOFS_FS
index 1f85d35..495ac54 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux autofs-filesystem routines.
 #
index edc5cc2..9550b64 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BEFS_FS
        tristate "BeOS file system (BeFS) support (read only)"
        depends on BLOCK
index 8b9f666..6c9c3cb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux BeOS filesystem routines.
 #
index e273850..462d096 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/befs/linuxvfs.c
  *
index 3728a64..3e1247f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BFS_FS
        tristate "BFS file system support"
        depends on BLOCK
index c787b36..2b6bc5e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for BFS filesystem.
 #
index dc0cd2a..5e97bed 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     fs/bfs/inode.c
  *     BFS superblock and inode operations.
index 1fefd87..8e8346a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/binfmt_aout.c
  *
index 7d09d12..8264b46 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/binfmt_elf.c
  *
@@ -524,6 +525,19 @@ static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp,
 
 #endif /* !CONFIG_ARCH_BINFMT_ELF_STATE */
 
+static inline int make_prot(u32 p_flags)
+{
+       int prot = 0;
+
+       if (p_flags & PF_R)
+               prot |= PROT_READ;
+       if (p_flags & PF_W)
+               prot |= PROT_WRITE;
+       if (p_flags & PF_X)
+               prot |= PROT_EXEC;
+       return prot;
+}
+
 /* This is much more generalized than the library routine read function,
    so we keep this separate.  Technically the library read function
    is only provided so that we can read a.out libraries that have
@@ -563,16 +577,10 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
        for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
                if (eppnt->p_type == PT_LOAD) {
                        int elf_type = MAP_PRIVATE | MAP_DENYWRITE;
-                       int elf_prot = 0;
+                       int elf_prot = make_prot(eppnt->p_flags);
                        unsigned long vaddr = 0;
                        unsigned long k, map_addr;
 
-                       if (eppnt->p_flags & PF_R)
-                               elf_prot = PROT_READ;
-                       if (eppnt->p_flags & PF_W)
-                               elf_prot |= PROT_WRITE;
-                       if (eppnt->p_flags & PF_X)
-                               elf_prot |= PROT_EXEC;
                        vaddr = eppnt->p_vaddr;
                        if (interp_elf_ex->e_type == ET_EXEC || load_addr_set)
                                elf_type |= MAP_FIXED_NOREPLACE;
@@ -687,7 +695,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
        struct file *interpreter = NULL; /* to shut gcc up */
        unsigned long load_addr = 0, load_bias = 0;
        int load_addr_set = 0;
-       char * elf_interpreter = NULL;
        unsigned long error;
        struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL;
        unsigned long elf_bss, elf_brk;
@@ -698,13 +705,12 @@ static int load_elf_binary(struct linux_binprm *bprm)
        unsigned long start_code, end_code, start_data, end_data;
        unsigned long reloc_func_desc __maybe_unused = 0;
        int executable_stack = EXSTACK_DEFAULT;
-       struct pt_regs *regs = current_pt_regs();
        struct {
                struct elfhdr elf_ex;
                struct elfhdr interp_elf_ex;
        } *loc;
        struct arch_elf_state arch_state = INIT_ARCH_ELF_STATE;
-       loff_t pos;
+       struct pt_regs *regs;
 
        loc = kmalloc(sizeof(*loc), GFP_KERNEL);
        if (!loc) {
@@ -734,69 +740,66 @@ static int load_elf_binary(struct linux_binprm *bprm)
                goto out;
 
        elf_ppnt = elf_phdata;
-       elf_bss = 0;
-       elf_brk = 0;
+       for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
+               char *elf_interpreter;
+               loff_t pos;
 
-       start_code = ~0UL;
-       end_code = 0;
-       start_data = 0;
-       end_data = 0;
+               if (elf_ppnt->p_type != PT_INTERP)
+                       continue;
 
-       for (i = 0; i < loc->elf_ex.e_phnum; i++) {
-               if (elf_ppnt->p_type == PT_INTERP) {
-                       /* This is the program interpreter used for
-                        * shared libraries - for now assume that this
-                        * is an a.out format binary
-                        */
-                       retval = -ENOEXEC;
-                       if (elf_ppnt->p_filesz > PATH_MAX || 
-                           elf_ppnt->p_filesz < 2)
-                               goto out_free_ph;
-
-                       retval = -ENOMEM;
-                       elf_interpreter = kmalloc(elf_ppnt->p_filesz,
-                                                 GFP_KERNEL);
-                       if (!elf_interpreter)
-                               goto out_free_ph;
-
-                       pos = elf_ppnt->p_offset;
-                       retval = kernel_read(bprm->file, elf_interpreter,
-                                            elf_ppnt->p_filesz, &pos);
-                       if (retval != elf_ppnt->p_filesz) {
-                               if (retval >= 0)
-                                       retval = -EIO;
-                               goto out_free_interp;
-                       }
-                       /* make sure path is NULL terminated */
-                       retval = -ENOEXEC;
-                       if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
-                               goto out_free_interp;
+               /*
+                * This is the program interpreter used for shared libraries -
+                * for now assume that this is an a.out format binary.
+                */
+               retval = -ENOEXEC;
+               if (elf_ppnt->p_filesz > PATH_MAX || elf_ppnt->p_filesz < 2)
+                       goto out_free_ph;
 
-                       interpreter = open_exec(elf_interpreter);
-                       retval = PTR_ERR(interpreter);
-                       if (IS_ERR(interpreter))
-                               goto out_free_interp;
+               retval = -ENOMEM;
+               elf_interpreter = kmalloc(elf_ppnt->p_filesz, GFP_KERNEL);
+               if (!elf_interpreter)
+                       goto out_free_ph;
 
-                       /*
-                        * If the binary is not readable then enforce
-                        * mm->dumpable = 0 regardless of the interpreter's
-                        * permissions.
-                        */
-                       would_dump(bprm, interpreter);
-
-                       /* Get the exec headers */
-                       pos = 0;
-                       retval = kernel_read(interpreter, &loc->interp_elf_ex,
-                                            sizeof(loc->interp_elf_ex), &pos);
-                       if (retval != sizeof(loc->interp_elf_ex)) {
-                               if (retval >= 0)
-                                       retval = -EIO;
-                               goto out_free_dentry;
-                       }
+               pos = elf_ppnt->p_offset;
+               retval = kernel_read(bprm->file, elf_interpreter,
+                                    elf_ppnt->p_filesz, &pos);
+               if (retval != elf_ppnt->p_filesz) {
+                       if (retval >= 0)
+                               retval = -EIO;
+                       goto out_free_interp;
+               }
+               /* make sure path is NULL terminated */
+               retval = -ENOEXEC;
+               if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
+                       goto out_free_interp;
 
-                       break;
+               interpreter = open_exec(elf_interpreter);
+               kfree(elf_interpreter);
+               retval = PTR_ERR(interpreter);
+               if (IS_ERR(interpreter))
+                       goto out_free_ph;
+
+               /*
+                * If the binary is not readable then enforce mm->dumpable = 0
+                * regardless of the interpreter's permissions.
+                */
+               would_dump(bprm, interpreter);
+
+               /* Get the exec headers */
+               pos = 0;
+               retval = kernel_read(interpreter, &loc->interp_elf_ex,
+                                    sizeof(loc->interp_elf_ex), &pos);
+               if (retval != sizeof(loc->interp_elf_ex)) {
+                       if (retval >= 0)
+                               retval = -EIO;
+                       goto out_free_dentry;
                }
-               elf_ppnt++;
+
+               break;
+
+out_free_interp:
+               kfree(elf_interpreter);
+               goto out_free_ph;
        }
 
        elf_ppnt = elf_phdata;
@@ -819,7 +822,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                }
 
        /* Some simple consistency checks for the interpreter */
-       if (elf_interpreter) {
+       if (interpreter) {
                retval = -ELIBBAD;
                /* Not an ELF interpreter */
                if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
@@ -884,13 +887,19 @@ static int load_elf_binary(struct linux_binprm *bprm)
        if (retval < 0)
                goto out_free_dentry;
        
-       current->mm->start_stack = bprm->p;
+       elf_bss = 0;
+       elf_brk = 0;
+
+       start_code = ~0UL;
+       end_code = 0;
+       start_data = 0;
+       end_data = 0;
 
        /* Now we do a little grungy work by mmapping the ELF image into
           the correct location in memory. */
        for(i = 0, elf_ppnt = elf_phdata;
            i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
-               int elf_prot = 0, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE;
+               int elf_prot, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE;
                unsigned long k, vaddr;
                unsigned long total_size = 0;
 
@@ -931,12 +940,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                        elf_fixed = MAP_FIXED;
                }
 
-               if (elf_ppnt->p_flags & PF_R)
-                       elf_prot |= PROT_READ;
-               if (elf_ppnt->p_flags & PF_W)
-                       elf_prot |= PROT_WRITE;
-               if (elf_ppnt->p_flags & PF_X)
-                       elf_prot |= PROT_EXEC;
+               elf_prot = make_prot(elf_ppnt->p_flags);
 
                elf_flags = MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE;
 
@@ -978,7 +982,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                         * independently randomized mmap region (0 load_bias
                         * without MAP_FIXED).
                         */
-                       if (elf_interpreter) {
+                       if (interpreter) {
                                load_bias = ELF_ET_DYN_BASE;
                                if (current->flags & PF_RANDOMIZE)
                                        load_bias += arch_mmap_rnd();
@@ -1076,7 +1080,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                goto out_free_dentry;
        }
 
-       if (elf_interpreter) {
+       if (interpreter) {
                unsigned long interp_map_addr = 0;
 
                elf_entry = load_elf_interp(&loc->interp_elf_ex,
@@ -1100,7 +1104,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
 
                allow_write_access(interpreter);
                fput(interpreter);
-               kfree(elf_interpreter);
        } else {
                elf_entry = loc->elf_ex.e_entry;
                if (BAD_ADDR(elf_entry)) {
@@ -1115,7 +1118,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
        set_binfmt(&elf_format);
 
 #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
-       retval = arch_setup_additional_pages(bprm, !!elf_interpreter);
+       retval = arch_setup_additional_pages(bprm, !!interpreter);
        if (retval < 0)
                goto out;
 #endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
@@ -1132,6 +1135,17 @@ static int load_elf_binary(struct linux_binprm *bprm)
        current->mm->start_stack = bprm->p;
 
        if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) {
+               /*
+                * For architectures with ELF randomization, when executing
+                * a loader directly (i.e. no interpreter listed in ELF
+                * headers), move the brk area out of the mmap region
+                * (since it grows up, and may collide early with the stack
+                * growing down), and into the unused ELF_ET_DYN_BASE region.
+                */
+               if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) && !interpreter)
+                       current->mm->brk = current->mm->start_brk =
+                               ELF_ET_DYN_BASE;
+
                current->mm->brk = current->mm->start_brk =
                        arch_randomize_brk(current->mm);
 #ifdef compat_brk_randomized
@@ -1148,6 +1162,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
                                MAP_FIXED | MAP_PRIVATE, 0);
        }
 
+       regs = current_pt_regs();
 #ifdef ELF_PLAT_INIT
        /*
         * The ABI may specify that certain registers be set up in special
@@ -1176,8 +1191,6 @@ out_free_dentry:
        allow_write_access(interpreter);
        if (interpreter)
                fput(interpreter);
-out_free_interp:
-       kfree(elf_interpreter);
 out_free_ph:
        kfree(elf_phdata);
        goto out;
@@ -1456,8 +1469,6 @@ static void fill_elf_header(struct elfhdr *elf, int segs,
        elf->e_ehsize = sizeof(struct elfhdr);
        elf->e_phentsize = sizeof(struct elf_phdr);
        elf->e_phnum = segs;
-
-       return;
 }
 
 static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
@@ -1470,7 +1481,6 @@ static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
        phdr->p_memsz = 0;
        phdr->p_flags = 0;
        phdr->p_align = 0;
-       return;
 }
 
 static void fill_note(struct memelfnote *note, const char *name, int type, 
@@ -1480,7 +1490,6 @@ static void fill_note(struct memelfnote *note, const char *name, int type,
        note->type = type;
        note->datasz = sz;
        note->data = data;
-       return;
 }
 
 /*
index dd2d3f0..4664978 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/binfmt_em86.c
  *
index aa4a7a2..b8e1455 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * binfmt_misc.c
  *
index e996174..e9e6a6f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/binfmt_script.c
  *
index f800450..e6886c9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/block_dev.c
  *
@@ -29,7 +30,6 @@
 #include <linux/namei.h>
 #include <linux/log2.h>
 #include <linux/cleancache.h>
-#include <linux/dax.h>
 #include <linux/task_io_accounting_ops.h>
 #include <linux/falloc.h>
 #include <linux/uaccess.h>
index daf7908..84dd4a8 100644 (file)
@@ -1008,6 +1008,7 @@ int btrfs_compress_pages(unsigned int type_level, struct address_space *mapping,
        struct list_head *workspace;
        int ret;
 
+       level = btrfs_compress_op[type]->set_level(level);
        workspace = get_workspace(type, level);
        ret = btrfs_compress_op[type]->compress_pages(workspace, mapping,
                                                      start, pages,
index f79e477..1aee51a 100644 (file)
@@ -757,12 +757,14 @@ static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
 }
 
 static void add_pinned_bytes(struct btrfs_fs_info *fs_info,
-                            struct btrfs_ref *ref)
+                            struct btrfs_ref *ref, int sign)
 {
        struct btrfs_space_info *space_info;
-       s64 num_bytes = -ref->len;
+       s64 num_bytes;
        u64 flags;
 
+       ASSERT(sign == 1 || sign == -1);
+       num_bytes = sign * ref->len;
        if (ref->type == BTRFS_REF_METADATA) {
                if (ref->tree_ref.root == BTRFS_CHUNK_TREE_OBJECTID)
                        flags = BTRFS_BLOCK_GROUP_SYSTEM;
@@ -2063,7 +2065,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
        btrfs_ref_tree_mod(fs_info, generic_ref);
 
        if (ret == 0 && old_ref_mod < 0 && new_ref_mod >= 0)
-               add_pinned_bytes(fs_info, generic_ref);
+               add_pinned_bytes(fs_info, generic_ref, -1);
 
        return ret;
 }
@@ -3882,8 +3884,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags)
                                    info->space_info_kobj, "%s",
                                    alloc_name(space_info->flags));
        if (ret) {
-               percpu_counter_destroy(&space_info->total_bytes_pinned);
-               kfree(space_info);
+               kobject_put(&space_info->kobj);
                return ret;
        }
 
@@ -7190,7 +7191,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
        }
 out:
        if (pin)
-               add_pinned_bytes(fs_info, &generic_ref);
+               add_pinned_bytes(fs_info, &generic_ref, 1);
 
        if (last_ref) {
                /*
@@ -7238,7 +7239,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref)
                btrfs_ref_tree_mod(fs_info, ref);
 
        if (ret == 0 && old_ref_mod >= 0 && new_ref_mod < 0)
-               add_pinned_bytes(fs_info, ref);
+               add_pinned_bytes(fs_info, ref, 1);
 
        return ret;
 }
index 7e85dca..89f5be2 100644 (file)
@@ -2068,6 +2068,18 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
        u64 len;
 
        /*
+        * If the inode needs a full sync, make sure we use a full range to
+        * avoid log tree corruption, due to hole detection racing with ordered
+        * extent completion for adjacent ranges, and assertion failures during
+        * hole detection.
+        */
+       if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
+                    &BTRFS_I(inode)->runtime_flags)) {
+               start = 0;
+               end = LLONG_MAX;
+       }
+
+       /*
         * The range length can be represented by u64, we have to do the typecasts
         * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
         */
@@ -2554,10 +2566,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
 
        ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend,
                                          &cached_state);
-       if (ret) {
-               inode_unlock(inode);
+       if (ret)
                goto out_only_mutex;
-       }
 
        path = btrfs_alloc_path();
        if (!path) {
index ca27169..a9e2e66 100644 (file)
@@ -332,6 +332,7 @@ static int inherit_props(struct btrfs_trans_handle *trans,
        struct btrfs_fs_info *fs_info = root->fs_info;
        int ret;
        int i;
+       bool need_reserve = false;
 
        if (!test_bit(BTRFS_INODE_HAS_PROPS,
                      &BTRFS_I(parent)->runtime_flags))
@@ -357,11 +358,20 @@ static int inherit_props(struct btrfs_trans_handle *trans,
                if (ret)
                        continue;
 
-               num_bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
-               ret = btrfs_block_rsv_add(root, trans->block_rsv,
-                                         num_bytes, BTRFS_RESERVE_NO_FLUSH);
-               if (ret)
-                       return ret;
+               /*
+                * Currently callers should be reserving 1 item for properties,
+                * since we only have 1 property that we currently support.  If
+                * we add more in the future we need to try and reserve more
+                * space for them.  But we should also revisit how we do space
+                * reservations if we do add more properties in the future.
+                */
+               if (need_reserve) {
+                       num_bytes = btrfs_calc_trans_metadata_size(fs_info, 1);
+                       ret = btrfs_block_rsv_add(root, trans->block_rsv,
+                                       num_bytes, BTRFS_RESERVE_NO_FLUSH);
+                       if (ret)
+                               return ret;
+               }
 
                ret = btrfs_setxattr(trans, inode, h->xattr_name, value,
                                     strlen(value), 0);
@@ -375,9 +385,13 @@ static int inherit_props(struct btrfs_trans_handle *trans,
                                        &BTRFS_I(inode)->runtime_flags);
                }
 
-               btrfs_block_rsv_release(fs_info, trans->block_rsv, num_bytes);
-               if (ret)
-                       return ret;
+               if (need_reserve) {
+                       btrfs_block_rsv_release(fs_info, trans->block_rsv,
+                                       num_bytes);
+                       if (ret)
+                               return ret;
+               }
+               need_reserve = true;
        }
 
        return 0;
index 1b9a5d0..2212412 100644 (file)
@@ -132,10 +132,8 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
                return -ENOMEM;
 
        ret = btrfs_search_slot(trans, root, key, path, 0, 1);
-       if (ret < 0) {
-               btrfs_abort_transaction(trans, ret);
+       if (ret < 0)
                goto out;
-       }
 
        if (ret > 0) {
                btrfs_crit(fs_info,
index 5a5930e..2f078b7 100644 (file)
@@ -825,7 +825,12 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs,
        fs_devs->fsid_kobj.kset = btrfs_kset;
        error = kobject_init_and_add(&fs_devs->fsid_kobj,
                                &btrfs_ktype, parent, "%pU", fs_devs->fsid);
-       return error;
+       if (error) {
+               kobject_put(&fs_devs->fsid_kobj);
+               return error;
+       }
+
+       return 0;
 }
 
 int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
index 748cd15..96fce4b 100644 (file)
@@ -107,8 +107,26 @@ static void file_extent_err(const struct extent_buffer *eb, int slot,
        (!IS_ALIGNED(btrfs_file_extent_##name((leaf), (fi)), (alignment)));   \
 })
 
+static u64 file_extent_end(struct extent_buffer *leaf,
+                          struct btrfs_key *key,
+                          struct btrfs_file_extent_item *extent)
+{
+       u64 end;
+       u64 len;
+
+       if (btrfs_file_extent_type(leaf, extent) == BTRFS_FILE_EXTENT_INLINE) {
+               len = btrfs_file_extent_ram_bytes(leaf, extent);
+               end = ALIGN(key->offset + len, leaf->fs_info->sectorsize);
+       } else {
+               len = btrfs_file_extent_num_bytes(leaf, extent);
+               end = key->offset + len;
+       }
+       return end;
+}
+
 static int check_extent_data_item(struct extent_buffer *leaf,
-                                 struct btrfs_key *key, int slot)
+                                 struct btrfs_key *key, int slot,
+                                 struct btrfs_key *prev_key)
 {
        struct btrfs_fs_info *fs_info = leaf->fs_info;
        struct btrfs_file_extent_item *fi;
@@ -188,6 +206,28 @@ static int check_extent_data_item(struct extent_buffer *leaf,
            CHECK_FE_ALIGNED(leaf, slot, fi, offset, sectorsize) ||
            CHECK_FE_ALIGNED(leaf, slot, fi, num_bytes, sectorsize))
                return -EUCLEAN;
+
+       /*
+        * Check that no two consecutive file extent items, in the same leaf,
+        * present ranges that overlap each other.
+        */
+       if (slot > 0 &&
+           prev_key->objectid == key->objectid &&
+           prev_key->type == BTRFS_EXTENT_DATA_KEY) {
+               struct btrfs_file_extent_item *prev_fi;
+               u64 prev_end;
+
+               prev_fi = btrfs_item_ptr(leaf, slot - 1,
+                                        struct btrfs_file_extent_item);
+               prev_end = file_extent_end(leaf, prev_key, prev_fi);
+               if (prev_end > key->offset) {
+                       file_extent_err(leaf, slot - 1,
+"file extent end range (%llu) goes beyond start offset (%llu) of the next file extent",
+                                       prev_end, key->offset);
+                       return -EUCLEAN;
+               }
+       }
+
        return 0;
 }
 
@@ -774,14 +814,15 @@ static int check_inode_item(struct extent_buffer *leaf,
  * Common point to switch the item-specific validation.
  */
 static int check_leaf_item(struct extent_buffer *leaf,
-                          struct btrfs_key *key, int slot)
+                          struct btrfs_key *key, int slot,
+                          struct btrfs_key *prev_key)
 {
        int ret = 0;
        struct btrfs_chunk *chunk;
 
        switch (key->type) {
        case BTRFS_EXTENT_DATA_KEY:
-               ret = check_extent_data_item(leaf, key, slot);
+               ret = check_extent_data_item(leaf, key, slot, prev_key);
                break;
        case BTRFS_EXTENT_CSUM_KEY:
                ret = check_csum_item(leaf, key, slot);
@@ -928,7 +969,7 @@ static int check_leaf(struct extent_buffer *leaf, bool check_item_data)
                         * Check if the item size and content meet other
                         * criteria
                         */
-                       ret = check_leaf_item(leaf, &key, slot);
+                       ret = check_leaf_item(leaf, &key, slot, &prev_key);
                        if (ret < 0)
                                return ret;
                }
index 6adcd8a..6c47f6e 100644 (file)
@@ -4182,6 +4182,7 @@ fill_holes:
                                                               *last_extent, 0,
                                                               0, len, 0, len,
                                                               0, 0, 0);
+                               *last_extent += len;
                        }
                }
        }
index 0faa41f..e450c55 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/buffer.c
  *
index 80e9c61..ae559ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config CACHEFILES
        tristate "Filesystem caching on files"
index 1645fcf..d27720c 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/namei.h>
 #include <linux/security.h>
 #include <linux/slab.h>
-#include <linux/xattr.h>
 #include "internal.h"
 
 #define CACHEFILES_KEYBUF_SIZE 512
index 52095f4..7f7d92d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CEPH_FS
        tristate "Ceph distributed file system"
        depends on INET
index 36a8dc6..72f8e13 100644 (file)
@@ -892,8 +892,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
        int have = ci->i_snap_caps;
 
        if ((have & mask) == mask) {
-               dout("__ceph_caps_issued_mask %p snap issued %s"
-                    " (mask %s)\n", &ci->vfs_inode,
+               dout("__ceph_caps_issued_mask ino 0x%lx snap issued %s"
+                    " (mask %s)\n", ci->vfs_inode.i_ino,
                     ceph_cap_string(have),
                     ceph_cap_string(mask));
                return 1;
@@ -904,8 +904,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                if (!__cap_is_valid(cap))
                        continue;
                if ((cap->issued & mask) == mask) {
-                       dout("__ceph_caps_issued_mask %p cap %p issued %s"
-                            " (mask %s)\n", &ci->vfs_inode, cap,
+                       dout("__ceph_caps_issued_mask ino 0x%lx cap %p issued %s"
+                            " (mask %s)\n", ci->vfs_inode.i_ino, cap,
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch)
@@ -916,8 +916,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                /* does a combination of caps satisfy mask? */
                have |= cap->issued;
                if ((have & mask) == mask) {
-                       dout("__ceph_caps_issued_mask %p combo issued %s"
-                            " (mask %s)\n", &ci->vfs_inode,
+                       dout("__ceph_caps_issued_mask ino 0x%lx combo issued %s"
+                            " (mask %s)\n", ci->vfs_inode.i_ino,
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch) {
@@ -2257,8 +2257,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
        if (datasync)
                goto out;
 
-       inode_lock(inode);
-
        dirty = try_flush_caps(inode, &flush_tid);
        dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
 
@@ -2273,7 +2271,6 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
                ret = wait_event_interruptible(ci->i_cap_wq,
                                        caps_are_flushed(inode, flush_tid));
        }
-       inode_unlock(inode);
 out:
        dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret);
        return ret;
@@ -2528,9 +2525,14 @@ static void __take_cap_refs(struct ceph_inode_info *ci, int got,
  * to (when applicable), and check against max_size here as well.
  * Note that caller is responsible for ensuring max_size increases are
  * requested from the MDS.
+ *
+ * Returns 0 if caps were not able to be acquired (yet), a 1 if they were,
+ * or a negative error code.
+ *
+ * FIXME: how does a 0 return differ from -EAGAIN?
  */
 static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want,
-                           loff_t endoff, bool nonblock, int *got, int *err)
+                           loff_t endoff, bool nonblock, int *got)
 {
        struct inode *inode = &ci->vfs_inode;
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
@@ -2550,8 +2552,7 @@ again:
        if ((file_wanted & need) != need) {
                dout("try_get_cap_refs need %s file_wanted %s, EBADF\n",
                     ceph_cap_string(need), ceph_cap_string(file_wanted));
-               *err = -EBADF;
-               ret = 1;
+               ret = -EBADF;
                goto out_unlock;
        }
 
@@ -2572,10 +2573,8 @@ again:
                if (endoff >= 0 && endoff > (loff_t)ci->i_max_size) {
                        dout("get_cap_refs %p endoff %llu > maxsize %llu\n",
                             inode, endoff, ci->i_max_size);
-                       if (endoff > ci->i_requested_max_size) {
-                               *err = -EAGAIN;
-                               ret = 1;
-                       }
+                       if (endoff > ci->i_requested_max_size)
+                               ret = -EAGAIN;
                        goto out_unlock;
                }
                /*
@@ -2610,8 +2609,7 @@ again:
                                         * task isn't in TASK_RUNNING state
                                         */
                                        if (nonblock) {
-                                               *err = -EAGAIN;
-                                               ret = 1;
+                                               ret = -EAGAIN;
                                                goto out_unlock;
                                        }
 
@@ -2640,8 +2638,7 @@ again:
                if (session_readonly) {
                        dout("get_cap_refs %p needed %s but mds%d readonly\n",
                             inode, ceph_cap_string(need), ci->i_auth_cap->mds);
-                       *err = -EROFS;
-                       ret = 1;
+                       ret = -EROFS;
                        goto out_unlock;
                }
 
@@ -2650,16 +2647,14 @@ again:
                        if (READ_ONCE(mdsc->fsc->mount_state) ==
                            CEPH_MOUNT_SHUTDOWN) {
                                dout("get_cap_refs %p forced umount\n", inode);
-                               *err = -EIO;
-                               ret = 1;
+                               ret = -EIO;
                                goto out_unlock;
                        }
                        mds_wanted = __ceph_caps_mds_wanted(ci, false);
                        if (need & ~(mds_wanted & need)) {
                                dout("get_cap_refs %p caps were dropped"
                                     " (session killed?)\n", inode);
-                               *err = -ESTALE;
-                               ret = 1;
+                               ret = -ESTALE;
                                goto out_unlock;
                        }
                        if (!(file_wanted & ~mds_wanted))
@@ -2710,7 +2705,7 @@ static void check_max_size(struct inode *inode, loff_t endoff)
 int ceph_try_get_caps(struct ceph_inode_info *ci, int need, int want,
                      bool nonblock, int *got)
 {
-       int ret, err = 0;
+       int ret;
 
        BUG_ON(need & ~CEPH_CAP_FILE_RD);
        BUG_ON(want & ~(CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO|CEPH_CAP_FILE_SHARED));
@@ -2718,15 +2713,8 @@ int ceph_try_get_caps(struct ceph_inode_info *ci, int need, int want,
        if (ret < 0)
                return ret;
 
-       ret = try_get_cap_refs(ci, need, want, 0, nonblock, got, &err);
-       if (ret) {
-               if (err == -EAGAIN) {
-                       ret = 0;
-               } else if (err < 0) {
-                       ret = err;
-               }
-       }
-       return ret;
+       ret = try_get_cap_refs(ci, need, want, 0, nonblock, got);
+       return ret == -EAGAIN ? 0 : ret;
 }
 
 /*
@@ -2737,7 +2725,7 @@ int ceph_try_get_caps(struct ceph_inode_info *ci, int need, int want,
 int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
                  loff_t endoff, int *got, struct page **pinned_page)
 {
-       int _got, ret, err = 0;
+       int _got, ret;
 
        ret = ceph_pool_perm_check(ci, need);
        if (ret < 0)
@@ -2747,21 +2735,19 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
                if (endoff > 0)
                        check_max_size(&ci->vfs_inode, endoff);
 
-               err = 0;
                _got = 0;
                ret = try_get_cap_refs(ci, need, want, endoff,
-                                      false, &_got, &err);
-               if (ret) {
-                       if (err == -EAGAIN)
-                               continue;
-                       if (err < 0)
-                               ret = err;
-               } else {
+                                      false, &_got);
+               if (ret == -EAGAIN) {
+                       continue;
+               } else if (!ret) {
+                       int err;
+
                        DEFINE_WAIT_FUNC(wait, woken_wake_function);
                        add_wait_queue(&ci->i_cap_wq, &wait);
 
-                       while (!try_get_cap_refs(ci, need, want, endoff,
-                                                true, &_got, &err)) {
+                       while (!(err = try_get_cap_refs(ci, need, want, endoff,
+                                                       true, &_got))) {
                                if (signal_pending(current)) {
                                        ret = -ERESTARTSYS;
                                        break;
@@ -2770,19 +2756,14 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want,
                        }
 
                        remove_wait_queue(&ci->i_cap_wq, &wait);
-
                        if (err == -EAGAIN)
                                continue;
-                       if (err < 0)
-                               ret = err;
                }
-               if (ret < 0) {
-                       if (err == -ESTALE) {
-                               /* session was killed, try renew caps */
-                               ret = ceph_renew_caps(&ci->vfs_inode);
-                               if (ret == 0)
-                                       continue;
-                       }
+               if (ret == -ESTALE) {
+                       /* session was killed, try renew caps */
+                       ret = ceph_renew_caps(&ci->vfs_inode);
+                       if (ret == 0)
+                               continue;
                        return ret;
                }
 
@@ -4099,7 +4080,7 @@ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode)
 }
 
 /*
- * For a soon-to-be unlinked file, drop the AUTH_RDCACHE caps. If it
+ * For a soon-to-be unlinked file, drop the LINK caps. If it
  * looks like the link count will hit 0, drop any other caps (other
  * than PIN) we don't specifically want (due to the file still being
  * open).
index 98365e7..b3fc5fe 100644 (file)
@@ -37,7 +37,7 @@ static int mdsmap_show(struct seq_file *s, void *p)
                struct ceph_entity_addr *addr = &mdsmap->m_info[i].addr;
                int state = mdsmap->m_info[i].state;
                seq_printf(s, "\tmds%d\t%s\t(%s)\n", i,
-                              ceph_pr_addr(&addr->in_addr),
+                              ceph_pr_addr(addr),
                               ceph_mds_state_name(state));
        }
        return 0;
@@ -88,7 +88,7 @@ static int mdsc_show(struct seq_file *s, void *p)
                                   req->r_dentry,
                                   path ? path : "");
                        spin_unlock(&req->r_dentry->d_lock);
-                       kfree(path);
+                       ceph_mdsc_free_path(path, pathlen);
                } else if (req->r_path1) {
                        seq_printf(s, " #%llx/%s", req->r_ino1.ino,
                                   req->r_path1);
@@ -108,7 +108,7 @@ static int mdsc_show(struct seq_file *s, void *p)
                                   req->r_old_dentry,
                                   path ? path : "");
                        spin_unlock(&req->r_old_dentry->d_lock);
-                       kfree(path);
+                       ceph_mdsc_free_path(path, pathlen);
                } else if (req->r_path2 && req->r_op != CEPH_MDS_OP_SYMLINK) {
                        if (req->r_ino2.ino)
                                seq_printf(s, " #%llx/%s", req->r_ino2.ino,
@@ -124,18 +124,48 @@ static int mdsc_show(struct seq_file *s, void *p)
        return 0;
 }
 
+static int caps_show_cb(struct inode *inode, struct ceph_cap *cap, void *p)
+{
+       struct seq_file *s = p;
+
+       seq_printf(s, "0x%-17lx%-17s%-17s\n", inode->i_ino,
+                  ceph_cap_string(cap->issued),
+                  ceph_cap_string(cap->implemented));
+       return 0;
+}
+
 static int caps_show(struct seq_file *s, void *p)
 {
        struct ceph_fs_client *fsc = s->private;
-       int total, avail, used, reserved, min;
+       struct ceph_mds_client *mdsc = fsc->mdsc;
+       int total, avail, used, reserved, min, i;
 
        ceph_reservation_status(fsc, &total, &avail, &used, &reserved, &min);
        seq_printf(s, "total\t\t%d\n"
                   "avail\t\t%d\n"
                   "used\t\t%d\n"
                   "reserved\t%d\n"
-                  "min\t%d\n",
+                  "min\t\t%d\n\n",
                   total, avail, used, reserved, min);
+       seq_printf(s, "ino                issued           implemented\n");
+       seq_printf(s, "-----------------------------------------------\n");
+
+       mutex_lock(&mdsc->mutex);
+       for (i = 0; i < mdsc->max_sessions; i++) {
+               struct ceph_mds_session *session;
+
+               session = __ceph_lookup_mds_session(mdsc, i);
+               if (!session)
+                       continue;
+               mutex_unlock(&mdsc->mutex);
+               mutex_lock(&session->s_mutex);
+               ceph_iterate_session_caps(session, caps_show_cb, s);
+               mutex_unlock(&session->s_mutex);
+               ceph_put_mds_session(session);
+               mutex_lock(&mdsc->mutex);
+       }
+       mutex_unlock(&mdsc->mutex);
+
        return 0;
 }
 
index 3c59ad1..d3ef7ee 100644 (file)
@@ -22,18 +22,77 @@ struct ceph_nfs_confh {
        u64 ino, parent_ino;
 } __attribute__ ((packed));
 
+/*
+ * fh for snapped inode
+ */
+struct ceph_nfs_snapfh {
+       u64 ino;
+       u64 snapid;
+       u64 parent_ino;
+       u32 hash;
+} __attribute__ ((packed));
+
+static int ceph_encode_snapfh(struct inode *inode, u32 *rawfh, int *max_len,
+                             struct inode *parent_inode)
+{
+       const static int snap_handle_length =
+               sizeof(struct ceph_nfs_snapfh) >> 2;
+       struct ceph_nfs_snapfh *sfh = (void *)rawfh;
+       u64 snapid = ceph_snap(inode);
+       int ret;
+       bool no_parent = true;
+
+       if (*max_len < snap_handle_length) {
+               *max_len = snap_handle_length;
+               ret = FILEID_INVALID;
+               goto out;
+       }
+
+       ret =  -EINVAL;
+       if (snapid != CEPH_SNAPDIR) {
+               struct inode *dir;
+               struct dentry *dentry = d_find_alias(inode);
+               if (!dentry)
+                       goto out;
+
+               rcu_read_lock();
+               dir = d_inode_rcu(dentry->d_parent);
+               if (ceph_snap(dir) != CEPH_SNAPDIR) {
+                       sfh->parent_ino = ceph_ino(dir);
+                       sfh->hash = ceph_dentry_hash(dir, dentry);
+                       no_parent = false;
+               }
+               rcu_read_unlock();
+               dput(dentry);
+       }
+
+       if (no_parent) {
+               if (!S_ISDIR(inode->i_mode))
+                       goto out;
+               sfh->parent_ino = sfh->ino;
+               sfh->hash = 0;
+       }
+       sfh->ino = ceph_ino(inode);
+       sfh->snapid = snapid;
+
+       *max_len = snap_handle_length;
+       ret = FILEID_BTRFS_WITH_PARENT;
+out:
+       dout("encode_snapfh %llx.%llx ret=%d\n", ceph_vinop(inode), ret);
+       return ret;
+}
+
 static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
                          struct inode *parent_inode)
 {
+       const static int handle_length =
+               sizeof(struct ceph_nfs_fh) >> 2;
+       const static int connected_handle_length =
+               sizeof(struct ceph_nfs_confh) >> 2;
        int type;
-       struct ceph_nfs_fh *fh = (void *)rawfh;
-       struct ceph_nfs_confh *cfh = (void *)rawfh;
-       int connected_handle_length = sizeof(*cfh)/4;
-       int handle_length = sizeof(*fh)/4;
 
-       /* don't re-export snaps */
        if (ceph_snap(inode) != CEPH_NOSNAP)
-               return -EINVAL;
+               return ceph_encode_snapfh(inode, rawfh, max_len, parent_inode);
 
        if (parent_inode && (*max_len < connected_handle_length)) {
                *max_len = connected_handle_length;
@@ -44,6 +103,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
        }
 
        if (parent_inode) {
+               struct ceph_nfs_confh *cfh = (void *)rawfh;
                dout("encode_fh %llx with parent %llx\n",
                     ceph_ino(inode), ceph_ino(parent_inode));
                cfh->ino = ceph_ino(inode);
@@ -51,6 +111,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
                *max_len = connected_handle_length;
                type = FILEID_INO32_GEN_PARENT;
        } else {
+               struct ceph_nfs_fh *fh = (void *)rawfh;
                dout("encode_fh %llx\n", ceph_ino(inode));
                fh->ino = ceph_ino(inode);
                *max_len = handle_length;
@@ -59,7 +120,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
        return type;
 }
 
-static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
+static struct inode *__lookup_inode(struct super_block *sb, u64 ino)
 {
        struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
        struct inode *inode;
@@ -81,7 +142,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
                mask = CEPH_STAT_CAP_INODE;
                if (ceph_security_xattr_wanted(d_inode(sb->s_root)))
                        mask |= CEPH_CAP_XATTR_SHARED;
-               req->r_args.getattr.mask = cpu_to_le32(mask);
+               req->r_args.lookupino.mask = cpu_to_le32(mask);
 
                req->r_ino1 = vino;
                req->r_num_caps = 1;
@@ -91,16 +152,114 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
                        ihold(inode);
                ceph_mdsc_put_request(req);
                if (!inode)
-                       return ERR_PTR(-ESTALE);
-               if (inode->i_nlink == 0) {
-                       iput(inode);
-                       return ERR_PTR(-ESTALE);
-               }
+                       return err < 0 ? ERR_PTR(err) : ERR_PTR(-ESTALE);
        }
+       return inode;
+}
+
+struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino)
+{
+       struct inode *inode = __lookup_inode(sb, ino);
+       if (IS_ERR(inode))
+               return inode;
+       if (inode->i_nlink == 0) {
+               iput(inode);
+               return ERR_PTR(-ESTALE);
+       }
+       return inode;
+}
 
+static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
+{
+       struct inode *inode = __lookup_inode(sb, ino);
+       if (IS_ERR(inode))
+               return ERR_CAST(inode);
+       if (inode->i_nlink == 0) {
+               iput(inode);
+               return ERR_PTR(-ESTALE);
+       }
        return d_obtain_alias(inode);
 }
 
+static struct dentry *__snapfh_to_dentry(struct super_block *sb,
+                                         struct ceph_nfs_snapfh *sfh,
+                                         bool want_parent)
+{
+       struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+       struct ceph_mds_request *req;
+       struct inode *inode;
+       struct ceph_vino vino;
+       int mask;
+       int err;
+       bool unlinked = false;
+
+       if (want_parent) {
+               vino.ino = sfh->parent_ino;
+               if (sfh->snapid == CEPH_SNAPDIR)
+                       vino.snap = CEPH_NOSNAP;
+               else if (sfh->ino == sfh->parent_ino)
+                       vino.snap = CEPH_SNAPDIR;
+               else
+                       vino.snap = sfh->snapid;
+       } else {
+               vino.ino = sfh->ino;
+               vino.snap = sfh->snapid;
+       }
+       inode = ceph_find_inode(sb, vino);
+       if (inode)
+               return d_obtain_alias(inode);
+
+       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPINO,
+                                      USE_ANY_MDS);
+       if (IS_ERR(req))
+               return ERR_CAST(req);
+
+       mask = CEPH_STAT_CAP_INODE;
+       if (ceph_security_xattr_wanted(d_inode(sb->s_root)))
+               mask |= CEPH_CAP_XATTR_SHARED;
+       req->r_args.lookupino.mask = cpu_to_le32(mask);
+       if (vino.snap < CEPH_NOSNAP) {
+               req->r_args.lookupino.snapid = cpu_to_le64(vino.snap);
+               if (!want_parent && sfh->ino != sfh->parent_ino) {
+                       req->r_args.lookupino.parent =
+                                       cpu_to_le64(sfh->parent_ino);
+                       req->r_args.lookupino.hash =
+                                       cpu_to_le32(sfh->hash);
+               }
+       }
+
+       req->r_ino1 = vino;
+       req->r_num_caps = 1;
+       err = ceph_mdsc_do_request(mdsc, NULL, req);
+       inode = req->r_target_inode;
+       if (inode) {
+               if (vino.snap == CEPH_SNAPDIR) {
+                       if (inode->i_nlink == 0)
+                               unlinked = true;
+                       inode = ceph_get_snapdir(inode);
+               } else if (ceph_snap(inode) == vino.snap) {
+                       ihold(inode);
+               } else {
+                       /* mds does not support lookup snapped inode */
+                       err = -EOPNOTSUPP;
+                       inode = NULL;
+               }
+       }
+       ceph_mdsc_put_request(req);
+
+       if (want_parent) {
+               dout("snapfh_to_parent %llx.%llx\n err=%d\n",
+                    vino.ino, vino.snap, err);
+       } else {
+               dout("snapfh_to_dentry %llx.%llx parent %llx hash %x err=%d",
+                     vino.ino, vino.snap, sfh->parent_ino, sfh->hash, err);
+       }
+       if (!inode)
+               return ERR_PTR(-ESTALE);
+       /* see comments in ceph_get_parent() */
+       return unlinked ? d_obtain_root(inode) : d_obtain_alias(inode);
+}
+
 /*
  * convert regular fh to dentry
  */
@@ -110,6 +269,11 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb,
 {
        struct ceph_nfs_fh *fh = (void *)fid->raw;
 
+       if (fh_type == FILEID_BTRFS_WITH_PARENT) {
+               struct ceph_nfs_snapfh *sfh = (void *)fid->raw;
+               return __snapfh_to_dentry(sb, sfh, false);
+       }
+
        if (fh_type != FILEID_INO32_GEN  &&
            fh_type != FILEID_INO32_GEN_PARENT)
                return NULL;
@@ -163,13 +327,49 @@ static struct dentry *__get_parent(struct super_block *sb,
 
 static struct dentry *ceph_get_parent(struct dentry *child)
 {
-       /* don't re-export snaps */
-       if (ceph_snap(d_inode(child)) != CEPH_NOSNAP)
-               return ERR_PTR(-EINVAL);
-
-       dout("get_parent %p ino %llx.%llx\n",
-            child, ceph_vinop(d_inode(child)));
-       return __get_parent(child->d_sb, child, 0);
+       struct inode *inode = d_inode(child);
+       struct dentry *dn;
+
+       if (ceph_snap(inode) != CEPH_NOSNAP) {
+               struct inode* dir;
+               bool unlinked = false;
+               /* do not support non-directory */
+               if (!d_is_dir(child)) {
+                       dn = ERR_PTR(-EINVAL);
+                       goto out;
+               }
+               dir = __lookup_inode(inode->i_sb, ceph_ino(inode));
+               if (IS_ERR(dir)) {
+                       dn = ERR_CAST(dir);
+                       goto out;
+               }
+               /* There can be multiple paths to access snapped inode.
+                * For simplicity, treat snapdir of head inode as parent */
+               if (ceph_snap(inode) != CEPH_SNAPDIR) {
+                       struct inode *snapdir = ceph_get_snapdir(dir);
+                       if (dir->i_nlink == 0)
+                               unlinked = true;
+                       iput(dir);
+                       if (IS_ERR(snapdir)) {
+                               dn = ERR_CAST(snapdir);
+                               goto out;
+                       }
+                       dir = snapdir;
+               }
+               /* If directory has already been deleted, futher get_parent
+                * will fail. Do not mark snapdir dentry as disconnected,
+                * this prevent exportfs from doing futher get_parent. */
+               if (unlinked)
+                       dn = d_obtain_root(dir);
+               else
+                       dn = d_obtain_alias(dir);
+       } else {
+               dn = __get_parent(child->d_sb, child, 0);
+       }
+out:
+       dout("get_parent %p ino %llx.%llx err=%ld\n",
+            child, ceph_vinop(inode), (IS_ERR(dn) ? PTR_ERR(dn) : 0));
+       return dn;
 }
 
 /*
@@ -182,6 +382,11 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
        struct ceph_nfs_confh *cfh = (void *)fid->raw;
        struct dentry *dentry;
 
+       if (fh_type == FILEID_BTRFS_WITH_PARENT) {
+               struct ceph_nfs_snapfh *sfh = (void *)fid->raw;
+               return __snapfh_to_dentry(sb, sfh, true);
+       }
+
        if (fh_type != FILEID_INO32_GEN_PARENT)
                return NULL;
        if (fh_len < sizeof(*cfh) / 4)
@@ -194,14 +399,115 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
        return dentry;
 }
 
+static int __get_snap_name(struct dentry *parent, char *name,
+                          struct dentry *child)
+{
+       struct inode *inode = d_inode(child);
+       struct inode *dir = d_inode(parent);
+       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_mds_request *req = NULL;
+       char *last_name = NULL;
+       unsigned next_offset = 2;
+       int err = -EINVAL;
+
+       if (ceph_ino(inode) != ceph_ino(dir))
+               goto out;
+       if (ceph_snap(inode) == CEPH_SNAPDIR) {
+               if (ceph_snap(dir) == CEPH_NOSNAP) {
+                       strcpy(name, fsc->mount_options->snapdir_name);
+                       err = 0;
+               }
+               goto out;
+       }
+       if (ceph_snap(dir) != CEPH_SNAPDIR)
+               goto out;
+
+       while (1) {
+               struct ceph_mds_reply_info_parsed *rinfo;
+               struct ceph_mds_reply_dir_entry *rde;
+               int i;
+
+               req = ceph_mdsc_create_request(fsc->mdsc, CEPH_MDS_OP_LSSNAP,
+                                              USE_AUTH_MDS);
+               if (IS_ERR(req)) {
+                       err = PTR_ERR(req);
+                       req = NULL;
+                       goto out;
+               }
+               err = ceph_alloc_readdir_reply_buffer(req, inode);
+               if (err)
+                       goto out;
+
+               req->r_direct_mode = USE_AUTH_MDS;
+               req->r_readdir_offset = next_offset;
+               req->r_args.readdir.flags =
+                               cpu_to_le16(CEPH_READDIR_REPLY_BITFLAGS);
+               if (last_name) {
+                       req->r_path2 = last_name;
+                       last_name = NULL;
+               }
+
+               req->r_inode = dir;
+               ihold(dir);
+               req->r_dentry = dget(parent);
+
+               inode_lock(dir);
+               err = ceph_mdsc_do_request(fsc->mdsc, NULL, req);
+               inode_unlock(dir);
+
+               if (err < 0)
+                       goto out;
+
+                rinfo = &req->r_reply_info;
+                for (i = 0; i < rinfo->dir_nr; i++) {
+                        rde = rinfo->dir_entries + i;
+                        BUG_ON(!rde->inode.in);
+                        if (ceph_snap(inode) ==
+                            le64_to_cpu(rde->inode.in->snapid)) {
+                                memcpy(name, rde->name, rde->name_len);
+                                name[rde->name_len] = '\0';
+                                err = 0;
+                                goto out;
+                        }
+                }
+
+                if (rinfo->dir_end)
+                        break;
+
+                BUG_ON(rinfo->dir_nr <= 0);
+                rde = rinfo->dir_entries + (rinfo->dir_nr - 1);
+                next_offset += rinfo->dir_nr;
+                last_name = kstrndup(rde->name, rde->name_len, GFP_KERNEL);
+                if (!last_name) {
+                        err = -ENOMEM;
+                        goto out;
+                }
+
+                ceph_mdsc_put_request(req);
+                req = NULL;
+       }
+       err = -ENOENT;
+out:
+       if (req)
+               ceph_mdsc_put_request(req);
+       kfree(last_name);
+       dout("get_snap_name %p ino %llx.%llx err=%d\n",
+            child, ceph_vinop(inode), err);
+       return err;
+}
+
 static int ceph_get_name(struct dentry *parent, char *name,
                         struct dentry *child)
 {
        struct ceph_mds_client *mdsc;
        struct ceph_mds_request *req;
+       struct inode *inode = d_inode(child);
        int err;
 
-       mdsc = ceph_inode_to_client(d_inode(child))->mdsc;
+       if (ceph_snap(inode) != CEPH_NOSNAP)
+               return __get_snap_name(parent, name, child);
+
+       mdsc = ceph_inode_to_client(inode)->mdsc;
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME,
                                       USE_ANY_MDS);
        if (IS_ERR(req))
@@ -209,8 +515,8 @@ static int ceph_get_name(struct dentry *parent, char *name,
 
        inode_lock(d_inode(parent));
 
-       req->r_inode = d_inode(child);
-       ihold(d_inode(child));
+       req->r_inode = inode;
+       ihold(inode);
        req->r_ino2 = ceph_vino(d_inode(parent));
        req->r_parent = d_inode(parent);
        set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
@@ -224,10 +530,10 @@ static int ceph_get_name(struct dentry *parent, char *name,
                memcpy(name, rinfo->dname, rinfo->dname_len);
                name[rinfo->dname_len] = 0;
                dout("get_name %p ino %llx.%llx name %s\n",
-                    child, ceph_vinop(d_inode(child)), name);
+                    child, ceph_vinop(inode), name);
        } else {
                dout("get_name %p ino %llx.%llx err %d\n",
-                    child, ceph_vinop(d_inode(child)), err);
+                    child, ceph_vinop(inode), err);
        }
 
        ceph_mdsc_put_request(req);
index 84725b5..305daf0 100644 (file)
@@ -929,7 +929,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 
        dout("sync_direct_%s on file %p %lld~%u snapc %p seq %lld\n",
             (write ? "write" : "read"), file, pos, (unsigned)count,
-            snapc, snapc->seq);
+            snapc, snapc ? snapc->seq : 0);
 
        ret = filemap_write_and_wait_range(inode->i_mapping,
                                           pos, pos + count - 1);
index 35dae6d..f85355b 100644 (file)
@@ -2266,43 +2266,72 @@ int ceph_permission(struct inode *inode, int mask)
        return err;
 }
 
+/* Craft a mask of needed caps given a set of requested statx attrs. */
+static int statx_to_caps(u32 want)
+{
+       int mask = 0;
+
+       if (want & (STATX_MODE|STATX_UID|STATX_GID|STATX_CTIME))
+               mask |= CEPH_CAP_AUTH_SHARED;
+
+       if (want & (STATX_NLINK|STATX_CTIME))
+               mask |= CEPH_CAP_LINK_SHARED;
+
+       if (want & (STATX_ATIME|STATX_MTIME|STATX_CTIME|STATX_SIZE|
+                   STATX_BLOCKS))
+               mask |= CEPH_CAP_FILE_SHARED;
+
+       if (want & (STATX_CTIME))
+               mask |= CEPH_CAP_XATTR_SHARED;
+
+       return mask;
+}
+
 /*
- * Get all attributes.  Hopefully somedata we'll have a statlite()
- * and can limit the fields we require to be accurate.
+ * Get all the attributes. If we have sufficient caps for the requested attrs,
+ * then we can avoid talking to the MDS at all.
  */
 int ceph_getattr(const struct path *path, struct kstat *stat,
                 u32 request_mask, unsigned int flags)
 {
        struct inode *inode = d_inode(path->dentry);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       int err;
+       int err = 0;
 
-       err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false);
-       if (!err) {
-               generic_fillattr(inode, stat);
-               stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
-               if (ceph_snap(inode) == CEPH_NOSNAP)
-                       stat->dev = inode->i_sb->s_dev;
+       /* Skip the getattr altogether if we're asked not to sync */
+       if (!(flags & AT_STATX_DONT_SYNC)) {
+               err = ceph_do_getattr(inode, statx_to_caps(request_mask),
+                                     flags & AT_STATX_FORCE_SYNC);
+               if (err)
+                       return err;
+       }
+
+       generic_fillattr(inode, stat);
+       stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
+       if (ceph_snap(inode) == CEPH_NOSNAP)
+               stat->dev = inode->i_sb->s_dev;
+       else
+               stat->dev = ci->i_snapid_map ? ci->i_snapid_map->dev : 0;
+
+       if (S_ISDIR(inode->i_mode)) {
+               if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
+                                       RBYTES))
+                       stat->size = ci->i_rbytes;
                else
-                       stat->dev = ci->i_snapid_map ? ci->i_snapid_map->dev : 0;
-
-               if (S_ISDIR(inode->i_mode)) {
-                       if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
-                                               RBYTES))
-                               stat->size = ci->i_rbytes;
-                       else
-                               stat->size = ci->i_files + ci->i_subdirs;
-                       stat->blocks = 0;
-                       stat->blksize = 65536;
-                       /*
-                        * Some applications rely on the number of st_nlink
-                        * value on directories to be either 0 (if unlinked)
-                        * or 2 + number of subdirectories.
-                        */
-                       if (stat->nlink == 1)
-                               /* '.' + '..' + subdirs */
-                               stat->nlink = 1 + 1 + ci->i_subdirs;
-               }
+                       stat->size = ci->i_files + ci->i_subdirs;
+               stat->blocks = 0;
+               stat->blksize = 65536;
+               /*
+                * Some applications rely on the number of st_nlink
+                * value on directories to be either 0 (if unlinked)
+                * or 2 + number of subdirectories.
+                */
+               if (stat->nlink == 1)
+                       /* '.' + '..' + subdirs */
+                       stat->nlink = 1 + 1 + ci->i_subdirs;
        }
+
+       /* Mask off any higher bits (e.g. btime) until we have support */
+       stat->result_mask = request_mask & STATX_BASIC_STATS;
        return err;
 }
index 9dae2ec..ac9b53b 100644 (file)
@@ -237,15 +237,6 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
        spin_lock(&ci->i_ceph_lock);
        if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) {
                err = -EIO;
-       } else if (op == CEPH_MDS_OP_SETFILELOCK) {
-               /*
-                * increasing i_filelock_ref closes race window between
-                * handling request reply and adding file_lock struct to
-                * inode. Otherwise, i_auth_cap may get trimmed in the
-                * window. Caller function will decrease the counter.
-                */
-               fl->fl_ops = &ceph_fl_lock_ops;
-               atomic_inc(&ci->i_filelock_ref);
        }
        spin_unlock(&ci->i_ceph_lock);
        if (err < 0) {
@@ -299,10 +290,6 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
        spin_lock(&ci->i_ceph_lock);
        if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) {
                err = -EIO;
-       } else {
-               /* see comment in ceph_lock */
-               fl->fl_ops = &ceph_fl_lock_ops;
-               atomic_inc(&ci->i_filelock_ref);
        }
        spin_unlock(&ci->i_ceph_lock);
        if (err < 0) {
index 9049c2a..959b1bf 100644 (file)
@@ -550,15 +550,9 @@ void ceph_put_mds_session(struct ceph_mds_session *s)
 struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc,
                                                   int mds)
 {
-       struct ceph_mds_session *session;
-
        if (mds >= mdsc->max_sessions || !mdsc->sessions[mds])
                return NULL;
-       session = mdsc->sessions[mds];
-       dout("lookup_mds_session %p %d\n", session,
-            refcount_read(&session->s_ref));
-       get_session(session);
-       return session;
+       return get_session(mdsc->sessions[mds]);
 }
 
 static bool __have_session(struct ceph_mds_client *mdsc, int mds)
@@ -1284,9 +1278,9 @@ static void cleanup_session_requests(struct ceph_mds_client *mdsc,
  *
  * Caller must hold session s_mutex.
  */
-static int iterate_session_caps(struct ceph_mds_session *session,
-                                int (*cb)(struct inode *, struct ceph_cap *,
-                                           void *), void *arg)
+int ceph_iterate_session_caps(struct ceph_mds_session *session,
+                             int (*cb)(struct inode *, struct ceph_cap *,
+                                       void *), void *arg)
 {
        struct list_head *p;
        struct ceph_cap *cap;
@@ -1451,7 +1445,7 @@ static void remove_session_caps(struct ceph_mds_session *session)
        LIST_HEAD(dispose);
 
        dout("remove_session_caps on %p\n", session);
-       iterate_session_caps(session, remove_session_caps_cb, fsc);
+       ceph_iterate_session_caps(session, remove_session_caps_cb, fsc);
 
        wake_up_all(&fsc->mdsc->cap_flushing_wq);
 
@@ -1534,8 +1528,8 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
 static void wake_up_session_caps(struct ceph_mds_session *session, int ev)
 {
        dout("wake_up_session_caps %p mds%d\n", session, session->s_mds);
-       iterate_session_caps(session, wake_up_session_cb,
-                            (void *)(unsigned long)ev);
+       ceph_iterate_session_caps(session, wake_up_session_cb,
+                                 (void *)(unsigned long)ev);
 }
 
 /*
@@ -1768,7 +1762,7 @@ int ceph_trim_caps(struct ceph_mds_client *mdsc,
             session->s_mds, session->s_nr_caps, max_caps, trim_caps);
        if (trim_caps > 0) {
                session->s_trim_caps = trim_caps;
-               iterate_session_caps(session, trim_caps_cb, session);
+               ceph_iterate_session_caps(session, trim_caps_cb, session);
                dout("trim_caps mds%d done: %d / %d, trimmed %d\n",
                     session->s_mds, session->s_nr_caps, max_caps,
                        trim_caps - session->s_trim_caps);
@@ -1861,7 +1855,8 @@ again:
                num_cap_releases--;
 
                head = msg->front.iov_base;
-               le32_add_cpu(&head->num, 1);
+               put_unaligned_le32(get_unaligned_le32(&head->num) + 1,
+                                  &head->num);
                item = msg->front.iov_base + msg->front.iov_len;
                item->ino = cpu_to_le64(cap->cap_ino);
                item->cap_id = cpu_to_le64(cap->cap_id);
@@ -2089,43 +2084,29 @@ static inline  u64 __get_oldest_tid(struct ceph_mds_client *mdsc)
  * Encode hidden .snap dirs as a double /, i.e.
  *   foo/.snap/bar -> foo//bar
  */
-char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
+char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase,
                           int stop_on_nosnap)
 {
        struct dentry *temp;
        char *path;
-       int len, pos;
+       int pos;
        unsigned seq;
+       u64 base;
 
        if (!dentry)
                return ERR_PTR(-EINVAL);
 
-retry:
-       len = 0;
-       seq = read_seqbegin(&rename_lock);
-       rcu_read_lock();
-       for (temp = dentry; !IS_ROOT(temp);) {
-               struct inode *inode = d_inode(temp);
-               if (inode && ceph_snap(inode) == CEPH_SNAPDIR)
-                       len++;  /* slash only */
-               else if (stop_on_nosnap && inode &&
-                        ceph_snap(inode) == CEPH_NOSNAP)
-                       break;
-               else
-                       len += 1 + temp->d_name.len;
-               temp = temp->d_parent;
-       }
-       rcu_read_unlock();
-       if (len)
-               len--;  /* no leading '/' */
-
-       path = kmalloc(len+1, GFP_NOFS);
+       path = __getname();
        if (!path)
                return ERR_PTR(-ENOMEM);
-       pos = len;
-       path[pos] = 0;  /* trailing null */
+retry:
+       pos = PATH_MAX - 1;
+       path[pos] = '\0';
+
+       seq = read_seqbegin(&rename_lock);
        rcu_read_lock();
-       for (temp = dentry; !IS_ROOT(temp) && pos != 0; ) {
+       temp = dentry;
+       for (;;) {
                struct inode *inode;
 
                spin_lock(&temp->d_lock);
@@ -2143,83 +2124,54 @@ retry:
                                spin_unlock(&temp->d_lock);
                                break;
                        }
-                       strncpy(path + pos, temp->d_name.name,
-                               temp->d_name.len);
+                       memcpy(path + pos, temp->d_name.name, temp->d_name.len);
                }
                spin_unlock(&temp->d_lock);
-               if (pos)
-                       path[--pos] = '/';
                temp = temp->d_parent;
+
+               /* Are we at the root? */
+               if (IS_ROOT(temp))
+                       break;
+
+               /* Are we out of buffer? */
+               if (--pos < 0)
+                       break;
+
+               path[pos] = '/';
        }
+       base = ceph_ino(d_inode(temp));
        rcu_read_unlock();
-       if (pos != 0 || read_seqretry(&rename_lock, seq)) {
+       if (pos < 0 || read_seqretry(&rename_lock, seq)) {
                pr_err("build_path did not end path lookup where "
-                      "expected, namelen is %d, pos is %d\n", len, pos);
+                      "expected, pos is %d\n", pos);
                /* presumably this is only possible if racing with a
                   rename of one of the parent directories (we can not
                   lock the dentries above us to prevent this, but
                   retrying should be harmless) */
-               kfree(path);
                goto retry;
        }
 
-       *base = ceph_ino(d_inode(temp));
-       *plen = len;
+       *pbase = base;
+       *plen = PATH_MAX - 1 - pos;
        dout("build_path on %p %d built %llx '%.*s'\n",
-            dentry, d_count(dentry), *base, len, path);
-       return path;
-}
-
-/* Duplicate the dentry->d_name.name safely */
-static int clone_dentry_name(struct dentry *dentry, const char **ppath,
-                            int *ppathlen)
-{
-       u32 len;
-       char *name;
-
-retry:
-       len = READ_ONCE(dentry->d_name.len);
-       name = kmalloc(len + 1, GFP_NOFS);
-       if (!name)
-               return -ENOMEM;
-
-       spin_lock(&dentry->d_lock);
-       if (dentry->d_name.len != len) {
-               spin_unlock(&dentry->d_lock);
-               kfree(name);
-               goto retry;
-       }
-       memcpy(name, dentry->d_name.name, len);
-       spin_unlock(&dentry->d_lock);
-
-       name[len] = '\0';
-       *ppath = name;
-       *ppathlen = len;
-       return 0;
+            dentry, d_count(dentry), base, *plen, path + pos);
+       return path + pos;
 }
 
 static int build_dentry_path(struct dentry *dentry, struct inode *dir,
                             const char **ppath, int *ppathlen, u64 *pino,
                             bool *pfreepath, bool parent_locked)
 {
-       int ret;
        char *path;
 
        rcu_read_lock();
        if (!dir)
                dir = d_inode_rcu(dentry->d_parent);
-       if (dir && ceph_snap(dir) == CEPH_NOSNAP) {
+       if (dir && parent_locked && ceph_snap(dir) == CEPH_NOSNAP) {
                *pino = ceph_ino(dir);
                rcu_read_unlock();
-               if (parent_locked) {
-                       *ppath = dentry->d_name.name;
-                       *ppathlen = dentry->d_name.len;
-               } else {
-                       ret = clone_dentry_name(dentry, ppath, ppathlen);
-                       if (ret)
-                               return ret;
-                       *pfreepath = true;
-               }
+               *ppath = dentry->d_name.name;
+               *ppathlen = dentry->d_name.len;
                return 0;
        }
        rcu_read_unlock();
@@ -2331,9 +2283,9 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
                (!!req->r_inode_drop + !!req->r_dentry_drop +
                 !!req->r_old_inode_drop + !!req->r_old_dentry_drop);
        if (req->r_dentry_drop)
-               len += req->r_dentry->d_name.len;
+               len += pathlen1;
        if (req->r_old_dentry_drop)
-               len += req->r_old_dentry->d_name.len;
+               len += pathlen2;
 
        msg = ceph_msg_new2(CEPH_MSG_CLIENT_REQUEST, len, 1, GFP_NOFS, false);
        if (!msg) {
@@ -2410,10 +2362,10 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
 
 out_free2:
        if (freepath2)
-               kfree((char *)path2);
+               ceph_mdsc_free_path((char *)path2, pathlen2);
 out_free1:
        if (freepath1)
-               kfree((char *)path1);
+               ceph_mdsc_free_path((char *)path1, pathlen1);
 out:
        return msg;
 }
@@ -2427,8 +2379,7 @@ static void complete_request(struct ceph_mds_client *mdsc,
 {
        if (req->r_callback)
                req->r_callback(mdsc, req);
-       else
-               complete_all(&req->r_completion);
+       complete_all(&req->r_completion);
 }
 
 /*
@@ -2670,28 +2621,11 @@ static void kick_requests(struct ceph_mds_client *mdsc, int mds)
        }
 }
 
-void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
+int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir,
                              struct ceph_mds_request *req)
 {
-       dout("submit_request on %p\n", req);
-       mutex_lock(&mdsc->mutex);
-       __register_request(mdsc, req, NULL);
-       __do_request(mdsc, req);
-       mutex_unlock(&mdsc->mutex);
-}
-
-/*
- * Synchrously perform an mds request.  Take care of all of the
- * session setup, forwarding, retry details.
- */
-int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
-                        struct inode *dir,
-                        struct ceph_mds_request *req)
-{
        int err;
 
-       dout("do_request on %p\n", req);
-
        /* take CAP_PIN refs for r_inode, r_parent, r_old_dentry */
        if (req->r_inode)
                ceph_get_cap_refs(ceph_inode(req->r_inode), CEPH_CAP_PIN);
@@ -2701,18 +2635,21 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
                ceph_get_cap_refs(ceph_inode(req->r_old_dentry_dir),
                                  CEPH_CAP_PIN);
 
-       /* issue */
+       dout("submit_request on %p for inode %p\n", req, dir);
        mutex_lock(&mdsc->mutex);
        __register_request(mdsc, req, dir);
        __do_request(mdsc, req);
+       err = req->r_err;
+       mutex_unlock(&mdsc->mutex);
+       return err;
+}
 
-       if (req->r_err) {
-               err = req->r_err;
-               goto out;
-       }
+static int ceph_mdsc_wait_request(struct ceph_mds_client *mdsc,
+                                 struct ceph_mds_request *req)
+{
+       int err;
 
        /* wait */
-       mutex_unlock(&mdsc->mutex);
        dout("do_request waiting\n");
        if (!req->r_timeout && req->r_wait_for_completion) {
                err = req->r_wait_for_completion(mdsc, req);
@@ -2753,8 +2690,26 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
                err = req->r_err;
        }
 
-out:
        mutex_unlock(&mdsc->mutex);
+       return err;
+}
+
+/*
+ * Synchrously perform an mds request.  Take care of all of the
+ * session setup, forwarding, retry details.
+ */
+int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
+                        struct inode *dir,
+                        struct ceph_mds_request *req)
+{
+       int err;
+
+       dout("do_request on %p\n", req);
+
+       /* issue */
+       err = ceph_mdsc_submit_request(mdsc, dir, req);
+       if (!err)
+               err = ceph_mdsc_wait_request(mdsc, req);
        dout("do_request %p done, result %d\n", req, err);
        return err;
 }
@@ -3485,7 +3440,7 @@ out_freeflocks:
                ceph_pagelist_encode_string(pagelist, path, pathlen);
                ceph_pagelist_append(pagelist, &rec, sizeof(rec.v1));
 out_freepath:
-               kfree(path);
+               ceph_mdsc_free_path(path, pathlen);
        }
 
 out_err:
@@ -3642,7 +3597,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
                recon_state.msg_version = 2;
        }
        /* trsaverse this session's caps */
-       err = iterate_session_caps(session, encode_caps_cb, &recon_state);
+       err = ceph_iterate_session_caps(session, encode_caps_cb, &recon_state);
 
        spin_lock(&session->s_cap_lock);
        session->s_cap_reconnect = 0;
@@ -4125,6 +4080,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
        mdsc->max_sessions = 0;
        mdsc->stopping = 0;
        atomic64_set(&mdsc->quotarealms_count, 0);
+       mdsc->quotarealms_inodes = RB_ROOT;
+       mutex_init(&mdsc->quotarealms_inodes_mutex);
        mdsc->last_snap_seq = 0;
        init_rwsem(&mdsc->snap_rwsem);
        mdsc->snap_realms = RB_ROOT;
@@ -4216,6 +4173,8 @@ void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc)
         * their inode/dcache refs
         */
        ceph_msgr_flush();
+
+       ceph_cleanup_quotarealms_inodes(mdsc);
 }
 
 /*
index 50385a4..a83f28b 100644 (file)
@@ -326,6 +326,18 @@ struct ceph_snapid_map {
 };
 
 /*
+ * node for list of quotarealm inodes that are not visible from the filesystem
+ * mountpoint, but required to handle, e.g. quotas.
+ */
+struct ceph_quotarealm_inode {
+       struct rb_node node;
+       u64 ino;
+       unsigned long timeout; /* last time a lookup failed for this inode */
+       struct mutex mutex;
+       struct inode *inode;
+};
+
+/*
  * mds client state
  */
 struct ceph_mds_client {
@@ -344,6 +356,12 @@ struct ceph_mds_client {
        int                     stopping;      /* true if shutting down */
 
        atomic64_t              quotarealms_count; /* # realms with quota */
+       /*
+        * We keep a list of inodes we don't see in the mountpoint but that we
+        * need to track quota realms.
+        */
+       struct rb_root          quotarealms_inodes;
+       struct mutex            quotarealms_inodes_mutex;
 
        /*
         * snap_rwsem will cover cap linkage into snaprealms, and
@@ -447,8 +465,9 @@ extern int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
                                           struct inode *dir);
 extern struct ceph_mds_request *
 ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
-extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
-                                    struct ceph_mds_request *req);
+extern int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,
+                                   struct inode *dir,
+                                   struct ceph_mds_request *req);
 extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
                                struct inode *dir,
                                struct ceph_mds_request *req);
@@ -468,8 +487,18 @@ extern void ceph_flush_cap_releases(struct ceph_mds_client *mdsc,
                                    struct ceph_mds_session *session);
 extern void ceph_queue_cap_reclaim_work(struct ceph_mds_client *mdsc);
 extern void ceph_reclaim_caps_nr(struct ceph_mds_client *mdsc, int nr);
+extern int ceph_iterate_session_caps(struct ceph_mds_session *session,
+                                    int (*cb)(struct inode *,
+                                              struct ceph_cap *, void *),
+                                    void *arg);
 extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
 
+static inline void ceph_mdsc_free_path(char *path, int len)
+{
+       if (path)
+               __putname(path - (PATH_MAX - 1 - len));
+}
+
 extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
                                  int stop_on_nosnap);
 
index 1a2c5d3..701b4fb 100644 (file)
@@ -205,7 +205,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
 
                dout("mdsmap_decode %d/%d %lld mds%d.%d %s %s\n",
                     i+1, n, global_id, mds, inc,
-                    ceph_pr_addr(&addr.in_addr),
+                    ceph_pr_addr(&addr),
                     ceph_mds_state_name(state));
 
                if (mds < 0 || state <= 0)
index 9455d3a..c452221 100644 (file)
@@ -22,7 +22,16 @@ void ceph_adjust_quota_realms_count(struct inode *inode, bool inc)
 static inline bool ceph_has_realms_with_quotas(struct inode *inode)
 {
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
-       return atomic64_read(&mdsc->quotarealms_count) > 0;
+       struct super_block *sb = mdsc->fsc->sb;
+
+       if (atomic64_read(&mdsc->quotarealms_count) > 0)
+               return true;
+       /* if root is the real CephFS root, we don't have quota realms */
+       if (sb->s_root->d_inode &&
+           (sb->s_root->d_inode->i_ino == CEPH_INO_ROOT))
+               return false;
+       /* otherwise, we can't know for sure */
+       return true;
 }
 
 void ceph_handle_quota(struct ceph_mds_client *mdsc,
@@ -68,6 +77,108 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
        iput(inode);
 }
 
+static struct ceph_quotarealm_inode *
+find_quotarealm_inode(struct ceph_mds_client *mdsc, u64 ino)
+{
+       struct ceph_quotarealm_inode *qri = NULL;
+       struct rb_node **node, *parent = NULL;
+
+       mutex_lock(&mdsc->quotarealms_inodes_mutex);
+       node = &(mdsc->quotarealms_inodes.rb_node);
+       while (*node) {
+               parent = *node;
+               qri = container_of(*node, struct ceph_quotarealm_inode, node);
+
+               if (ino < qri->ino)
+                       node = &((*node)->rb_left);
+               else if (ino > qri->ino)
+                       node = &((*node)->rb_right);
+               else
+                       break;
+       }
+       if (!qri || (qri->ino != ino)) {
+               /* Not found, create a new one and insert it */
+               qri = kmalloc(sizeof(*qri), GFP_KERNEL);
+               if (qri) {
+                       qri->ino = ino;
+                       qri->inode = NULL;
+                       qri->timeout = 0;
+                       mutex_init(&qri->mutex);
+                       rb_link_node(&qri->node, parent, node);
+                       rb_insert_color(&qri->node, &mdsc->quotarealms_inodes);
+               } else
+                       pr_warn("Failed to alloc quotarealms_inode\n");
+       }
+       mutex_unlock(&mdsc->quotarealms_inodes_mutex);
+
+       return qri;
+}
+
+/*
+ * This function will try to lookup a realm inode which isn't visible in the
+ * filesystem mountpoint.  A list of these kind of inodes (not visible) is
+ * maintained in the mdsc and freed only when the filesystem is umounted.
+ *
+ * Note that these inodes are kept in this list even if the lookup fails, which
+ * allows to prevent useless lookup requests.
+ */
+static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc,
+                                            struct super_block *sb,
+                                            struct ceph_snap_realm *realm)
+{
+       struct ceph_quotarealm_inode *qri;
+       struct inode *in;
+
+       qri = find_quotarealm_inode(mdsc, realm->ino);
+       if (!qri)
+               return NULL;
+
+       mutex_lock(&qri->mutex);
+       if (qri->inode) {
+               /* A request has already returned the inode */
+               mutex_unlock(&qri->mutex);
+               return qri->inode;
+       }
+       /* Check if this inode lookup has failed recently */
+       if (qri->timeout &&
+           time_before_eq(jiffies, qri->timeout)) {
+               mutex_unlock(&qri->mutex);
+               return NULL;
+       }
+       in = ceph_lookup_inode(sb, realm->ino);
+       if (IS_ERR(in)) {
+               pr_warn("Can't lookup inode %llx (err: %ld)\n",
+                       realm->ino, PTR_ERR(in));
+               qri->timeout = jiffies + msecs_to_jiffies(60 * 1000); /* XXX */
+       } else {
+               qri->timeout = 0;
+               qri->inode = in;
+       }
+       mutex_unlock(&qri->mutex);
+
+       return in;
+}
+
+void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc)
+{
+       struct ceph_quotarealm_inode *qri;
+       struct rb_node *node;
+
+       /*
+        * It should now be safe to clean quotarealms_inode tree without holding
+        * mdsc->quotarealms_inodes_mutex...
+        */
+       mutex_lock(&mdsc->quotarealms_inodes_mutex);
+       while (!RB_EMPTY_ROOT(&mdsc->quotarealms_inodes)) {
+               node = rb_first(&mdsc->quotarealms_inodes);
+               qri = rb_entry(node, struct ceph_quotarealm_inode, node);
+               rb_erase(node, &mdsc->quotarealms_inodes);
+               iput(qri->inode);
+               kfree(qri);
+       }
+       mutex_unlock(&mdsc->quotarealms_inodes_mutex);
+}
+
 /*
  * This function walks through the snaprealm for an inode and returns the
  * ceph_snap_realm for the first snaprealm that has quotas set (either max_files
@@ -76,9 +187,15 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc,
  *
  * Note that the caller is responsible for calling ceph_put_snap_realm() on the
  * returned realm.
+ *
+ * Callers of this function need to hold mdsc->snap_rwsem.  However, if there's
+ * a need to do an inode lookup, this rwsem will be temporarily dropped.  Hence
+ * the 'retry' argument: if rwsem needs to be dropped and 'retry' is 'false'
+ * this function will return -EAGAIN; otherwise, the snaprealms walk-through
+ * will be restarted.
  */
 static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
-                                              struct inode *inode)
+                                              struct inode *inode, bool retry)
 {
        struct ceph_inode_info *ci = NULL;
        struct ceph_snap_realm *realm, *next;
@@ -88,6 +205,7 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
        if (ceph_snap(inode) != CEPH_NOSNAP)
                return NULL;
 
+restart:
        realm = ceph_inode(inode)->i_snap_realm;
        if (realm)
                ceph_get_snap_realm(mdsc, realm);
@@ -95,11 +213,25 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
                pr_err_ratelimited("get_quota_realm: ino (%llx.%llx) "
                                   "null i_snap_realm\n", ceph_vinop(inode));
        while (realm) {
+               bool has_inode;
+
                spin_lock(&realm->inodes_with_caps_lock);
-               in = realm->inode ? igrab(realm->inode) : NULL;
+               has_inode = realm->inode;
+               in = has_inode ? igrab(realm->inode) : NULL;
                spin_unlock(&realm->inodes_with_caps_lock);
-               if (!in)
+               if (has_inode && !in)
                        break;
+               if (!in) {
+                       up_read(&mdsc->snap_rwsem);
+                       in = lookup_quotarealm_inode(mdsc, inode->i_sb, realm);
+                       down_read(&mdsc->snap_rwsem);
+                       if (IS_ERR_OR_NULL(in))
+                               break;
+                       ceph_put_snap_realm(mdsc, realm);
+                       if (!retry)
+                               return ERR_PTR(-EAGAIN);
+                       goto restart;
+               }
 
                ci = ceph_inode(in);
                has_quota = __ceph_has_any_quota(ci);
@@ -125,9 +257,22 @@ bool ceph_quota_is_same_realm(struct inode *old, struct inode *new)
        struct ceph_snap_realm *old_realm, *new_realm;
        bool is_same;
 
+restart:
+       /*
+        * We need to lookup 2 quota realms atomically, i.e. with snap_rwsem.
+        * However, get_quota_realm may drop it temporarily.  By setting the
+        * 'retry' parameter to 'false', we'll get -EAGAIN if the rwsem was
+        * dropped and we can then restart the whole operation.
+        */
        down_read(&mdsc->snap_rwsem);
-       old_realm = get_quota_realm(mdsc, old);
-       new_realm = get_quota_realm(mdsc, new);
+       old_realm = get_quota_realm(mdsc, old, true);
+       new_realm = get_quota_realm(mdsc, new, false);
+       if (PTR_ERR(new_realm) == -EAGAIN) {
+               up_read(&mdsc->snap_rwsem);
+               if (old_realm)
+                       ceph_put_snap_realm(mdsc, old_realm);
+               goto restart;
+       }
        is_same = (old_realm == new_realm);
        up_read(&mdsc->snap_rwsem);
 
@@ -166,6 +311,7 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
                return false;
 
        down_read(&mdsc->snap_rwsem);
+restart:
        realm = ceph_inode(inode)->i_snap_realm;
        if (realm)
                ceph_get_snap_realm(mdsc, realm);
@@ -173,12 +319,23 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
                pr_err_ratelimited("check_quota_exceeded: ino (%llx.%llx) "
                                   "null i_snap_realm\n", ceph_vinop(inode));
        while (realm) {
+               bool has_inode;
+
                spin_lock(&realm->inodes_with_caps_lock);
-               in = realm->inode ? igrab(realm->inode) : NULL;
+               has_inode = realm->inode;
+               in = has_inode ? igrab(realm->inode) : NULL;
                spin_unlock(&realm->inodes_with_caps_lock);
-               if (!in)
+               if (has_inode && !in)
                        break;
-
+               if (!in) {
+                       up_read(&mdsc->snap_rwsem);
+                       in = lookup_quotarealm_inode(mdsc, inode->i_sb, realm);
+                       down_read(&mdsc->snap_rwsem);
+                       if (IS_ERR_OR_NULL(in))
+                               break;
+                       ceph_put_snap_realm(mdsc, realm);
+                       goto restart;
+               }
                ci = ceph_inode(in);
                spin_lock(&ci->i_ceph_lock);
                if (op == QUOTA_CHECK_MAX_FILES_OP) {
@@ -314,7 +471,7 @@ bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, struct kstatfs *buf)
        bool is_updated = false;
 
        down_read(&mdsc->snap_rwsem);
-       realm = get_quota_realm(mdsc, d_inode(fsc->sb->s_root));
+       realm = get_quota_realm(mdsc, d_inode(fsc->sb->s_root), true);
        up_read(&mdsc->snap_rwsem);
        if (!realm)
                return false;
index 285edda..01be7c1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/ceph/ceph_debug.h>
 
@@ -845,6 +846,12 @@ static void ceph_umount_begin(struct super_block *sb)
        return;
 }
 
+static int ceph_remount(struct super_block *sb, int *flags, char *data)
+{
+       sync_filesystem(sb);
+       return 0;
+}
+
 static const struct super_operations ceph_super_ops = {
        .alloc_inode    = ceph_alloc_inode,
        .destroy_inode  = ceph_destroy_inode,
@@ -853,6 +860,7 @@ static const struct super_operations ceph_super_ops = {
        .drop_inode     = ceph_drop_inode,
        .sync_fs        = ceph_sync_fs,
        .put_super      = ceph_put_super,
+       .remount_fs     = ceph_remount,
        .show_options   = ceph_show_options,
        .statfs         = ceph_statfs,
        .umount_begin   = ceph_umount_begin,
index c5b4a05..6edab9a 100644 (file)
@@ -1083,6 +1083,7 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 
 /* export.c */
 extern const struct export_operations ceph_export_ops;
+struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino);
 
 /* locks.c */
 extern __init void ceph_flock_init(void);
@@ -1133,5 +1134,6 @@ extern bool ceph_quota_is_max_bytes_approaching(struct inode *inode,
                                                loff_t newlen);
 extern bool ceph_quota_update_statfs(struct ceph_fs_client *fsc,
                                     struct kstatfs *buf);
+extern void ceph_cleanup_quotarealms_inodes(struct ceph_mds_client *mdsc);
 
 #endif /* _FS_CEPH_SUPER_H */
index 76724ef..aae2b8b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CIFS
        tristate "SMB3 and CIFS support (advanced network filesystem)"
        depends on INET
index 6a69f11..45e74da 100644 (file)
@@ -380,6 +380,8 @@ skip_rdma:
                                atomic_read(&server->in_send),
                                atomic_read(&server->num_waiters));
 #endif
+                       /* dump session id helpful for use with network trace */
+                       seq_printf(m, " SessionId: 0x%llx", ses->Suid);
                        if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
                                seq_puts(m, " encrypted");
                        if (ses->sign)
index b1a5fcf..f5fcd63 100644 (file)
@@ -878,6 +878,9 @@ out:
 
 static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
 {
+       struct cifsFileInfo *cfile = file->private_data;
+       struct cifs_tcon *tcon;
+
        /*
         * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
         * the cached file length
@@ -909,6 +912,12 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
                if (rc < 0)
                        return (loff_t)rc;
        }
+       if (cfile && cfile->tlink) {
+               tcon = tlink_tcon(cfile->tlink);
+               if (tcon->ses->server->ops->llseek)
+                       return tcon->ses->server->ops->llseek(file, tcon,
+                                                             offset, whence);
+       }
        return generic_file_llseek(file, offset, whence);
 }
 
@@ -1070,11 +1079,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
 
        cifs_dbg(FYI, "copychunk range\n");
 
-       if (src_inode == target_inode) {
-               rc = -EINVAL;
-               goto out;
-       }
-
        if (!src_file->private_data || !dst_file->private_data) {
                rc = -EBADF;
                cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");
index 33c251b..334ff5f 100644 (file)
@@ -497,6 +497,8 @@ struct smb_version_operations {
        /* version specific fiemap implementation */
        int (*fiemap)(struct cifs_tcon *tcon, struct cifsFileInfo *,
                      struct fiemap_extent_info *, u64, u64);
+       /* version specific llseek implementation */
+       loff_t (*llseek)(struct file *, struct cifs_tcon *, loff_t, int);
 };
 
 struct smb_version_values {
index 084756c..8c4121d 100644 (file)
@@ -528,6 +528,21 @@ cifs_reconnect(struct TCP_Server_Info *server)
        /* do not want to be sending data on a socket we are freeing */
        cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
        mutex_lock(&server->srv_mutex);
+       if (server->ssocket) {
+               cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
+                        server->ssocket->state, server->ssocket->flags);
+               kernel_sock_shutdown(server->ssocket, SHUT_WR);
+               cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n",
+                        server->ssocket->state, server->ssocket->flags);
+               sock_release(server->ssocket);
+               server->ssocket = NULL;
+       }
+       server->sequence_number = 0;
+       server->session_estab = false;
+       kfree(server->session_key.response);
+       server->session_key.response = NULL;
+       server->session_key.len = 0;
+       server->lstrp = jiffies;
 
        /* mark submitted MIDs for retry and issue callback */
        INIT_LIST_HEAD(&retry_list);
@@ -540,6 +555,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
                list_move(&mid_entry->qhead, &retry_list);
        }
        spin_unlock(&GlobalMid_Lock);
+       mutex_unlock(&server->srv_mutex);
 
        cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
        list_for_each_safe(tmp, tmp2, &retry_list) {
@@ -548,24 +564,11 @@ cifs_reconnect(struct TCP_Server_Info *server)
                mid_entry->callback(mid_entry);
        }
 
-       if (server->ssocket) {
-               cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
-                        server->ssocket->state, server->ssocket->flags);
-               kernel_sock_shutdown(server->ssocket, SHUT_WR);
-               cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n",
-                        server->ssocket->state, server->ssocket->flags);
-               sock_release(server->ssocket);
-               server->ssocket = NULL;
-       } else if (cifs_rdma_enabled(server))
+       if (cifs_rdma_enabled(server)) {
+               mutex_lock(&server->srv_mutex);
                smbd_destroy(server);
-       server->sequence_number = 0;
-       server->session_estab = false;
-       kfree(server->session_key.response);
-       server->session_key.response = NULL;
-       server->session_key.len = 0;
-       server->lstrp = jiffies;
-
-       mutex_unlock(&server->srv_mutex);
+               mutex_unlock(&server->srv_mutex);
+       }
 
        do {
                try_to_freeze();
@@ -2443,6 +2446,10 @@ match_port(struct TCP_Server_Info *server, struct sockaddr *addr)
 {
        __be16 port, *sport;
 
+       /* SMBDirect manages its own ports, don't match it here */
+       if (server->rdma)
+               return true;
+
        switch (addr->sa_family) {
        case AF_INET:
                sport = &((struct sockaddr_in *) &server->dstaddr)->sin_port;
index 7ede730..1e21b25 100644 (file)
@@ -77,7 +77,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
                goto name_is_IP_address;
 
        /* Perform the upcall */
-       rc = dns_query(NULL, hostname, len, NULL, ip_addr, NULL);
+       rc = dns_query(NULL, hostname, len, NULL, ip_addr, NULL, false);
        if (rc < 0)
                cifs_dbg(FYI, "%s: unable to resolve: %*.*s\n",
                         __func__, len, len, hostname);
index a930c89..e921e65 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  *  SMB2 version specific operations
  *
@@ -282,7 +283,7 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf)
        __u64 wire_mid = le64_to_cpu(shdr->MessageId);
 
        if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) {
-               cifs_dbg(VFS, "encrypted frame parsing not supported yet");
+               cifs_dbg(VFS, "Encrypted frame parsing not supported yet\n");
                return NULL;
        }
 
@@ -324,6 +325,7 @@ static int
 smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
 {
        int rc;
+
        ses->server->CurrentMid = 0;
        rc = SMB2_negotiate(xid, ses);
        /* BB we probably don't need to retry with modern servers */
@@ -789,8 +791,6 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
                SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
        else
                close_shroot(&tcon->crfid);
-
-       return;
 }
 
 static void
@@ -818,7 +818,6 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon)
        SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
                        FS_DEVICE_INFORMATION);
        SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
-       return;
 }
 
 static int
@@ -906,9 +905,8 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
                value = &src->ea_data[src->ea_name_length + 1];
                value_len = (size_t)le16_to_cpu(src->ea_value_length);
 
-               if (name_len == 0) {
+               if (name_len == 0)
                        break;
-               }
 
                if (src_size < 8 + name_len + 1 + value_len) {
                        cifs_dbg(FYI, "EA entry goes beyond length of list\n");
@@ -1161,6 +1159,7 @@ static void
 smb2_clear_stats(struct cifs_tcon *tcon)
 {
        int i;
+
        for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
                atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
                atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
@@ -1529,7 +1528,7 @@ smb2_copychunk_range(const unsigned int xid,
        if (pcchunk == NULL)
                return -ENOMEM;
 
-       cifs_dbg(FYI, "in smb2_copychunk_range - about to call request res key\n");
+       cifs_dbg(FYI, "%s: about to call request res key\n", __func__);
        /* Request a key from the server to identify the source of the copy */
        rc = SMB2_request_res_key(xid, tlink_tcon(srcfile->tlink),
                                srcfile->fid.persistent_fid,
@@ -1649,6 +1648,7 @@ static unsigned int
 smb2_read_data_offset(char *buf)
 {
        struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
+
        return rsp->DataOffset;
 }
 
@@ -1777,7 +1777,7 @@ smb2_duplicate_extents(const unsigned int xid,
        dup_ext_buf.SourceFileOffset = cpu_to_le64(src_off);
        dup_ext_buf.TargetFileOffset = cpu_to_le64(dest_off);
        dup_ext_buf.ByteCount = cpu_to_le64(len);
-       cifs_dbg(FYI, "duplicate extents: src off %lld dst off %lld len %lld",
+       cifs_dbg(FYI, "Duplicate extents: src off %lld dst off %lld len %lld\n",
                src_off, dest_off, len);
 
        rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false);
@@ -1794,7 +1794,7 @@ smb2_duplicate_extents(const unsigned int xid,
                        &ret_data_len);
 
        if (ret_data_len > 0)
-               cifs_dbg(FYI, "non-zero response length in duplicate extents");
+               cifs_dbg(FYI, "Non-zero response length in duplicate extents\n");
 
 duplicate_extents_out:
        return rc;
@@ -1983,9 +1983,9 @@ smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
 }
 
 /*
-* If we negotiate SMB2 protocol and get STATUS_PENDING - update
-* the number of credits and return true. Otherwise - return false.
-*/
+ * If we negotiate SMB2 protocol and get STATUS_PENDING - update
+ * the number of credits and return true. Otherwise - return false.
+ */
 static bool
 smb2_is_status_pending(char *buf, struct TCP_Server_Info *server)
 {
@@ -2306,7 +2306,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
        struct get_dfs_referral_rsp *dfs_rsp = NULL;
        u32 dfs_req_size = 0, dfs_rsp_size = 0;
 
-       cifs_dbg(FYI, "smb2_get_dfs_refer path <%s>\n", search_name);
+       cifs_dbg(FYI, "%s: path: %s\n", __func__, search_name);
 
        /*
         * Try to use the IPC tcon, otherwise just use any
@@ -2360,7 +2360,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
 
        if (rc) {
                if ((rc != -ENOENT) && (rc != -EOPNOTSUPP))
-                       cifs_dbg(VFS, "ioctl error in smb2_get_dfs_refer rc=%d\n", rc);
+                       cifs_dbg(VFS, "ioctl error in %s rc=%d\n", __func__, rc);
                goto out;
        }
 
@@ -2369,7 +2369,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
                                 nls_codepage, remap, search_name,
                                 true /* is_unicode */);
        if (rc) {
-               cifs_dbg(VFS, "parse error in smb2_get_dfs_refer rc=%d\n", rc);
+               cifs_dbg(VFS, "parse error in %s rc=%d\n", __func__, rc);
                goto out;
        }
 
@@ -2745,7 +2745,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
        inode = d_inode(cfile->dentry);
        cifsi = CIFS_I(inode);
 
-        trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid,
+       trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid,
                              ses->Suid, offset, len);
 
 
@@ -2759,7 +2759,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
                        return rc;
                }
 
-       cifs_dbg(FYI, "offset %lld len %lld", offset, len);
+       cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len);
 
        fsctl_buf.FileOffset = cpu_to_le64(offset);
        fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len);
@@ -2816,7 +2816,7 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
                return rc;
        }
 
-       cifs_dbg(FYI, "offset %lld len %lld", offset, len);
+       cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len);
 
        fsctl_buf.FileOffset = cpu_to_le64(offset);
        fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len);
@@ -2922,6 +2922,90 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
        return rc;
 }
 
+static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offset, int whence)
+{
+       struct cifsFileInfo *wrcfile, *cfile = file->private_data;
+       struct cifsInodeInfo *cifsi;
+       struct inode *inode;
+       int rc = 0;
+       struct file_allocated_range_buffer in_data, *out_data = NULL;
+       u32 out_data_len;
+       unsigned int xid;
+
+       if (whence != SEEK_HOLE && whence != SEEK_DATA)
+               return generic_file_llseek(file, offset, whence);
+
+       inode = d_inode(cfile->dentry);
+       cifsi = CIFS_I(inode);
+
+       if (offset < 0 || offset >= i_size_read(inode))
+               return -ENXIO;
+
+       xid = get_xid();
+       /*
+        * We need to be sure that all dirty pages are written as they
+        * might fill holes on the server.
+        * Note that we also MUST flush any written pages since at least
+        * some servers (Windows2016) will not reflect recent writes in
+        * QUERY_ALLOCATED_RANGES until SMB2_flush is called.
+        */
+       wrcfile = find_writable_file(cifsi, false);
+       if (wrcfile) {
+               filemap_write_and_wait(inode->i_mapping);
+               smb2_flush_file(xid, tcon, &wrcfile->fid);
+               cifsFileInfo_put(wrcfile);
+       }
+
+       if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) {
+               if (whence == SEEK_HOLE)
+                       offset = i_size_read(inode);
+               goto lseek_exit;
+       }
+
+       in_data.file_offset = cpu_to_le64(offset);
+       in_data.length = cpu_to_le64(i_size_read(inode));
+
+       rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
+                       cfile->fid.volatile_fid,
+                       FSCTL_QUERY_ALLOCATED_RANGES, true,
+                       (char *)&in_data, sizeof(in_data),
+                       sizeof(struct file_allocated_range_buffer),
+                       (char **)&out_data, &out_data_len);
+       if (rc == -E2BIG)
+               rc = 0;
+       if (rc)
+               goto lseek_exit;
+
+       if (whence == SEEK_HOLE && out_data_len == 0)
+               goto lseek_exit;
+
+       if (whence == SEEK_DATA && out_data_len == 0) {
+               rc = -ENXIO;
+               goto lseek_exit;
+       }
+
+       if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
+               rc = -EINVAL;
+               goto lseek_exit;
+       }
+       if (whence == SEEK_DATA) {
+               offset = le64_to_cpu(out_data->file_offset);
+               goto lseek_exit;
+       }
+       if (offset < le64_to_cpu(out_data->file_offset))
+               goto lseek_exit;
+
+       offset = le64_to_cpu(out_data->file_offset) + le64_to_cpu(out_data->length);
+
+ lseek_exit:
+       free_xid(xid);
+       kfree(out_data);
+       if (!rc)
+               return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+       else
+               return rc;
+}
+
 static int smb3_fiemap(struct cifs_tcon *tcon,
                       struct cifsFileInfo *cfile,
                       struct fiemap_extent_info *fei, u64 start, u64 len)
@@ -3384,7 +3468,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
 
        req = aead_request_alloc(tfm, GFP_KERNEL);
        if (!req) {
-               cifs_dbg(VFS, "%s: Failed to alloc aead request", __func__);
+               cifs_dbg(VFS, "%s: Failed to alloc aead request\n", __func__);
                return -ENOMEM;
        }
 
@@ -3395,7 +3479,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
 
        sg = init_sg(num_rqst, rqst, sign);
        if (!sg) {
-               cifs_dbg(VFS, "%s: Failed to init sg", __func__);
+               cifs_dbg(VFS, "%s: Failed to init sg\n", __func__);
                rc = -ENOMEM;
                goto free_req;
        }
@@ -3403,7 +3487,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
        iv_len = crypto_aead_ivsize(tfm);
        iv = kzalloc(iv_len, GFP_KERNEL);
        if (!iv) {
-               cifs_dbg(VFS, "%s: Failed to alloc IV", __func__);
+               cifs_dbg(VFS, "%s: Failed to alloc iv\n", __func__);
                rc = -ENOMEM;
                goto free_sg;
        }
@@ -3511,7 +3595,7 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
        fill_transform_hdr(tr_hdr, orig_len, old_rq);
 
        rc = crypt_message(server, num_rqst, new_rq, 1);
-       cifs_dbg(FYI, "encrypt message returned %d", rc);
+       cifs_dbg(FYI, "Encrypt message returned %d\n", rc);
        if (rc)
                goto err_free;
 
@@ -3552,7 +3636,7 @@ decrypt_raw_data(struct TCP_Server_Info *server, char *buf,
        rqst.rq_tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE;
 
        rc = crypt_message(server, 1, &rqst, 0);
-       cifs_dbg(FYI, "decrypt message returned %d\n", rc);
+       cifs_dbg(FYI, "Decrypt message returned %d\n", rc);
 
        if (rc)
                return rc;
@@ -4166,6 +4250,7 @@ struct smb_version_operations smb20_operations = {
        .ioctl_query_info = smb2_ioctl_query_info,
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
+       .llseek = smb3_llseek,
 };
 
 struct smb_version_operations smb21_operations = {
@@ -4266,6 +4351,7 @@ struct smb_version_operations smb21_operations = {
        .ioctl_query_info = smb2_ioctl_query_info,
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
+       .llseek = smb3_llseek,
 };
 
 struct smb_version_operations smb30_operations = {
@@ -4375,6 +4461,7 @@ struct smb_version_operations smb30_operations = {
        .ioctl_query_info = smb2_ioctl_query_info,
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
+       .llseek = smb3_llseek,
 };
 
 struct smb_version_operations smb311_operations = {
@@ -4485,6 +4572,7 @@ struct smb_version_operations smb311_operations = {
        .ioctl_query_info = smb2_ioctl_query_info,
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
+       .llseek = smb3_llseek,
 };
 
 struct smb_version_values smb20_values = {
index 29f011d..710ceb8 100644 (file)
@@ -2538,11 +2538,25 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
        struct kvec *iov = rqst->rq_iov;
        unsigned int total_len;
        int rc;
+       char *in_data_buf;
 
        rc = smb2_plain_req_init(SMB2_IOCTL, tcon, (void **) &req, &total_len);
        if (rc)
                return rc;
 
+       if (indatalen) {
+               /*
+                * indatalen is usually small at a couple of bytes max, so
+                * just allocate through generic pool
+                */
+               in_data_buf = kmalloc(indatalen, GFP_NOFS);
+               if (!in_data_buf) {
+                       cifs_small_buf_release(req);
+                       return -ENOMEM;
+               }
+               memcpy(in_data_buf, in_data, indatalen);
+       }
+
        req->CtlCode = cpu_to_le32(opcode);
        req->PersistentFileId = persistent_fid;
        req->VolatileFileId = volatile_fid;
@@ -2563,7 +2577,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
                       cpu_to_le32(offsetof(struct smb2_ioctl_req, Buffer));
                rqst->rq_nvec = 2;
                iov[0].iov_len = total_len - 1;
-               iov[1].iov_base = in_data;
+               iov[1].iov_base = in_data_buf;
                iov[1].iov_len = indatalen;
        } else {
                rqst->rq_nvec = 1;
@@ -2605,8 +2619,11 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
 void
 SMB2_ioctl_free(struct smb_rqst *rqst)
 {
-       if (rqst && rqst->rq_iov)
+       if (rqst && rqst->rq_iov) {
                cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
+               if (rqst->rq_iov[1].iov_len)
+                       kfree(rqst->rq_iov[1].iov_base);
+       }
 }
 
 
index 251ef12..caac37b 100644 (file)
@@ -903,7 +903,7 @@ static int smbd_create_header(struct smbd_connection *info,
        request->sge[0].addr = ib_dma_map_single(info->id->device,
                                                 (void *)packet,
                                                 header_length,
-                                                DMA_BIDIRECTIONAL);
+                                                DMA_TO_DEVICE);
        if (ib_dma_mapping_error(info->id->device, request->sge[0].addr)) {
                mempool_free(request, info->request_mempool);
                rc = -EIO;
@@ -1005,7 +1005,7 @@ static int smbd_post_send_sgl(struct smbd_connection *info,
        for_each_sg(sgl, sg, num_sgs, i) {
                request->sge[i+1].addr =
                        ib_dma_map_page(info->id->device, sg_page(sg),
-                              sg->offset, sg->length, DMA_BIDIRECTIONAL);
+                              sg->offset, sg->length, DMA_TO_DEVICE);
                if (ib_dma_mapping_error(
                                info->id->device, request->sge[i+1].addr)) {
                        rc = -EIO;
@@ -2110,8 +2110,10 @@ int smbd_send(struct TCP_Server_Info *server,
                goto done;
        }
 
-       rqst_idx = 0;
+       log_write(INFO, "num_rqst=%d total length=%u\n",
+                       num_rqst, remaining_data_length);
 
+       rqst_idx = 0;
 next_rqst:
        rqst = &rqst_array[rqst_idx];
        iov = rqst->rq_iov;
index 9a16ff4..60661b3 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/uaccess.h>
 #include <asm/processor.h>
 #include <linux/mempool.h>
-#include <linux/signal.h>
+#include <linux/sched/signal.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
index c0e5a7f..ae6759f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CODA_FS
        tristate "Coda file system support (advanced network fs)"
        depends on INET
index 1bab69a..1ce6681 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Coda filesystem routines.
 #
index c5234c2..f2bb798 100644 (file)
@@ -39,7 +39,6 @@
 #include <linux/device.h>
 #include <linux/pid_namespace.h>
 #include <asm/io.h>
-#include <linux/poll.h>
 #include <linux/uaccess.h>
 
 #include <linux/coda.h>
index 9febcde..272b644 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CONFIGFS_FS
        tristate "Userspace-driven configuration filesystem"
        select SYSFS
index 00ffb27..0200498 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the configfs virtual filesystem
 #
index 591e82b..5e7932d 100644 (file)
@@ -1757,12 +1757,19 @@ int configfs_register_group(struct config_group *parent_group,
 
        inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
        ret = create_default_group(parent_group, group);
-       if (!ret) {
-               spin_lock(&configfs_dirent_lock);
-               configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata);
-               spin_unlock(&configfs_dirent_lock);
-       }
+       if (ret)
+               goto err_out;
+
+       spin_lock(&configfs_dirent_lock);
+       configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata);
+       spin_unlock(&configfs_dirent_lock);
+       inode_unlock(d_inode(parent));
+       return 0;
+err_out:
        inode_unlock(d_inode(parent));
+       mutex_lock(&subsys->su_mutex);
+       unlink_group(group);
+       mutex_unlock(&subsys->su_mutex);
        return ret;
 }
 EXPORT_SYMBOL(configfs_register_group);
index 5933f99..c8bebb7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CRAMFS
        tristate "Compressed ROM file system support (cramfs)"
        select ZLIB_INFLATE
index 92ebb46..8c3ed29 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux cramfs routines.
 #
index f0de238..24ed99e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FS_ENCRYPTION
        bool "FS Encryption (Per-file encryption)"
        select CRYPTO
index cb49698..4f0df5e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_FS_ENCRYPTION)    += fscrypto.o
 
 fscrypto-y := crypto.o fname.o hooks.o keyinfo.o policy.o
index 68e2ca4..335a362 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This contains encryption functions for per-file encryption.
  *
index 2dc2254..bd525f7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/crypto/hooks.c
  *
index 8136bda..c435398 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/dcache.c
  *
index 57bc964..6eeb611 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * dcookies.c
  *
index 840c456..9c0fe38 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 debugfs-objs   := inode.o file.o
 
 obj-$(CONFIG_DEBUG_FS) += debugfs.o
index 236696e..66064c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux /dev/pts virtual filesystem.
 #
index fbe885d..ac7fb19 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/direct-io.c
  *
index e4242c3..f82a495 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig DLM
        tristate "Distributed Lock Manager (DLM)"
        depends on INET
index 434aa31..522c35d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ECRYPT_FS
        tristate "eCrypt filesystem layer support"
        depends on KEYS && CRYPTO && (ENCRYPTED_KEYS || ENCRYPTED_KEYS=n)
index 49678a6..4f2cc5b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux eCryptfs
 #
index c2499ef..edec8a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config EFIVAR_FS
        tristate "EFI Variable filesystem"
        depends on EFI
index 955d478..0b1c5e6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the efivarfs filesystem
 #
index d020e3c..2df1bac 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config EFS_FS
        tristate "EFS file system support (read only)"
        depends on BLOCK
index 963543d..85e5b88 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux efs-filesystem routines.
 #
index cdf0872..89e73a6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * inode.c
  *
index 08d3bd6..8aa0ea8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  fs/eventfd.c
  *
@@ -21,6 +22,9 @@
 #include <linux/eventfd.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/idr.h>
+
+static DEFINE_IDA(eventfd_ida);
 
 struct eventfd_ctx {
        struct kref kref;
@@ -35,6 +39,7 @@ struct eventfd_ctx {
         */
        __u64 count;
        unsigned int flags;
+       int id;
 };
 
 /**
@@ -69,6 +74,8 @@ EXPORT_SYMBOL_GPL(eventfd_signal);
 
 static void eventfd_free_ctx(struct eventfd_ctx *ctx)
 {
+       if (ctx->id >= 0)
+               ida_simple_remove(&eventfd_ida, ctx->id);
        kfree(ctx);
 }
 
@@ -297,6 +304,7 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
        seq_printf(m, "eventfd-count: %16llx\n",
                   (unsigned long long)ctx->count);
        spin_unlock_irq(&ctx->wqh.lock);
+       seq_printf(m, "eventfd-id: %d\n", ctx->id);
 }
 #endif
 
@@ -400,6 +408,7 @@ static int do_eventfd(unsigned int count, int flags)
        init_waitqueue_head(&ctx->wqh);
        ctx->count = count;
        ctx->flags = flags;
+       ctx->id = ida_simple_get(&eventfd_ida, 0, 0, GFP_KERNEL);
 
        fd = anon_inode_getfd("[eventfd]", &eventfd_fops, ctx,
                              O_RDWR | (flags & EFD_SHARED_FCNTL_FLAGS));
index 2e00333..89a500b 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/exec.c
  *
@@ -1652,11 +1653,13 @@ int search_binary_handler(struct linux_binprm *bprm)
                if (!try_module_get(fmt->module))
                        continue;
                read_unlock(&binfmt_lock);
+
                bprm->recursion_depth++;
                retval = fmt->load_binary(bprm);
+               bprm->recursion_depth--;
+
                read_lock(&binfmt_lock);
                put_binfmt(fmt);
-               bprm->recursion_depth--;
                if (retval < 0 && !bprm->mm) {
                        /* we got to flush_old_exec() and failed after it */
                        read_unlock(&binfmt_lock);
index d7c5d4d..a04a8af 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the filesystem export support routines.
 
index c69927b..f0e5497 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) Neil Brown 2002
  * Copyright (C) Christoph Hellwig 2007
index 894e4c5..54eec91 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config EXT2_FS
        tristate "Second extended fs support"
        help
index 3988633..1d7ab73 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/ext2/super.c
  *
index 06f77ca..cbb5ca8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Ext3 configs are here for backward compatibility with old configs which may
 # have EXT3_FS set but not EXT4_FS set and thus would result in non-bootable
 # kernels after the removal of ext3 driver.
index 968f163..8e83741 100644 (file)
@@ -142,7 +142,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
        struct inode *inode;
        struct ext4_sb_info *sbi = EXT4_SB(sb);
        struct ext4_map_blocks map;
-       u32 i = 0, err = 0, num, n;
+       u32 i = 0, num;
+       int err = 0, n;
 
        if ((ino < EXT4_ROOT_INO) ||
            (ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
@@ -276,6 +277,11 @@ int ext4_check_blockref(const char *function, unsigned int line,
        __le32 *bref = p;
        unsigned int blk;
 
+       if (ext4_has_feature_journal(inode->i_sb) &&
+           (inode->i_ino ==
+            le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum)))
+               return 0;
+
        while (bref < p+max) {
                blk = le32_to_cpu(*bref++);
                if (blk &&
index 0f89f51..f2c62e2 100644 (file)
@@ -1035,6 +1035,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
        __le32 border;
        ext4_fsblk_t *ablocks = NULL; /* array of allocated blocks */
        int err = 0;
+       size_t ext_size = 0;
 
        /* make decision: where to split? */
        /* FIXME: now decision is simplest: at current extent */
@@ -1126,6 +1127,10 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
                le16_add_cpu(&neh->eh_entries, m);
        }
 
+       /* zero out unused area in the extent block */
+       ext_size = sizeof(struct ext4_extent_header) +
+               sizeof(struct ext4_extent) * le16_to_cpu(neh->eh_entries);
+       memset(bh->b_data + ext_size, 0, inode->i_sb->s_blocksize - ext_size);
        ext4_extent_block_csum_set(inode, neh);
        set_buffer_uptodate(bh);
        unlock_buffer(bh);
@@ -1205,6 +1210,11 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
                                sizeof(struct ext4_extent_idx) * m);
                        le16_add_cpu(&neh->eh_entries, m);
                }
+               /* zero out unused area in the extent block */
+               ext_size = sizeof(struct ext4_extent_header) +
+                  (sizeof(struct ext4_extent) * le16_to_cpu(neh->eh_entries));
+               memset(bh->b_data + ext_size, 0,
+                       inode->i_sb->s_blocksize - ext_size);
                ext4_extent_block_csum_set(inode, neh);
                set_buffer_uptodate(bh);
                unlock_buffer(bh);
@@ -1270,6 +1280,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
        ext4_fsblk_t newblock, goal = 0;
        struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
        int err = 0;
+       size_t ext_size = 0;
 
        /* Try to prepend new index to old one */
        if (ext_depth(inode))
@@ -1295,9 +1306,11 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
                goto out;
        }
 
+       ext_size = sizeof(EXT4_I(inode)->i_data);
        /* move top-level index/leaf into new block */
-       memmove(bh->b_data, EXT4_I(inode)->i_data,
-               sizeof(EXT4_I(inode)->i_data));
+       memmove(bh->b_data, EXT4_I(inode)->i_data, ext_size);
+       /* zero out unused area in the extent block */
+       memset(bh->b_data + ext_size, 0, inode->i_sb->s_blocksize - ext_size);
 
        /* set size of new block */
        neh = ext_block_hdr(bh);
index 98ec11f..2c5baa5 100644 (file)
@@ -264,6 +264,13 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
        }
 
        ret = __generic_file_write_iter(iocb, from);
+       /*
+        * Unaligned direct AIO must be the only IO in flight. Otherwise
+        * overlapping aligned IO after unaligned might result in data
+        * corruption.
+        */
+       if (ret == -EIOCBQUEUED && unaligned_aio)
+               ext4_unwritten_wait(inode);
        inode_unlock(inode);
 
        if (ret > 0)
index 4b99e2d..dbccf46 100644 (file)
@@ -626,7 +626,7 @@ int ext4_getfsmap(struct super_block *sb, struct ext4_fsmap_head *head,
 {
        struct ext4_fsmap dkeys[2];     /* per-dev keys */
        struct ext4_getfsmap_dev handlers[EXT4_GETFSMAP_DEVS];
-       struct ext4_getfsmap_info info = {0};
+       struct ext4_getfsmap_info info = { NULL };
        int i;
        int error = 0;
 
index 7e85ecf..e486e49 100644 (file)
@@ -608,7 +608,7 @@ static int ext4_getfsmap_format(struct ext4_fsmap *xfm, void *priv)
 static int ext4_ioc_getfsmap(struct super_block *sb,
                             struct fsmap_head __user *arg)
 {
-       struct getfsmap_info info = {0};
+       struct getfsmap_info info = { NULL };
        struct ext4_fsmap_head xhead = {0};
        struct fsmap_head head;
        bool aborted = false;
index 6d50f53..cd01c4a 100644 (file)
@@ -872,12 +872,15 @@ static void dx_release(struct dx_frame *frames)
 {
        struct dx_root_info *info;
        int i;
+       unsigned int indirect_levels;
 
        if (frames[0].bh == NULL)
                return;
 
        info = &((struct dx_root *)frames[0].bh->b_data)->info;
-       for (i = 0; i <= info->indirect_levels; i++) {
+       /* save local copy, "info" may be freed after brelse() */
+       indirect_levels = info->indirect_levels;
+       for (i = 0; i <= indirect_levels; i++) {
                if (frames[i].bh == NULL)
                        break;
                brelse(frames[i].bh);
index f71b525..4079605 100644 (file)
@@ -699,7 +699,7 @@ void __ext4_abort(struct super_block *sb, const char *function,
                        jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
                save_error_info(sb, function, line);
        }
-       if (test_opt(sb, ERRORS_PANIC)) {
+       if (test_opt(sb, ERRORS_PANIC) && !system_going_down()) {
                if (EXT4_SB(sb)->s_journal &&
                  !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR))
                        return;
@@ -4661,7 +4661,7 @@ failed_mount:
 
 #ifdef CONFIG_QUOTA
        for (i = 0; i < EXT4_MAXQUOTAS; i++)
-               kfree(sbi->s_qf_names[i]);
+               kfree(get_qf_name(sb, sbi, i));
 #endif
        ext4_blkdev_remove(sbi);
        brelse(bh);
index e57cc75..110a38c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config F2FS_FS
        tristate "F2FS filesystem support"
        depends on BLOCK
index 3ff1772..718163d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FAT_FS
        tristate
        select NLS
index 9d01db3..1bda2ab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/fat/dir.c
  *
index b3bed32..4614c0b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/fat/file.c
  *
@@ -193,12 +194,17 @@ static int fat_file_release(struct inode *inode, struct file *filp)
 int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 {
        struct inode *inode = filp->f_mapping->host;
-       int res, err;
+       int err;
+
+       err = __generic_file_fsync(filp, start, end, datasync);
+       if (err)
+               return err;
 
-       res = generic_file_fsync(filp, start, end, datasync);
        err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping);
+       if (err)
+               return err;
 
-       return res ? res : err;
+       return blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
 }
 
 
index ba93d13..0568919 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/fat/inode.c
  *
index 4fc950b..1e08bd5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/fat/misc.c
  *
index f2cd365..9d06288 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/msdos/namei.c
  *
index 996c8c2..0cdd0fb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/vfat/namei.c
  *
index 3f9c1b4..b07b53f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/file_table.c
  *
index ce49df1..c05c71d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config VXFS_FS
        tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
        depends on BLOCK
index 87ad097..e6ee592 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # VxFS Makefile
 #
index 36855c1..e41cbe8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/fs-writeback.c
  *
@@ -523,8 +524,6 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
 
        isw->inode = inode;
 
-       atomic_inc(&isw_nr_in_flight);
-
        /*
         * In addition to synchronizing among switchers, I_WB_SWITCH tells
         * the RCU protected stat update paths to grab the i_page
@@ -532,6 +531,9 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
         * Let's continue after I_WB_SWITCH is guaranteed to be visible.
         */
        call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn);
+
+       atomic_inc(&isw_nr_in_flight);
+
        goto out_unlock;
 
 out_free:
@@ -901,7 +903,11 @@ restart:
 void cgroup_writeback_umount(void)
 {
        if (atomic_read(&isw_nr_in_flight)) {
-               synchronize_rcu();
+               /*
+                * Use rcu_barrier() to wait for all pending callbacks to
+                * ensure that all in-flight wb switches are in the workqueue.
+                */
+               rcu_barrier();
                flush_workqueue(isw_wq);
        }
 }
index be02507..ca639ed 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/sched/signal.h>
 #include <linux/sched/task.h>
index 3f6dfa9..506c5e6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config FSCACHE
        tristate "General filesystem local caching manager"
index 3bb9c0c..c2891e9 100644 (file)
@@ -92,7 +92,7 @@ static int fscontext_create_fd(struct fs_context *fc, unsigned int o_flags)
 {
        int fd;
 
-       fd = anon_inode_getfd("fscontext", &fscontext_fops, fc,
+       fd = anon_inode_getfd("[fscontext]", &fscontext_fops, fc,
                              O_RDWR | o_flags);
        if (fd < 0)
                put_fs_context(fc);
index 76f09ce..24fc5a5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FUSE_FS
        tristate "FUSE (Filesystem in Userspace) support"
        select FS_POSIX_ACL
index f7b807b..9485019 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the FUSE filesystem.
 #
index 6a1e499..03c9668 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config GFS2_FS
        tristate "GFS2 file system support"
        select FS_POSIX_ACL
index 31df26e..69bd159 100644 (file)
  * @delta is the difference between the current rtt sample and the
  * running average srtt. We add 1/8 of that to the srtt in order to
  * update the current srtt estimate. The variance estimate is a bit
- * more complicated. We subtract the abs value of the @delta from
- * the current variance estimate and add 1/4 of that to the running
- * total.
+ * more complicated. We subtract the current variance estimate from
+ * the abs value of the @delta and add 1/4 of that to the running
+ * total.  That's equivalent to 3/4 of the current variance
+ * estimate plus 1/4 of the abs of @delta.
  *
  * Note that the index points at the array entry containing the smoothed
  * mean value, and the variance is always in the following entry
@@ -49,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index,
        s64 delta = sample - s->stats[index];
        s->stats[index] += (delta >> 3);
        index++;
-       s->stats[index] += ((abs(delta) - s->stats[index]) >> 2);
+       s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2;
 }
 
 /**
index 998e3a6..44f6e89 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HFS_FS
        tristate "Apple Macintosh file system support"
        depends on BLOCK
index c41f5a8..b65459b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux hfs filesystem routines.
 #
index a633718..7d4229a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HFSPLUS_FS
        tristate "Apple Extended HFS file system support"
        depends on BLOCK
index 0cc5fef..2b9e574 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/hfsplus/super.c
  *
index 56bd15c..56aa033 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HPFS_FS
        tristate "OS/2 HPFS file system support"
        depends on BLOCK
index 57b786f..153c173 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux hpfs filesystem routines.
 #
index ed4264b..9db6d84 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/hpfs/super.c
  *
index 6adf870..d876ecf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux ramfs routines.
 #
index e9d18b2..df6542e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * (C) 1997 Linus Torvalds
  * (C) 1999 Andrea Arcangeli <andrea@suse.de> (dynamic inode allocation)
index fdc1832..310f8d1 100644 (file)
@@ -231,7 +231,6 @@ struct io_ring_ctx {
        struct task_struct      *sqo_thread;    /* if using sq thread polling */
        struct mm_struct        *sqo_mm;
        wait_queue_head_t       sqo_wait;
-       unsigned                sqo_stop;
 
        struct {
                /* CQ ring */
@@ -329,9 +328,8 @@ struct io_kiocb {
 #define REQ_F_IOPOLL_COMPLETED 2       /* polled IO has completed */
 #define REQ_F_FIXED_FILE       4       /* ctx owns file */
 #define REQ_F_SEQ_PREV         8       /* sequential with previous */
-#define REQ_F_PREPPED          16      /* prep already done */
-#define REQ_F_IO_DRAIN         32      /* drain existing IO first */
-#define REQ_F_IO_DRAINED       64      /* drain done */
+#define REQ_F_IO_DRAIN         16      /* drain existing IO first */
+#define REQ_F_IO_DRAINED       32      /* drain done */
        u64                     user_data;
        u32                     error;  /* iopoll result from callback */
        u32                     sequence;
@@ -490,7 +488,7 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx)
 }
 
 static void io_cqring_fill_event(struct io_ring_ctx *ctx, u64 ki_user_data,
-                                long res, unsigned ev_flags)
+                                long res)
 {
        struct io_uring_cqe *cqe;
 
@@ -503,7 +501,7 @@ static void io_cqring_fill_event(struct io_ring_ctx *ctx, u64 ki_user_data,
        if (cqe) {
                WRITE_ONCE(cqe->user_data, ki_user_data);
                WRITE_ONCE(cqe->res, res);
-               WRITE_ONCE(cqe->flags, ev_flags);
+               WRITE_ONCE(cqe->flags, 0);
        } else {
                unsigned overflow = READ_ONCE(ctx->cq_ring->overflow);
 
@@ -522,12 +520,12 @@ static void io_cqring_ev_posted(struct io_ring_ctx *ctx)
 }
 
 static void io_cqring_add_event(struct io_ring_ctx *ctx, u64 user_data,
-                               long res, unsigned ev_flags)
+                               long res)
 {
        unsigned long flags;
 
        spin_lock_irqsave(&ctx->completion_lock, flags);
-       io_cqring_fill_event(ctx, user_data, res, ev_flags);
+       io_cqring_fill_event(ctx, user_data, res);
        io_commit_cqring(ctx);
        spin_unlock_irqrestore(&ctx->completion_lock, flags);
 
@@ -629,7 +627,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
                req = list_first_entry(done, struct io_kiocb, list);
                list_del(&req->list);
 
-               io_cqring_fill_event(ctx, req->user_data, req->error, 0);
+               io_cqring_fill_event(ctx, req->user_data, req->error);
                (*nr_events)++;
 
                if (refcount_dec_and_test(&req->refs)) {
@@ -777,7 +775,7 @@ static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
 
        kiocb_end_write(kiocb);
 
-       io_cqring_add_event(req->ctx, req->user_data, res, 0);
+       io_cqring_add_event(req->ctx, req->user_data, res);
        io_put_req(req);
 }
 
@@ -896,9 +894,6 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s,
 
        if (!req->file)
                return -EBADF;
-       /* For -EAGAIN retry, everything is already prepped */
-       if (req->flags & REQ_F_PREPPED)
-               return 0;
 
        if (force_nonblock && !io_file_supports_async(req->file))
                force_nonblock = false;
@@ -941,7 +936,6 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s,
                        return -EINVAL;
                kiocb->ki_complete = io_complete_rw;
        }
-       req->flags |= REQ_F_PREPPED;
        return 0;
 }
 
@@ -1216,7 +1210,7 @@ static int io_nop(struct io_kiocb *req, u64 user_data)
        if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
                return -EINVAL;
 
-       io_cqring_add_event(ctx, user_data, err, 0);
+       io_cqring_add_event(ctx, user_data, err);
        io_put_req(req);
        return 0;
 }
@@ -1227,16 +1221,12 @@ static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 
        if (!req->file)
                return -EBADF;
-       /* Prep already done (EAGAIN retry) */
-       if (req->flags & REQ_F_PREPPED)
-               return 0;
 
        if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
                return -EINVAL;
        if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index))
                return -EINVAL;
 
-       req->flags |= REQ_F_PREPPED;
        return 0;
 }
 
@@ -1265,7 +1255,7 @@ static int io_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe,
                                end > 0 ? end : LLONG_MAX,
                                fsync_flags & IORING_FSYNC_DATASYNC);
 
-       io_cqring_add_event(req->ctx, sqe->user_data, ret, 0);
+       io_cqring_add_event(req->ctx, sqe->user_data, ret);
        io_put_req(req);
        return 0;
 }
@@ -1277,16 +1267,12 @@ static int io_prep_sfr(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 
        if (!req->file)
                return -EBADF;
-       /* Prep already done (EAGAIN retry) */
-       if (req->flags & REQ_F_PREPPED)
-               return 0;
 
        if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
                return -EINVAL;
        if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index))
                return -EINVAL;
 
-       req->flags |= REQ_F_PREPPED;
        return ret;
 }
 
@@ -1313,7 +1299,7 @@ static int io_sync_file_range(struct io_kiocb *req,
 
        ret = sync_file_range(req->rw.ki_filp, sqe_off, sqe_len, flags);
 
-       io_cqring_add_event(req->ctx, sqe->user_data, ret, 0);
+       io_cqring_add_event(req->ctx, sqe->user_data, ret);
        io_put_req(req);
        return 0;
 }
@@ -1371,7 +1357,7 @@ static int io_poll_remove(struct io_kiocb *req, const struct io_uring_sqe *sqe)
        }
        spin_unlock_irq(&ctx->completion_lock);
 
-       io_cqring_add_event(req->ctx, sqe->user_data, ret, 0);
+       io_cqring_add_event(req->ctx, sqe->user_data, ret);
        io_put_req(req);
        return 0;
 }
@@ -1380,7 +1366,7 @@ static void io_poll_complete(struct io_ring_ctx *ctx, struct io_kiocb *req,
                             __poll_t mask)
 {
        req->poll.done = true;
-       io_cqring_fill_event(ctx, req->user_data, mangle_poll(mask), 0);
+       io_cqring_fill_event(ctx, req->user_data, mangle_poll(mask));
        io_commit_cqring(ctx);
 }
 
@@ -1700,7 +1686,7 @@ restart:
                io_put_req(req);
 
                if (ret) {
-                       io_cqring_add_event(ctx, sqe->user_data, ret, 0);
+                       io_cqring_add_event(ctx, sqe->user_data, ret);
                        io_put_req(req);
                }
 
@@ -2005,7 +1991,7 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes,
                        continue;
                }
 
-               io_cqring_add_event(ctx, sqes[i].sqe->user_data, ret, 0);
+               io_cqring_add_event(ctx, sqes[i].sqe->user_data, ret);
        }
 
        if (statep)
@@ -2028,7 +2014,7 @@ static int io_sq_thread(void *data)
        set_fs(USER_DS);
 
        timeout = inflight = 0;
-       while (!kthread_should_stop() && !ctx->sqo_stop) {
+       while (!kthread_should_park()) {
                bool all_fixed, mm_fault = false;
                int i;
 
@@ -2090,7 +2076,7 @@ static int io_sq_thread(void *data)
                        smp_mb();
 
                        if (!io_get_sqring(ctx, &sqes[0])) {
-                               if (kthread_should_stop()) {
+                               if (kthread_should_park()) {
                                        finish_wait(&ctx->sqo_wait, &wait);
                                        break;
                                }
@@ -2140,8 +2126,7 @@ static int io_sq_thread(void *data)
                mmput(cur_mm);
        }
 
-       if (kthread_should_park())
-               kthread_parkme();
+       kthread_parkme();
 
        return 0;
 }
@@ -2170,7 +2155,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
 
                ret = io_submit_sqe(ctx, &s, statep);
                if (ret)
-                       io_cqring_add_event(ctx, s.sqe->user_data, ret, 0);
+                       io_cqring_add_event(ctx, s.sqe->user_data, ret);
        }
        io_commit_sqring(ctx);
 
@@ -2182,6 +2167,8 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
 
 static unsigned io_cqring_events(struct io_cq_ring *ring)
 {
+       /* See comment at the top of this file */
+       smp_rmb();
        return READ_ONCE(ring->r.tail) - READ_ONCE(ring->r.head);
 }
 
@@ -2194,11 +2181,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 {
        struct io_cq_ring *ring = ctx->cq_ring;
        sigset_t ksigmask, sigsaved;
-       DEFINE_WAIT(wait);
        int ret;
 
-       /* See comment at the top of this file */
-       smp_rmb();
        if (io_cqring_events(ring) >= min_events)
                return 0;
 
@@ -2216,23 +2200,9 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
                        return ret;
        }
 
-       do {
-               prepare_to_wait(&ctx->wait, &wait, TASK_INTERRUPTIBLE);
-
-               ret = 0;
-               /* See comment at the top of this file */
-               smp_rmb();
-               if (io_cqring_events(ring) >= min_events)
-                       break;
-
-               schedule();
-
+       ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events);
+       if (ret == -ERESTARTSYS)
                ret = -EINTR;
-               if (signal_pending(current))
-                       break;
-       } while (1);
-
-       finish_wait(&ctx->wait, &wait);
 
        if (sig)
                restore_user_sigmask(sig, &sigsaved);
@@ -2273,8 +2243,11 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
 static void io_sq_thread_stop(struct io_ring_ctx *ctx)
 {
        if (ctx->sqo_thread) {
-               ctx->sqo_stop = 1;
-               mb();
+               /*
+                * The park is a bit of a work-around, without it we get
+                * warning spews on shutdown with SQPOLL set and affinity
+                * set to a single CPU.
+                */
                kthread_park(ctx->sqo_thread);
                kthread_stop(ctx->sqo_thread);
                ctx->sqo_thread = NULL;
@@ -2467,10 +2440,11 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
                        ctx->sq_thread_idle = HZ;
 
                if (p->flags & IORING_SETUP_SQ_AFF) {
-                       int cpu = array_index_nospec(p->sq_thread_cpu,
-                                                       nr_cpu_ids);
+                       int cpu = p->sq_thread_cpu;
 
                        ret = -EINVAL;
+                       if (cpu >= nr_cpu_ids)
+                               goto err;
                        if (!cpu_online(cpu))
                                goto err;
 
index 8ab9878..5e74195 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ISO9660_FS
        tristate "ISO 9660 CDROM file system support"
        help
index 603b052..9e30d87 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/isofs/inode.c
  *
index 5a9f553..4ad2c67 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config JBD2
        tristate
        select CRC32
index 802a341..126b4da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux journaling routines.
 #
index 37e16d9..43df0c9 100644 (file)
@@ -2375,22 +2375,19 @@ static struct kmem_cache *jbd2_journal_head_cache;
 static atomic_t nr_journal_heads = ATOMIC_INIT(0);
 #endif
 
-static int jbd2_journal_init_journal_head_cache(void)
+static int __init jbd2_journal_init_journal_head_cache(void)
 {
-       int retval;
-
-       J_ASSERT(jbd2_journal_head_cache == NULL);
+       J_ASSERT(!jbd2_journal_head_cache);
        jbd2_journal_head_cache = kmem_cache_create("jbd2_journal_head",
                                sizeof(struct journal_head),
                                0,              /* offset */
                                SLAB_TEMPORARY | SLAB_TYPESAFE_BY_RCU,
                                NULL);          /* ctor */
-       retval = 0;
        if (!jbd2_journal_head_cache) {
-               retval = -ENOMEM;
                printk(KERN_EMERG "JBD2: no memory for journal_head cache\n");
+               return -ENOMEM;
        }
-       return retval;
+       return 0;
 }
 
 static void jbd2_journal_destroy_journal_head_cache(void)
@@ -2636,28 +2633,38 @@ static void __exit jbd2_remove_jbd_stats_proc_entry(void)
 
 struct kmem_cache *jbd2_handle_cache, *jbd2_inode_cache;
 
+static int __init jbd2_journal_init_inode_cache(void)
+{
+       J_ASSERT(!jbd2_inode_cache);
+       jbd2_inode_cache = KMEM_CACHE(jbd2_inode, 0);
+       if (!jbd2_inode_cache) {
+               pr_emerg("JBD2: failed to create inode cache\n");
+               return -ENOMEM;
+       }
+       return 0;
+}
+
 static int __init jbd2_journal_init_handle_cache(void)
 {
+       J_ASSERT(!jbd2_handle_cache);
        jbd2_handle_cache = KMEM_CACHE(jbd2_journal_handle, SLAB_TEMPORARY);
-       if (jbd2_handle_cache == NULL) {
+       if (!jbd2_handle_cache) {
                printk(KERN_EMERG "JBD2: failed to create handle cache\n");
                return -ENOMEM;
        }
-       jbd2_inode_cache = KMEM_CACHE(jbd2_inode, 0);
-       if (jbd2_inode_cache == NULL) {
-               printk(KERN_EMERG "JBD2: failed to create inode cache\n");
-               kmem_cache_destroy(jbd2_handle_cache);
-               return -ENOMEM;
-       }
        return 0;
 }
 
+static void jbd2_journal_destroy_inode_cache(void)
+{
+       kmem_cache_destroy(jbd2_inode_cache);
+       jbd2_inode_cache = NULL;
+}
+
 static void jbd2_journal_destroy_handle_cache(void)
 {
        kmem_cache_destroy(jbd2_handle_cache);
        jbd2_handle_cache = NULL;
-       kmem_cache_destroy(jbd2_inode_cache);
-       jbd2_inode_cache = NULL;
 }
 
 /*
@@ -2668,21 +2675,27 @@ static int __init journal_init_caches(void)
 {
        int ret;
 
-       ret = jbd2_journal_init_revoke_caches();
+       ret = jbd2_journal_init_revoke_record_cache();
+       if (ret == 0)
+               ret = jbd2_journal_init_revoke_table_cache();
        if (ret == 0)
                ret = jbd2_journal_init_journal_head_cache();
        if (ret == 0)
                ret = jbd2_journal_init_handle_cache();
        if (ret == 0)
+               ret = jbd2_journal_init_inode_cache();
+       if (ret == 0)
                ret = jbd2_journal_init_transaction_cache();
        return ret;
 }
 
 static void jbd2_journal_destroy_caches(void)
 {
-       jbd2_journal_destroy_revoke_caches();
+       jbd2_journal_destroy_revoke_record_cache();
+       jbd2_journal_destroy_revoke_table_cache();
        jbd2_journal_destroy_journal_head_cache();
        jbd2_journal_destroy_handle_cache();
+       jbd2_journal_destroy_inode_cache();
        jbd2_journal_destroy_transaction_cache();
        jbd2_journal_destroy_slabs();
 }
index a1143e5..69b9bc3 100644 (file)
@@ -178,33 +178,41 @@ static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
        return NULL;
 }
 
-void jbd2_journal_destroy_revoke_caches(void)
+void jbd2_journal_destroy_revoke_record_cache(void)
 {
        kmem_cache_destroy(jbd2_revoke_record_cache);
        jbd2_revoke_record_cache = NULL;
+}
+
+void jbd2_journal_destroy_revoke_table_cache(void)
+{
        kmem_cache_destroy(jbd2_revoke_table_cache);
        jbd2_revoke_table_cache = NULL;
 }
 
-int __init jbd2_journal_init_revoke_caches(void)
+int __init jbd2_journal_init_revoke_record_cache(void)
 {
        J_ASSERT(!jbd2_revoke_record_cache);
-       J_ASSERT(!jbd2_revoke_table_cache);
-
        jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s,
                                        SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
-       if (!jbd2_revoke_record_cache)
-               goto record_cache_failure;
 
+       if (!jbd2_revoke_record_cache) {
+               pr_emerg("JBD2: failed to create revoke_record cache\n");
+               return -ENOMEM;
+       }
+       return 0;
+}
+
+int __init jbd2_journal_init_revoke_table_cache(void)
+{
+       J_ASSERT(!jbd2_revoke_table_cache);
        jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s,
                                             SLAB_TEMPORARY);
-       if (!jbd2_revoke_table_cache)
-               goto table_cache_failure;
-       return 0;
-table_cache_failure:
-       jbd2_journal_destroy_revoke_caches();
-record_cache_failure:
+       if (!jbd2_revoke_table_cache) {
+               pr_emerg("JBD2: failed to create revoke_table cache\n");
                return -ENOMEM;
+       }
+       return 0;
 }
 
 static struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
index f940d31..8ca4fdd 100644 (file)
@@ -42,9 +42,11 @@ int __init jbd2_journal_init_transaction_cache(void)
                                        0,
                                        SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
                                        NULL);
-       if (transaction_cache)
-               return 0;
-       return -ENOMEM;
+       if (!transaction_cache) {
+               pr_emerg("JBD2: failed to create transaction cache\n");
+               return -ENOMEM;
+       }
+       return 0;
 }
 
 void jbd2_journal_destroy_transaction_cache(void)
index ad850c5..7c96bc1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config JFFS2_FS
        tristate "Journalling Flash File System v2 (JFFS2) support"
        select CRC32
index 851de78..22a273b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config JFS_FS
        tristate "JFS filesystem support"
        select NLS
index 397b5f7..e7f0910 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # KERNFS should be selected by its users
 #
index 674337c..4ca54ff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the kernfs pseudo filesystem
 #
index 4b59b18..7e52e77 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     fs/libfs.c
  *     Library for filesystems writers.
index 70f520b..a5bb3f7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/lockd/clntlock.c
  *
@@ -56,7 +57,7 @@ struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init)
        u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4;
        int status;
 
-       status = lockd_up(nlm_init->net);
+       status = lockd_up(nlm_init->net, nlm_init->cred);
        if (status < 0)
                return ERR_PTR(status);
 
@@ -241,7 +242,7 @@ reclaimer(void *ptr)
        allow_signal(SIGKILL);
 
        down_write(&host->h_rwsem);
-       lockd_up(net);  /* note: this cannot fail as lockd is already running */
+       lockd_up(net, NULL);    /* note: this cannot fail as lockd is already running */
 
        dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
 
index d9c32d1..62f9822 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/lockd/clntproc.c
  *
index 346ed16..1a639e3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/lockd/svc.c
  *
@@ -188,28 +189,31 @@ lockd(void *vrqstp)
 
 static int create_lockd_listener(struct svc_serv *serv, const char *name,
                                 struct net *net, const int family,
-                                const unsigned short port)
+                                const unsigned short port,
+                                const struct cred *cred)
 {
        struct svc_xprt *xprt;
 
        xprt = svc_find_xprt(serv, name, net, family, 0);
        if (xprt == NULL)
                return svc_create_xprt(serv, name, net, family, port,
-                                               SVC_SOCK_DEFAULTS);
+                                               SVC_SOCK_DEFAULTS, cred);
        svc_xprt_put(xprt);
        return 0;
 }
 
 static int create_lockd_family(struct svc_serv *serv, struct net *net,
-                              const int family)
+                              const int family, const struct cred *cred)
 {
        int err;
 
-       err = create_lockd_listener(serv, "udp", net, family, nlm_udpport);
+       err = create_lockd_listener(serv, "udp", net, family, nlm_udpport,
+                       cred);
        if (err < 0)
                return err;
 
-       return create_lockd_listener(serv, "tcp", net, family, nlm_tcpport);
+       return create_lockd_listener(serv, "tcp", net, family, nlm_tcpport,
+                       cred);
 }
 
 /*
@@ -222,16 +226,17 @@ static int create_lockd_family(struct svc_serv *serv, struct net *net,
  * Returns zero if all listeners are available; otherwise a
  * negative errno value is returned.
  */
-static int make_socks(struct svc_serv *serv, struct net *net)
+static int make_socks(struct svc_serv *serv, struct net *net,
+               const struct cred *cred)
 {
        static int warned;
        int err;
 
-       err = create_lockd_family(serv, net, PF_INET);
+       err = create_lockd_family(serv, net, PF_INET, cred);
        if (err < 0)
                goto out_err;
 
-       err = create_lockd_family(serv, net, PF_INET6);
+       err = create_lockd_family(serv, net, PF_INET6, cred);
        if (err < 0 && err != -EAFNOSUPPORT)
                goto out_err;
 
@@ -246,7 +251,8 @@ out_err:
        return err;
 }
 
-static int lockd_up_net(struct svc_serv *serv, struct net *net)
+static int lockd_up_net(struct svc_serv *serv, struct net *net,
+               const struct cred *cred)
 {
        struct lockd_net *ln = net_generic(net, lockd_net_id);
        int error;
@@ -258,7 +264,7 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net)
        if (error)
                goto err_bind;
 
-       error = make_socks(serv, net);
+       error = make_socks(serv, net, cred);
        if (error < 0)
                goto err_bind;
        set_grace_period(net);
@@ -461,7 +467,7 @@ static struct svc_serv *lockd_create_svc(void)
 /*
  * Bring up the lockd process if it's not already up.
  */
-int lockd_up(struct net *net)
+int lockd_up(struct net *net, const struct cred *cred)
 {
        struct svc_serv *serv;
        int error;
@@ -474,7 +480,7 @@ int lockd_up(struct net *net)
                goto err_create;
        }
 
-       error = lockd_up_net(serv, net);
+       error = lockd_up_net(serv, net, cred);
        if (error < 0) {
                lockd_unregister_notifiers();
                goto err_put;
@@ -807,5 +813,7 @@ static struct svc_program   nlmsvc_program = {
        .pg_name                = "lockd",              /* service name */
        .pg_class               = "nfsd",               /* share authentication with nfsd */
        .pg_stats               = &nlmsvc_stats,        /* stats table */
-       .pg_authenticate = &lockd_authenticate  /* export authentication */
+       .pg_authenticate        = &lockd_authenticate,  /* export authentication */
+       .pg_init_request        = svc_generic_init_request,
+       .pg_rpcbind_set         = svc_generic_rpcbind_set,
 };
index 899360b..0e610f4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/lockd/svcsubs.c
  *
index d7c05dd..ec1e4a5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/locks.c
  *
@@ -352,6 +353,12 @@ EXPORT_SYMBOL_GPL(locks_alloc_lock);
 
 void locks_release_private(struct file_lock *fl)
 {
+       BUG_ON(waitqueue_active(&fl->fl_wait));
+       BUG_ON(!list_empty(&fl->fl_list));
+       BUG_ON(!list_empty(&fl->fl_blocked_requests));
+       BUG_ON(!list_empty(&fl->fl_blocked_member));
+       BUG_ON(!hlist_unhashed(&fl->fl_link));
+
        if (fl->fl_ops) {
                if (fl->fl_ops->fl_release_private)
                        fl->fl_ops->fl_release_private(fl);
@@ -371,12 +378,6 @@ EXPORT_SYMBOL_GPL(locks_release_private);
 /* Free a lock which is not in use. */
 void locks_free_lock(struct file_lock *fl)
 {
-       BUG_ON(waitqueue_active(&fl->fl_wait));
-       BUG_ON(!list_empty(&fl->fl_list));
-       BUG_ON(!list_empty(&fl->fl_blocked_requests));
-       BUG_ON(!list_empty(&fl->fl_blocked_member));
-       BUG_ON(!hlist_unhashed(&fl->fl_link));
-
        locks_release_private(fl);
        kmem_cache_free(filelock_cache, fl);
 }
index 081ccf0..97c54d3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/list.h>
index bcd53a7..de20039 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MINIX_FS
        tristate "Minix file system support"
        depends on BLOCK
index 3063015..a2d3ab5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux minix filesystem routines.
 #
index 1012007..f96073f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/minix/inode.c
  *
index 69d02cf..295a7a2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFS_FS
        tristate "NFS client support"
        depends on INET && FILE_LOCKING && MULTIUSER
index 3ca14c3..7668a1b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the pNFS block layout driver kernel module
 #
index 0b602a3..7817ad9 100644 (file)
@@ -41,11 +41,13 @@ static struct svc_program nfs4_callback_program;
 
 static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net)
 {
+       const struct cred *cred = current_cred();
        int ret;
        struct nfs_net *nn = net_generic(net, nfs_net_id);
 
        ret = svc_create_xprt(serv, "tcp", net, PF_INET,
-                               nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
+                               nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS,
+                               cred);
        if (ret <= 0)
                goto out_err;
        nn->nfs_callback_tcpport = ret;
@@ -53,7 +55,8 @@ static int nfs4_callback_up_net(struct svc_serv *serv, struct net *net)
                nn->nfs_callback_tcpport, PF_INET, net->ns.inum);
 
        ret = svc_create_xprt(serv, "tcp", net, PF_INET6,
-                               nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
+                               nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS,
+                               cred);
        if (ret > 0) {
                nn->nfs_callback_tcpport6 = ret;
                dprintk("NFS: Callback listener port = %u (af %u, net %x)\n",
@@ -457,4 +460,6 @@ static struct svc_program nfs4_callback_program = {
        .pg_class = "nfs",                              /* authentication class */
        .pg_stats = &nfs4_callback_stats,
        .pg_authenticate = nfs_callback_authenticate,
+       .pg_init_request = svc_generic_init_request,
+       .pg_rpcbind_set = svc_generic_rpcbind_set,
 };
index 06233bf..73a5a5e 100644 (file)
@@ -983,7 +983,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
 
 out_invalidcred:
        pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n");
-       return rpc_autherr_badcred;
+       return svc_return_autherr(rqstp, rpc_autherr_badcred);
 }
 
 /*
index da74c4c..3d04cb0 100644 (file)
@@ -558,6 +558,7 @@ static int nfs_start_lockd(struct nfs_server *server)
                                        1 : 0,
                .net            = clp->cl_net,
                .nlmclnt_ops    = clp->cl_nfs_mod->rpc_ops->nlmclnt_ops,
+               .cred           = current_cred(),
        };
 
        if (nlm_init.nfs_version > 3)
index 8b78274..0ff3fac 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/delegation.c
  *
index 47d445b..57b6a45 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/nfs/dir.c
  *
index 2436bd9..0cb4424 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/direct.c
  *
index a7d3df8..e6a700f 100644 (file)
@@ -22,7 +22,7 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
        char *ip_addr = NULL;
        int ip_len;
 
-       ip_len = dns_query(NULL, name, namelen, NULL, &ip_addr, NULL);
+       ip_len = dns_query(NULL, name, namelen, NULL, &ip_addr, NULL, false);
        if (ip_len > 0)
                ret = rpc_pton(net, ip_addr, ip_len, sa, salen);
        else
index 144e183..95dc905 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/nfs/file.c
  *
index 8516cdf..de05631 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the pNFS Files Layout Driver kernel module
 #
index 1d2c9f6..49f0342 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the pNFS Flexfile Layout Driver kernel module
 #
index 9920c52..bcff3bf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Module for pnfs flexfile layout driver.
  *
index 3bc2550..0b4a1a9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/nfs/inode.c
  *
index 15f099a..9287eb6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/namespace.c
  *
index 0a9782c..467f21e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2012 Netapp, Inc. All rights reserved.
  */
index 1afdb0f..fb0c425 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
 #include <linux/sunrpc/addr.h>
index 5c4394e..7c58094 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2012 Netapp, Inc. All rights reserved.
  */
index 3ce2463..81b9b6d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
index bcb532d..4145a01 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/nfs/nfs4session.c
  *
index 689977e..04c5706 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2012 Bryan Schumaker <bjschuma@netapp.com>
  */
index 6ec3001..6ef5278 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/pagelist.c
  *
index f5ad75f..c0046c3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common NFS I/O  operations for the pnfs file based
  * layout drivers.
index c799e54..c19841c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/read.c
  *
index d6c6874..f88ddac 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/nfs/super.c
  *
index bc5bb93..059a7c3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/fs/nfs/write.c
  *
index d153ca3..4bebe83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for Linux filesystem routines that are shared by client and server.
 #
index 5be08f0..b73d9dd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common code for control of lockd and nfsv4 grace periods.
  *
index 538f142..8ceb642 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * fs/nfs_common/nfsacl.c
  *
index 20b1c17..d25f6bb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFSD
        tristate "NFS server support"
        depends on INET
index 802993d..baa0195 100644 (file)
@@ -570,13 +570,13 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
                err = get_int(&mesg, &an_int);
                if (err)
                        goto out3;
-               exp.ex_anon_uid= make_kuid(&init_user_ns, an_int);
+               exp.ex_anon_uid= make_kuid(current_user_ns(), an_int);
 
                /* anon gid */
                err = get_int(&mesg, &an_int);
                if (err)
                        goto out3;
-               exp.ex_anon_gid= make_kgid(&init_user_ns, an_int);
+               exp.ex_anon_gid= make_kgid(current_user_ns(), an_int);
 
                /* fsid */
                err = get_int(&mesg, &an_int);
@@ -1170,15 +1170,17 @@ static void show_secinfo(struct seq_file *m, struct svc_export *exp)
 static void exp_flags(struct seq_file *m, int flag, int fsid,
                kuid_t anonu, kgid_t anong, struct nfsd4_fs_locations *fsloc)
 {
+       struct user_namespace *userns = m->file->f_cred->user_ns;
+
        show_expflags(m, flag, NFSEXP_ALLFLAGS);
        if (flag & NFSEXP_FSID)
                seq_printf(m, ",fsid=%d", fsid);
-       if (!uid_eq(anonu, make_kuid(&init_user_ns, (uid_t)-2)) &&
-           !uid_eq(anonu, make_kuid(&init_user_ns, 0x10000-2)))
-               seq_printf(m, ",anonuid=%u", from_kuid(&init_user_ns, anonu));
-       if (!gid_eq(anong, make_kgid(&init_user_ns, (gid_t)-2)) &&
-           !gid_eq(anong, make_kgid(&init_user_ns, 0x10000-2)))
-               seq_printf(m, ",anongid=%u", from_kgid(&init_user_ns, anong));
+       if (!uid_eq(anonu, make_kuid(userns, (uid_t)-2)) &&
+           !uid_eq(anonu, make_kuid(userns, 0x10000-2)))
+               seq_printf(m, ",anonuid=%u", from_kuid_munged(userns, anonu));
+       if (!gid_eq(anong, make_kgid(userns, (gid_t)-2)) &&
+           !gid_eq(anong, make_kgid(userns, 0x10000-2)))
+               seq_printf(m, ",anongid=%u", from_kgid_munged(userns, anong));
        if (fsloc && fsloc->locations_count > 0) {
                char *loctype = (fsloc->migrated) ? "refer" : "replicas";
                int i;
index 32cb8c0..7c686a2 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * per net namespace data structures for nfsd
  *
  * Copyright (C) 2012, Jeff Layton <jlayton@redhat.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifndef __NFSD_NETNS_H__
@@ -104,6 +91,9 @@ struct nfsd_net {
        time_t nfsd4_grace;
        bool somebody_reclaimed;
 
+       bool track_reclaim_completes;
+       atomic_t nr_reclaim_complete;
+
        bool nfsd_net_up;
        bool lockd_up;
 
@@ -131,10 +121,18 @@ struct nfsd_net {
        u32             s2s_cp_cl_id;
        struct idr      s2s_cp_stateids;
        spinlock_t      s2s_cp_lock;
+
+       /*
+        * Version information
+        */
+       bool *nfsd_versions;
+       bool *nfsd4_minorversions;
 };
 
 /* Simple check to find out if a given net was properly initialized */
 #define nfsd_netns_ready(nn) ((nn)->sessionid_hashtbl)
 
+extern void nfsd_netns_free_versions(struct nfsd_net *nn);
+
 extern unsigned int nfsd_net_id;
 #endif /* __NFSD_NETNS_H__ */
index 8d78912..fcf3182 100644 (file)
@@ -96,7 +96,7 @@ decode_filename(__be32 *p, char **namp, unsigned int *lenp)
 }
 
 static __be32 *
-decode_sattr3(__be32 *p, struct iattr *iap)
+decode_sattr3(__be32 *p, struct iattr *iap, struct user_namespace *userns)
 {
        u32     tmp;
 
@@ -107,12 +107,12 @@ decode_sattr3(__be32 *p, struct iattr *iap)
                iap->ia_mode = ntohl(*p++);
        }
        if (*p++) {
-               iap->ia_uid = make_kuid(&init_user_ns, ntohl(*p++));
+               iap->ia_uid = make_kuid(userns, ntohl(*p++));
                if (uid_valid(iap->ia_uid))
                        iap->ia_valid |= ATTR_UID;
        }
        if (*p++) {
-               iap->ia_gid = make_kgid(&init_user_ns, ntohl(*p++));
+               iap->ia_gid = make_kgid(userns, ntohl(*p++));
                if (gid_valid(iap->ia_gid))
                        iap->ia_valid |= ATTR_GID;
        }
@@ -165,12 +165,13 @@ static __be32 *
 encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
              struct kstat *stat)
 {
+       struct user_namespace *userns = nfsd_user_namespace(rqstp);
        struct timespec ts;
        *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
        *p++ = htonl((u32) (stat->mode & S_IALLUGO));
        *p++ = htonl((u32) stat->nlink);
-       *p++ = htonl((u32) from_kuid(&init_user_ns, stat->uid));
-       *p++ = htonl((u32) from_kgid(&init_user_ns, stat->gid));
+       *p++ = htonl((u32) from_kuid_munged(userns, stat->uid));
+       *p++ = htonl((u32) from_kgid_munged(userns, stat->gid));
        if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
                p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
        } else {
@@ -325,7 +326,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p)
        p = decode_fh(p, &args->fh);
        if (!p)
                return 0;
-       p = decode_sattr3(p, &args->attrs);
+       p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        if ((args->check_guard = ntohl(*p++)) != 0) { 
                struct timespec time; 
@@ -455,7 +456,7 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p)
        switch (args->createmode = ntohl(*p++)) {
        case NFS3_CREATE_UNCHECKED:
        case NFS3_CREATE_GUARDED:
-               p = decode_sattr3(p, &args->attrs);
+               p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
                break;
        case NFS3_CREATE_EXCLUSIVE:
                args->verf = p;
@@ -476,7 +477,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p)
        if (!(p = decode_fh(p, &args->fh)) ||
            !(p = decode_filename(p, &args->name, &args->len)))
                return 0;
-       p = decode_sattr3(p, &args->attrs);
+       p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        return xdr_argsize_check(rqstp, p);
 }
@@ -491,7 +492,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p)
        if (!(p = decode_fh(p, &args->ffh)) ||
            !(p = decode_filename(p, &args->fname, &args->flen)))
                return 0;
-       p = decode_sattr3(p, &args->attrs);
+       p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        args->tlen = ntohl(*p++);
 
@@ -519,7 +520,7 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p)
 
        if (args->ftype == NF3BLK  || args->ftype == NF3CHR
         || args->ftype == NF3SOCK || args->ftype == NF3FIFO)
-               p = decode_sattr3(p, &args->attrs);
+               p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        if (args->ftype == NF3BLK || args->ftype == NF3CHR) {
                args->major = ntohl(*p++);
index 9b93e7a..397eb78 100644 (file)
@@ -1123,10 +1123,11 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
                rpc_restart_call_prepare(task);
                return;
        case 1:
-               break;
-       case -1:
-               /* Network partition? */
-               nfsd4_mark_cb_down(clp, task->tk_status);
+               switch (task->tk_status) {
+               case -EIO:
+               case -ETIMEDOUT:
+                       nfsd4_mark_cb_down(clp, task->tk_status);
+               }
                break;
        default:
                BUG();
index bf137fe..2961016 100644 (file)
@@ -634,7 +634,7 @@ nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen,
                return nfserr_inval;
 
        status = do_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, &id);
-       *uid = make_kuid(&init_user_ns, id);
+       *uid = make_kuid(nfsd_user_namespace(rqstp), id);
        if (!uid_valid(*uid))
                status = nfserr_badowner;
        return status;
@@ -651,7 +651,7 @@ nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
                return nfserr_inval;
 
        status = do_name_to_id(rqstp, IDMAP_TYPE_GROUP, name, namelen, &id);
-       *gid = make_kgid(&init_user_ns, id);
+       *gid = make_kgid(nfsd_user_namespace(rqstp), id);
        if (!gid_valid(*gid))
                status = nfserr_badowner;
        return status;
@@ -660,13 +660,13 @@ nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen,
 __be32 nfsd4_encode_user(struct xdr_stream *xdr, struct svc_rqst *rqstp,
                         kuid_t uid)
 {
-       u32 id = from_kuid(&init_user_ns, uid);
+       u32 id = from_kuid_munged(nfsd_user_namespace(rqstp), uid);
        return encode_name_from_id(xdr, rqstp, IDMAP_TYPE_USER, id);
 }
 
 __be32 nfsd4_encode_group(struct xdr_stream *xdr, struct svc_rqst *rqstp,
                          kgid_t gid)
 {
-       u32 id = from_kgid(&init_user_ns, gid);
+       u32 id = from_kgid_munged(nfsd_user_namespace(rqstp), gid);
        return encode_name_from_id(xdr, rqstp, IDMAP_TYPE_GROUP, id);
 }
index 44517fb..a79e24b 100644 (file)
@@ -693,7 +693,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
                        ops->fence_client(ls);
                else
                        nfsd4_cb_layout_fail(ls);
-               return -1;
+               return 1;
        case -NFS4ERR_NOMATCHING_LAYOUT:
                trace_nfsd_layout_recall_done(&ls->ls_stid.sc_stateid);
                task->tk_status = 0;
index 4680ad3..8beda99 100644 (file)
@@ -1927,6 +1927,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
        struct nfsd4_compound_state *cstate = &resp->cstate;
        struct svc_fh *current_fh = &cstate->current_fh;
        struct svc_fh *save_fh = &cstate->save_fh;
+       struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
        __be32          status;
 
        svcxdr_init_encode(rqstp, resp);
@@ -1949,7 +1950,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
         * According to RFC3010, this takes precedence over all other errors.
         */
        status = nfserr_minor_vers_mismatch;
-       if (nfsd_minorversion(args->minorversion, NFSD_TEST) <= 0)
+       if (nfsd_minorversion(nn, args->minorversion, NFSD_TEST) <= 0)
                goto out;
        status = nfserr_resource;
        if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND)
index 8c85634..8767955 100644 (file)
@@ -169,12 +169,33 @@ legacy_recdir_name_error(struct nfs4_client *clp, int error)
 }
 
 static void
+__nfsd4_create_reclaim_record_grace(struct nfs4_client *clp,
+               const char *dname, int len, struct nfsd_net *nn)
+{
+       struct xdr_netobj name;
+       struct nfs4_client_reclaim *crp;
+
+       name.data = kmemdup(dname, len, GFP_KERNEL);
+       if (!name.data) {
+               dprintk("%s: failed to allocate memory for name.data!\n",
+                       __func__);
+               return;
+       }
+       name.len = len;
+       crp = nfs4_client_to_reclaim(name, nn);
+       if (!crp) {
+               kfree(name.data);
+               return;
+       }
+       crp->cr_clp = clp;
+}
+
+static void
 nfsd4_create_clid_dir(struct nfs4_client *clp)
 {
        const struct cred *original_cred;
        char dname[HEXDIR_LEN];
        struct dentry *dir, *dentry;
-       struct nfs4_client_reclaim *crp;
        int status;
        struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
 
@@ -220,11 +241,9 @@ out_put:
 out_unlock:
        inode_unlock(d_inode(dir));
        if (status == 0) {
-               if (nn->in_grace) {
-                       crp = nfs4_client_to_reclaim(dname, nn);
-                       if (crp)
-                               crp->cr_clp = clp;
-               }
+               if (nn->in_grace)
+                       __nfsd4_create_reclaim_record_grace(clp, dname,
+                                       HEXDIR_LEN, nn);
                vfs_fsync(nn->rec_file, 0);
        } else {
                printk(KERN_ERR "NFSD: failed to write recovery record"
@@ -345,10 +364,29 @@ out_unlock:
 }
 
 static void
+__nfsd4_remove_reclaim_record_grace(const char *dname, int len,
+               struct nfsd_net *nn)
+{
+       struct xdr_netobj name;
+       struct nfs4_client_reclaim *crp;
+
+       name.data = kmemdup(dname, len, GFP_KERNEL);
+       if (!name.data) {
+               dprintk("%s: failed to allocate memory for name.data!\n",
+                       __func__);
+               return;
+       }
+       name.len = len;
+       crp = nfsd4_find_reclaim_client(name, nn);
+       kfree(name.data);
+       if (crp)
+               nfs4_remove_reclaim_record(crp, nn);
+}
+
+static void
 nfsd4_remove_clid_dir(struct nfs4_client *clp)
 {
        const struct cred *original_cred;
-       struct nfs4_client_reclaim *crp;
        char dname[HEXDIR_LEN];
        int status;
        struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
@@ -373,12 +411,9 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
        nfs4_reset_creds(original_cred);
        if (status == 0) {
                vfs_fsync(nn->rec_file, 0);
-               if (nn->in_grace) {
-                       /* remove reclaim record */
-                       crp = nfsd4_find_reclaim_client(dname, nn);
-                       if (crp)
-                               nfs4_remove_reclaim_record(crp, nn);
-               }
+               if (nn->in_grace)
+                       __nfsd4_remove_reclaim_record_grace(dname,
+                                       HEXDIR_LEN, nn);
        }
 out_drop_write:
        mnt_drop_write_file(nn->rec_file);
@@ -392,14 +427,31 @@ static int
 purge_old(struct dentry *parent, struct dentry *child, struct nfsd_net *nn)
 {
        int status;
+       struct xdr_netobj name;
 
-       if (nfs4_has_reclaimed_state(child->d_name.name, nn))
+       if (child->d_name.len != HEXDIR_LEN - 1) {
+               printk("%s: illegal name %pd in recovery directory\n",
+                               __func__, child);
+               /* Keep trying; maybe the others are OK: */
                return 0;
+       }
+       name.data = kmemdup_nul(child->d_name.name, child->d_name.len, GFP_KERNEL);
+       if (!name.data) {
+               dprintk("%s: failed to allocate memory for name.data!\n",
+                       __func__);
+               goto out;
+       }
+       name.len = HEXDIR_LEN;
+       if (nfs4_has_reclaimed_state(name, nn))
+               goto out_free;
 
        status = vfs_rmdir(d_inode(parent), child);
        if (status)
                printk("failed to remove client recovery directory %pd\n",
                                child);
+out_free:
+       kfree(name.data);
+out:
        /* Keep trying, success or failure: */
        return 0;
 }
@@ -429,13 +481,24 @@ out:
 static int
 load_recdir(struct dentry *parent, struct dentry *child, struct nfsd_net *nn)
 {
+       struct xdr_netobj name;
+
        if (child->d_name.len != HEXDIR_LEN - 1) {
-               printk("nfsd4: illegal name %pd in recovery directory\n",
-                               child);
+               printk("%s: illegal name %pd in recovery directory\n",
+                               __func__, child);
                /* Keep trying; maybe the others are OK: */
                return 0;
        }
-       nfs4_client_to_reclaim(child->d_name.name, nn);
+       name.data = kmemdup_nul(child->d_name.name, child->d_name.len, GFP_KERNEL);
+       if (!name.data) {
+               dprintk("%s: failed to allocate memory for name.data!\n",
+                       __func__);
+               goto out;
+       }
+       name.len = HEXDIR_LEN;
+       if (!nfs4_client_to_reclaim(name, nn))
+               kfree(name.data);
+out:
        return 0;
 }
 
@@ -564,6 +627,7 @@ nfsd4_legacy_tracking_init(struct net *net)
        status = nfsd4_load_reboot_recovery_data(net);
        if (status)
                goto err;
+       printk("NFSD: Using legacy client tracking operations.\n");
        return 0;
 
 err:
@@ -615,6 +679,7 @@ nfsd4_check_legacy_client(struct nfs4_client *clp)
        char dname[HEXDIR_LEN];
        struct nfs4_client_reclaim *crp;
        struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+       struct xdr_netobj name;
 
        /* did we already find that this client is stable? */
        if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags))
@@ -627,13 +692,22 @@ nfsd4_check_legacy_client(struct nfs4_client *clp)
        }
 
        /* look for it in the reclaim hashtable otherwise */
-       crp = nfsd4_find_reclaim_client(dname, nn);
+       name.data = kmemdup(dname, HEXDIR_LEN, GFP_KERNEL);
+       if (!name.data) {
+               dprintk("%s: failed to allocate memory for name.data!\n",
+                       __func__);
+               goto out_enoent;
+       }
+       name.len = HEXDIR_LEN;
+       crp = nfsd4_find_reclaim_client(name, nn);
+       kfree(name.data);
        if (crp) {
                set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags);
                crp->cr_clp = clp;
                return 0;
        }
 
+out_enoent:
        return -ENOENT;
 }
 
@@ -656,6 +730,7 @@ struct cld_net {
        spinlock_t               cn_lock;
        struct list_head         cn_list;
        unsigned int             cn_xid;
+       bool                     cn_has_legacy;
 };
 
 struct cld_upcall {
@@ -706,6 +781,40 @@ cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg)
 }
 
 static ssize_t
+__cld_pipe_inprogress_downcall(const struct cld_msg __user *cmsg,
+               struct nfsd_net *nn)
+{
+       uint8_t cmd;
+       struct xdr_netobj name;
+       uint16_t namelen;
+       struct cld_net *cn = nn->cld_net;
+
+       if (get_user(cmd, &cmsg->cm_cmd)) {
+               dprintk("%s: error when copying cmd from userspace", __func__);
+               return -EFAULT;
+       }
+       if (cmd == Cld_GraceStart) {
+               if (get_user(namelen, &cmsg->cm_u.cm_name.cn_len))
+                       return -EFAULT;
+               name.data = memdup_user(&cmsg->cm_u.cm_name.cn_id, namelen);
+               if (IS_ERR_OR_NULL(name.data))
+                       return -EFAULT;
+               name.len = namelen;
+               if (name.len > 5 && memcmp(name.data, "hash:", 5) == 0) {
+                       name.len = name.len - 5;
+                       memmove(name.data, name.data + 5, name.len);
+                       cn->cn_has_legacy = true;
+               }
+               if (!nfs4_client_to_reclaim(name, nn)) {
+                       kfree(name.data);
+                       return -EFAULT;
+               }
+               return sizeof(*cmsg);
+       }
+       return -EFAULT;
+}
+
+static ssize_t
 cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 {
        struct cld_upcall *tmp, *cup;
@@ -714,6 +823,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
        struct nfsd_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info,
                                                nfsd_net_id);
        struct cld_net *cn = nn->cld_net;
+       int16_t status;
 
        if (mlen != sizeof(*cmsg)) {
                dprintk("%s: got %zu bytes, expected %zu\n", __func__, mlen,
@@ -727,13 +837,24 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
                return -EFAULT;
        }
 
+       /*
+        * copy the status so we know whether to remove the upcall from the
+        * list (for -EINPROGRESS, we just want to make sure the xid is
+        * valid, not remove the upcall from the list)
+        */
+       if (get_user(status, &cmsg->cm_status)) {
+               dprintk("%s: error when copying status from userspace", __func__);
+               return -EFAULT;
+       }
+
        /* walk the list and find corresponding xid */
        cup = NULL;
        spin_lock(&cn->cn_lock);
        list_for_each_entry(tmp, &cn->cn_list, cu_list) {
                if (get_unaligned(&tmp->cu_msg.cm_xid) == xid) {
                        cup = tmp;
-                       list_del_init(&cup->cu_list);
+                       if (status != -EINPROGRESS)
+                               list_del_init(&cup->cu_list);
                        break;
                }
        }
@@ -745,6 +866,9 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
                return -EINVAL;
        }
 
+       if (status == -EINPROGRESS)
+               return __cld_pipe_inprogress_downcall(cmsg, nn);
+
        if (copy_from_user(&cup->cu_msg, src, mlen) != 0)
                return -EFAULT;
 
@@ -820,7 +944,7 @@ nfsd4_cld_unregister_net(struct net *net, struct rpc_pipe *pipe)
 
 /* Initialize rpc_pipefs pipe for communication with client tracking daemon */
 static int
-nfsd4_init_cld_pipe(struct net *net)
+__nfsd4_init_cld_pipe(struct net *net)
 {
        int ret;
        struct dentry *dentry;
@@ -851,6 +975,7 @@ nfsd4_init_cld_pipe(struct net *net)
        }
 
        cn->cn_pipe->dentry = dentry;
+       cn->cn_has_legacy = false;
        nn->cld_net = cn;
        return 0;
 
@@ -863,6 +988,17 @@ err:
        return ret;
 }
 
+static int
+nfsd4_init_cld_pipe(struct net *net)
+{
+       int status;
+
+       status = __nfsd4_init_cld_pipe(net);
+       if (!status)
+               printk("NFSD: Using old nfsdcld client tracking operations.\n");
+       return status;
+}
+
 static void
 nfsd4_remove_cld_pipe(struct net *net)
 {
@@ -991,9 +1127,14 @@ out_err:
                                "record from stable storage: %d\n", ret);
 }
 
-/* Check for presence of a record, and update its timestamp */
+/*
+ * For older nfsdcld's that do not allow us to "slurp" the clients
+ * from the tracking database during startup.
+ *
+ * Check for presence of a record, and update its timestamp
+ */
 static int
-nfsd4_cld_check(struct nfs4_client *clp)
+nfsd4_cld_check_v0(struct nfs4_client *clp)
 {
        int ret;
        struct cld_upcall *cup;
@@ -1026,8 +1167,84 @@ nfsd4_cld_check(struct nfs4_client *clp)
        return ret;
 }
 
+/*
+ * For newer nfsdcld's that allow us to "slurp" the clients
+ * from the tracking database during startup.
+ *
+ * Check for presence of a record in the reclaim_str_hashtbl
+ */
+static int
+nfsd4_cld_check(struct nfs4_client *clp)
+{
+       struct nfs4_client_reclaim *crp;
+       struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+       struct cld_net *cn = nn->cld_net;
+       int status;
+       char dname[HEXDIR_LEN];
+       struct xdr_netobj name;
+
+       /* did we already find that this client is stable? */
+       if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags))
+               return 0;
+
+       /* look for it in the reclaim hashtable otherwise */
+       crp = nfsd4_find_reclaim_client(clp->cl_name, nn);
+       if (crp)
+               goto found;
+
+       if (cn->cn_has_legacy) {
+               status = nfs4_make_rec_clidname(dname, &clp->cl_name);
+               if (status)
+                       return -ENOENT;
+
+               name.data = kmemdup(dname, HEXDIR_LEN, GFP_KERNEL);
+               if (!name.data) {
+                       dprintk("%s: failed to allocate memory for name.data!\n",
+                               __func__);
+                       return -ENOENT;
+               }
+               name.len = HEXDIR_LEN;
+               crp = nfsd4_find_reclaim_client(name, nn);
+               kfree(name.data);
+               if (crp)
+                       goto found;
+
+       }
+       return -ENOENT;
+found:
+       crp->cr_clp = clp;
+       return 0;
+}
+
+static int
+nfsd4_cld_grace_start(struct nfsd_net *nn)
+{
+       int ret;
+       struct cld_upcall *cup;
+       struct cld_net *cn = nn->cld_net;
+
+       cup = alloc_cld_upcall(cn);
+       if (!cup) {
+               ret = -ENOMEM;
+               goto out_err;
+       }
+
+       cup->cu_msg.cm_cmd = Cld_GraceStart;
+       ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_msg);
+       if (!ret)
+               ret = cup->cu_msg.cm_status;
+
+       free_cld_upcall(cup);
+out_err:
+       if (ret)
+               dprintk("%s: Unable to get clients from userspace: %d\n",
+                       __func__, ret);
+       return ret;
+}
+
+/* For older nfsdcld's that need cm_gracetime */
 static void
-nfsd4_cld_grace_done(struct nfsd_net *nn)
+nfsd4_cld_grace_done_v0(struct nfsd_net *nn)
 {
        int ret;
        struct cld_upcall *cup;
@@ -1051,11 +1268,149 @@ out_err:
                printk(KERN_ERR "NFSD: Unable to end grace period: %d\n", ret);
 }
 
-static const struct nfsd4_client_tracking_ops nfsd4_cld_tracking_ops = {
+/*
+ * For newer nfsdcld's that do not need cm_gracetime.  We also need to call
+ * nfs4_release_reclaim() to clear out the reclaim_str_hashtbl.
+ */
+static void
+nfsd4_cld_grace_done(struct nfsd_net *nn)
+{
+       int ret;
+       struct cld_upcall *cup;
+       struct cld_net *cn = nn->cld_net;
+
+       cup = alloc_cld_upcall(cn);
+       if (!cup) {
+               ret = -ENOMEM;
+               goto out_err;
+       }
+
+       cup->cu_msg.cm_cmd = Cld_GraceDone;
+       ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_msg);
+       if (!ret)
+               ret = cup->cu_msg.cm_status;
+
+       free_cld_upcall(cup);
+out_err:
+       nfs4_release_reclaim(nn);
+       if (ret)
+               printk(KERN_ERR "NFSD: Unable to end grace period: %d\n", ret);
+}
+
+static int
+nfs4_cld_state_init(struct net *net)
+{
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+       int i;
+
+       nn->reclaim_str_hashtbl = kmalloc_array(CLIENT_HASH_SIZE,
+                                               sizeof(struct list_head),
+                                               GFP_KERNEL);
+       if (!nn->reclaim_str_hashtbl)
+               return -ENOMEM;
+
+       for (i = 0; i < CLIENT_HASH_SIZE; i++)
+               INIT_LIST_HEAD(&nn->reclaim_str_hashtbl[i]);
+       nn->reclaim_str_hashtbl_size = 0;
+       nn->track_reclaim_completes = true;
+       atomic_set(&nn->nr_reclaim_complete, 0);
+
+       return 0;
+}
+
+static void
+nfs4_cld_state_shutdown(struct net *net)
+{
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+
+       nn->track_reclaim_completes = false;
+       kfree(nn->reclaim_str_hashtbl);
+}
+
+static bool
+cld_running(struct nfsd_net *nn)
+{
+       struct cld_net *cn = nn->cld_net;
+       struct rpc_pipe *pipe = cn->cn_pipe;
+
+       return pipe->nreaders || pipe->nwriters;
+}
+
+static int
+nfsd4_cld_tracking_init(struct net *net)
+{
+       int status;
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+       bool running;
+       int retries = 10;
+
+       status = nfs4_cld_state_init(net);
+       if (status)
+               return status;
+
+       status = __nfsd4_init_cld_pipe(net);
+       if (status)
+               goto err_shutdown;
+
+       /*
+        * rpc pipe upcalls take 30 seconds to time out, so we don't want to
+        * queue an upcall unless we know that nfsdcld is running (because we
+        * want this to fail fast so that nfsd4_client_tracking_init() can try
+        * the next client tracking method).  nfsdcld should already be running
+        * before nfsd is started, so the wait here is for nfsdcld to open the
+        * pipefs file we just created.
+        */
+       while (!(running = cld_running(nn)) && retries--)
+               msleep(100);
+
+       if (!running) {
+               status = -ETIMEDOUT;
+               goto err_remove;
+       }
+
+       status = nfsd4_cld_grace_start(nn);
+       if (status) {
+               if (status == -EOPNOTSUPP)
+                       printk(KERN_WARNING "NFSD: Please upgrade nfsdcld.\n");
+               nfs4_release_reclaim(nn);
+               goto err_remove;
+       } else
+               printk("NFSD: Using nfsdcld client tracking operations.\n");
+       return 0;
+
+err_remove:
+       nfsd4_remove_cld_pipe(net);
+err_shutdown:
+       nfs4_cld_state_shutdown(net);
+       return status;
+}
+
+static void
+nfsd4_cld_tracking_exit(struct net *net)
+{
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+
+       nfs4_release_reclaim(nn);
+       nfsd4_remove_cld_pipe(net);
+       nfs4_cld_state_shutdown(net);
+}
+
+/* For older nfsdcld's */
+static const struct nfsd4_client_tracking_ops nfsd4_cld_tracking_ops_v0 = {
        .init           = nfsd4_init_cld_pipe,
        .exit           = nfsd4_remove_cld_pipe,
        .create         = nfsd4_cld_create,
        .remove         = nfsd4_cld_remove,
+       .check          = nfsd4_cld_check_v0,
+       .grace_done     = nfsd4_cld_grace_done_v0,
+};
+
+/* For newer nfsdcld's */
+static const struct nfsd4_client_tracking_ops nfsd4_cld_tracking_ops = {
+       .init           = nfsd4_cld_tracking_init,
+       .exit           = nfsd4_cld_tracking_exit,
+       .create         = nfsd4_cld_create,
+       .remove         = nfsd4_cld_remove,
        .check          = nfsd4_cld_check,
        .grace_done     = nfsd4_cld_grace_done,
 };
@@ -1267,6 +1622,8 @@ nfsd4_umh_cltrack_init(struct net *net)
 
        ret = nfsd4_umh_cltrack_upcall("init", NULL, grace_start, NULL);
        kfree(grace_start);
+       if (!ret)
+               printk("NFSD: Using UMH upcall client tracking operations.\n");
        return ret;
 }
 
@@ -1416,9 +1773,20 @@ nfsd4_client_tracking_init(struct net *net)
        if (nn->client_tracking_ops)
                goto do_init;
 
+       /* First, try to use nfsdcld */
+       nn->client_tracking_ops = &nfsd4_cld_tracking_ops;
+       status = nn->client_tracking_ops->init(net);
+       if (!status)
+               return status;
+       if (status != -ETIMEDOUT) {
+               nn->client_tracking_ops = &nfsd4_cld_tracking_ops_v0;
+               status = nn->client_tracking_ops->init(net);
+               if (!status)
+                       return status;
+       }
+
        /*
-        * First, try a UMH upcall. It should succeed or fail quickly, so
-        * there's little harm in trying that first.
+        * Next, try the UMH upcall.
         */
        nn->client_tracking_ops = &nfsd4_umh_tracking_ops;
        status = nn->client_tracking_ops->init(net);
@@ -1426,25 +1794,23 @@ nfsd4_client_tracking_init(struct net *net)
                return status;
 
        /*
-        * See if the recoverydir exists and is a directory. If it is,
-        * then use the legacy ops.
+        * Finally, See if the recoverydir exists and is a directory.
+        * If it is, then use the legacy ops.
         */
        nn->client_tracking_ops = &nfsd4_legacy_tracking_ops;
        status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path);
        if (!status) {
                status = d_is_dir(path.dentry);
                path_put(&path);
-               if (status)
-                       goto do_init;
+               if (!status) {
+                       status = -EINVAL;
+                       goto out;
+               }
        }
 
-       /* Finally, try to use nfsdcld */
-       nn->client_tracking_ops = &nfsd4_cld_tracking_ops;
-       printk(KERN_WARNING "NFSD: the nfsdcld client tracking upcall will be "
-                       "removed in 3.10. Please transition to using "
-                       "nfsdcltrack.\n");
 do_init:
        status = nn->client_tracking_ops->init(net);
+out:
        if (status) {
                printk(KERN_WARNING "NFSD: Unable to initialize client "
                                    "recovery tracking! (%d)\n", status);
index eca4a23..618e660 100644 (file)
@@ -77,6 +77,7 @@ static u64 current_sessionid = 1;
 /* forward declarations */
 static bool check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner);
 static void nfs4_free_ol_stateid(struct nfs4_stid *stid);
+void nfsd4_end_grace(struct nfsd_net *nn);
 
 /* Locking: */
 
@@ -1067,9 +1068,9 @@ static unsigned int clientid_hashval(u32 id)
        return id & CLIENT_HASH_MASK;
 }
 
-static unsigned int clientstr_hashval(const char *name)
+static unsigned int clientstr_hashval(struct xdr_netobj name)
 {
-       return opaque_hashval(name, 8) & CLIENT_HASH_MASK;
+       return opaque_hashval(name.data, 8) & CLIENT_HASH_MASK;
 }
 
 /*
@@ -1997,6 +1998,22 @@ destroy_client(struct nfs4_client *clp)
        __destroy_client(clp);
 }
 
+static void inc_reclaim_complete(struct nfs4_client *clp)
+{
+       struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+
+       if (!nn->track_reclaim_completes)
+               return;
+       if (!nfsd4_find_reclaim_client(clp->cl_name, nn))
+               return;
+       if (atomic_inc_return(&nn->nr_reclaim_complete) ==
+                       nn->reclaim_str_hashtbl_size) {
+               printk(KERN_INFO "NFSD: all clients done reclaiming, ending NFSv4 grace period (net %x)\n",
+                               clp->net->ns.inum);
+               nfsd4_end_grace(nn);
+       }
+}
+
 static void expire_client(struct nfs4_client *clp)
 {
        unhash_client(clp);
@@ -2048,11 +2065,6 @@ compare_blob(const struct xdr_netobj *o1, const struct xdr_netobj *o2)
        return memcmp(o1->data, o2->data, o1->len);
 }
 
-static int same_name(const char *n1, const char *n2)
-{
-       return 0 == memcmp(n1, n2, HEXDIR_LEN);
-}
-
 static int
 same_verf(nfs4_verifier *v1, nfs4_verifier *v2)
 {
@@ -3354,6 +3366,7 @@ nfsd4_reclaim_complete(struct svc_rqst *rqstp,
 
        status = nfs_ok;
        nfsd4_client_record_create(cstate->session->se_client);
+       inc_reclaim_complete(cstate->session->se_client);
 out:
        return status;
 }
@@ -3958,6 +3971,9 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
        switch (task->tk_status) {
        case 0:
                return 1;
+       case -NFS4ERR_DELAY:
+               rpc_delay(task, 2 * HZ);
+               return 0;
        case -EBADHANDLE:
        case -NFS4ERR_BAD_STATEID:
                /*
@@ -3970,7 +3986,7 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
                }
                /*FALLTHRU*/
        default:
-               return -1;
+               return 1;
        }
 }
 
@@ -4713,7 +4729,6 @@ nfsd4_end_grace(struct nfsd_net *nn)
        if (nn->grace_ended)
                return;
 
-       dprintk("NFSD: end of grace period\n");
        nn->grace_ended = true;
        /*
         * If the server goes down again right now, an NFSv4
@@ -4749,6 +4764,10 @@ static bool clients_still_reclaiming(struct nfsd_net *nn)
        unsigned long double_grace_period_end = nn->boot_time +
                                                2 * nn->nfsd4_lease;
 
+       if (nn->track_reclaim_completes &&
+                       atomic_read(&nn->nr_reclaim_complete) ==
+                       nn->reclaim_str_hashtbl_size)
+               return false;
        if (!nn->somebody_reclaimed)
                return false;
        nn->somebody_reclaimed = false;
@@ -4779,6 +4798,7 @@ nfs4_laundromat(struct nfsd_net *nn)
                new_timeo = 0;
                goto out;
        }
+       dprintk("NFSD: end of grace period\n");
        nfsd4_end_grace(nn);
        INIT_LIST_HEAD(&reaplist);
        spin_lock(&nn->client_lock);
@@ -6458,7 +6478,7 @@ alloc_reclaim(void)
 }
 
 bool
-nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn)
+nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn)
 {
        struct nfs4_client_reclaim *crp;
 
@@ -6468,20 +6488,24 @@ nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn)
 
 /*
  * failure => all reset bets are off, nfserr_no_grace...
+ *
+ * The caller is responsible for freeing name.data if NULL is returned (it
+ * will be freed in nfs4_remove_reclaim_record in the normal case).
  */
 struct nfs4_client_reclaim *
-nfs4_client_to_reclaim(const char *name, struct nfsd_net *nn)
+nfs4_client_to_reclaim(struct xdr_netobj name, struct nfsd_net *nn)
 {
        unsigned int strhashval;
        struct nfs4_client_reclaim *crp;
 
-       dprintk("NFSD nfs4_client_to_reclaim NAME: %.*s\n", HEXDIR_LEN, name);
+       dprintk("NFSD nfs4_client_to_reclaim NAME: %.*s\n", name.len, name.data);
        crp = alloc_reclaim();
        if (crp) {
                strhashval = clientstr_hashval(name);
                INIT_LIST_HEAD(&crp->cr_strhash);
                list_add(&crp->cr_strhash, &nn->reclaim_str_hashtbl[strhashval]);
-               memcpy(crp->cr_recdir, name, HEXDIR_LEN);
+               crp->cr_name.data = name.data;
+               crp->cr_name.len = name.len;
                crp->cr_clp = NULL;
                nn->reclaim_str_hashtbl_size++;
        }
@@ -6492,6 +6516,7 @@ void
 nfs4_remove_reclaim_record(struct nfs4_client_reclaim *crp, struct nfsd_net *nn)
 {
        list_del(&crp->cr_strhash);
+       kfree(crp->cr_name.data);
        kfree(crp);
        nn->reclaim_str_hashtbl_size--;
 }
@@ -6515,16 +6540,16 @@ nfs4_release_reclaim(struct nfsd_net *nn)
 /*
  * called from OPEN, CLAIM_PREVIOUS with a new clientid. */
 struct nfs4_client_reclaim *
-nfsd4_find_reclaim_client(const char *recdir, struct nfsd_net *nn)
+nfsd4_find_reclaim_client(struct xdr_netobj name, struct nfsd_net *nn)
 {
        unsigned int strhashval;
        struct nfs4_client_reclaim *crp = NULL;
 
-       dprintk("NFSD: nfs4_find_reclaim_client for recdir %s\n", recdir);
+       dprintk("NFSD: nfs4_find_reclaim_client for name %.*s\n", name.len, name.data);
 
-       strhashval = clientstr_hashval(recdir);
+       strhashval = clientstr_hashval(name);
        list_for_each_entry(crp, &nn->reclaim_str_hashtbl[strhashval], cr_strhash) {
-               if (same_name(crp->cr_recdir, recdir)) {
+               if (compare_blob(&crp->cr_name, &name) == 0) {
                        return crp;
                }
        }
@@ -7262,10 +7287,19 @@ nfs4_state_start_net(struct net *net)
                return ret;
        locks_start_grace(net, &nn->nfsd4_manager);
        nfsd4_client_tracking_init(net);
+       if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0)
+               goto skip_grace;
        printk(KERN_INFO "NFSD: starting %ld-second grace period (net %x)\n",
               nn->nfsd4_grace, net->ns.inum);
        queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
        return 0;
+
+skip_grace:
+       printk(KERN_INFO "NFSD: no clients to reclaim, skipping NFSv4 grace period (net %x)\n",
+                       net->ns.inum);
+       queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_lease * HZ);
+       nfsd4_end_grace(nn);
+       return 0;
 }
 
 /* initialization to perform when the nfsd service is started: */
index 3de42a7..52c4f6d 100644 (file)
@@ -521,6 +521,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access
 static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_cb_sec *cbs)
 {
        DECODE_HEAD;
+       struct user_namespace *userns = nfsd_user_namespace(argp->rqstp);
        u32 dummy, uid, gid;
        char *machine_name;
        int i;
@@ -563,8 +564,8 @@ static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_
                        dummy = be32_to_cpup(p++);
                        READ_BUF(dummy * 4);
                        if (cbs->flavor == (u32)(-1)) {
-                               kuid_t kuid = make_kuid(&init_user_ns, uid);
-                               kgid_t kgid = make_kgid(&init_user_ns, gid);
+                               kuid_t kuid = make_kuid(userns, uid);
+                               kgid_t kgid = make_kgid(userns, gid);
                                if (uid_valid(kuid) && gid_valid(kgid)) {
                                        cbs->uid = kuid;
                                        cbs->gid = kgid;
@@ -2420,8 +2421,10 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
        __be32 status;
        int err;
        struct nfs4_acl *acl = NULL;
+#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
        void *context = NULL;
        int contextlen;
+#endif
        bool contextsupport = false;
        struct nfsd4_compoundres *resp = rqstp->rq_resp;
        u32 minorversion = resp->cstate.minorversion;
@@ -2906,12 +2909,14 @@ out_acl:
                        *p++ = cpu_to_be32(NFS4_CHANGE_TYPE_IS_TIME_METADATA);
        }
 
+#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
        if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) {
                status = nfsd4_encode_security_label(xdr, rqstp, context,
                                                                contextlen);
                if (status)
                        goto out;
        }
+#endif
 
        attrlen = htonl(xdr->buf->len - attrlen_offset - 4);
        write_bytes_to_xdr_buf(xdr->buf, attrlen_offset, &attrlen, 4);
index f2feb2d..62c58cf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Syscall interface to knfsd.
  *
@@ -439,7 +440,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
                        return rv;
                if (newthreads < 0)
                        return -EINVAL;
-               rv = nfsd_svc(newthreads, net);
+               rv = nfsd_svc(newthreads, net, file->f_cred);
                if (rv < 0)
                        return rv;
        } else
@@ -537,14 +538,14 @@ out_free:
 }
 
 static ssize_t
-nfsd_print_version_support(char *buf, int remaining, const char *sep,
-               unsigned vers, int minor)
+nfsd_print_version_support(struct nfsd_net *nn, char *buf, int remaining,
+               const char *sep, unsigned vers, int minor)
 {
        const char *format = minor < 0 ? "%s%c%u" : "%s%c%u.%u";
-       bool supported = !!nfsd_vers(vers, NFSD_TEST);
+       bool supported = !!nfsd_vers(nn, vers, NFSD_TEST);
 
        if (vers == 4 && minor >= 0 &&
-           !nfsd_minorversion(minor, NFSD_TEST))
+           !nfsd_minorversion(nn, minor, NFSD_TEST))
                supported = false;
        if (minor == 0 && supported)
                /*
@@ -599,20 +600,20 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
                        switch(num) {
                        case 2:
                        case 3:
-                               nfsd_vers(num, cmd);
+                               nfsd_vers(nn, num, cmd);
                                break;
                        case 4:
                                if (*minorp == '.') {
-                                       if (nfsd_minorversion(minor, cmd) < 0)
+                                       if (nfsd_minorversion(nn, minor, cmd) < 0)
                                                return -EINVAL;
-                               } else if ((cmd == NFSD_SET) != nfsd_vers(num, NFSD_TEST)) {
+                               } else if ((cmd == NFSD_SET) != nfsd_vers(nn, num, NFSD_TEST)) {
                                        /*
                                         * Either we have +4 and no minors are enabled,
                                         * or we have -4 and at least one minor is enabled.
                                         * In either case, propagate 'cmd' to all minors.
                                         */
                                        minor = 0;
-                                       while (nfsd_minorversion(minor, cmd) >= 0)
+                                       while (nfsd_minorversion(nn, minor, cmd) >= 0)
                                                minor++;
                                }
                                break;
@@ -624,7 +625,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
                /* If all get turned off, turn them back on, as
                 * having no versions is BAD
                 */
-               nfsd_reset_versions();
+               nfsd_reset_versions(nn);
        }
 
        /* Now write current state into reply buffer */
@@ -633,12 +634,12 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
        remaining = SIMPLE_TRANSACTION_LIMIT;
        for (num=2 ; num <= 4 ; num++) {
                int minor;
-               if (!nfsd_vers(num, NFSD_AVAIL))
+               if (!nfsd_vers(nn, num, NFSD_AVAIL))
                        continue;
 
                minor = -1;
                do {
-                       len = nfsd_print_version_support(buf, remaining,
+                       len = nfsd_print_version_support(nn, buf, remaining,
                                        sep, num, minor);
                        if (len >= remaining)
                                goto out;
@@ -717,7 +718,7 @@ static ssize_t __write_ports_names(char *buf, struct net *net)
  * a socket of a supported family/protocol, and we use it as an
  * nfsd listener.
  */
-static ssize_t __write_ports_addfd(char *buf, struct net *net)
+static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred *cred)
 {
        char *mesg = buf;
        int fd, err;
@@ -736,7 +737,7 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net)
        if (err != 0)
                return err;
 
-       err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
+       err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
        if (err < 0) {
                nfsd_destroy(net);
                return err;
@@ -751,7 +752,7 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net)
  * A transport listener is added by writing it's transport name and
  * a port number.
  */
-static ssize_t __write_ports_addxprt(char *buf, struct net *net)
+static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cred *cred)
 {
        char transport[16];
        struct svc_xprt *xprt;
@@ -769,12 +770,12 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net)
                return err;
 
        err = svc_create_xprt(nn->nfsd_serv, transport, net,
-                               PF_INET, port, SVC_SOCK_ANONYMOUS);
+                               PF_INET, port, SVC_SOCK_ANONYMOUS, cred);
        if (err < 0)
                goto out_err;
 
        err = svc_create_xprt(nn->nfsd_serv, transport, net,
-                               PF_INET6, port, SVC_SOCK_ANONYMOUS);
+                               PF_INET6, port, SVC_SOCK_ANONYMOUS, cred);
        if (err < 0 && err != -EAFNOSUPPORT)
                goto out_close;
 
@@ -799,10 +800,10 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size,
                return __write_ports_names(buf, net);
 
        if (isdigit(buf[0]))
-               return __write_ports_addfd(buf, net);
+               return __write_ports_addfd(buf, net, file->f_cred);
 
        if (isalpha(buf[0]))
-               return __write_ports_addxprt(buf, net);
+               return __write_ports_addxprt(buf, net, file->f_cred);
 
        return -EINVAL;
 }
@@ -1239,9 +1240,12 @@ static __net_init int nfsd_init_net(struct net *net)
        retval = nfsd_idmap_init(net);
        if (retval)
                goto out_idmap_error;
+       nn->nfsd_versions = NULL;
+       nn->nfsd4_minorversions = NULL;
        nn->nfsd4_lease = 90;   /* default lease time */
        nn->nfsd4_grace = 90;
        nn->somebody_reclaimed = false;
+       nn->track_reclaim_completes = false;
        nn->clverifier_counter = prandom_u32();
        nn->clientid_counter = prandom_u32();
        nn->s2s_cp_cl_id = nn->clientid_counter++;
@@ -1260,6 +1264,7 @@ static __net_exit void nfsd_exit_net(struct net *net)
 {
        nfsd_idmap_shutdown(net);
        nfsd_export_shutdown(net);
+       nfsd_netns_free_versions(net_generic(net, nfsd_net_id));
 }
 
 static struct pernet_operations nfsd_net_ops = {
index 0668999..24187b5 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/nfs3.h>
 #include <linux/nfs4.h>
 #include <linux/sunrpc/svc.h>
+#include <linux/sunrpc/svc_xprt.h>
 #include <linux/sunrpc/msg_prot.h>
 
 #include <uapi/linux/nfsd/debug.h>
@@ -73,7 +74,7 @@ extern const struct seq_operations nfs_exports_op;
 /*
  * Function prototypes.
  */
-int            nfsd_svc(int nrservs, struct net *net);
+int            nfsd_svc(int nrservs, struct net *net, const struct cred *cred);
 int            nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
 
 int            nfsd_nrthreads(struct net *);
@@ -98,10 +99,12 @@ extern const struct svc_version nfsd_acl_version3;
 #endif
 #endif
 
+struct nfsd_net;
+
 enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
-int nfsd_vers(int vers, enum vers_op change);
-int nfsd_minorversion(u32 minorversion, enum vers_op change);
-void nfsd_reset_versions(void);
+int nfsd_vers(struct nfsd_net *nn, int vers, enum vers_op change);
+int nfsd_minorversion(struct nfsd_net *nn, u32 minorversion, enum vers_op change);
+void nfsd_reset_versions(struct nfsd_net *nn);
 int nfsd_create_serv(struct net *net);
 
 extern int nfsd_max_blksize;
@@ -110,6 +113,12 @@ static inline int nfsd_v4client(struct svc_rqst *rq)
 {
        return rq->rq_prog == NFS_PROGRAM && rq->rq_vers == 4;
 }
+static inline struct user_namespace *
+nfsd_user_namespace(const struct svc_rqst *rqstp)
+{
+       const struct cred *cred = rqstp->rq_xprt->xpt_cred;
+       return cred ? cred->user_ns : &init_user_ns;
+}
 
 /* 
  * NFSv4 State
index 89cb484..18d94ea 100644 (file)
 
 extern struct svc_program      nfsd_program;
 static int                     nfsd(void *vrqstp);
+#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
+static int                     nfsd_acl_rpcbind_set(struct net *,
+                                                    const struct svc_program *,
+                                                    u32, int,
+                                                    unsigned short,
+                                                    unsigned short);
+static __be32                  nfsd_acl_init_request(struct svc_rqst *,
+                                               const struct svc_program *,
+                                               struct svc_process_info *);
+#endif
+static int                     nfsd_rpcbind_set(struct net *,
+                                                const struct svc_program *,
+                                                u32, int,
+                                                unsigned short,
+                                                unsigned short);
+static __be32                  nfsd_init_request(struct svc_rqst *,
+                                               const struct svc_program *,
+                                               struct svc_process_info *);
 
 /*
  * nfsd_mutex protects nn->nfsd_serv -- both the pointer itself and the members
@@ -86,6 +104,8 @@ static struct svc_program    nfsd_acl_program = {
        .pg_class               = "nfsd",
        .pg_stats               = &nfsd_acl_svcstats,
        .pg_authenticate        = &svc_set_client,
+       .pg_init_request        = nfsd_acl_init_request,
+       .pg_rpcbind_set         = nfsd_acl_rpcbind_set,
 };
 
 static struct svc_stat nfsd_acl_svcstats = {
@@ -105,7 +125,6 @@ static const struct svc_version *nfsd_version[] = {
 
 #define NFSD_MINVERS           2
 #define NFSD_NRVERS            ARRAY_SIZE(nfsd_version)
-static const struct svc_version *nfsd_versions[NFSD_NRVERS];
 
 struct svc_program             nfsd_program = {
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -113,77 +132,136 @@ struct svc_program               nfsd_program = {
 #endif
        .pg_prog                = NFS_PROGRAM,          /* program number */
        .pg_nvers               = NFSD_NRVERS,          /* nr of entries in nfsd_version */
-       .pg_vers                = nfsd_versions,        /* version table */
+       .pg_vers                = nfsd_version        /* version table */
        .pg_name                = "nfsd",               /* program name */
        .pg_class               = "nfsd",               /* authentication class */
        .pg_stats               = &nfsd_svcstats,       /* version table */
        .pg_authenticate        = &svc_set_client,      /* export authentication */
-
+       .pg_init_request        = nfsd_init_request,
+       .pg_rpcbind_set         = nfsd_rpcbind_set,
 };
 
-static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
-       [0] = 1,
-       [1] = 1,
-       [2] = 1,
-};
+static bool
+nfsd_support_version(int vers)
+{
+       if (vers >= NFSD_MINVERS && vers < NFSD_NRVERS)
+               return nfsd_version[vers] != NULL;
+       return false;
+}
+
+static bool *
+nfsd_alloc_versions(void)
+{
+       bool *vers = kmalloc_array(NFSD_NRVERS, sizeof(bool), GFP_KERNEL);
+       unsigned i;
+
+       if (vers) {
+               /* All compiled versions are enabled by default */
+               for (i = 0; i < NFSD_NRVERS; i++)
+                       vers[i] = nfsd_support_version(i);
+       }
+       return vers;
+}
+
+static bool *
+nfsd_alloc_minorversions(void)
+{
+       bool *vers = kmalloc_array(NFSD_SUPPORTED_MINOR_VERSION + 1,
+                       sizeof(bool), GFP_KERNEL);
+       unsigned i;
+
+       if (vers) {
+               /* All minor versions are enabled by default */
+               for (i = 0; i <= NFSD_SUPPORTED_MINOR_VERSION; i++)
+                       vers[i] = nfsd_support_version(4);
+       }
+       return vers;
+}
 
-int nfsd_vers(int vers, enum vers_op change)
+void
+nfsd_netns_free_versions(struct nfsd_net *nn)
+{
+       kfree(nn->nfsd_versions);
+       kfree(nn->nfsd4_minorversions);
+       nn->nfsd_versions = NULL;
+       nn->nfsd4_minorversions = NULL;
+}
+
+static void
+nfsd_netns_init_versions(struct nfsd_net *nn)
+{
+       if (!nn->nfsd_versions) {
+               nn->nfsd_versions = nfsd_alloc_versions();
+               nn->nfsd4_minorversions = nfsd_alloc_minorversions();
+               if (!nn->nfsd_versions || !nn->nfsd4_minorversions)
+                       nfsd_netns_free_versions(nn);
+       }
+}
+
+int nfsd_vers(struct nfsd_net *nn, int vers, enum vers_op change)
 {
        if (vers < NFSD_MINVERS || vers >= NFSD_NRVERS)
                return 0;
        switch(change) {
        case NFSD_SET:
-               nfsd_versions[vers] = nfsd_version[vers];
-#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
-               if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_versions[vers] = nfsd_acl_version[vers];
-#endif
+               if (nn->nfsd_versions)
+                       nn->nfsd_versions[vers] = nfsd_support_version(vers);
                break;
        case NFSD_CLEAR:
-               nfsd_versions[vers] = NULL;
-#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
-               if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_versions[vers] = NULL;
-#endif
+               nfsd_netns_init_versions(nn);
+               if (nn->nfsd_versions)
+                       nn->nfsd_versions[vers] = false;
                break;
        case NFSD_TEST:
-               return nfsd_versions[vers] != NULL;
+               if (nn->nfsd_versions)
+                       return nn->nfsd_versions[vers];
+               /* Fallthrough */
        case NFSD_AVAIL:
-               return nfsd_version[vers] != NULL;
+               return nfsd_support_version(vers);
        }
        return 0;
 }
 
 static void
-nfsd_adjust_nfsd_versions4(void)
+nfsd_adjust_nfsd_versions4(struct nfsd_net *nn)
 {
        unsigned i;
 
        for (i = 0; i <= NFSD_SUPPORTED_MINOR_VERSION; i++) {
-               if (nfsd_supported_minorversions[i])
+               if (nn->nfsd4_minorversions[i])
                        return;
        }
-       nfsd_vers(4, NFSD_CLEAR);
+       nfsd_vers(nn, 4, NFSD_CLEAR);
 }
 
-int nfsd_minorversion(u32 minorversion, enum vers_op change)
+int nfsd_minorversion(struct nfsd_net *nn, u32 minorversion, enum vers_op change)
 {
        if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
            change != NFSD_AVAIL)
                return -1;
+
        switch(change) {
        case NFSD_SET:
-               nfsd_supported_minorversions[minorversion] = true;
-               nfsd_vers(4, NFSD_SET);
+               if (nn->nfsd4_minorversions) {
+                       nfsd_vers(nn, 4, NFSD_SET);
+                       nn->nfsd4_minorversions[minorversion] =
+                               nfsd_vers(nn, 4, NFSD_TEST);
+               }
                break;
        case NFSD_CLEAR:
-               nfsd_supported_minorversions[minorversion] = false;
-               nfsd_adjust_nfsd_versions4();
+               nfsd_netns_init_versions(nn);
+               if (nn->nfsd4_minorversions) {
+                       nn->nfsd4_minorversions[minorversion] = false;
+                       nfsd_adjust_nfsd_versions4(nn);
+               }
                break;
        case NFSD_TEST:
-               return nfsd_supported_minorversions[minorversion];
+               if (nn->nfsd4_minorversions)
+                       return nn->nfsd4_minorversions[minorversion];
+               return nfsd_vers(nn, 4, NFSD_TEST);
        case NFSD_AVAIL:
-               return minorversion <= NFSD_SUPPORTED_MINOR_VERSION;
+               return minorversion <= NFSD_SUPPORTED_MINOR_VERSION &&
+                       nfsd_vers(nn, 4, NFSD_AVAIL);
        }
        return 0;
 }
@@ -205,7 +283,7 @@ int nfsd_nrthreads(struct net *net)
        return rv;
 }
 
-static int nfsd_init_socks(struct net *net)
+static int nfsd_init_socks(struct net *net, const struct cred *cred)
 {
        int error;
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
@@ -214,12 +292,12 @@ static int nfsd_init_socks(struct net *net)
                return 0;
 
        error = svc_create_xprt(nn->nfsd_serv, "udp", net, PF_INET, NFS_PORT,
-                                       SVC_SOCK_DEFAULTS);
+                                       SVC_SOCK_DEFAULTS, cred);
        if (error < 0)
                return error;
 
        error = svc_create_xprt(nn->nfsd_serv, "tcp", net, PF_INET, NFS_PORT,
-                                       SVC_SOCK_DEFAULTS);
+                                       SVC_SOCK_DEFAULTS, cred);
        if (error < 0)
                return error;
 
@@ -265,16 +343,12 @@ static void nfsd_shutdown_generic(void)
        nfsd_racache_shutdown();
 }
 
-static bool nfsd_needs_lockd(void)
+static bool nfsd_needs_lockd(struct nfsd_net *nn)
 {
-#if defined(CONFIG_NFSD_V3)
-       return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);
-#else
-       return (nfsd_versions[2] != NULL);
-#endif
+       return nfsd_vers(nn, 2, NFSD_TEST) || nfsd_vers(nn, 3, NFSD_TEST);
 }
 
-static int nfsd_startup_net(int nrservs, struct net *net)
+static int nfsd_startup_net(int nrservs, struct net *net, const struct cred *cred)
 {
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
        int ret;
@@ -285,12 +359,12 @@ static int nfsd_startup_net(int nrservs, struct net *net)
        ret = nfsd_startup_generic(nrservs);
        if (ret)
                return ret;
-       ret = nfsd_init_socks(net);
+       ret = nfsd_init_socks(net, cred);
        if (ret)
                goto out_socks;
 
-       if (nfsd_needs_lockd() && !nn->lockd_up) {
-               ret = lockd_up(net);
+       if (nfsd_needs_lockd(nn) && !nn->lockd_up) {
+               ret = lockd_up(net, cred);
                if (ret)
                        goto out_socks;
                nn->lockd_up = 1;
@@ -422,20 +496,20 @@ static void nfsd_last_thread(struct svc_serv *serv, struct net *net)
        nfsd_export_flush(net);
 }
 
-void nfsd_reset_versions(void)
+void nfsd_reset_versions(struct nfsd_net *nn)
 {
        int i;
 
        for (i = 0; i < NFSD_NRVERS; i++)
-               if (nfsd_vers(i, NFSD_TEST))
+               if (nfsd_vers(nn, i, NFSD_TEST))
                        return;
 
        for (i = 0; i < NFSD_NRVERS; i++)
                if (i != 4)
-                       nfsd_vers(i, NFSD_SET);
+                       nfsd_vers(nn, i, NFSD_SET);
                else {
                        int minor = 0;
-                       while (nfsd_minorversion(minor, NFSD_SET) >= 0)
+                       while (nfsd_minorversion(nn, minor, NFSD_SET) >= 0)
                                minor++;
                }
 }
@@ -503,7 +577,7 @@ int nfsd_create_serv(struct net *net)
        }
        if (nfsd_max_blksize == 0)
                nfsd_max_blksize = nfsd_get_default_max_blksize();
-       nfsd_reset_versions();
+       nfsd_reset_versions(nn);
        nn->nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
                                                &nfsd_thread_sv_ops);
        if (nn->nfsd_serv == NULL)
@@ -623,7 +697,7 @@ int nfsd_set_nrthreads(int n, int *nthreads, struct net *net)
  * this is the first time nrservs is nonzero.
  */
 int
-nfsd_svc(int nrservs, struct net *net)
+nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
 {
        int     error;
        bool    nfsd_up_before;
@@ -645,7 +719,7 @@ nfsd_svc(int nrservs, struct net *net)
 
        nfsd_up_before = nn->nfsd_net_up;
 
-       error = nfsd_startup_net(nrservs, net);
+       error = nfsd_startup_net(nrservs, net, cred);
        if (error)
                goto out_destroy;
        error = nn->nfsd_serv->sv_ops->svo_setup(nn->nfsd_serv,
@@ -667,6 +741,101 @@ out:
        return error;
 }
 
+#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
+static bool
+nfsd_support_acl_version(int vers)
+{
+       if (vers >= NFSD_ACL_MINVERS && vers < NFSD_ACL_NRVERS)
+               return nfsd_acl_version[vers] != NULL;
+       return false;
+}
+
+static int
+nfsd_acl_rpcbind_set(struct net *net, const struct svc_program *progp,
+                    u32 version, int family, unsigned short proto,
+                    unsigned short port)
+{
+       if (!nfsd_support_acl_version(version) ||
+           !nfsd_vers(net_generic(net, nfsd_net_id), version, NFSD_TEST))
+               return 0;
+       return svc_generic_rpcbind_set(net, progp, version, family,
+                       proto, port);
+}
+
+static __be32
+nfsd_acl_init_request(struct svc_rqst *rqstp,
+                     const struct svc_program *progp,
+                     struct svc_process_info *ret)
+{
+       struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
+       int i;
+
+       if (likely(nfsd_support_acl_version(rqstp->rq_vers) &&
+           nfsd_vers(nn, rqstp->rq_vers, NFSD_TEST)))
+               return svc_generic_init_request(rqstp, progp, ret);
+
+       ret->mismatch.lovers = NFSD_ACL_NRVERS;
+       for (i = NFSD_ACL_MINVERS; i < NFSD_ACL_NRVERS; i++) {
+               if (nfsd_support_acl_version(rqstp->rq_vers) &&
+                   nfsd_vers(nn, i, NFSD_TEST)) {
+                       ret->mismatch.lovers = i;
+                       break;
+               }
+       }
+       if (ret->mismatch.lovers == NFSD_ACL_NRVERS)
+               return rpc_prog_unavail;
+       ret->mismatch.hivers = NFSD_ACL_MINVERS;
+       for (i = NFSD_ACL_NRVERS - 1; i >= NFSD_ACL_MINVERS; i--) {
+               if (nfsd_support_acl_version(rqstp->rq_vers) &&
+                   nfsd_vers(nn, i, NFSD_TEST)) {
+                       ret->mismatch.hivers = i;
+                       break;
+               }
+       }
+       return rpc_prog_mismatch;
+}
+#endif
+
+static int
+nfsd_rpcbind_set(struct net *net, const struct svc_program *progp,
+                u32 version, int family, unsigned short proto,
+                unsigned short port)
+{
+       if (!nfsd_vers(net_generic(net, nfsd_net_id), version, NFSD_TEST))
+               return 0;
+       return svc_generic_rpcbind_set(net, progp, version, family,
+                       proto, port);
+}
+
+static __be32
+nfsd_init_request(struct svc_rqst *rqstp,
+                 const struct svc_program *progp,
+                 struct svc_process_info *ret)
+{
+       struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
+       int i;
+
+       if (likely(nfsd_vers(nn, rqstp->rq_vers, NFSD_TEST)))
+               return svc_generic_init_request(rqstp, progp, ret);
+
+       ret->mismatch.lovers = NFSD_NRVERS;
+       for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) {
+               if (nfsd_vers(nn, i, NFSD_TEST)) {
+                       ret->mismatch.lovers = i;
+                       break;
+               }
+       }
+       if (ret->mismatch.lovers == NFSD_NRVERS)
+               return rpc_prog_unavail;
+       ret->mismatch.hivers = NFSD_MINVERS;
+       for (i = NFSD_NRVERS - 1; i >= NFSD_MINVERS; i--) {
+               if (nfsd_vers(nn, i, NFSD_TEST)) {
+                       ret->mismatch.hivers = i;
+                       break;
+               }
+       }
+       return rpc_prog_mismatch;
+}
 
 /*
  * This is the NFS server kernel thread
index 6b2e8b7..b51fe51 100644 (file)
@@ -71,7 +71,7 @@ decode_filename(__be32 *p, char **namp, unsigned int *lenp)
 }
 
 static __be32 *
-decode_sattr(__be32 *p, struct iattr *iap)
+decode_sattr(__be32 *p, struct iattr *iap, struct user_namespace *userns)
 {
        u32     tmp, tmp1;
 
@@ -86,12 +86,12 @@ decode_sattr(__be32 *p, struct iattr *iap)
                iap->ia_mode = tmp;
        }
        if ((tmp = ntohl(*p++)) != (u32)-1) {
-               iap->ia_uid = make_kuid(&init_user_ns, tmp);
+               iap->ia_uid = make_kuid(userns, tmp);
                if (uid_valid(iap->ia_uid))
                        iap->ia_valid |= ATTR_UID;
        }
        if ((tmp = ntohl(*p++)) != (u32)-1) {
-               iap->ia_gid = make_kgid(&init_user_ns, tmp);
+               iap->ia_gid = make_kgid(userns, tmp);
                if (gid_valid(iap->ia_gid))
                        iap->ia_valid |= ATTR_GID;
        }
@@ -129,6 +129,7 @@ static __be32 *
 encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
             struct kstat *stat)
 {
+       struct user_namespace *userns = nfsd_user_namespace(rqstp);
        struct dentry   *dentry = fhp->fh_dentry;
        int type;
        struct timespec64 time;
@@ -139,8 +140,8 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
        *p++ = htonl(nfs_ftypes[type >> 12]);
        *p++ = htonl((u32) stat->mode);
        *p++ = htonl((u32) stat->nlink);
-       *p++ = htonl((u32) from_kuid(&init_user_ns, stat->uid));
-       *p++ = htonl((u32) from_kgid(&init_user_ns, stat->gid));
+       *p++ = htonl((u32) from_kuid_munged(userns, stat->uid));
+       *p++ = htonl((u32) from_kgid_munged(userns, stat->gid));
 
        if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
                *p++ = htonl(NFS_MAXPATHLEN);
@@ -216,7 +217,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p)
        p = decode_fh(p, &args->fh);
        if (!p)
                return 0;
-       p = decode_sattr(p, &args->attrs);
+       p = decode_sattr(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        return xdr_argsize_check(rqstp, p);
 }
@@ -319,7 +320,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p)
        if (   !(p = decode_fh(p, &args->fh))
            || !(p = decode_filename(p, &args->name, &args->len)))
                return 0;
-       p = decode_sattr(p, &args->attrs);
+       p = decode_sattr(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        return xdr_argsize_check(rqstp, p);
 }
@@ -398,7 +399,7 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p)
                        return 0;
                p += xdrlen;
        }
-       decode_sattr(p, &args->attrs);
+       decode_sattr(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        return 1;
 }
index 9d6cb24..0b74d37 100644 (file)
@@ -368,7 +368,7 @@ struct nfs4_client {
 struct nfs4_client_reclaim {
        struct list_head        cr_strhash;     /* hash by cr_name */
        struct nfs4_client      *cr_clp;        /* pointer to associated clp */
-       char                    cr_recdir[HEXDIR_LEN]; /* recover dir */
+       struct xdr_netobj       cr_name;        /* recovery dir name */
 };
 
 /* A reasonable value for REPLAY_ISIZE was estimated as follows:  
@@ -620,7 +620,7 @@ void nfs4_put_stid(struct nfs4_stid *s);
 void nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid);
 void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *);
 extern void nfs4_release_reclaim(struct nfsd_net *);
-extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
+extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(struct xdr_netobj name,
                                                        struct nfsd_net *nn);
 extern __be32 nfs4_check_open_reclaim(clientid_t *clid,
                struct nfsd4_compound_state *cstate, struct nfsd_net *nn);
@@ -635,9 +635,9 @@ extern void nfsd4_destroy_callback_queue(void);
 extern void nfsd4_shutdown_callback(struct nfs4_client *);
 extern void nfsd4_shutdown_copy(struct nfs4_client *clp);
 extern void nfsd4_prepare_cb_recall(struct nfs4_delegation *dp);
-extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name,
+extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name,
                                                        struct nfsd_net *nn);
-extern bool nfs4_has_reclaimed_state(const char *name, struct nfsd_net *nn);
+extern bool nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn);
 
 struct nfs4_file *find_file(struct knfsd_fh *fh);
 void put_nfs4_file(struct nfs4_file *fi);
index 7dc98e1..fc24ee4 100644 (file)
@@ -1786,12 +1786,12 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
        rdentry = lookup_one_len(fname, dentry, flen);
        host_err = PTR_ERR(rdentry);
        if (IS_ERR(rdentry))
-               goto out_nfserr;
+               goto out_drop_write;
 
        if (d_really_is_negative(rdentry)) {
                dput(rdentry);
-               err = nfserr_noent;
-               goto out;
+               host_err = -ENOENT;
+               goto out_drop_write;
        }
 
        if (!type)
@@ -1805,6 +1805,8 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                host_err = commit_metadata(fhp);
        dput(rdentry);
 
+out_drop_write:
+       fh_drop_write(fhp);
 out_nfserr:
        err = nfserrno(host_err);
 out:
index a7e1073..db35124 100644 (file)
@@ -120,8 +120,11 @@ void               nfsd_put_raparams(struct file *file, struct raparms *ra);
 
 static inline int fh_want_write(struct svc_fh *fh)
 {
-       int ret = mnt_want_write(fh->fh_export->ex_path.mnt);
+       int ret;
 
+       if (fh->fh_want_write)
+               return 0;
+       ret = mnt_want_write(fh->fh_export->ex_path.mnt);
        if (!ret)
                fh->fh_want_write = true;
        return ret;
index 80da8eb..254d102 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NILFS2_FS
        tristate "NILFS2 file system support"
        select CRC32
index e2ce79e..5a63303 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Native language support configuration
 #
index 2a24249..c020d26 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FSNOTIFY
        def_bool n
        select SRCU
index f9c1ca1..3df7def 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DNOTIFY
        bool "Dnotify support"
        select FSNOTIFY
index f145251..121b4dd 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DNOTIFY)          += dnotify.o
index 521dc91..8b9103f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FANOTIFY
        bool "Filesystem wide access notification"
        select FSNOTIFY
index 0999213..25ef222 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_FANOTIFY)         += fanotify.o fanotify_user.o
index 8c7cbac..4eb2ebf 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/dcache.h>
index c03b836..0391190 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <linux/list.h>
index 0161c74..6736e47 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config INOTIFY_USER
        bool "Inotify support for userspace"
        select FSNOTIFY
index a380dab..812237e 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_INOTIFY_USER)     += inotify_fsnotify.o inotify_user.o
index b251105..25eb247 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /*
index 5f3a54d..75d79d6 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /*
index f5a868c..de9fb5c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NTFS_FS
        tristate "NTFS file system support"
        select NLS
index 77a8de5..46bba20 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config OCFS2_FS
        tristate "OCFS2 file system support"
        depends on NET && SYSFS && CONFIGFS_FS
index 1aefc03..0e5b732 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_OCFS2_FS) += ocfs2_nodemanager.o
 
 ocfs2_nodemanager-objs := heartbeat.o masklog.o sys.o nodemanager.o \
index ef28544..38b2243 100644 (file)
@@ -1,7 +1,7 @@
-ccflags-y := -I$(src)/..
+# SPDX-License-Identifier: GPL-2.0-only
+ccflags-y := -I $(srctree)/$(src)/..
 
 obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o
 
 ocfs2_dlm-objs := dlmdomain.o dlmdebug.o dlmthread.o dlmrecovery.o \
        dlmmaster.o dlmast.o dlmconvert.o dlmlock.o dlmunlock.o
-
index 33431a0..a9874e4 100644 (file)
@@ -1,4 +1,5 @@
-ccflags-y := -I$(src)/..
+# SPDX-License-Identifier: GPL-2.0-only
+ccflags-y := -I $(srctree)/$(src)/..
 
 obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o
 
index b1b9a0a..42b2ec3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config OMFS_FS
        tristate "SonicBlue Optimized MPEG File System support"
        depends on BLOCK
index 8b82b63..ae16fc3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_OMFS_FS) += omfs.o
 
index 9c7d724..b5b8046 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/open.c
  *
index 4563199..843c270 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Sun Openprom filesystem routines.
 #
index 46655e4..e6cb768 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* inode.c: /proc/openprom handling routines
  *
  * Copyright (C) 1996-1999 Jakub Jelinek  (jakub@redhat.com)
index 1554c02..890c0ae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ORANGEFS_FS
        tristate "ORANGEFS (Powered by PVFS) support"
        select FS_POSIX_ACL
index 82cf8b3..4f2d7ee 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * (C) 2001 Clemson University and The University of Chicago
  *
index 2ef91be..444e2da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config OVERLAY_FS
        tristate "Overlay filesystem support"
        select EXPORTFS
index 46e1ff8..9164c58 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the overlay filesystem.
 #
index 2fd0fde..84ad1c9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2002,2003 by Andreas Gruenbacher <a.gruenbacher@computer.org>
  *
index 817c02b..62ee41b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PROC_FS
        bool "/proc file system support" if EXPERT
        default y
index b6ccb6c..9c8ca6c 100644 (file)
@@ -510,7 +510,7 @@ static ssize_t lstats_write(struct file *file, const char __user *buf,
 
        if (!task)
                return -ESRCH;
-       clear_all_latency_tracing(task);
+       clear_tsk_latency_tracing(task);
        put_task_struct(task);
 
        return count;
index e39bac9..64e9ee1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * proc/fs/generic.c --- generic routines for the proc-fs
  *
index a7b1243..76ae278 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/proc/net.c
  *
index 3fe9044..7bb96fd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     fs/proc/vmcore.c Interface for accessing the crash
  *                              dump from the system's previous life.
index 0d19d19..8f0369a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PSTORE
        tristate "Persistent store support"
        select CRYPTO if PSTORE_COMPRESS
index 5f60899..45b5b98 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QNX4FS_FS
        tristate "QNX4 file system support (read only)"
        depends on BLOCK
index 4a283b3..42d4fc2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux qnx4-filesystem routines.
 #
index 48c70aa..922d083 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * QNX4 file system, Linux implementation.
  *
index edbba5c..6a9d6bc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config QNX6FS_FS
        tristate "QNX6 file system support (read only)"
        depends on BLOCK && CRC32
index 5e6bae6..bd4e6c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux qnx4-filesystem routines.
 #
index 59cf45f..0f8b0ff 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * QNX6 file system, Linux implementation.
  *
index 4a09975..7218314 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 #  Quota configuration
 #
index bb3f59b..a6f856f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     vfsv0 quota IO operations on file
  */
index 9f2b257..c740e55 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/quota.h>
index 3c30034..53429c2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     vfsv0 quota IO operations on file
  */
index c71e65d..d1198ad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux ramfs routines.
 #
index 86e71c0..8fd54ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config REISERFS_FS
        tristate "Reiserfs support"
        select CRC32
index 32d8986..b5b26d8 100644 (file)
@@ -450,6 +450,15 @@ fail:
 
 static inline __u32 xattr_hash(const char *msg, int len)
 {
+       /*
+        * csum_partial() gives different results for little-endian and
+        * big endian hosts. Images created on little-endian hosts and
+        * mounted on big-endian hosts(and vice versa) will see csum mismatches
+        * when trying to fetch xattrs. Treating the hash as __wsum_t would
+        * lower the frequency of mismatch.  This is an endianness bug in
+        * reiserfs.  The return statement would result in a sparse warning. Do
+        * not fix the sparse warning so as to not hide a reminder of the bug.
+        */
        return csum_partial(msg, len, 0);
 }
 
index ce2d6bc..ad4c457 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ROMFS_FS
        tristate "ROM file system support"
        depends on BLOCK || MTD
index 25212dc..14cb602 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * "splice": joining two ropes together by interweaving their strands.
  *
index 1adb334..916e78f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SQUASHFS
        tristate "SquashFS 4.0 - Squashed file system support"
        depends on BLOCK
index 664ed35..4ef2c05 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/fs.h>
 #include <linux/fs_stack.h>
index b275601..b0fe1cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SYSFS
        bool "sysfs file system support" if EXPERT
        default y
index 6eff6e1..0906b9e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the sysfs virtual filesystem
 #
index 33aeb4b..d4edf7d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SYSV_FS
        tristate "System V/Xenix/V7/Coherent file system support"
        depends on BLOCK
index 7a75e70..17d12ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux SystemV/Coherent filesystem routines.
 #
index d3b2f54..d788b1d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/sysv/inode.c
  *
index 82fa35b..7c35a28 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 tracefs-objs   := inode.o
 
 obj-$(CONFIG_TRACING)  += tracefs.o
index 9da2f13..06c35c6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config UBIFS_FS
        tristate "UBIFS file system support"
        select CRC16
index 2afc8b1..3ca4196 100644 (file)
@@ -748,7 +748,7 @@ int ubifs_read_superblock(struct ubifs_info *c)
                goto out;
        }
 
-       if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) {
+       if (!IS_ENABLED(CONFIG_FS_ENCRYPTION) && c->encrypted) {
                ubifs_err(c, "file system contains encrypted files but UBIFS"
                             " was built without crypto support.");
                err = -EINVAL;
@@ -941,7 +941,7 @@ int ubifs_enable_encryption(struct ubifs_info *c)
        int err;
        struct ubifs_sb_node *sup = c->sup_node;
 
-       if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION))
+       if (!IS_ENABLED(CONFIG_FS_ENCRYPTION))
                return -EOPNOTSUPP;
 
        if (c->encrypted)
index 379b9f7..fd7f399 100644 (file)
@@ -2015,13 +2015,17 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
                    size_t size, int flags, bool check_lock);
 ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
                        size_t size);
-int ubifs_purge_xattrs(struct inode *host);
 
 #ifdef CONFIG_UBIFS_FS_XATTR
 void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum);
+int ubifs_purge_xattrs(struct inode *host);
 #else
 static inline void ubifs_evict_xattr_inode(struct ubifs_info *c,
                                           ino_t xattr_inum) { }
+static inline int ubifs_purge_xattrs(struct inode *host)
+{
+       return 0;
+}
 #endif
 
 #ifdef CONFIG_UBIFS_FS_SECURITY
index acab318..bcfed27 100644 (file)
@@ -527,7 +527,7 @@ int ubifs_purge_xattrs(struct inode *host)
                fname_name(&nm) = xent->name;
                fname_len(&nm) = le16_to_cpu(xent->nlen);
 
-               xino = ubifs_iget(c->vfs_sb, xent->inum);
+               xino = ubifs_iget(c->vfs_sb, le64_to_cpu(xent->inum));
                if (IS_ERR(xino)) {
                        err = PTR_ERR(xino);
                        ubifs_err(c, "dead directory entry '%s', error %d",
index aa41505..6848de5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config UDF_FS
        tristate "UDF file system support"
        select CRC_ITU_T
index eb880f6..63981cd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux udf-filesystem routines.
 #
index 0bf6e16..fcb4151 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config UFS_FS
        tristate "UFS file system support (read only)"
        depends on BLOCK
index ec4a6b4..042344c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux ufs filesystem routines.
 #
index 84c0c51..3d247c0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/fs/ufs/super.c
  *
index b560a87..2c27b9a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # UTF-8 normalization
 #
index 9307cf0..c737868 100644 (file)
@@ -5,29 +5,15 @@ The full set of files can be found here:
 
   http://www.unicode.org/Public/12.1.0/ucd/
 
-Note!
-
-The URL's listed below are not stable.  That's because Unicode 12.1.0
-has not been officially released yet; it is scheduled to be released
-on May 8, 2019.  We taking Unicode 12.1.0 a few weeks early because it
-contains a new Japanese character which is required in order to
-specify Japenese dates after May 1, 2019, when Crown Prince Naruhito
-ascends to the Chrysanthemum Throne.  (Isn't internationalization fun?
-The abdication of Emperor Akihito of Japan is requiring dozens of
-software packages to be updated with only a month's notice.  :-)
-
-We will update the URL's (and any needed changes to the checksums)
-after the final Unicode 12.1.0 is released.
-
 Individual source links:
 
-  https://www.unicode.org/Public/12.1.0/ucd/CaseFolding-12.1.0d2.txt
-  https://www.unicode.org/Public/12.1.0/ucd/DerivedAge-12.1.0d3.txt
-  https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedCombiningClass-12.1.0d2.txt
-  https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties-12.1.0d2.txt
-  https://www.unicode.org/Public/12.1.0/ucd/NormalizationCorrections-12.1.0d1.txt
-  https://www.unicode.org/Public/12.1.0/ucd/NormalizationTest-12.1.0d3.txt
-  https://www.unicode.org/Public/12.1.0/ucd/UnicodeData-12.1.0d2.txt
+  https://www.unicode.org/Public/12.1.0/ucd/CaseFolding.txt
+  https://www.unicode.org/Public/12.1.0/ucd/DerivedAge.txt
+  https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedCombiningClass.txt
+  https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties.txt
+  https://www.unicode.org/Public/12.1.0/ucd/NormalizationCorrections.txt
+  https://www.unicode.org/Public/12.1.0/ucd/NormalizationTest.txt
+  https://www.unicode.org/Public/12.1.0/ucd/UnicodeData.txt
 
 md5sums (verify by running "md5sum -c README.utf8data"):
 
index 20d440c..801ed6d 100644 (file)
@@ -714,6 +714,8 @@ int utf8byte(struct utf8cursor *u8c)
                        }
 
                        leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
+                       if (!leaf)
+                               return -1;
                        ccc = LEAF_CCC(leaf);
                }
 
index 0d6a6a4..90dd78f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
   File: fs/xattr.c
 
index 99af5e5..e685299 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config XFS_FS
        tristate "XFS filesystem support"
        depends on BLOCK
index 1dfc6df..9183197 100644 (file)
@@ -4,8 +4,8 @@
 # All Rights Reserved.
 #
 
-ccflags-y += -I$(src)                  # needed for trace events
-ccflags-y += -I$(src)/libxfs
+ccflags-y += -I $(srctree)/$(src)              # needed for trace events
+ccflags-y += -I $(srctree)/$(src)/libxfs
 
 ccflags-$(CONFIG_XFS_DEBUG) += -g
 
index 2a462cf..52d4375 100644 (file)
@@ -230,7 +230,7 @@ struct acpi_device_dir {
 /* Plug and Play */
 
 typedef char acpi_bus_id[8];
-typedef unsigned long acpi_bus_address;
+typedef u64 acpi_bus_address;
 typedef char acpi_device_name[40];
 typedef char acpi_device_class[20];
 
index 3b1b1d0..4a8a054 100644 (file)
@@ -12,7 +12,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20190405
+#define ACPI_CA_VERSION                 0x20190509
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
index 624b90b..3105019 100644 (file)
 
 #define ACPI_INIT_FUNCTION __init
 
+/* Use a specific bugging default separate from ACPICA */
+
+#undef ACPI_DEBUG_DEFAULT
+#define ACPI_DEBUG_DEFAULT          (ACPI_LV_INFO | ACPI_LV_REPAIR)
+
 #ifndef CONFIG_ACPI
 
 /* External globals for __KERNEL__, stubs is needed */
 #define ACPI_NO_ERROR_MESSAGES
 #undef ACPI_DEBUG_OUTPUT
 
-/* Use a specific bugging default separate from ACPICA */
-
-#undef ACPI_DEBUG_DEFAULT
-#define ACPI_DEBUG_DEFAULT          (ACPI_LV_INFO | ACPI_LV_REPAIR)
-
 /* External interface for __KERNEL__, stub is needed */
 
 #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
index 8ac4e68..6736ed2 100644 (file)
@@ -18,7 +18,6 @@ static inline void arch_exit_mmap(struct mm_struct *mm)
 }
 
 static inline void arch_unmap(struct mm_struct *mm,
-                       struct vm_area_struct *vma,
                        unsigned long start, unsigned long end)
 {
 }
diff --git a/include/asm-generic/segment.h b/include/asm-generic/segment.h
deleted file mode 100644 (file)
index 5580eac..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ASM_GENERIC_SEGMENT_H
-#define __ASM_GENERIC_SEGMENT_H
-/*
- * Only here because we have some old header files that expect it...
- *
- * New architectures probably don't want to have their own version.
- */
-
-#endif /* __ASM_GENERIC_SEGMENT_H */
index 8b78c0b..b8f9035 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __ASM_GENERIC_SHMPARAM_H
 #define __ASM_GENERIC_SHMPARAM_H
 
diff --git a/include/asm-generic/sizes.h b/include/asm-generic/sizes.h
deleted file mode 100644 (file)
index 1dcfad9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is a placeholder, to be removed over time */
-#include <linux/sizes.h>
index b3d2241..e935318 100644 (file)
@@ -9,7 +9,63 @@
  */
 #include <linux/string.h>
 
-#include <asm/segment.h>
+#ifdef CONFIG_UACCESS_MEMCPY
+static inline __must_check unsigned long
+raw_copy_from_user(void *to, const void __user * from, unsigned long n)
+{
+       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
+               }
+       }
+
+       memcpy(to, (const void __force *)from, n);
+       return 0;
+}
+
+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;
+}
+#define INLINE_COPY_FROM_USER
+#define INLINE_COPY_TO_USER
+#endif /* CONFIG_UACCESS_MEMCPY */
 
 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
 
index d21bea2..d6702b4 100644 (file)
@@ -150,7 +150,13 @@ struct shash_desc {
 };
 
 #define HASH_MAX_DIGESTSIZE     64
-#define HASH_MAX_DESCSIZE      360
+
+/*
+ * Worst case is hmac(sha3-224-generic).  Its context is a nested 'shash_desc'
+ * containing a 'struct sha3_state'.
+ */
+#define HASH_MAX_DESCSIZE      (sizeof(struct shash_desc) + 360)
+
 #define HASH_MAX_STATESIZE     512
 
 #define SHASH_DESC_ON_STACK(shash, ctx)                                  \
index ed30da2..38b5554 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * This header provides constants for AT91 pmc status.
  *
  * The constants defined in this header are being used in dts.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef _DT_BINDINGS_CLK_AT91_H
index 5ba51b8..ccea1ba 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __DTS_HI3516CV300_CLOCK_H
index 14f4d21..4335410 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2015 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __DTS_HI3519_CLOCK_H
index 21b9d0e..f9dc6f6 100644 (file)
@@ -1,24 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2012-2013 Hisilicon Limited.
  * Copyright (c) 2012-2013 Linaro Limited.
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
  *        Xin Li <li.xin@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #ifndef __DTS_HI3620_CLOCK_H
index 695e61c..088d70c 100644 (file)
@@ -1,23 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2013-2014 Hisilicon Limited.
  * Copyright (c) 2013-2014 Linaro Limited.
  *
  * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 #ifndef __DTS_HIP04_CLOCK_H
index 136de24..e64e577 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2016 HiSilicon Technologies Co., Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __DTS_HISTB_CLOCK_H
similarity index 85%
rename from include/dt-bindings/clock/xlnx,zynqmp-clk.h
rename to include/dt-bindings/clock/xlnx-zynqmp-clk.h
index 4aebe6e..cdc4c0b 100644 (file)
 #define IOU_SWITCH             42
 #define GEM_TSU_REF            43
 #define GEM_TSU                        44
-#define GEM0_REF               45
-#define GEM1_REF               46
-#define GEM2_REF               47
-#define GEM3_REF               48
-#define GEM0_TX                        49
-#define GEM1_TX                        50
-#define GEM2_TX                        51
-#define GEM3_TX                        52
+#define GEM0_TX                        45
+#define GEM1_TX                        46
+#define GEM2_TX                        47
+#define GEM3_TX                        48
+#define GEM0_RX                        49
+#define GEM1_RX                        50
+#define GEM2_RX                        51
+#define GEM3_RX                        52
 #define QSPI_REF               53
 #define SDIO0_REF              54
 #define SDIO1_REF              55
 #define VPLL_POST_SRC          100
 #define CAN0_MIO               101
 #define CAN1_MIO               102
+#define ACPU_FULL              103
+#define GEM0_REF               104
+#define GEM1_REF               105
+#define GEM2_REF               106
+#define GEM3_REF               107
+#define GEM0_REF_UNG           108
+#define GEM1_REF_UNG           109
+#define GEM2_REF_UNG           110
+#define GEM3_REF_UNG           111
+#define LPD_WDT                        112
 
 #endif
index 4481f2d..4e61f64 100644 (file)
 #define IMX_SC_R_DC_0_BLIT1            20
 #define IMX_SC_R_DC_0_BLIT2            21
 #define IMX_SC_R_DC_0_BLIT_OUT         22
-#define IMX_SC_R_DC_0_CAPTURE0         23
-#define IMX_SC_R_DC_0_CAPTURE1         24
+#define IMX_SC_R_PERF                  23
 #define IMX_SC_R_DC_0_WARP             25
-#define IMX_SC_R_DC_0_INTEGRAL0                26
-#define IMX_SC_R_DC_0_INTEGRAL1                27
 #define IMX_SC_R_DC_0_VIDEO0           28
 #define IMX_SC_R_DC_0_VIDEO1           29
 #define IMX_SC_R_DC_0_FRAC0            30
-#define IMX_SC_R_DC_0_FRAC1            31
 #define IMX_SC_R_DC_0                  32
 #define IMX_SC_R_GPU_2_PID0            33
 #define IMX_SC_R_DC_0_PLL_0            34
 #define IMX_SC_R_DC_1_BLIT1            37
 #define IMX_SC_R_DC_1_BLIT2            38
 #define IMX_SC_R_DC_1_BLIT_OUT         39
-#define IMX_SC_R_DC_1_CAPTURE0         40
-#define IMX_SC_R_DC_1_CAPTURE1         41
 #define IMX_SC_R_DC_1_WARP             42
-#define IMX_SC_R_DC_1_INTEGRAL0                43
-#define IMX_SC_R_DC_1_INTEGRAL1                44
 #define IMX_SC_R_DC_1_VIDEO0           45
 #define IMX_SC_R_DC_1_VIDEO1           46
 #define IMX_SC_R_DC_1_FRAC0            47
-#define IMX_SC_R_DC_1_FRAC1            48
 #define IMX_SC_R_DC_1                  49
-#define IMX_SC_R_GPU_3_PID0            50
 #define IMX_SC_R_DC_1_PLL_0            51
 #define IMX_SC_R_DC_1_PLL_1            52
 #define IMX_SC_R_SPI_0                 53
 #define IMX_SC_R_M4_0_UART             287
 #define IMX_SC_R_M4_0_I2C              288
 #define IMX_SC_R_M4_0_INTMUX           289
-#define IMX_SC_R_M4_0_SIM              290
-#define IMX_SC_R_M4_0_WDOG             291
 #define IMX_SC_R_M4_0_MU_0B            292
 #define IMX_SC_R_M4_0_MU_0A0           293
 #define IMX_SC_R_M4_0_MU_0A1           294
 #define IMX_SC_R_M4_1_UART             307
 #define IMX_SC_R_M4_1_I2C              308
 #define IMX_SC_R_M4_1_INTMUX           309
-#define IMX_SC_R_M4_1_SIM              310
-#define IMX_SC_R_M4_1_WDOG             311
 #define IMX_SC_R_M4_1_MU_0B            312
 #define IMX_SC_R_M4_1_MU_0A0           313
 #define IMX_SC_R_M4_1_MU_0A1           314
 #define IMX_SC_R_IRQSTR_SCU2           321
 #define IMX_SC_R_IRQSTR_DSP            322
 #define IMX_SC_R_ELCDIF_PLL            323
-#define IMX_SC_R_UNUSED6               324
+#define IMX_SC_R_OCRAM                 324
 #define IMX_SC_R_AUDIO_PLL_0           325
 #define IMX_SC_R_PI_0                  326
 #define IMX_SC_R_PI_0_PWM_0            327
 #define IMX_SC_R_VPU_MU_3              538
 #define IMX_SC_R_VPU_ENC_1             539
 #define IMX_SC_R_VPU                   540
-#define IMX_SC_R_LAST                  541
+#define IMX_SC_R_DMA_5_CH0             541
+#define IMX_SC_R_DMA_5_CH1             542
+#define IMX_SC_R_DMA_5_CH2             543
+#define IMX_SC_R_DMA_5_CH3             544
+#define IMX_SC_R_ATTESTATION           545
+#define IMX_SC_R_LAST                  546
 
 #endif /* __DT_BINDINGS_RSCRC_IMX_H */
index 7d947a5..17877e8 100644 (file)
 #undef PIN_OFF_INPUT_PULLDOWN
 #undef PIN_OFF_WAKEUPENABLE
 
-#endif
+#define AM335X_PIN_OFFSET_MIN                  0x0800U
+
+#define AM335X_PIN_GPMC_AD0                    0x800
+#define AM335X_PIN_GPMC_AD1                    0x804
+#define AM335X_PIN_GPMC_AD2                    0x808
+#define AM335X_PIN_GPMC_AD3                    0x80c
+#define AM335X_PIN_GPMC_AD4                    0x810
+#define AM335X_PIN_GPMC_AD5                    0x814
+#define AM335X_PIN_GPMC_AD6                    0x818
+#define AM335X_PIN_GPMC_AD7                    0x81c
+#define AM335X_PIN_GPMC_AD8                    0x820
+#define AM335X_PIN_GPMC_AD9                    0x824
+#define AM335X_PIN_GPMC_AD10                   0x828
+#define AM335X_PIN_GPMC_AD11                   0x82c
+#define AM335X_PIN_GPMC_AD12                   0x830
+#define AM335X_PIN_GPMC_AD13                   0x834
+#define AM335X_PIN_GPMC_AD14                   0x838
+#define AM335X_PIN_GPMC_AD15                   0x83c
+#define AM335X_PIN_GPMC_A0                     0x840
+#define AM335X_PIN_GPMC_A1                     0x844
+#define AM335X_PIN_GPMC_A2                     0x848
+#define AM335X_PIN_GPMC_A3                     0x84c
+#define AM335X_PIN_GPMC_A4                     0x850
+#define AM335X_PIN_GPMC_A5                     0x854
+#define AM335X_PIN_GPMC_A6                     0x858
+#define AM335X_PIN_GPMC_A7                     0x85c
+#define AM335X_PIN_GPMC_A8                     0x860
+#define AM335X_PIN_GPMC_A9                     0x864
+#define AM335X_PIN_GPMC_A10                    0x868
+#define AM335X_PIN_GPMC_A11                    0x86c
+#define AM335X_PIN_GPMC_WAIT0                  0x870
+#define AM335X_PIN_GPMC_WPN                    0x874
+#define AM335X_PIN_GPMC_BEN1                   0x878
+#define AM335X_PIN_GPMC_CSN0                   0x87c
+#define AM335X_PIN_GPMC_CSN1                   0x880
+#define AM335X_PIN_GPMC_CSN2                   0x884
+#define AM335X_PIN_GPMC_CSN3                   0x888
+#define AM335X_PIN_GPMC_CLK                    0x88c
+#define AM335X_PIN_GPMC_ADVN_ALE               0x890
+#define AM335X_PIN_GPMC_OEN_REN                        0x894
+#define AM335X_PIN_GPMC_WEN                    0x898
+#define AM335X_PIN_GPMC_BEN0_CLE               0x89c
+#define AM335X_PIN_LCD_DATA0                   0x8a0
+#define AM335X_PIN_LCD_DATA1                   0x8a4
+#define AM335X_PIN_LCD_DATA2                   0x8a8
+#define AM335X_PIN_LCD_DATA3                   0x8ac
+#define AM335X_PIN_LCD_DATA4                   0x8b0
+#define AM335X_PIN_LCD_DATA5                   0x8b4
+#define AM335X_PIN_LCD_DATA6                   0x8b8
+#define AM335X_PIN_LCD_DATA7                   0x8bc
+#define AM335X_PIN_LCD_DATA8                   0x8c0
+#define AM335X_PIN_LCD_DATA9                   0x8c4
+#define AM335X_PIN_LCD_DATA10                  0x8c8
+#define AM335X_PIN_LCD_DATA11                  0x8cc
+#define AM335X_PIN_LCD_DATA12                  0x8d0
+#define AM335X_PIN_LCD_DATA13                  0x8d4
+#define AM335X_PIN_LCD_DATA14                  0x8d8
+#define AM335X_PIN_LCD_DATA15                  0x8dc
+#define AM335X_PIN_LCD_VSYNC                   0x8e0
+#define AM335X_PIN_LCD_HSYNC                   0x8e4
+#define AM335X_PIN_LCD_PCLK                    0x8e8
+#define AM335X_PIN_LCD_AC_BIAS_EN              0x8ec
+#define AM335X_PIN_MMC0_DAT3                   0x8f0
+#define AM335X_PIN_MMC0_DAT2                   0x8f4
+#define AM335X_PIN_MMC0_DAT1                   0x8f8
+#define AM335X_PIN_MMC0_DAT0                   0x8fc
+#define AM335X_PIN_MMC0_CLK                    0x900
+#define AM335X_PIN_MMC0_CMD                    0x904
+#define AM335X_PIN_MII1_COL                    0x908
+#define AM335X_PIN_MII1_CRS                    0x90c
+#define AM335X_PIN_MII1_RX_ER                  0x910
+#define AM335X_PIN_MII1_TX_EN                  0x914
+#define AM335X_PIN_MII1_RX_DV                  0x918
+#define AM335X_PIN_MII1_TXD3                   0x91c
+#define AM335X_PIN_MII1_TXD2                   0x920
+#define AM335X_PIN_MII1_TXD1                   0x924
+#define AM335X_PIN_MII1_TXD0                   0x928
+#define AM335X_PIN_MII1_TX_CLK                 0x92c
+#define AM335X_PIN_MII1_RX_CLK                 0x930
+#define AM335X_PIN_MII1_RXD3                   0x934
+#define AM335X_PIN_MII1_RXD2                   0x938
+#define AM335X_PIN_MII1_RXD1                   0x93c
+#define AM335X_PIN_MII1_RXD0                   0x940
+#define AM335X_PIN_RMII1_REF_CLK               0x944
+#define AM335X_PIN_MDIO                                0x948
+#define AM335X_PIN_MDC                         0x94c
+#define AM335X_PIN_SPI0_SCLK                   0x950
+#define AM335X_PIN_SPI0_D0                     0x954
+#define AM335X_PIN_SPI0_D1                     0x958
+#define AM335X_PIN_SPI0_CS0                    0x95c
+#define AM335X_PIN_SPI0_CS1                    0x960
+#define AM335X_PIN_ECAP0_IN_PWM0_OUT           0x964
+#define AM335X_PIN_UART0_CTSN                  0x968
+#define AM335X_PIN_UART0_RTSN                  0x96c
+#define AM335X_PIN_UART0_RXD                   0x970
+#define AM335X_PIN_UART0_TXD                   0x974
+#define AM335X_PIN_UART1_CTSN                  0x978
+#define AM335X_PIN_UART1_RTSN                  0x97c
+#define AM335X_PIN_UART1_RXD                   0x980
+#define AM335X_PIN_UART1_TXD                   0x984
+#define AM335X_PIN_I2C0_SDA                    0x988
+#define AM335X_PIN_I2C0_SCL                    0x98c
+#define AM335X_PIN_MCASP0_ACLKX                        0x990
+#define AM335X_PIN_MCASP0_FSX                  0x994
+#define AM335X_PIN_MCASP0_AXR0                 0x998
+#define AM335X_PIN_MCASP0_AHCLKR               0x99c
+#define AM335X_PIN_MCASP0_ACLKR                        0x9a0
+#define AM335X_PIN_MCASP0_FSR                  0x9a4
+#define AM335X_PIN_MCASP0_AXR1                 0x9a8
+#define AM335X_PIN_MCASP0_AHCLKX               0x9ac
+#define AM335X_PIN_XDMA_EVENT_INTR0            0x9b0
+#define AM335X_PIN_XDMA_EVENT_INTR1            0x9b4
+#define AM335X_PIN_WARMRSTN                    0x9b8
+#define AM335X_PIN_NNMI                                0x9c0
+#define AM335X_PIN_TMS                         0x9d0
+#define AM335X_PIN_TDI                         0x9d4
+#define AM335X_PIN_TDO                         0x9d8
+#define AM335X_PIN_TCK                         0x9dc
+#define AM335X_PIN_TRSTN                       0x9e0
+#define AM335X_PIN_EMU0                                0x9e4
+#define AM335X_PIN_EMU1                                0x9e8
+#define AM335X_PIN_RTC_PWRONRSTN               0x9f8
+#define AM335X_PIN_PMIC_POWER_EN               0x9fc
+#define AM335X_PIN_EXT_WAKEUP                  0xa00
+#define AM335X_PIN_USB0_DRVVBUS                        0xa1c
+#define AM335X_PIN_USB1_DRVVBUS                        0xa34
 
+#define AM335X_PIN_OFFSET_MAX                  0x0a34U
+
+#endif
index 49b5dea..6257180 100644 (file)
@@ -65,6 +65,7 @@
 #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_PADCONF(pa, dir, mux)   OMAP_IOPAD_OFFSET((pa), 0x0800) ((dir) | (mux))
 
 /*
  * Macros to allow using the offset from the padconf physical address
index 05a4b59..de82d8a 100644 (file)
@@ -21,7 +21,6 @@
 #define R8A77965_PD_A3VC               14
 #define R8A77965_PD_3DG_A              17
 #define R8A77965_PD_3DG_B              18
-#define R8A77965_PD_A3IR               24
 #define R8A77965_PD_A2VC1              26
 
 /* Always-on power area */
index c15e8b7..444c7bd 100644 (file)
@@ -12,9 +12,9 @@
 #define TEGRA124_SOCTHERM_SENSOR_PLLX 3
 #define TEGRA124_SOCTHERM_SENSOR_NUM 4
 
-#define TEGRA_SOCTHERM_THROT_LEVEL_LOW  0
-#define TEGRA_SOCTHERM_THROT_LEVEL_MED  1
-#define TEGRA_SOCTHERM_THROT_LEVEL_HIGH 2
-#define TEGRA_SOCTHERM_THROT_LEVEL_NONE -1
+#define TEGRA_SOCTHERM_THROT_LEVEL_NONE 0
+#define TEGRA_SOCTHERM_THROT_LEVEL_LOW  1
+#define TEGRA_SOCTHERM_THROT_LEVEL_MED  2
+#define TEGRA_SOCTHERM_THROT_LEVEL_HIGH 3
 
 #endif
index 40d150a..6e67ade 100644 (file)
@@ -1,29 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 /*
  *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2004 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
  *
  *  Hardware documentation available from http://www.t13.org/
- *
  */
 
 #ifndef __LINUX_ATA_H__
index 688ab0d..b40fc63 100644 (file)
@@ -15,7 +15,6 @@ struct filename;
  * This structure is used to hold the arguments that are used when loading binaries.
  */
 struct linux_binprm {
-       char buf[BINPRM_BUF_SIZE];
 #ifdef CONFIG_MMU
        struct vm_area_struct *vma;
        unsigned long vma_pages;
@@ -64,6 +63,8 @@ struct linux_binprm {
        unsigned long loader, exec;
 
        struct rlimit rlim_stack; /* Saved RLIMIT_STACK used during exec. */
+
+       char buf[BINPRM_BUF_SIZE];
 } __randomize_layout;
 
 #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
index 602af23..cf074bc 100644 (file)
@@ -60,7 +60,7 @@ static __always_inline unsigned long hweight_long(unsigned long w)
  */
 static inline __u64 rol64(__u64 word, unsigned int shift)
 {
-       return (word << shift) | (word >> (64 - shift));
+       return (word << (shift & 63)) | (word >> ((-shift) & 63));
 }
 
 /**
@@ -70,7 +70,7 @@ static inline __u64 rol64(__u64 word, unsigned int shift)
  */
 static inline __u64 ror64(__u64 word, unsigned int shift)
 {
-       return (word >> shift) | (word << (64 - shift));
+       return (word >> (shift & 63)) | (word << ((-shift) & 63));
 }
 
 /**
@@ -80,7 +80,7 @@ static inline __u64 ror64(__u64 word, unsigned int shift)
  */
 static inline __u32 rol32(__u32 word, unsigned int shift)
 {
-       return (word << shift) | (word >> ((-shift) & 31));
+       return (word << (shift & 31)) | (word >> ((-shift) & 31));
 }
 
 /**
@@ -90,7 +90,7 @@ static inline __u32 rol32(__u32 word, unsigned int shift)
  */
 static inline __u32 ror32(__u32 word, unsigned int shift)
 {
-       return (word >> shift) | (word << (32 - shift));
+       return (word >> (shift & 31)) | (word << ((-shift) & 31));
 }
 
 /**
@@ -100,7 +100,7 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
  */
 static inline __u16 rol16(__u16 word, unsigned int shift)
 {
-       return (word << shift) | (word >> (16 - shift));
+       return (word << (shift & 15)) | (word >> ((-shift) & 15));
 }
 
 /**
@@ -110,7 +110,7 @@ static inline __u16 rol16(__u16 word, unsigned int shift)
  */
 static inline __u16 ror16(__u16 word, unsigned int shift)
 {
-       return (word >> shift) | (word << (16 - shift));
+       return (word >> (shift & 15)) | (word << ((-shift) & 15));
 }
 
 /**
@@ -120,7 +120,7 @@ static inline __u16 ror16(__u16 word, unsigned int shift)
  */
 static inline __u8 rol8(__u8 word, unsigned int shift)
 {
-       return (word << shift) | (word >> (8 - shift));
+       return (word << (shift & 7)) | (word >> ((-shift) & 7));
 }
 
 /**
@@ -130,7 +130,7 @@ static inline __u8 rol8(__u8 word, unsigned int shift)
  */
 static inline __u8 ror8(__u8 word, unsigned int shift)
 {
-       return (word >> shift) | (word << (8 - shift));
+       return (word >> (shift & 7)) | (word << ((-shift) & 7));
 }
 
 /**
index 4903deb..3ac0fea 100644 (file)
@@ -436,6 +436,12 @@ union ceph_mds_request_args {
                __le64 length; /* num bytes to lock from start */
                __u8 wait; /* will caller wait for lock to become available? */
        } __attribute__ ((packed)) filelock_change;
+       struct {
+               __le32 mask;                 /* CEPH_CAP_* */
+               __le64 snapid;
+               __le64 parent;
+               __le32 hash;
+       } __attribute__ ((packed)) lookupino;
 } __attribute__ ((packed));
 
 #define CEPH_MDS_FLAG_REPLAY        1  /* this is a replayed op */
index 800a212..23895d1 100644 (file)
@@ -323,7 +323,8 @@ struct ceph_connection {
 };
 
 
-extern const char *ceph_pr_addr(const struct sockaddr_storage *ss);
+extern const char *ceph_pr_addr(const struct ceph_entity_addr *addr);
+
 extern int ceph_parse_ips(const char *c, const char *end,
                          struct ceph_entity_addr *addr,
                          int max_count, int *count);
index 5675b1f..e081b56 100644 (file)
@@ -110,17 +110,16 @@ struct ceph_object_id {
        int name_len;
 };
 
+#define __CEPH_OID_INITIALIZER(oid) { .name = (oid).inline_name }
+
+#define CEPH_DEFINE_OID_ONSTACK(oid)                           \
+       struct ceph_object_id oid = __CEPH_OID_INITIALIZER(oid)
+
 static inline void ceph_oid_init(struct ceph_object_id *oid)
 {
-       oid->name = oid->inline_name;
-       oid->name_len = 0;
+       *oid = (struct ceph_object_id) __CEPH_OID_INITIALIZER(*oid);
 }
 
-#define CEPH_OID_INIT_ONSTACK(oid)                                     \
-    ({ ceph_oid_init(&oid); oid; })
-#define CEPH_DEFINE_OID_ONSTACK(oid)                                   \
-       struct ceph_object_id oid = CEPH_OID_INIT_ONSTACK(oid)
-
 static inline bool ceph_oid_empty(const struct ceph_object_id *oid)
 {
        return oid->name == oid->inline_name && !oid->name_len;
index 491d992..bb6118f 100644 (file)
@@ -6,7 +6,6 @@
 #ifndef __LINUX_CLK_PROVIDER_H
 #define __LINUX_CLK_PROVIDER_H
 
-#include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_clk.h>
 
index 0c53f26..44e8fc3 100644 (file)
 
 #define AT91_PMC_FSMR          0x70            /* Fast Startup Mode Register */
 #define AT91_PMC_FSTT(n)       BIT(n)
+#define AT91_PMC_RTTAL         BIT(16)
 #define AT91_PMC_RTCAL         BIT(17)         /* RTC Alarm Enable */
 #define AT91_PMC_USBAL         BIT(18)         /* USB Resume Enable */
 #define AT91_PMC_SDMMC_CD      BIT(19)         /* SDMMC Card Detect Enable */
index d58aa0d..8aaf7cd 100644 (file)
@@ -53,23 +53,24 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
  * "Define 'is'", Bill Clinton
  * "Define 'if'", Steven Rostedt
  */
-#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
-#define __trace_if(cond) \
-       if (__builtin_constant_p(!!(cond)) ? !!(cond) :                 \
-       ({                                                              \
-               int ______r;                                            \
-               static struct ftrace_branch_data                        \
-                       __aligned(4)                                    \
-                       __section("_ftrace_branch")                     \
-                       ______f = {                                     \
-                               .func = __func__,                       \
-                               .file = __FILE__,                       \
-                               .line = __LINE__,                       \
-                       };                                              \
-               ______r = !!(cond);                                     \
-               ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\
-               ______r;                                                \
-       }))
+#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
+
+#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
+
+#define __trace_if_value(cond) ({                      \
+       static struct ftrace_branch_data                \
+               __aligned(4)                            \
+               __section("_ftrace_branch")             \
+               __if_trace = {                          \
+                       .func = __func__,               \
+                       .file = __FILE__,               \
+                       .line = __LINE__,               \
+               };                                      \
+       (cond) ?                                        \
+               (__if_trace.miss_hit[1]++,1) :          \
+               (__if_trace.miss_hit[0]++,0);           \
+})
+
 #endif /* CONFIG_PROFILE_ALL_BRANCHES */
 
 #else
index ba814f1..19e58b9 100644 (file)
@@ -140,8 +140,7 @@ struct ftrace_likely_data {
  * Do not use __always_inline here, since currently it expands to inline again
  * (which would break users of __always_inline).
  */
-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
-       !defined(CONFIG_OPTIMIZE_INLINING)
+#if !defined(CONFIG_OPTIMIZE_INLINING)
 #define inline inline __attribute__((__always_inline__)) __gnu_inline \
        __maybe_unused notrace
 #else
index ec9bdb3..d09951d 100644 (file)
@@ -166,6 +166,11 @@ struct console {
 extern int console_set_on_cmdline;
 extern struct console *early_console;
 
+enum con_flush_mode {
+       CONSOLE_FLUSH_PENDING,
+       CONSOLE_REPLAY_ALL,
+};
+
 extern int add_preferred_console(char *name, int idx, char *options);
 extern void register_console(struct console *);
 extern int unregister_console(struct console *);
@@ -175,7 +180,7 @@ extern int console_trylock(void);
 extern void console_unlock(void);
 extern void console_conditional_schedule(void);
 extern void console_unblank(void);
-extern void console_flush_on_panic(void);
+extern void console_flush_on_panic(enum con_flush_mode mode);
 extern struct tty_driver *console_device(int *);
 extern void console_stop(struct console *);
 extern void console_start(struct console *);
index 684caf0..d01a74f 100644 (file)
@@ -42,13 +42,6 @@ enum cpufreq_table_sorting {
        CPUFREQ_TABLE_SORTED_DESCENDING
 };
 
-struct cpufreq_freqs {
-       unsigned int cpu;       /* cpu nr */
-       unsigned int old;
-       unsigned int new;
-       u8 flags;               /* flags of cpufreq_driver, see below. */
-};
-
 struct cpufreq_cpuinfo {
        unsigned int            max_freq;
        unsigned int            min_freq;
@@ -156,6 +149,13 @@ struct cpufreq_policy {
        struct thermal_cooling_device *cdev;
 };
 
+struct cpufreq_freqs {
+       struct cpufreq_policy *policy;
+       unsigned int old;
+       unsigned int new;
+       u8 flags;               /* flags of cpufreq_driver, see below. */
+};
+
 /* Only for ACPI */
 #define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
 #define CPUFREQ_SHARED_TYPE_HW  (1) /* HW does needed coordination */
index 147bdec..2175547 100644 (file)
@@ -633,8 +633,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len,
  */
 static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
 {
-       char *nl = strchr(buf, '\n');
-       unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
+       unsigned int len = strchrnul(buf, '\n') - buf;
 
        return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
 }
index b067275..e1f51d6 100644 (file)
@@ -62,7 +62,8 @@ typedef int (*dm_clone_and_map_request_fn) (struct dm_target *ti,
                                            struct request *rq,
                                            union map_info *map_context,
                                            struct request **clone);
-typedef void (*dm_release_clone_request_fn) (struct request *clone);
+typedef void (*dm_release_clone_request_fn) (struct request *clone,
+                                            union map_info *map_context);
 
 /*
  * Returns:
index e760dc5..476e0c5 100644 (file)
@@ -71,12 +71,25 @@ void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle,
                size_t size, enum dma_data_direction dir, unsigned long attrs);
 
 /* The DMA API isn't _quite_ the whole story, though... */
-void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg);
+/*
+ * iommu_dma_prepare_msi() - Map the MSI page in the IOMMU device
+ *
+ * The MSI page will be stored in @desc.
+ *
+ * Return: 0 on success otherwise an error describing the failure.
+ */
+int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr);
+
+/* Update the MSI message if required. */
+void iommu_dma_compose_msi_msg(struct msi_desc *desc,
+                              struct msi_msg *msg);
+
 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
 
 #else
 
 struct iommu_domain;
+struct msi_desc;
 struct msi_msg;
 struct device;
 
@@ -99,7 +112,14 @@ static inline void iommu_put_dma_cookie(struct iommu_domain *domain)
 {
 }
 
-static inline void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
+static inline int iommu_dma_prepare_msi(struct msi_desc *desc,
+                                       phys_addr_t msi_addr)
+{
+       return 0;
+}
+
+static inline void iommu_dma_compose_msi_msg(struct msi_desc *desc,
+                                            struct msi_msg *msg)
 {
 }
 
index d49ec5c..c952f98 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This 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.
  */
 #ifndef LINUX_DMAENGINE_H
 #define LINUX_DMAENGINE_H
index 34a744a..f2b3ae2 100644 (file)
@@ -27,6 +27,7 @@
 #include <uapi/linux/dns_resolver.h>
 
 extern int dns_query(const char *type, const char *name, size_t namelen,
-                    const char *options, char **_result, time64_t *_expiry);
+                    const char *options, char **_result, time64_t *_expiry,
+                    bool invalidate);
 
 #endif /* _LINUX_DNS_RESOLVER_H */
index ebc5509..17ba4e4 100644 (file)
@@ -15,4 +15,9 @@
 
 #include <linux/firmware/imx/svc/misc.h>
 #include <linux/firmware/imx/svc/pm.h>
+
+int imx_scu_enable_general_irq_channel(struct device *dev);
+int imx_scu_irq_register_notifier(struct notifier_block *nb);
+int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
+int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
 #endif /* _SC_SCI_H */
similarity index 77%
rename from arch/arm/include/asm/trusted_foundations.h
rename to include/linux/firmware/trusted_foundations.h
index 0074835..4064e7c 100644 (file)
  * PSCI standard.
  */
 
-#ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H
-#define __ASM_ARM_TRUSTED_FOUNDATIONS_H
+#ifndef __FIRMWARE_TRUSTED_FOUNDATIONS_H
+#define __FIRMWARE_TRUSTED_FOUNDATIONS_H
 
 #include <linux/printk.h>
 #include <linux/bug.h>
 #include <linux/of.h>
 #include <linux/cpu.h>
 #include <linux/smp.h>
+#include <linux/types.h>
+
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/outercache.h>
+
+#define TF_PM_MODE_LP0                 0
+#define TF_PM_MODE_LP1                 1
+#define TF_PM_MODE_LP1_NO_MC_CLK       2
+#define TF_PM_MODE_LP2                 3
+#define TF_PM_MODE_LP2_NOFLUSH_L2      4
 
 struct trusted_foundations_platform_data {
        unsigned int version_major;
@@ -41,8 +51,12 @@ struct trusted_foundations_platform_data {
 
 void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
 void of_register_trusted_foundations(void);
+bool trusted_foundations_registered(void);
 
 #else /* CONFIG_TRUSTED_FOUNDATIONS */
+static inline void tf_dummy_write_sec(unsigned long val, unsigned int reg)
+{
+}
 
 static inline void register_trusted_foundations(
                                   struct trusted_foundations_platform_data *pd)
@@ -53,6 +67,10 @@ static inline void register_trusted_foundations(
         */
        pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
        pr_err("Secondary processors as well as CPU PM will be disabled.\n");
+#if IS_ENABLED(CONFIG_CACHE_L2X0)
+       pr_err("L2X0 cache will be kept disabled.\n");
+       outer_cache.write_sec = tf_dummy_write_sec;
+#endif
 #if IS_ENABLED(CONFIG_SMP)
        setup_max_cpus = 0;
 #endif
@@ -68,6 +86,11 @@ static inline void of_register_trusted_foundations(void)
        if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations"))
                register_trusted_foundations(NULL);
 }
+
+static inline bool trusted_foundations_registered(void)
+{
+       return false;
+}
 #endif /* CONFIG_TRUSTED_FOUNDATIONS */
 
 #endif
index 642dab1..1262ea6 100644 (file)
 #define        ZYNQMP_PM_CAPABILITY_WAKEUP     0x4U
 #define        ZYNQMP_PM_CAPABILITY_POWER      0x8U
 
+/*
+ * Firmware FPGA Manager flags
+ * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
+ * XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
+ */
+#define XILINX_ZYNQMP_PM_FPGA_FULL     0x0U
+#define XILINX_ZYNQMP_PM_FPGA_PARTIAL  BIT(0)
+
 enum pm_api_id {
        PM_GET_API_VERSION = 1,
        PM_REQUEST_NODE = 13,
@@ -56,6 +64,8 @@ enum pm_api_id {
        PM_RESET_ASSERT = 17,
        PM_RESET_GET_STATUS,
        PM_PM_INIT_FINALIZE = 21,
+       PM_FPGA_LOAD,
+       PM_FPGA_GET_STATUS,
        PM_GET_CHIPID = 24,
        PM_IOCTL = 34,
        PM_QUERY_DATA,
@@ -258,6 +268,8 @@ struct zynqmp_pm_query_data {
 struct zynqmp_eemi_ops {
        int (*get_api_version)(u32 *version);
        int (*get_chipid)(u32 *idcode, u32 *version);
+       int (*fpga_load)(const u64 address, const u32 size, const u32 flags);
+       int (*fpga_get_status)(u32 *value);
        int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
        int (*clock_enable)(u32 clock_id);
        int (*clock_disable)(u32 clock_id);
@@ -293,7 +305,7 @@ const struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void);
 #else
 static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
 {
-       return NULL;
+       return ERR_PTR(-ENODEV);
 }
 #endif
 
index 2089991..25e2995 100644 (file)
@@ -741,6 +741,8 @@ struct ftrace_graph_ret {
 typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
 typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
 
+extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace);
+
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
 struct fgraph_ops {
index 89110d8..cfff30b 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifndef __LINUX_HOST1X_H
index 538e8f4..696e7de 100644 (file)
@@ -1,23 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ------------------------------------------------------------------------- */
 /* adap-pcf.h i2c driver algorithms for PCF8584 adapters                     */
 /* ------------------------------------------------------------------------- */
 /*   Copyright (C) 1995-97 Simon G. Vogl
                    1998-99 Hans Berglund
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This 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.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.                                                      */
+ */
 /* ------------------------------------------------------------------------- */
 
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
index 7972714..4c86fce 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
     i2c-dev.h - i2c-bus driver, char device interface
 
     Copyright (C) 1995-97 Simon G. Vogl
     Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This 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.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.
 */
 #ifndef _LINUX_I2C_DEV_H
 #define _LINUX_I2C_DEV_H
index bd74d57..c5a9773 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *
  * i2c-mux.h - functions for the i2c-bus mux support
@@ -5,21 +6,6 @@
  * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
  * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
  * Michael Lawnick <michael.lawnick.ext@nsn.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA.
  */
 
 #ifndef _LINUX_I2C_MUX_H
index fb0e040..585ad6f 100644 (file)
@@ -1,22 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * i2c-smbus.h - SMBus extensions to the I2C protocol
  *
  * Copyright (C) 2010 Jean Delvare <jdelvare@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA.
  */
 
 #ifndef _LINUX_I2C_SMBUS_H
index be27062..1308126 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* ------------------------------------------------------------------------- */
 /*                                                                          */
 /* i2c.h - definitions for the i2c-bus interface                            */
@@ -5,20 +6,7 @@
 /* ------------------------------------------------------------------------- */
 /*   Copyright (C) 1995-2000 Simon G. Vogl
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This 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.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301 USA.                                                      */
+ */
 /* ------------------------------------------------------------------------- */
 
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
@@ -470,6 +458,9 @@ extern struct i2c_client *
 i2c_new_dummy(struct i2c_adapter *adap, u16 address);
 
 extern struct i2c_client *
+devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address);
+
+extern struct i2c_client *
 i2c_new_secondary_device(struct i2c_client *client,
                                const char *name,
                                u16 default_addr);
index 9887f4f..b2d3483 100644 (file)
@@ -291,6 +291,20 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
                               const int **vals, int *length);
 
 /**
+ * iio_read_avail_channel_attribute() - read available channel attribute values
+ * @chan:              The channel being queried.
+ * @vals:              Available values read back.
+ * @type:              Type of values read back.
+ * @length:            Number of entries in vals.
+ * @attribute:         info attribute to be read back.
+ *
+ * Returns an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST.
+ */
+int iio_read_avail_channel_attribute(struct iio_channel *chan,
+                                    const int **vals, int *type, int *length,
+                                    enum iio_chan_info_enum attribute);
+
+/**
  * iio_get_channel_type() - get the type of a channel
  * @channel:           The channel being queried.
  * @type:              The type of the channel.
index 6ab8c1b..c309f43 100644 (file)
@@ -19,6 +19,7 @@ struct ipc_ids {
        struct rw_semaphore rwsem;
        struct idr ipcs_idr;
        int max_idx;
+       int last_idx;   /* For wrap around detection */
 #ifdef CONFIG_CHECKPOINT_RESTORE
        int next_id;
 #endif
index 7ae8de5..fb301cf 100644 (file)
@@ -625,6 +625,8 @@ extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
 extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data,
                                             void *vcpu_info);
 extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
+extern int irq_chip_request_resources_parent(struct irq_data *data);
+extern void irq_chip_release_resources_parent(struct irq_data *data);
 #endif
 
 /* Handling of unhandled and spurious interrupts: */
index c848a7c..c7e3e39 100644 (file)
 #define GICR_PROPBASER_nCnB    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nCnB)
 #define GICR_PROPBASER_nC      GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, nC)
 #define GICR_PROPBASER_RaWt    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt)
-#define GICR_PROPBASER_RaWb    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWt)
+#define GICR_PROPBASER_RaWb    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWb)
 #define GICR_PROPBASER_WaWt    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWt)
 #define GICR_PROPBASER_WaWb    GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, WaWb)
 #define GICR_PROPBASER_RaWaWt  GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt)
 #define GICR_PENDBASER_nCnB    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nCnB)
 #define GICR_PENDBASER_nC      GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, nC)
 #define GICR_PENDBASER_RaWt    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt)
-#define GICR_PENDBASER_RaWb    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWt)
+#define GICR_PENDBASER_RaWb    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWb)
 #define GICR_PENDBASER_WaWt    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWt)
 #define GICR_PENDBASER_WaWb    GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, WaWb)
 #define GICR_PENDBASER_RaWaWt  GIC_BASER_CACHEABILITY(GICR_PENDBASER, INNER, RaWaWt)
 #define GICR_VPROPBASER_nCnB   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nCnB)
 #define GICR_VPROPBASER_nC     GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, nC)
 #define GICR_VPROPBASER_RaWt   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt)
-#define GICR_VPROPBASER_RaWb   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWt)
+#define GICR_VPROPBASER_RaWb   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWb)
 #define GICR_VPROPBASER_WaWt   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWt)
 #define GICR_VPROPBASER_WaWb   GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, WaWb)
 #define GICR_VPROPBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPROPBASER, INNER, RaWaWt)
 #define GICR_VPENDBASER_nCnB   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nCnB)
 #define GICR_VPENDBASER_nC     GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, nC)
 #define GICR_VPENDBASER_RaWt   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt)
-#define GICR_VPENDBASER_RaWb   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWt)
+#define GICR_VPENDBASER_RaWb   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWb)
 #define GICR_VPENDBASER_WaWt   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWt)
 #define GICR_VPENDBASER_WaWb   GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, WaWb)
 #define GICR_VPENDBASER_RaWaWt GIC_BASER_CACHEABILITY(GICR_VPENDBASER, INNER, RaWaWt)
 #define GITS_CBASER_nCnB       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nCnB)
 #define GITS_CBASER_nC         GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, nC)
 #define GITS_CBASER_RaWt       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt)
-#define GITS_CBASER_RaWb       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWt)
+#define GITS_CBASER_RaWb       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWb)
 #define GITS_CBASER_WaWt       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWt)
 #define GITS_CBASER_WaWb       GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, WaWb)
 #define GITS_CBASER_RaWaWt     GIC_BASER_CACHEABILITY(GITS_CBASER, INNER, RaWaWt)
 #define GITS_BASER_nCnB                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nCnB)
 #define GITS_BASER_nC          GIC_BASER_CACHEABILITY(GITS_BASER, INNER, nC)
 #define GITS_BASER_RaWt                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt)
-#define GITS_BASER_RaWb                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWt)
+#define GITS_BASER_RaWb                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWb)
 #define GITS_BASER_WaWt                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWt)
 #define GITS_BASER_WaWb                GIC_BASER_CACHEABILITY(GITS_BASER, INNER, WaWb)
 #define GITS_BASER_RaWaWt      GIC_BASER_CACHEABILITY(GITS_BASER, INNER, RaWaWt)
diff --git a/include/linux/irqchip/irq-ixp4xx.h b/include/linux/irqchip/irq-ixp4xx.h
new file mode 100644 (file)
index 0000000..9395917
--- /dev/null
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __IRQ_IXP4XX_H
+#define __IRQ_IXP4XX_H
+
+#include <linux/ioport.h>
+struct irq_domain;
+
+void ixp4xx_irq_init(resource_size_t irqbase,
+                    bool is_356);
+struct irq_domain *ixp4xx_get_irq_domain(void);
+
+#endif /* __IRQ_IXP4XX_H */
index 61706b4..07ec8b3 100644 (file)
@@ -82,6 +82,7 @@ enum irq_domain_bus_token {
        DOMAIN_BUS_NEXUS,
        DOMAIN_BUS_IPI,
        DOMAIN_BUS_FSL_MC_MSI,
+       DOMAIN_BUS_TI_SCI_INTA_MSI,
 };
 
 /**
index c2ffff5..6c9870e 100644 (file)
@@ -1318,7 +1318,7 @@ extern void               __wait_on_journal (journal_t *);
 
 /* Transaction cache support */
 extern void jbd2_journal_destroy_transaction_cache(void);
-extern int  jbd2_journal_init_transaction_cache(void);
+extern int __init jbd2_journal_init_transaction_cache(void);
 extern void jbd2_journal_free_transaction(transaction_t *);
 
 /*
@@ -1446,8 +1446,10 @@ static inline void jbd2_free_inode(struct jbd2_inode *jinode)
 /* Primary revoke support */
 #define JOURNAL_REVOKE_DEFAULT_HASH 256
 extern int        jbd2_journal_init_revoke(journal_t *, int);
-extern void       jbd2_journal_destroy_revoke_caches(void);
-extern int        jbd2_journal_init_revoke_caches(void);
+extern void       jbd2_journal_destroy_revoke_record_cache(void);
+extern void       jbd2_journal_destroy_revoke_table_cache(void);
+extern int __init jbd2_journal_init_revoke_record_cache(void);
+extern int __init jbd2_journal_init_revoke_table_cache(void);
 
 extern void       jbd2_journal_destroy_revoke(journal_t *);
 extern int        jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
index a3b59d1..74b1ee9 100644 (file)
@@ -484,6 +484,7 @@ extern int __kernel_text_address(unsigned long addr);
 extern int kernel_text_address(unsigned long addr);
 extern int func_ptr_is_kernel_text(void *ptr);
 
+u64 int_pow(u64 base, unsigned int exp);
 unsigned long int_sqrt(unsigned long);
 
 #if BITS_PER_LONG < 64
index 2c89e60..0f9da96 100644 (file)
@@ -4,7 +4,6 @@
 /* Simple interface for creating and stopping kernel threads without mess. */
 #include <linux/err.h>
 #include <linux/sched.h>
-#include <linux/cgroup.h>
 
 __printf(4, 5)
 struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
@@ -198,6 +197,8 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work);
 
 void kthread_destroy_worker(struct kthread_worker *worker);
 
+struct cgroup_subsys_state;
+
 #ifdef CONFIG_BLK_CGROUP
 void kthread_associate_blkcg(struct cgroup_subsys_state *css);
 struct cgroup_subsys_state *kthread_blkcg(void);
index 640a036..79fa442 100644 (file)
@@ -227,6 +227,32 @@ enum {
        READING_SHADOW_PAGE_TABLES,
 };
 
+#define KVM_UNMAPPED_PAGE      ((void *) 0x500 + POISON_POINTER_DELTA)
+
+struct kvm_host_map {
+       /*
+        * Only valid if the 'pfn' is managed by the host kernel (i.e. There is
+        * a 'struct page' for it. When using mem= kernel parameter some memory
+        * can be used as guest memory but they are not managed by host
+        * kernel).
+        * If 'pfn' is not managed by the host kernel, this field is
+        * initialized to KVM_UNMAPPED_PAGE.
+        */
+       struct page *page;
+       void *hva;
+       kvm_pfn_t pfn;
+       kvm_pfn_t gfn;
+};
+
+/*
+ * Used to check if the mapping is valid or not. Never use 'kvm_host_map'
+ * directly to check for that.
+ */
+static inline bool kvm_vcpu_mapped(struct kvm_host_map *map)
+{
+       return !!map->hva;
+}
+
 /*
  * Sometimes a large or cross-page mmio needs to be broken up into separate
  * exits for userspace servicing.
@@ -733,7 +759,9 @@ struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu);
 struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn);
 kvm_pfn_t kvm_vcpu_gfn_to_pfn_atomic(struct kvm_vcpu *vcpu, gfn_t gfn);
 kvm_pfn_t kvm_vcpu_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn);
+int kvm_vcpu_map(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map);
 struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn);
+void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map, bool dirty);
 unsigned long kvm_vcpu_gfn_to_hva(struct kvm_vcpu *vcpu, gfn_t gfn);
 unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable);
 int kvm_vcpu_read_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset,
@@ -1242,11 +1270,21 @@ struct kvm_device_ops {
         */
        void (*destroy)(struct kvm_device *dev);
 
+       /*
+        * Release is an alternative method to free the device. It is
+        * called when the device file descriptor is closed. Once
+        * release is called, the destroy method will not be called
+        * anymore as the device is removed from the device list of
+        * the VM. kvm->lock is held.
+        */
+       void (*release)(struct kvm_device *dev);
+
        int (*set_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
        int (*get_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
        int (*has_attr)(struct kvm_device *dev, struct kvm_device_attr *attr);
        long (*ioctl)(struct kvm_device *dev, unsigned int ioctl,
                      unsigned long arg);
+       int (*mmap)(struct kvm_device *dev, struct vm_area_struct *vma);
 };
 
 void kvm_device_get(struct kvm_device *dev);
@@ -1307,6 +1345,16 @@ static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu)
 }
 #endif /* CONFIG_HAVE_KVM_INVALID_WAKEUPS */
 
+#ifdef CONFIG_HAVE_KVM_NO_POLL
+/* Callback that tells if we must not poll */
+bool kvm_arch_no_poll(struct kvm_vcpu *vcpu);
+#else
+static inline bool kvm_arch_no_poll(struct kvm_vcpu *vcpu)
+{
+       return false;
+}
+#endif /* CONFIG_HAVE_KVM_NO_POLL */
+
 #ifdef CONFIG_HAVE_KVM_VCPU_ASYNC_IOCTL
 long kvm_arch_vcpu_async_ioctl(struct file *filp,
                               unsigned int ioctl, unsigned long arg);
index 7c560e0..9022f0c 100644 (file)
@@ -36,7 +36,7 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter)
                __account_scheduler_latency(task, usecs, inter);
 }
 
-void clear_all_latency_tracing(struct task_struct *p);
+void clear_tsk_latency_tracing(struct task_struct *p);
 
 extern int sysctl_latencytop(struct ctl_table *table, int write,
                        void __user *buffer, size_t *lenp, loff_t *ppos);
@@ -48,7 +48,7 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter)
 {
 }
 
-static inline void clear_all_latency_tracing(struct task_struct *p)
+static inline void clear_tsk_latency_tracing(struct task_struct *p)
 {
 }
 
index c9419c0..207e7ee 100644 (file)
@@ -1,26 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  Copyright 2003-2005 Red Hat, Inc.  All rights reserved.
  *  Copyright 2003-2005 Jeff Garzik
  *
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
  *  libata documentation is available via 'make {ps|pdf}docs',
  *  as Documentation/driver-api/libata.rst
- *
  */
 
 #ifndef __LINUX_LIBATA_H__
index 5d865a5..4d0d565 100644 (file)
@@ -358,6 +358,7 @@ struct nvm_geo {
        u16     csecs;          /* sector size */
        u16     sos;            /* out-of-band area size */
        bool    ext;            /* metadata in extended data buffer */
+       u32     mdts;           /* Max data transfer size*/
 
        /* device write constrains */
        u32     ws_min;         /* minimum write size */
@@ -427,6 +428,7 @@ struct nvm_dev {
        char name[DISK_NAME_LEN];
        void *private_data;
 
+       struct kref ref;
        void *rmap;
 
        struct mutex mlock;
index 9e9a640..e951228 100644 (file)
@@ -151,6 +151,23 @@ static inline void list_replace_init(struct list_head *old,
 }
 
 /**
+ * list_swap - replace entry1 with entry2 and re-add entry1 at entry2's position
+ * @entry1: the location to place entry2
+ * @entry2: the location to place entry1
+ */
+static inline void list_swap(struct list_head *entry1,
+                            struct list_head *entry2)
+{
+       struct list_head *pos = entry2->prev;
+
+       list_del(entry2);
+       list_replace(entry1, entry2);
+       if (pos == entry1)
+               pos = entry2;
+       list_add(entry1, pos);
+}
+
+/**
  * list_del_init - deletes entry from list and reinitialize it.
  * @entry: the element to delete from the list.
  */
@@ -772,7 +789,7 @@ static inline void hlist_add_behind(struct hlist_node *n,
                                    struct hlist_node *prev)
 {
        n->next = prev->next;
-       WRITE_ONCE(prev->next, n);
+       prev->next = n;
        n->pprev = &prev->next;
 
        if (n->next)
index 3fc2cc5..ae1b541 100644 (file)
@@ -86,6 +86,32 @@ static inline void hlist_bl_add_head(struct hlist_bl_node *n,
        hlist_bl_set_first(h, n);
 }
 
+static inline void hlist_bl_add_before(struct hlist_bl_node *n,
+                                      struct hlist_bl_node *next)
+{
+       struct hlist_bl_node **pprev = next->pprev;
+
+       n->pprev = pprev;
+       n->next = next;
+       next->pprev = &n->next;
+
+       /* pprev may be `first`, so be careful not to lose the lock bit */
+       WRITE_ONCE(*pprev,
+                  (struct hlist_bl_node *)
+                       ((uintptr_t)n | ((uintptr_t)*pprev & LIST_BL_LOCKMASK)));
+}
+
+static inline void hlist_bl_add_behind(struct hlist_bl_node *n,
+                                      struct hlist_bl_node *prev)
+{
+       n->next = prev->next;
+       n->pprev = &prev->next;
+       prev->next = n;
+
+       if (n->next)
+               n->next->pprev = &n->next;
+}
+
 static inline void __hlist_bl_del(struct hlist_bl_node *n)
 {
        struct hlist_bl_node *next = n->next;
index ba79956..20f178c 100644 (file)
@@ -6,6 +6,7 @@
 
 struct list_head;
 
+__attribute__((nonnull(2,3)))
 void list_sort(void *priv, struct list_head *head,
               int (*cmp)(void *priv, struct list_head *a,
                          struct list_head *b));
index a14bab1..eeba421 100644 (file)
@@ -1,21 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * livepatch.h - Kernel Live Patching Core
  *
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
  * Copyright (C) 2014 SUSE
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _LINUX_LIVEPATCH_H_
index 8c0cf10..0520c0c 100644 (file)
@@ -76,7 +76,7 @@ struct nlmclnt_operations {
 };
 
 extern int     nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
-extern int     lockd_up(struct net *net);
+extern int     lockd_up(struct net *net, const struct cred *cred);
 extern void    lockd_down(struct net *net);
 
 #endif /* LINUX_LOCKD_BIND_H */
index 30561a9..bc74d6a 100644 (file)
@@ -94,8 +94,8 @@ enum mem_cgroup_events_target {
        MEM_CGROUP_NTARGETS,
 };
 
-struct mem_cgroup_stat_cpu {
-       long count[MEMCG_NR_STAT];
+struct memcg_vmstats_percpu {
+       long stat[MEMCG_NR_STAT];
        unsigned long events[NR_VM_EVENT_ITEMS];
        unsigned long nr_page_events;
        unsigned long targets[MEM_CGROUP_NTARGETS];
@@ -128,6 +128,7 @@ struct mem_cgroup_per_node {
 
        struct lruvec_stat __percpu *lruvec_stat_cpu;
        atomic_long_t           lruvec_stat[NR_VM_NODE_STAT_ITEMS];
+       atomic_long_t           lruvec_stat_local[NR_VM_NODE_STAT_ITEMS];
 
        unsigned long           lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
 
@@ -274,13 +275,17 @@ struct mem_cgroup {
        struct task_struct      *move_lock_task;
 
        /* memory.stat */
-       struct mem_cgroup_stat_cpu __percpu *stat_cpu;
+       struct memcg_vmstats_percpu __percpu *vmstats_percpu;
 
        MEMCG_PADDING(_pad2_);
 
-       atomic_long_t           stat[MEMCG_NR_STAT];
-       atomic_long_t           events[NR_VM_EVENT_ITEMS];
-       atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS];
+       atomic_long_t           vmstats[MEMCG_NR_STAT];
+       atomic_long_t           vmstats_local[MEMCG_NR_STAT];
+
+       atomic_long_t           vmevents[NR_VM_EVENT_ITEMS];
+       atomic_long_t           vmevents_local[NR_VM_EVENT_ITEMS];
+
+       atomic_long_t           memory_events[MEMCG_NR_MEMORY_EVENTS];
 
        unsigned long           socket_pressure;
 
@@ -554,10 +559,9 @@ void unlock_page_memcg(struct page *page);
  * idx can be of type enum memcg_stat_item or node_stat_item.
  * Keep in sync with memcg_exact_page_state().
  */
-static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
-                                            int idx)
+static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx)
 {
-       long x = atomic_long_read(&memcg->stat[idx]);
+       long x = atomic_long_read(&memcg->vmstats[idx]);
 #ifdef CONFIG_SMP
        if (x < 0)
                x = 0;
@@ -565,23 +569,23 @@ static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
        return x;
 }
 
-/* idx can be of type enum memcg_stat_item or node_stat_item */
-static inline void __mod_memcg_state(struct mem_cgroup *memcg,
-                                    int idx, int val)
+/*
+ * idx can be of type enum memcg_stat_item or node_stat_item.
+ * Keep in sync with memcg_exact_page_state().
+ */
+static inline unsigned long memcg_page_state_local(struct mem_cgroup *memcg,
+                                                  int idx)
 {
-       long x;
-
-       if (mem_cgroup_disabled())
-               return;
-
-       x = val + __this_cpu_read(memcg->stat_cpu->count[idx]);
-       if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) {
-               atomic_long_add(x, &memcg->stat[idx]);
+       long x = atomic_long_read(&memcg->vmstats_local[idx]);
+#ifdef CONFIG_SMP
+       if (x < 0)
                x = 0;
-       }
-       __this_cpu_write(memcg->stat_cpu->count[idx], x);
+#endif
+       return x;
 }
 
+void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val);
+
 /* idx can be of type enum memcg_stat_item or node_stat_item */
 static inline void mod_memcg_state(struct mem_cgroup *memcg,
                                   int idx, int val)
@@ -642,32 +646,27 @@ static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
        return x;
 }
 
-static inline void __mod_lruvec_state(struct lruvec *lruvec,
-                                     enum node_stat_item idx, int val)
+static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec,
+                                                   enum node_stat_item idx)
 {
        struct mem_cgroup_per_node *pn;
        long x;
 
-       /* Update node */
-       __mod_node_page_state(lruvec_pgdat(lruvec), idx, val);
-
        if (mem_cgroup_disabled())
-               return;
+               return node_page_state(lruvec_pgdat(lruvec), idx);
 
        pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
-
-       /* Update memcg */
-       __mod_memcg_state(pn->memcg, idx, val);
-
-       /* Update lruvec */
-       x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]);
-       if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) {
-               atomic_long_add(x, &pn->lruvec_stat[idx]);
+       x = atomic_long_read(&pn->lruvec_stat_local[idx]);
+#ifdef CONFIG_SMP
+       if (x < 0)
                x = 0;
-       }
-       __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x);
+#endif
+       return x;
 }
 
+void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
+                       int val);
+
 static inline void mod_lruvec_state(struct lruvec *lruvec,
                                    enum node_stat_item idx, int val)
 {
@@ -708,22 +707,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
                                                gfp_t gfp_mask,
                                                unsigned long *total_scanned);
 
-static inline void __count_memcg_events(struct mem_cgroup *memcg,
-                                       enum vm_event_item idx,
-                                       unsigned long count)
-{
-       unsigned long x;
-
-       if (mem_cgroup_disabled())
-               return;
-
-       x = count + __this_cpu_read(memcg->stat_cpu->events[idx]);
-       if (unlikely(x > MEMCG_CHARGE_BATCH)) {
-               atomic_long_add(x, &memcg->events[idx]);
-               x = 0;
-       }
-       __this_cpu_write(memcg->stat_cpu->events[idx], x);
-}
+void __count_memcg_events(struct mem_cgroup *memcg, enum vm_event_item idx,
+                         unsigned long count);
 
 static inline void count_memcg_events(struct mem_cgroup *memcg,
                                      enum vm_event_item idx,
@@ -1011,8 +996,13 @@ static inline void mem_cgroup_print_oom_group(struct mem_cgroup *memcg)
 {
 }
 
-static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
-                                            int idx)
+static inline unsigned long memcg_page_state(struct mem_cgroup *memcg, int idx)
+{
+       return 0;
+}
+
+static inline unsigned long memcg_page_state_local(struct mem_cgroup *memcg,
+                                                  int idx)
 {
        return 0;
 }
@@ -1047,6 +1037,12 @@ static inline unsigned long lruvec_page_state(struct lruvec *lruvec,
        return node_page_state(lruvec_pgdat(lruvec), idx);
 }
 
+static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec,
+                                                   enum node_stat_item idx)
+{
+       return node_page_state(lruvec_pgdat(lruvec), idx);
+}
+
 static inline void __mod_lruvec_state(struct lruvec *lruvec,
                                      enum node_stat_item idx, int val)
 {
index f05bf4a..44ebcc4 100644 (file)
@@ -1,22 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Core driver interface for TI TPS65090 PMIC family
  *
  * Copyright (C) 2012 NVIDIA Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
  */
 
 #ifndef __LINUX_MFD_TPS65090_H
index 8c40128..517288d 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Microchip Technology
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _MICROCHIPPHY_H
index 8261274..5e74305 100644 (file)
@@ -7344,7 +7344,7 @@ struct mlx5_ifc_create_eq_out_bits {
 
 struct mlx5_ifc_create_eq_in_bits {
        u8         opcode[0x10];
-       u8         reserved_at_10[0x10];
+       u8         uid[0x10];
 
        u8         reserved_at_20[0x10];
        u8         op_mod[0x10];
index 912614f..0e8834a 100644 (file)
@@ -536,9 +536,6 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma)
 struct mmu_gather;
 struct inode;
 
-#define page_private(page)             ((page)->private)
-#define set_page_private(page, v)      ((page)->private = (v))
-
 #if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
 static inline int pmd_devmap(pmd_t pmd)
 {
index e1f42a0..8ec38b1 100644 (file)
@@ -220,6 +220,9 @@ struct page {
 #define PAGE_FRAG_CACHE_MAX_SIZE       __ALIGN_MASK(32768, ~PAGE_MASK)
 #define PAGE_FRAG_CACHE_MAX_ORDER      get_order(PAGE_FRAG_CACHE_MAX_SIZE)
 
+#define page_private(page)             ((page)->private)
+#define set_page_private(page, v)      ((page)->private = (v))
+
 struct page_frag_cache {
        void * va;
 #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
index 5a4aedc..70394ca 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/pageblock-flags.h>
 #include <linux/page-flags-layout.h>
 #include <linux/atomic.h>
+#include <linux/mm_types.h>
+#include <linux/page-flags.h>
 #include <asm/page.h>
 
 /* Free memory management - zoned buddy allocator.  */
@@ -98,6 +100,62 @@ struct free_area {
        unsigned long           nr_free;
 };
 
+/* Used for pages not on another list */
+static inline void add_to_free_area(struct page *page, struct free_area *area,
+                            int migratetype)
+{
+       list_add(&page->lru, &area->free_list[migratetype]);
+       area->nr_free++;
+}
+
+/* Used for pages not on another list */
+static inline void add_to_free_area_tail(struct page *page, struct free_area *area,
+                                 int migratetype)
+{
+       list_add_tail(&page->lru, &area->free_list[migratetype]);
+       area->nr_free++;
+}
+
+#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
+/* Used to preserve page allocation order entropy */
+void add_to_free_area_random(struct page *page, struct free_area *area,
+               int migratetype);
+#else
+static inline void add_to_free_area_random(struct page *page,
+               struct free_area *area, int migratetype)
+{
+       add_to_free_area(page, area, migratetype);
+}
+#endif
+
+/* Used for pages which are on another list */
+static inline void move_to_free_area(struct page *page, struct free_area *area,
+                            int migratetype)
+{
+       list_move(&page->lru, &area->free_list[migratetype]);
+}
+
+static inline struct page *get_page_from_free_area(struct free_area *area,
+                                           int migratetype)
+{
+       return list_first_entry_or_null(&area->free_list[migratetype],
+                                       struct page, lru);
+}
+
+static inline void del_page_from_free_area(struct page *page,
+               struct free_area *area)
+{
+       list_del(&page->lru);
+       __ClearPageBuddy(page);
+       set_page_private(page, 0);
+       area->nr_free--;
+}
+
+static inline bool free_area_empty(struct free_area *area, int migratetype)
+{
+       return list_empty(&area->free_list[migratetype]);
+}
+
 struct pglist_data;
 
 /*
@@ -1271,6 +1329,7 @@ void sparse_init(void);
 #else
 #define sparse_init()  do {} while (0)
 #define sparse_index_init(_sec, _nid)  do {} while (0)
+#define pfn_present pfn_valid
 #endif /* CONFIG_SPARSEMEM */
 
 /*
index 052f04f..d48e919 100644 (file)
@@ -48,6 +48,14 @@ struct fsl_mc_msi_desc {
 };
 
 /**
+ * ti_sci_inta_msi_desc - TISCI based INTA specific msi descriptor data
+ * @dev_index: TISCI device index
+ */
+struct ti_sci_inta_msi_desc {
+       u16     dev_index;
+};
+
+/**
  * struct msi_desc - Descriptor structure for MSI based interrupts
  * @list:      List head for management
  * @irq:       The base interrupt number
@@ -68,6 +76,7 @@ struct fsl_mc_msi_desc {
  * @mask_base: [PCI MSI-X] Mask register base address
  * @platform:  [platform]  Platform device specific msi descriptor data
  * @fsl_mc:    [fsl-mc]    FSL MC device specific msi descriptor data
+ * @inta:      [INTA]      TISCI based INTA specific msi descriptor data
  */
 struct msi_desc {
        /* Shared device/bus type independent data */
@@ -77,6 +86,9 @@ struct msi_desc {
        struct device                   *dev;
        struct msi_msg                  msg;
        struct irq_affinity_desc        *affinity;
+#ifdef CONFIG_IRQ_MSI_IOMMU
+       const void                      *iommu_cookie;
+#endif
 
        union {
                /* PCI MSI/X specific data */
@@ -106,6 +118,7 @@ struct msi_desc {
                 */
                struct platform_msi_desc platform;
                struct fsl_mc_msi_desc fsl_mc;
+               struct ti_sci_inta_msi_desc inta;
        };
 };
 
@@ -119,6 +132,29 @@ struct msi_desc {
 #define for_each_msi_entry_safe(desc, tmp, dev)        \
        list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
 
+#ifdef CONFIG_IRQ_MSI_IOMMU
+static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
+{
+       return desc->iommu_cookie;
+}
+
+static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
+                                            const void *iommu_cookie)
+{
+       desc->iommu_cookie = iommu_cookie;
+}
+#else
+static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
+{
+       return NULL;
+}
+
+static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
+                                            const void *iommu_cookie)
+{
+}
+#endif
+
 #ifdef CONFIG_PCI_MSI
 #define first_pci_msi_entry(pdev)      first_msi_entry(&(pdev)->dev)
 #define for_each_pci_msi_entry(desc, pdev)     \
index c40720c..8028ada 100644 (file)
@@ -1246,9 +1246,9 @@ enum {
        NVME_SC_FW_NEEDS_SUBSYS_RESET   = 0x110,
        NVME_SC_FW_NEEDS_RESET          = 0x111,
        NVME_SC_FW_NEEDS_MAX_TIME       = 0x112,
-       NVME_SC_FW_ACIVATE_PROHIBITED   = 0x113,
+       NVME_SC_FW_ACTIVATE_PROHIBITED  = 0x113,
        NVME_SC_OVERLAPPING_RANGE       = 0x114,
-       NVME_SC_NS_INSUFFICENT_CAP      = 0x115,
+       NVME_SC_NS_INSUFFICIENT_CAP     = 0x115,
        NVME_SC_NS_ID_UNAVAILABLE       = 0x116,
        NVME_SC_NS_ALREADY_ATTACHED     = 0x118,
        NVME_SC_NS_IS_PRIVATE           = 0x119,
index 9cd72aa..0f0346e 100644 (file)
@@ -22,7 +22,7 @@ static inline int of_get_phy_mode(struct device_node *np)
 
 static inline const void *of_get_mac_address(struct device_node *np)
 {
-       return NULL;
+       return ERR_PTR(-ENODEV);
 }
 
 static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
index 15eb85d..6590450 100644 (file)
@@ -284,11 +284,15 @@ static inline __must_check size_t array3_size(size_t a, size_t b, size_t c)
        return bytes;
 }
 
-static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
+/*
+ * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
+ * struct_size() below.
+ */
+static inline __must_check size_t __ab_c_size(size_t a, size_t b, size_t c)
 {
        size_t bytes;
 
-       if (check_mul_overflow(n, size, &bytes))
+       if (check_mul_overflow(a, b, &bytes))
                return SIZE_MAX;
        if (check_add_overflow(bytes, c, &bytes))
                return SIZE_MAX;
index 1ce8e26..a6fabd8 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * linux/percpu-defs.h - basic definitions for percpu areas
  *
index 15a82ff..0ab99c7 100644 (file)
@@ -30,6 +30,7 @@ struct perf_guest_info_callbacks {
        int                             (*is_in_guest)(void);
        int                             (*is_user_mode)(void);
        unsigned long                   (*get_guest_ip)(void);
+       void                            (*handle_intel_pt_intr)(void);
 };
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
index 6cf7df1..0b65fd0 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Generic PXA PATA driver
  *
  * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #ifndef        __MACH_PATA_PXA_H__
diff --git a/include/linux/platform_data/eth-ep93xx.h b/include/linux/platform_data/eth-ep93xx.h
new file mode 100644 (file)
index 0000000..8eef637
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PLATFORM_DATA_ETH_EP93XX
+#define _LINUX_PLATFORM_DATA_ETH_EP93XX
+
+struct ep93xx_eth_data {
+       unsigned char   dev_addr[6];
+       unsigned char   phy_id;
+};
+
+#endif
index 0e36818..3054fce 100644 (file)
@@ -9,8 +9,7 @@ struct matrix_keymap_data;
 #define EP93XX_KEYPAD_DIAG_MODE                (1<<1)  /* diagnostic mode */
 #define EP93XX_KEYPAD_BACK_DRIVE       (1<<2)  /* back driving mode */
 #define EP93XX_KEYPAD_TEST_MODE                (1<<3)  /* scan only column 0 */
-#define EP93XX_KEYPAD_KDIV             (1<<4)  /* 1/4 clock or 1/16 clock */
-#define EP93XX_KEYPAD_AUTOREPEAT       (1<<5)  /* enable key autorepeat */
+#define EP93XX_KEYPAD_AUTOREPEAT       (1<<4)  /* enable key autorepeat */
 
 /**
  * struct ep93xx_keypad_platform_data - platform specific device structure
@@ -24,6 +23,7 @@ struct ep93xx_keypad_platform_data {
        unsigned int    debounce;
        unsigned int    prescale;
        unsigned int    flags;
+       unsigned int    clk_rate;
 };
 
 #define EP93XX_MATRIX_ROWS             (8)
index 6bb96ef..d123003 100644 (file)
@@ -1,20 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef __ASM_ARCH_NAND_H
index fbf5ed7..dd59719 100644 (file)
@@ -51,6 +51,11 @@ struct am33xx_pm_platform_data {
                               unsigned long args);
        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);
 };
 
 struct am33xx_pm_sram_data {
index a938eba..0844b21 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #ifndef ASMARM_ARCH_UART_H
index 6f0fb6e..61db674 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * STMicroelectronics TPM Linux driver for TPM 1.2 ST33ZP24
  * Copyright (C) 2009 - 2016  STMicroelectronics
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef __ST33ZP24_H__
 #define __ST33ZP24_H__
index 1ea3aab..9256c03 100644 (file)
@@ -46,8 +46,13 @@ struct sysc_regbits {
        s8 emufree_shift;
 };
 
-#define SYSC_QUIRK_LEGACY_IDLE         BIT(8)
-#define SYSC_QUIRK_RESET_STATUS                BIT(7)
+#define SYSC_QUIRK_SWSUP_MSTANDBY      BIT(13)
+#define SYSC_QUIRK_SWSUP_SIDLE_ACT     BIT(12)
+#define SYSC_QUIRK_SWSUP_SIDLE         BIT(11)
+#define SYSC_QUIRK_EXT_OPT_CLOCK       BIT(10)
+#define SYSC_QUIRK_LEGACY_IDLE         BIT(9)
+#define SYSC_QUIRK_RESET_STATUS                BIT(8)
+#define SYSC_QUIRK_NO_IDLE             BIT(7)
 #define SYSC_QUIRK_NO_IDLE_ON_INIT     BIT(6)
 #define SYSC_QUIRK_NO_RESET_ON_INIT    BIT(5)
 #define SYSC_QUIRK_OPT_CLKS_NEEDED     BIT(4)
diff --git a/include/linux/platform_data/timer-ixp4xx.h b/include/linux/platform_data/timer-ixp4xx.h
new file mode 100644 (file)
index 0000000..ee92ae7
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __TIMER_IXP4XX_H
+#define __TIMER_IXP4XX_H
+
+#include <linux/ioport.h>
+
+void __init ixp4xx_timer_setup(resource_size_t timerbase,
+                              int timer_irq,
+                              unsigned int timer_freq);
+
+#endif
diff --git a/include/linux/platform_data/xtalk-bridge.h b/include/linux/platform_data/xtalk-bridge.h
new file mode 100644 (file)
index 0000000..51e5001
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * SGI PCI Xtalk Bridge
+ */
+
+#ifndef PLATFORM_DATA_XTALK_BRIDGE_H
+#define PLATFORM_DATA_XTALK_BRIDGE_H
+
+#include <asm/sn/types.h>
+
+struct xtalk_bridge_platform_data {
+       struct resource mem;
+       struct resource io;
+       unsigned long bridge_addr;
+       unsigned long intr_addr;
+       unsigned long mem_offset;
+       unsigned long io_offset;
+       nasid_t nasid;
+       int     masterwid;
+};
+
+#endif /* PLATFORM_DATA_XTALK_BRIDGE_H */
index 9788360..66bab1b 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Descending-priority-sorted double-linked list
  *
@@ -12,8 +13,6 @@
  * Simplifications of the original code by
  * Oleg Nesterov <oleg@tv-sign.ru>
  *
- * Licensed under the FSF's GNU Public License v2 or later.
- *
  * Based on simple lists (include/linux/list.h).
  *
  * This is a priority-sorted list of nodes; each node has a
@@ -70,7 +69,6 @@
  * is lowest priority.
  *
  * No locking is done, up to the caller.
- *
  */
 #ifndef _LINUX_PLIST_H_
 #define _LINUX_PLIST_H_
@@ -231,7 +229,7 @@ static inline int plist_node_empty(const struct plist_node *node)
  * @type:      the type of the struct this is embedded in
  * @member:    the name of the list_head within the struct
  */
-#ifdef CONFIG_DEBUG_PI_LIST
+#ifdef CONFIG_DEBUG_PLIST
 # define plist_first_entry(head, type, member) \
 ({ \
        WARN_ON(plist_head_empty(head)); \
@@ -248,7 +246,7 @@ static inline int plist_node_empty(const struct plist_node *node)
  * @type:      the type of the struct this is embedded in
  * @member:    the name of the list_head within the struct
  */
-#ifdef CONFIG_DEBUG_PI_LIST
+#ifdef CONFIG_DEBUG_PLIST
 # define plist_last_entry(head, type, member)  \
 ({ \
        WARN_ON(plist_head_empty(head)); \
index 0e8e356..b21f35f 100644 (file)
  *                             driver must then comply with the so called,
  *                             last-man-standing algorithm, for the CPUs in the
  *                             PM domain.
+ *
+ * GENPD_FLAG_RPM_ALWAYS_ON:   Instructs genpd to always keep the PM domain
+ *                             powered on except for system suspend.
  */
 #define GENPD_FLAG_PM_CLK       (1U << 0)
 #define GENPD_FLAG_IRQ_SAFE     (1U << 1)
 #define GENPD_FLAG_ALWAYS_ON    (1U << 2)
 #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3)
 #define GENPD_FLAG_CPU_DOMAIN   (1U << 4)
+#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
 
 enum gpd_status {
        GPD_STATE_ACTIVE = 0,   /* PM domain is active */
index 7e0fdcf..1cdc32b 100644 (file)
 extern struct ctl_table epoll_table[]; /* for sysctl */
 /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
    additional memory. */
+#ifdef __clang__
+#define MAX_STACK_ALLOC 768
+#else
 #define MAX_STACK_ALLOC 832
+#endif
 #define FRONTEND_STACK_ALLOC   256
 #define SELECT_STACK_ALLOC     FRONTEND_STACK_ALLOC
 #define POLL_STACK_ALLOC       FRONTEND_STACK_ALLOC
index 50762af..7a91b35 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * bq2415x charger driver
  *
  * Copyright (C) 2011-2013  Pali Rohár <pali.rohar@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef BQ2415X_CHARGER_H
index 519b8b4..ccfe797 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Gas Gauge driver for SBS Compliant Gas Gauges
  *
  * Copyright (c) 2010, NVIDIA Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #ifndef __LINUX_POWER_SBS_BATTERY_H_
index 2f9c201..d9c0c09 100644 (file)
@@ -40,11 +40,15 @@ enum {
        POWER_SUPPLY_STATUS_FULL,
 };
 
+/* What algorithm is the charger using? */
 enum {
        POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0,
        POWER_SUPPLY_CHARGE_TYPE_NONE,
-       POWER_SUPPLY_CHARGE_TYPE_TRICKLE,
-       POWER_SUPPLY_CHARGE_TYPE_FAST,
+       POWER_SUPPLY_CHARGE_TYPE_TRICKLE,       /* slow speed */
+       POWER_SUPPLY_CHARGE_TYPE_FAST,          /* fast speed */
+       POWER_SUPPLY_CHARGE_TYPE_STANDARD,      /* normal speed */
+       POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE,      /* dynamically adjusted speed */
+       POWER_SUPPLY_CHARGE_TYPE_CUSTOM,        /* use CHARGE_CONTROL_* props */
 };
 
 enum {
@@ -57,6 +61,7 @@ enum {
        POWER_SUPPLY_HEALTH_COLD,
        POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
        POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
+       POWER_SUPPLY_HEALTH_OVERCURRENT,
 };
 
 enum {
@@ -121,6 +126,8 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
        POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
        POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
+       POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */
+       POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */
        POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
        POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
        POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
index 56f35dd..44171e6 100644 (file)
 #define _PPS_GPIO_H
 
 struct pps_gpio_platform_data {
+       struct gpio_desc *gpio_pin;
+       struct gpio_desc *echo_pin;
        bool assert_falling_edge;
        bool capture_clear;
-       unsigned int gpio_pin;
-       const char *gpio_label;
+       unsigned int echo_active_ms;
 };
 
 #endif /* _PPS_GPIO_H */
index 84ea4d0..cefd374 100644 (file)
@@ -82,6 +82,8 @@ static inline void console_verbose(void)
 extern char devkmsg_log_str[];
 struct ctl_table;
 
+extern int suppress_printk;
+
 struct va_format {
        const char *fmt;
        va_list *va;
index 7006008..7b3de73 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/jump_label.h>
 #include <linux/psi_types.h>
 #include <linux/sched.h>
+#include <linux/poll.h>
 
 struct seq_file;
 struct css_set;
@@ -11,6 +12,7 @@ struct css_set;
 #ifdef CONFIG_PSI
 
 extern struct static_key_false psi_disabled;
+extern struct psi_group psi_system;
 
 void psi_init(void);
 
@@ -26,6 +28,13 @@ int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
 int psi_cgroup_alloc(struct cgroup *cgrp);
 void psi_cgroup_free(struct cgroup *cgrp);
 void cgroup_move_task(struct task_struct *p, struct css_set *to);
+
+struct psi_trigger *psi_trigger_create(struct psi_group *group,
+                       char *buf, size_t nbytes, enum psi_res res);
+void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t);
+
+__poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
+                       poll_table *wait);
 #endif
 
 #else /* CONFIG_PSI */
index 2cf422d..07aaf9b 100644 (file)
@@ -1,8 +1,11 @@
 #ifndef _LINUX_PSI_TYPES_H
 #define _LINUX_PSI_TYPES_H
 
+#include <linux/kthread.h>
 #include <linux/seqlock.h>
 #include <linux/types.h>
+#include <linux/kref.h>
+#include <linux/wait.h>
 
 #ifdef CONFIG_PSI
 
@@ -11,7 +14,7 @@ enum psi_task_count {
        NR_IOWAIT,
        NR_MEMSTALL,
        NR_RUNNING,
-       NR_PSI_TASK_COUNTS,
+       NR_PSI_TASK_COUNTS = 3,
 };
 
 /* Task state bitmasks */
@@ -24,7 +27,7 @@ enum psi_res {
        PSI_IO,
        PSI_MEM,
        PSI_CPU,
-       NR_PSI_RESOURCES,
+       NR_PSI_RESOURCES = 3,
 };
 
 /*
@@ -41,7 +44,13 @@ enum psi_states {
        PSI_CPU_SOME,
        /* Only per-CPU, to weigh the CPU in the global average: */
        PSI_NONIDLE,
-       NR_PSI_STATES,
+       NR_PSI_STATES = 6,
+};
+
+enum psi_aggregators {
+       PSI_AVGS = 0,
+       PSI_POLL,
+       NR_PSI_AGGREGATORS,
 };
 
 struct psi_group_cpu {
@@ -53,6 +62,9 @@ struct psi_group_cpu {
        /* States of the tasks belonging to this group */
        unsigned int tasks[NR_PSI_TASK_COUNTS];
 
+       /* Aggregate pressure state derived from the tasks */
+       u32 state_mask;
+
        /* Period time sampling buckets for each state of interest (ns) */
        u32 times[NR_PSI_STATES];
 
@@ -62,25 +74,94 @@ struct psi_group_cpu {
        /* 2nd cacheline updated by the aggregator */
 
        /* Delta detection against the sampling buckets */
-       u32 times_prev[NR_PSI_STATES] ____cacheline_aligned_in_smp;
+       u32 times_prev[NR_PSI_AGGREGATORS][NR_PSI_STATES]
+                       ____cacheline_aligned_in_smp;
+};
+
+/* PSI growth tracking window */
+struct psi_window {
+       /* Window size in ns */
+       u64 size;
+
+       /* Start time of the current window in ns */
+       u64 start_time;
+
+       /* Value at the start of the window */
+       u64 start_value;
+
+       /* Value growth in the previous window */
+       u64 prev_growth;
+};
+
+struct psi_trigger {
+       /* PSI state being monitored by the trigger */
+       enum psi_states state;
+
+       /* User-spacified threshold in ns */
+       u64 threshold;
+
+       /* List node inside triggers list */
+       struct list_head node;
+
+       /* Backpointer needed during trigger destruction */
+       struct psi_group *group;
+
+       /* Wait queue for polling */
+       wait_queue_head_t event_wait;
+
+       /* Pending event flag */
+       int event;
+
+       /* Tracking window */
+       struct psi_window win;
+
+       /*
+        * Time last event was generated. Used for rate-limiting
+        * events to one per window
+        */
+       u64 last_event_time;
+
+       /* Refcounting to prevent premature destruction */
+       struct kref refcount;
 };
 
 struct psi_group {
-       /* Protects data updated during an aggregation */
-       struct mutex stat_lock;
+       /* Protects data used by the aggregator */
+       struct mutex avgs_lock;
 
        /* Per-cpu task state & time tracking */
        struct psi_group_cpu __percpu *pcpu;
 
-       /* Periodic aggregation state */
-       u64 total_prev[NR_PSI_STATES - 1];
-       u64 last_update;
-       u64 next_update;
-       struct delayed_work clock_work;
+       /* Running pressure averages */
+       u64 avg_total[NR_PSI_STATES - 1];
+       u64 avg_last_update;
+       u64 avg_next_update;
+
+       /* Aggregator work control */
+       struct delayed_work avgs_work;
 
        /* Total stall times and sampled pressure averages */
-       u64 total[NR_PSI_STATES - 1];
+       u64 total[NR_PSI_AGGREGATORS][NR_PSI_STATES - 1];
        unsigned long avg[NR_PSI_STATES - 1][3];
+
+       /* Monitor work control */
+       atomic_t poll_scheduled;
+       struct kthread_worker __rcu *poll_kworker;
+       struct kthread_delayed_work poll_work;
+
+       /* Protects data used by the monitor */
+       struct mutex trigger_lock;
+
+       /* Configured polling triggers */
+       struct list_head triggers;
+       u32 nr_triggers[NR_PSI_STATES - 1];
+       u32 poll_states;
+       u64 poll_min_period;
+
+       /* Total stall times at the start of monitor activation */
+       u64 polling_total[NR_PSI_STATES - 1];
+       u64 polling_next_update;
+       u64 polling_until;
 };
 
 #else /* CONFIG_PSI */
index 3bcd67f..dd46494 100644 (file)
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
  */
index 13aeaf5..1f7dced 100644 (file)
@@ -20,7 +20,7 @@ struct random_ready_callback {
 
 extern void add_device_randomness(const void *, unsigned int);
 
-#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__)
+#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
 static inline void add_latent_entropy(void)
 {
        add_device_randomness((const void *)&latent_entropy,
index e63799a..3734cd8 100644 (file)
@@ -14,6 +14,7 @@ struct device;
 #define SYS_POWER_OFF  0x0003  /* Notify of system power off */
 
 enum reboot_mode {
+       REBOOT_UNDEFINED = -1,
        REBOOT_COLD = 0,
        REBOOT_WARM,
        REBOOT_HARD,
@@ -21,6 +22,7 @@ enum reboot_mode {
        REBOOT_GPIO,
 };
 extern enum reboot_mode reboot_mode;
+extern enum reboot_mode panic_reboot_mode;
 
 enum reboot_type {
        BOOT_TRIPLE     = 't',
index 2fcb998..8313e7e 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * max8973-regulator.h -- MAXIM 8973 regulator
  *
@@ -7,21 +8,6 @@
  * Copyright (C) 2012 NVIDIA Corporation
 
  * Author: Laxman Dewangan <ldewangan@nvidia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
  */
 
 #ifndef __LINUX_REGULATOR_MAX8973_H
index 331d7d9..d47e668 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #ifndef __LINUX_REG_PFUZE100_H
 #define __LINUX_REG_PFUZE100_H
index d00841e..1413d77 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * tps51632-regulator.h -- TPS51632 regulator
  *
@@ -7,21 +8,6 @@
  * Copyright (C) 2012 NVIDIA Corporation
 
  * Author: Laxman Dewangan <ldewangan@nvidia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
  */
 
 #ifndef __LINUX_REGULATOR_TPS51632_H
index a4c4939..94a90c0 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * tps62360.h -- TI tps62360
  *
@@ -6,21 +7,6 @@
  * Copyright (C) 2012 NVIDIA Corporation
 
  * Author: Laxman Dewangan <ldewangan@nvidia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
  */
 
 #ifndef __LINUX_REGULATOR_TPS62360_H
index 95d555c..e7793fc 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef _LINUX_RESET_H_
 #define _LINUX_RESET_H_
 
+#include <linux/err.h>
+#include <linux/errno.h>
 #include <linux/types.h>
 
 struct device;
diff --git a/include/linux/rtc/rtc-omap.h b/include/linux/rtc/rtc-omap.h
new file mode 100644 (file)
index 0000000..9f03a32
--- /dev/null
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _LINUX_RTCOMAP_H_
+#define _LINUX_RTCOMAP_H_
+
+int omap_rtc_power_off_program(struct device *dev);
+#endif /* _LINUX_RTCOMAP_H_ */
index aefd997..b31f285 100644 (file)
@@ -1,10 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * RTC I/O Bridge interfaces for CSR SiRFprimaII
  * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 #ifndef _SIRFSOC_RTC_IOBRG_H_
 #define _SIRFSOC_RTC_IOBRG_H_
index 443176e..bf290ad 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Driver for Realtek driver-based card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index e964bbd..f87da30 100644 (file)
@@ -1,20 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /* Driver for Realtek PCI-Express card reader
  *
  * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author:
  *   Wei WANG <wei_wang@realsil.com.cn>
  */
index a2cd158..1183741 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/latencytop.h>
 #include <linux/sched/prio.h>
 #include <linux/signal_types.h>
-#include <linux/psi_types.h>
 #include <linux/mm_types_task.h>
 #include <linux/task_io_accounting.h>
 #include <linux/rseq.h>
index e412c09..38a0f07 100644 (file)
@@ -271,17 +271,18 @@ static inline int signal_group_exit(const struct signal_struct *sig)
 extern void flush_signals(struct task_struct *);
 extern void ignore_signals(struct task_struct *);
 extern void flush_signal_handlers(struct task_struct *, int force_default);
-extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, kernel_siginfo_t *info);
+extern int dequeue_signal(struct task_struct *task,
+                         sigset_t *mask, kernel_siginfo_t *info);
 
 static inline int kernel_dequeue_signal(void)
 {
-       struct task_struct *tsk = current;
+       struct task_struct *task = current;
        kernel_siginfo_t __info;
        int ret;
 
-       spin_lock_irq(&tsk->sighand->siglock);
-       ret = dequeue_signal(tsk, &tsk->blocked, &__info);
-       spin_unlock_irq(&tsk->sighand->siglock);
+       spin_lock_irq(&task->sighand->siglock);
+       ret = dequeue_signal(task, &task->blocked, &__info);
+       spin_unlock_irq(&task->sighand->siglock);
 
        return ret;
 }
@@ -419,18 +420,18 @@ static inline void set_restore_sigmask(void)
        WARN_ON(!test_thread_flag(TIF_SIGPENDING));
 }
 
-static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
+static inline void clear_tsk_restore_sigmask(struct task_struct *task)
 {
-       clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
+       clear_tsk_thread_flag(task, TIF_RESTORE_SIGMASK);
 }
 
 static inline void clear_restore_sigmask(void)
 {
        clear_thread_flag(TIF_RESTORE_SIGMASK);
 }
-static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
+static inline bool test_tsk_restore_sigmask(struct task_struct *task)
 {
-       return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
+       return test_tsk_thread_flag(task, TIF_RESTORE_SIGMASK);
 }
 static inline bool test_restore_sigmask(void)
 {
@@ -449,9 +450,9 @@ static inline void set_restore_sigmask(void)
        current->restore_sigmask = true;
        WARN_ON(!test_thread_flag(TIF_SIGPENDING));
 }
-static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
+static inline void clear_tsk_restore_sigmask(struct task_struct *task)
 {
-       tsk->restore_sigmask = false;
+       task->restore_sigmask = false;
 }
 static inline void clear_restore_sigmask(void)
 {
@@ -461,9 +462,9 @@ static inline bool test_restore_sigmask(void)
 {
        return current->restore_sigmask;
 }
-static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
+static inline bool test_tsk_restore_sigmask(struct task_struct *task)
 {
-       return tsk->restore_sigmask;
+       return task->restore_sigmask;
 }
 static inline bool test_and_clear_restore_sigmask(void)
 {
@@ -617,9 +618,9 @@ static inline struct pid *task_session(struct task_struct *task)
        return task->signal->pids[PIDTYPE_SID];
 }
 
-static inline int get_nr_threads(struct task_struct *tsk)
+static inline int get_nr_threads(struct task_struct *task)
 {
-       return tsk->signal->nr_threads;
+       return task->signal->nr_threads;
 }
 
 static inline bool thread_group_leader(struct task_struct *p)
@@ -658,35 +659,35 @@ static inline int thread_group_empty(struct task_struct *p)
 #define delay_group_leader(p) \
                (thread_group_leader(p) && !thread_group_empty(p))
 
-extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
+extern struct sighand_struct *__lock_task_sighand(struct task_struct *task,
                                                        unsigned long *flags);
 
-static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
+static inline struct sighand_struct *lock_task_sighand(struct task_struct *task,
                                                       unsigned long *flags)
 {
        struct sighand_struct *ret;
 
-       ret = __lock_task_sighand(tsk, flags);
-       (void)__cond_lock(&tsk->sighand->siglock, ret);
+       ret = __lock_task_sighand(task, flags);
+       (void)__cond_lock(&task->sighand->siglock, ret);
        return ret;
 }
 
-static inline void unlock_task_sighand(struct task_struct *tsk,
+static inline void unlock_task_sighand(struct task_struct *task,
                                                unsigned long *flags)
 {
-       spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
+       spin_unlock_irqrestore(&task->sighand->siglock, *flags);
 }
 
-static inline unsigned long task_rlimit(const struct task_struct *tsk,
+static inline unsigned long task_rlimit(const struct task_struct *task,
                unsigned int limit)
 {
-       return READ_ONCE(tsk->signal->rlim[limit].rlim_cur);
+       return READ_ONCE(task->signal->rlim[limit].rlim_cur);
 }
 
-static inline unsigned long task_rlimit_max(const struct task_struct *tsk,
+static inline unsigned long task_rlimit_max(const struct task_struct *task,
                unsigned int limit)
 {
-       return READ_ONCE(tsk->signal->rlim[limit].rlim_max);
+       return READ_ONCE(task->signal->rlim[limit].rlim_max);
 }
 
 static inline unsigned long rlimit(unsigned int limit)
index 9a5eafb..abc7de7 100644 (file)
@@ -61,9 +61,6 @@ struct kmem_cache {
        atomic_t allocmiss;
        atomic_t freehit;
        atomic_t freemiss;
-#ifdef CONFIG_DEBUG_SLAB_LEAK
-       atomic_t store_user_clean;
-#endif
 
        /*
         * If debugging is enabled, then the allocator can add additional
diff --git a/include/linux/soc/cirrus/ep93xx.h b/include/linux/soc/cirrus/ep93xx.h
new file mode 100644 (file)
index 0000000..56fbe2d
--- /dev/null
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _SOC_EP93XX_H
+#define _SOC_EP93XX_H
+
+struct platform_device;
+
+#define EP93XX_CHIP_REV_D0     3
+#define EP93XX_CHIP_REV_D1     4
+#define EP93XX_CHIP_REV_E0     5
+#define EP93XX_CHIP_REV_E1     6
+#define EP93XX_CHIP_REV_E2     7
+
+#ifdef CONFIG_ARCH_EP93XX
+int ep93xx_pwm_acquire_gpio(struct platform_device *pdev);
+void ep93xx_pwm_release_gpio(struct platform_device *pdev);
+int ep93xx_ide_acquire_gpio(struct platform_device *pdev);
+void ep93xx_ide_release_gpio(struct platform_device *pdev);
+int ep93xx_keypad_acquire_gpio(struct platform_device *pdev);
+void ep93xx_keypad_release_gpio(struct platform_device *pdev);
+int ep93xx_i2s_acquire(void);
+void ep93xx_i2s_release(void);
+unsigned int ep93xx_chip_revision(void);
+
+#else
+static inline int ep93xx_pwm_acquire_gpio(struct platform_device *pdev) { return 0; }
+static inline void ep93xx_pwm_release_gpio(struct platform_device *pdev) {}
+static inline int ep93xx_ide_acquire_gpio(struct platform_device *pdev) { return 0; }
+static inline void ep93xx_ide_release_gpio(struct platform_device *pdev) {}
+static inline int ep93xx_keypad_acquire_gpio(struct platform_device *pdev) { return 0; }
+static inline void ep93xx_keypad_release_gpio(struct platform_device *pdev) {}
+static inline int ep93xx_i2s_acquire(void) { return 0; }
+static inline void ep93xx_i2s_release(void) {}
+static inline unsigned int ep93xx_chip_revision(void) { return 0; }
+
+#endif
+
+#endif
similarity index 95%
rename from arch/arm/mach-ixp4xx/include/mach/npe.h
rename to include/linux/soc/ixp4xx/npe.h
index 3a98084..2a91f46 100644 (file)
@@ -16,9 +16,7 @@ struct npe_regs {
 };
 
 struct npe {
-       struct resource *mem_res;
        struct npe_regs __iomem *regs;
-       u32 regs_phys;
        int id;
        int valid;
 };
diff --git a/include/linux/soc/ixp4xx/qmgr.h b/include/linux/soc/ixp4xx/qmgr.h
new file mode 100644 (file)
index 0000000..bed8ee9
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2007 Krzysztof Halasa <khc@pm.waw.pl>
+ *
+ * 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.
+ */
+
+#ifndef IXP4XX_QMGR_H
+#define IXP4XX_QMGR_H
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+
+#define DEBUG_QMGR     0
+
+#define HALF_QUEUES    32
+#define QUEUES         64
+#define MAX_QUEUE_LENGTH 4     /* in dwords */
+
+#define QUEUE_STAT1_EMPTY              1 /* queue status bits */
+#define QUEUE_STAT1_NEARLY_EMPTY       2
+#define QUEUE_STAT1_NEARLY_FULL                4
+#define QUEUE_STAT1_FULL               8
+#define QUEUE_STAT2_UNDERFLOW          1
+#define QUEUE_STAT2_OVERFLOW           2
+
+#define QUEUE_WATERMARK_0_ENTRIES      0
+#define QUEUE_WATERMARK_1_ENTRY                1
+#define QUEUE_WATERMARK_2_ENTRIES      2
+#define QUEUE_WATERMARK_4_ENTRIES      3
+#define QUEUE_WATERMARK_8_ENTRIES      4
+#define QUEUE_WATERMARK_16_ENTRIES     5
+#define QUEUE_WATERMARK_32_ENTRIES     6
+#define QUEUE_WATERMARK_64_ENTRIES     7
+
+/* queue interrupt request conditions */
+#define QUEUE_IRQ_SRC_EMPTY            0
+#define QUEUE_IRQ_SRC_NEARLY_EMPTY     1
+#define QUEUE_IRQ_SRC_NEARLY_FULL      2
+#define QUEUE_IRQ_SRC_FULL             3
+#define QUEUE_IRQ_SRC_NOT_EMPTY                4
+#define QUEUE_IRQ_SRC_NOT_NEARLY_EMPTY 5
+#define QUEUE_IRQ_SRC_NOT_NEARLY_FULL  6
+#define QUEUE_IRQ_SRC_NOT_FULL         7
+
+struct qmgr_regs {
+       u32 acc[QUEUES][MAX_QUEUE_LENGTH]; /* 0x000 - 0x3FF */
+       u32 stat1[4];           /* 0x400 - 0x40F */
+       u32 stat2[2];           /* 0x410 - 0x417 */
+       u32 statne_h;           /* 0x418 - queue nearly empty */
+       u32 statf_h;            /* 0x41C - queue full */
+       u32 irqsrc[4];          /* 0x420 - 0x42F IRC source */
+       u32 irqen[2];           /* 0x430 - 0x437 IRQ enabled */
+       u32 irqstat[2];         /* 0x438 - 0x43F - IRQ access only */
+       u32 reserved[1776];
+       u32 sram[2048];         /* 0x2000 - 0x3FFF - config and buffer */
+};
+
+void qmgr_put_entry(unsigned int queue, u32 val);
+u32 qmgr_get_entry(unsigned int queue);
+int qmgr_stat_empty(unsigned int queue);
+int qmgr_stat_below_low_watermark(unsigned int queue);
+int qmgr_stat_full(unsigned int queue);
+int qmgr_stat_overflow(unsigned int queue);
+void qmgr_release_queue(unsigned int queue);
+void qmgr_set_irq(unsigned int queue, int src,
+                 void (*handler)(void *pdev), void *pdev);
+void qmgr_enable_irq(unsigned int queue);
+void qmgr_disable_irq(unsigned int queue);
+
+/* request_ and release_queue() must be called from non-IRQ context */
+
+#if DEBUG_QMGR
+extern char qmgr_queue_descs[QUEUES][32];
+
+int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
+                      unsigned int nearly_empty_watermark,
+                      unsigned int nearly_full_watermark,
+                      const char *desc_format, const char* name);
+#else
+int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */,
+                        unsigned int nearly_empty_watermark,
+                        unsigned int nearly_full_watermark);
+#define qmgr_request_queue(queue, len, nearly_empty_watermark,         \
+                          nearly_full_watermark, desc_format, name)    \
+       __qmgr_request_queue(queue, len, nearly_empty_watermark,        \
+                            nearly_full_watermark)
+#endif
+
+#endif
diff --git a/include/linux/soc/ti/ti_sci_inta_msi.h b/include/linux/soc/ti/ti_sci_inta_msi.h
new file mode 100644 (file)
index 0000000..11fb504
--- /dev/null
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Texas Instruments' K3 TI SCI INTA MSI helper
+ *
+ * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
+ *     Lokesh Vutla <lokeshvutla@ti.com>
+ */
+
+#ifndef __INCLUDE_LINUX_TI_SCI_INTA_MSI_H
+#define __INCLUDE_LINUX_TI_SCI_INTA_MSI_H
+
+#include <linux/msi.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+struct irq_domain
+*ti_sci_inta_msi_create_irq_domain(struct fwnode_handle *fwnode,
+                                  struct msi_domain_info *info,
+                                  struct irq_domain *parent);
+int ti_sci_inta_msi_domain_alloc_irqs(struct device *dev,
+                                     struct ti_sci_resource *res);
+unsigned int ti_sci_inta_msi_get_virq(struct device *dev, u32 index);
+void ti_sci_inta_msi_domain_free_irqs(struct device *dev);
+#endif /* __INCLUDE_LINUX_IRQCHIP_TI_SCI_INTA_H */
index 18435e5..568722a 100644 (file)
@@ -193,14 +193,67 @@ struct ti_sci_clk_ops {
 };
 
 /**
+ * struct ti_sci_rm_core_ops - Resource management core operations
+ * @get_range:         Get a range of resources belonging to ti sci host.
+ * @get_rage_from_shost:       Get a range of resources belonging to
+ *                             specified host id.
+ *                     - s_host: Host processing entity to which the
+ *                               resources are allocated
+ *
+ * NOTE: for these functions, all the parameters are consolidated and defined
+ * as below:
+ * - handle:   Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * - dev_id:   TISCI device ID.
+ * - subtype:  Resource assignment subtype that is being requested
+ *             from the given device.
+ * - range_start:      Start index of the resource range
+ * - range_end:                Number of resources in the range
+ */
+struct ti_sci_rm_core_ops {
+       int (*get_range)(const struct ti_sci_handle *handle, u32 dev_id,
+                        u8 subtype, u16 *range_start, u16 *range_num);
+       int (*get_range_from_shost)(const struct ti_sci_handle *handle,
+                                   u32 dev_id, u8 subtype, u8 s_host,
+                                   u16 *range_start, u16 *range_num);
+};
+
+/**
+ * struct ti_sci_rm_irq_ops: IRQ management operations
+ * @set_irq:           Set an IRQ route between the requested source
+ *                     and destination
+ * @set_event_map:     Set an Event based peripheral irq to Interrupt
+ *                     Aggregator.
+ * @free_irq:          Free an an IRQ route between the requested source
+ *                     destination.
+ * @free_event_map:    Free an event based peripheral irq to Interrupt
+ *                     Aggregator.
+ */
+struct ti_sci_rm_irq_ops {
+       int (*set_irq)(const struct ti_sci_handle *handle, u16 src_id,
+                      u16 src_index, u16 dst_id, u16 dst_host_irq);
+       int (*set_event_map)(const struct ti_sci_handle *handle, u16 src_id,
+                            u16 src_index, u16 ia_id, u16 vint,
+                            u16 global_event, u8 vint_status_bit);
+       int (*free_irq)(const struct ti_sci_handle *handle, u16 src_id,
+                       u16 src_index, u16 dst_id, u16 dst_host_irq);
+       int (*free_event_map)(const struct ti_sci_handle *handle, u16 src_id,
+                             u16 src_index, u16 ia_id, u16 vint,
+                             u16 global_event, u8 vint_status_bit);
+};
+
+/**
  * struct ti_sci_ops - Function support for TI SCI
  * @dev_ops:   Device specific operations
  * @clk_ops:   Clock specific operations
+ * @rm_core_ops:       Resource management core operations.
+ * @rm_irq_ops:                IRQ management specific operations
  */
 struct ti_sci_ops {
        struct ti_sci_core_ops core_ops;
        struct ti_sci_dev_ops dev_ops;
        struct ti_sci_clk_ops clk_ops;
+       struct ti_sci_rm_core_ops rm_core_ops;
+       struct ti_sci_rm_irq_ops rm_irq_ops;
 };
 
 /**
@@ -213,10 +266,47 @@ struct ti_sci_handle {
        struct ti_sci_ops ops;
 };
 
+#define TI_SCI_RESOURCE_NULL   0xffff
+
+/**
+ * struct ti_sci_resource_desc - Description of TI SCI resource instance range.
+ * @start:     Start index of the resource.
+ * @num:       Number of resources.
+ * @res_map:   Bitmap to manage the allocation of these resources.
+ */
+struct ti_sci_resource_desc {
+       u16 start;
+       u16 num;
+       unsigned long *res_map;
+};
+
+/**
+ * struct ti_sci_resource - Structure representing a resource assigned
+ *                         to a device.
+ * @sets:      Number of sets available from this resource type
+ * @lock:      Lock to guard the res map in each set.
+ * @desc:      Array of resource descriptors.
+ */
+struct ti_sci_resource {
+       u16 sets;
+       raw_spinlock_t lock;
+       struct ti_sci_resource_desc *desc;
+};
+
 #if IS_ENABLED(CONFIG_TI_SCI_PROTOCOL)
 const struct ti_sci_handle *ti_sci_get_handle(struct device *dev);
 int ti_sci_put_handle(const struct ti_sci_handle *handle);
 const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev);
+const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
+                                                 const char *property);
+const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev,
+                                                      const char *property);
+u16 ti_sci_get_free_resource(struct ti_sci_resource *res);
+void ti_sci_release_resource(struct ti_sci_resource *res, u16 id);
+u32 ti_sci_get_num_resources(struct ti_sci_resource *res);
+struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+                           struct device *dev, u32 dev_id, char *of_prop);
 
 #else  /* CONFIG_TI_SCI_PROTOCOL */
 
@@ -236,6 +326,40 @@ const struct ti_sci_handle *devm_ti_sci_get_handle(struct device *dev)
        return ERR_PTR(-EINVAL);
 }
 
+static inline
+const struct ti_sci_handle *ti_sci_get_by_phandle(struct device_node *np,
+                                                 const char *property)
+{
+       return ERR_PTR(-EINVAL);
+}
+
+static inline
+const struct ti_sci_handle *devm_ti_sci_get_by_phandle(struct device *dev,
+                                                      const char *property)
+{
+       return ERR_PTR(-EINVAL);
+}
+
+static inline u16 ti_sci_get_free_resource(struct ti_sci_resource *res)
+{
+       return TI_SCI_RESOURCE_NULL;
+}
+
+static inline void ti_sci_release_resource(struct ti_sci_resource *res, u16 id)
+{
+}
+
+static inline u32 ti_sci_get_num_resources(struct ti_sci_resource *res)
+{
+       return 0;
+}
+
+static inline struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+                           struct device *dev, u32 dev_id, char *of_prop)
+{
+       return ERR_PTR(-EINVAL);
+}
 #endif /* CONFIG_TI_SCI_PROTOCOL */
 
 #endif /* __TISCI_PROTOCOL_H */
index e523853..1afe38e 100644 (file)
@@ -271,6 +271,7 @@ struct svc_rqst {
 #define        RQ_VICTIM       (5)                     /* about to be shut down */
 #define        RQ_BUSY         (6)                     /* request is busy */
 #define        RQ_DATA         (7)                     /* request has data */
+#define RQ_AUTHERR     (8)                     /* Request status is auth error */
        unsigned long           rq_flags;       /* flags field */
        ktime_t                 rq_qtime;       /* enqueue time */
 
@@ -382,6 +383,16 @@ struct svc_deferred_req {
        __be32                  args[0];
 };
 
+struct svc_process_info {
+       union {
+               int  (*dispatch)(struct svc_rqst *, __be32 *);
+               struct {
+                       unsigned int lovers;
+                       unsigned int hivers;
+               } mismatch;
+       };
+};
+
 /*
  * List of RPC programs on the same transport endpoint
  */
@@ -396,6 +407,14 @@ struct svc_program {
        char *                  pg_class;       /* class name: services sharing authentication */
        struct svc_stat *       pg_stats;       /* rpc statistics */
        int                     (*pg_authenticate)(struct svc_rqst *);
+       __be32                  (*pg_init_request)(struct svc_rqst *,
+                                                  const struct svc_program *,
+                                                  struct svc_process_info *);
+       int                     (*pg_rpcbind_set)(struct net *net,
+                                                 const struct svc_program *,
+                                                 u32 version, int family,
+                                                 unsigned short proto,
+                                                 unsigned short port);
 };
 
 /*
@@ -504,6 +523,20 @@ unsigned int          svc_fill_write_vector(struct svc_rqst *rqstp,
 char             *svc_fill_symlink_pathname(struct svc_rqst *rqstp,
                                             struct kvec *first, void *p,
                                             size_t total);
+__be32            svc_return_autherr(struct svc_rqst *rqstp, __be32 auth_err);
+__be32            svc_generic_init_request(struct svc_rqst *rqstp,
+                                           const struct svc_program *progp,
+                                           struct svc_process_info *procinfo);
+int               svc_generic_rpcbind_set(struct net *net,
+                                          const struct svc_program *progp,
+                                          u32 version, int family,
+                                          unsigned short proto,
+                                          unsigned short port);
+int               svc_rpcbind_set_version(struct net *net,
+                                          const struct svc_program *progp,
+                                          u32 version, int family,
+                                          unsigned short proto,
+                                          unsigned short port);
 
 #define        RPC_MAX_ADDRBUFLEN      (63U)
 
index b3f9577..ea6f46b 100644 (file)
@@ -86,6 +86,7 @@ struct svc_xprt {
        struct list_head        xpt_users;      /* callbacks on free */
 
        struct net              *xpt_net;
+       const struct cred       *xpt_cred;
        struct rpc_xprt         *xpt_bc_xprt;   /* NFSv4.1 backchannel */
        struct rpc_xprt_switch  *xpt_bc_xps;    /* NFSv4.1 backchannel */
 };
@@ -119,7 +120,8 @@ void        svc_unreg_xprt_class(struct svc_xprt_class *);
 void   svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
                      struct svc_serv *);
 int    svc_create_xprt(struct svc_serv *, const char *, struct net *,
-                       const int, const unsigned short, int);
+                       const int, const unsigned short, int,
+                       const struct cred *);
 void   svc_xprt_do_enqueue(struct svc_xprt *xprt);
 void   svc_xprt_enqueue(struct svc_xprt *xprt);
 void   svc_xprt_put(struct svc_xprt *xprt);
index 119718a..771baad 100644 (file)
@@ -59,7 +59,8 @@ void          svc_drop(struct svc_rqst *);
 void           svc_sock_update_bufs(struct svc_serv *serv);
 bool           svc_alien_sock(struct net *net, int fd);
 int            svc_addsock(struct svc_serv *serv, const int fd,
-                                       char *name_return, const size_t len);
+                                       char *name_return, const size_t len,
+                                       const struct cred *cred);
 void           svc_init_xprt_sock(void);
 void           svc_cleanup_xprt_sock(void);
 struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot);
index e1c3632..86af908 100644 (file)
@@ -1,21 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*  Syslog internals
  *
  *  Copyright 2010 Canonical, Ltd.
  *  Author: Kees Cook <kees.cook@canonical.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  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.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #ifndef _LINUX_SYSLOG_H
index 5f4705f..15a4ca5 100644 (file)
@@ -442,11 +442,16 @@ void thermal_zone_device_update(struct thermal_zone_device *,
                                enum thermal_notify_event);
 void thermal_zone_set_trips(struct thermal_zone_device *);
 
-struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
-               const struct thermal_cooling_device_ops *);
+struct thermal_cooling_device *thermal_cooling_device_register(const char *,
+               void *, const struct thermal_cooling_device_ops *);
 struct thermal_cooling_device *
-thermal_of_cooling_device_register(struct device_node *np, char *, void *,
+thermal_of_cooling_device_register(struct device_node *np, const char *, void *,
                                   const struct thermal_cooling_device_ops *);
+struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev,
+                               struct device_node *np,
+                               char *type, void *devdata,
+                               const struct thermal_cooling_device_ops *ops);
 void thermal_cooling_device_unregister(struct thermal_cooling_device *);
 struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name);
 int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp);
@@ -503,6 +508,14 @@ static inline struct thermal_cooling_device *
 thermal_of_cooling_device_register(struct device_node *np,
        char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
 { return ERR_PTR(-ENODEV); }
+static inline struct thermal_cooling_device *
+devm_thermal_of_cooling_device_register(struct device *dev,
+                               struct device_node *np,
+                               char *type, void *devdata,
+                               const struct thermal_cooling_device_ops *ops)
+{
+       return ERR_PTR(-ENODEV);
+}
 static inline void thermal_cooling_device_unregister(
        struct thermal_cooling_device *cdev)
 { }
index 53604b0..2fc8541 100644 (file)
@@ -55,6 +55,7 @@ struct ti_emif_pm_data {
 struct ti_emif_pm_functions {
        u32 save_context;
        u32 restore_context;
+       u32 run_hw_leveling;
        u32 enter_sr;
        u32 exit_sr;
        u32 abort_sr;
@@ -126,6 +127,8 @@ static inline void ti_emif_asm_offsets(void)
               offsetof(struct ti_emif_pm_functions, save_context));
        DEFINE(EMIF_PM_RESTORE_CONTEXT_OFFSET,
               offsetof(struct ti_emif_pm_functions, restore_context));
+       DEFINE(EMIF_PM_RUN_HW_LEVELING,
+              offsetof(struct ti_emif_pm_functions, run_hw_leveling));
        DEFINE(EMIF_PM_ENTER_SR_OFFSET,
               offsetof(struct ti_emif_pm_functions, enter_sr));
        DEFINE(EMIF_PM_EXIT_SR_OFFSET,
index 9c31865..86b019a 100644 (file)
@@ -548,4 +548,19 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 
 #define TRACE_EVENT_PERF_PERM(event, expr...)
 
+#define DECLARE_EVENT_NOP(name, proto, args)                           \
+       static inline void trace_##name(proto)                          \
+       { }                                                             \
+       static inline bool trace_##name##_enabled(void)                 \
+       {                                                               \
+               return false;                                           \
+       }
+
+#define TRACE_EVENT_NOP(name, proto, args, struct, assign, print)      \
+       DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
+
+#define DECLARE_EVENT_CLASS_NOP(name, proto, args, tstruct, assign, print)
+#define DEFINE_EVENT_NOP(template, name, proto, args)                  \
+       DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
+
 #endif /* ifdef TRACE_EVENT (see note above) */
index c6eebb8..51e1312 100644 (file)
@@ -50,12 +50,16 @@ struct vm_struct {
 struct vmap_area {
        unsigned long va_start;
        unsigned long va_end;
+
+       /*
+        * Largest available free size in subtree.
+        */
+       unsigned long subtree_max_size;
        unsigned long flags;
        struct rb_node rb_node;         /* address sorted rbtree */
        struct list_head list;          /* address sorted list */
        struct llist_node purge_list;    /* "lazy purge" list */
        struct vm_struct *vm;
-       struct rcu_head rcu_head;
 };
 
 /*
index 2b0072f..7dec36a 100644 (file)
@@ -305,6 +305,19 @@ do {                                                                       \
        __ret;                                                          \
 })
 
+#define __wait_var_event_interruptible(var, condition)                 \
+       ___wait_var_event(var, condition, TASK_INTERRUPTIBLE, 0, 0,     \
+                         schedule())
+
+#define wait_var_event_interruptible(var, condition)                   \
+({                                                                     \
+       int __ret = 0;                                                  \
+       might_sleep();                                                  \
+       if (!(condition))                                               \
+               __ret = __wait_var_event_interruptible(var, condition); \
+       __ret;                                                          \
+})
+
 /**
  * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit
  *
index 5c31a76..f76d2f2 100644 (file)
@@ -92,7 +92,7 @@ struct vpbe_config {
        struct encoder_config_info *ext_encoders;
        /* amplifier information goes here */
        struct amp_config_info *amp;
-       int num_outputs;
+       unsigned int num_outputs;
        /* Order is venc outputs followed by LCD and then external encoders */
        struct vpbe_output *outputs;
 };
index 78c856c..93358bf 100644 (file)
@@ -45,6 +45,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
                                           gfp_t,
                                           rxrpc_notify_rx_t,
                                           bool,
+                                          bool,
                                           unsigned int);
 int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
                           struct msghdr *, size_t,
@@ -68,5 +69,7 @@ u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
 bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
                                 ktime_t *);
 bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
+void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
+                              unsigned long);
 
 #endif /* _NET_RXRPC_H */
index 313a8d3..b3504fc 100644 (file)
@@ -1,22 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
  */
 
 #ifndef _NET_BOND_ALB_H
index 5f95b11..f8667a3 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * CALIPSO - Common Architecture Label IPv6 Security Option
  *
@@ -6,26 +7,11 @@
  *
  * Authors: Paul Moore <paul@paul-moore.com>
  *          Huw Davies <huw@codeweavers.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _CALIPSO_H
index 880adb2..428b672 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * CIPSO - Commercial IP Security Option
  *
  * de-facto standard for labeled networking.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _CIPSO_IPV4_H
index 413a15e..f83932b 100644 (file)
@@ -1,17 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #ifndef _NET_DN_NSP_H
 #define _NET_DN_NSP_H
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
     
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 *******************************************************************************/
 /* dn_nsp.c functions prototyping */
 
index 342d250..6f1e94a 100644 (file)
@@ -1,18 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #ifndef _NET_DN_ROUTE_H
 #define _NET_DN_ROUTE_H
 
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
     
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 *******************************************************************************/
 
 struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
index 0386b61..f1c2897 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C)2003-2006 Helsinki University of Technology
  * Copyright (C)2003-2006 USAGI/WIDE Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Authors:
index 72d6435..43ae503 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel System
  *
@@ -5,25 +6,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_H
index 008f466..b35f37a 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __NET_HCI_H
index bbdc73a..5d277d6 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  * Copyright (C) 2014 Marvell International Ltd.
@@ -5,19 +6,6 @@
  * Authors:
  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __NET_NFC_H
similarity index 99%
rename from include/linux/atmel_tc.h
rename to include/soc/at91/atmel_tcb.h
index 468fdfa..c3c7200 100644 (file)
@@ -7,8 +7,8 @@
  * (at your option) any later version.
  */
 
-#ifndef ATMEL_TC_H
-#define ATMEL_TC_H
+#ifndef __SOC_ATMEL_TCB_H
+#define __SOC_ATMEL_TCB_H
 
 #include <linux/compiler.h>
 #include <linux/list.h>
index 896c3f4..e834678 100644 (file)
@@ -81,6 +81,7 @@ struct hdac_device {
        atomic_t in_pm;         /* suspend/resume being performed */
 
        /* sysfs */
+       struct mutex widget_lock;
        struct hdac_widget_tree *widgets;
 
        /* regmap */
index cb30c55..bd75f97 100644 (file)
                assign, print, reg, unreg)                      \
        DEFINE_TRACE_FN(name, reg, unreg)
 
+#undef TRACE_EVENT_NOP
+#define TRACE_EVENT_NOP(name, proto, args, struct, assign, print)
+
+#undef DEFINE_EVENT_NOP
+#define DEFINE_EVENT_NOP(template, name, proto, args)
+
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args) \
        DEFINE_TRACE(name)
 #undef TRACE_EVENT_FN
 #undef TRACE_EVENT_FN_COND
 #undef TRACE_EVENT_CONDITION
+#undef TRACE_EVENT_NOP
+#undef DEFINE_EVENT_NOP
 #undef DECLARE_EVENT_CLASS
 #undef DEFINE_EVENT
 #undef DEFINE_EVENT_FN
index 3d340b6..1ba84b7 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * include/trace/events/host1x.h
  *
  * host1x event logging to ftrace.
  *
  * Copyright (c) 2010-2013, NVIDIA Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #undef TRACE_SYSTEM
index 80339fd..02a3f78 100644 (file)
@@ -7,6 +7,12 @@
 
 #include <linux/tracepoint.h>
 
+#ifdef CONFIG_RCU_TRACE
+#define TRACE_EVENT_RCU TRACE_EVENT
+#else
+#define TRACE_EVENT_RCU TRACE_EVENT_NOP
+#endif
+
 /*
  * Tracepoint for start/end markers used for utilization calculations.
  * By convention, the string is of the following forms:
@@ -35,8 +41,6 @@ TRACE_EVENT(rcu_utilization,
        TP_printk("%s", __entry->s)
 );
 
-#ifdef CONFIG_RCU_TRACE
-
 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
 
 /*
@@ -62,7 +66,7 @@ TRACE_EVENT(rcu_utilization,
  *     "end": End a grace period.
  *     "cpuend": CPU first notices a grace-period end.
  */
-TRACE_EVENT(rcu_grace_period,
+TRACE_EVENT_RCU(rcu_grace_period,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent),
 
@@ -101,7 +105,7 @@ TRACE_EVENT(rcu_grace_period,
  * "Cleanup": Clean up rcu_node structure after previous GP.
  * "CleanupMore": Clean up, and another GP is needed.
  */
-TRACE_EVENT(rcu_future_grace_period,
+TRACE_EVENT_RCU(rcu_future_grace_period,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq,
                 unsigned long gp_seq_req, u8 level, int grplo, int grphi,
@@ -141,7 +145,7 @@ TRACE_EVENT(rcu_future_grace_period,
  * rcu_node structure, and the mask of CPUs that will be waited for.
  * All but the type of RCU are extracted from the rcu_node structure.
  */
-TRACE_EVENT(rcu_grace_period_init,
+TRACE_EVENT_RCU(rcu_grace_period_init,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level,
                 int grplo, int grphi, unsigned long qsmask),
@@ -186,7 +190,7 @@ TRACE_EVENT(rcu_grace_period_init,
  *     "endwake": Woke piggybackers up.
  *     "done": Someone else did the expedited grace period for us.
  */
-TRACE_EVENT(rcu_exp_grace_period,
+TRACE_EVENT_RCU(rcu_exp_grace_period,
 
        TP_PROTO(const char *rcuname, unsigned long gpseq, const char *gpevent),
 
@@ -218,7 +222,7 @@ TRACE_EVENT(rcu_exp_grace_period,
  *     "nxtlvl": Advance to next level of rcu_node funnel
  *     "wait": Wait for someone else to do expedited GP
  */
-TRACE_EVENT(rcu_exp_funnel_lock,
+TRACE_EVENT_RCU(rcu_exp_funnel_lock,
 
        TP_PROTO(const char *rcuname, u8 level, int grplo, int grphi,
                 const char *gpevent),
@@ -269,7 +273,7 @@ TRACE_EVENT(rcu_exp_funnel_lock,
  *     "WaitQueue": Enqueue partially done, timed wait for it to complete.
  *     "WokeQueue": Partial enqueue now complete.
  */
-TRACE_EVENT(rcu_nocb_wake,
+TRACE_EVENT_RCU(rcu_nocb_wake,
 
        TP_PROTO(const char *rcuname, int cpu, const char *reason),
 
@@ -297,7 +301,7 @@ TRACE_EVENT(rcu_nocb_wake,
  * include SRCU), the grace-period number that the task is blocking
  * (the current or the next), and the task's PID.
  */
-TRACE_EVENT(rcu_preempt_task,
+TRACE_EVENT_RCU(rcu_preempt_task,
 
        TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq),
 
@@ -324,7 +328,7 @@ TRACE_EVENT(rcu_preempt_task,
  * read-side critical section exiting that critical section.  Track the
  * type of RCU (which one day might include SRCU) and the task's PID.
  */
-TRACE_EVENT(rcu_unlock_preempted_task,
+TRACE_EVENT_RCU(rcu_unlock_preempted_task,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid),
 
@@ -353,7 +357,7 @@ TRACE_EVENT(rcu_unlock_preempted_task,
  * whether there are any blocked tasks blocking the current grace period.
  * All but the type of RCU are extracted from the rcu_node structure.
  */
-TRACE_EVENT(rcu_quiescent_state_report,
+TRACE_EVENT_RCU(rcu_quiescent_state_report,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq,
                 unsigned long mask, unsigned long qsmask,
@@ -396,7 +400,7 @@ TRACE_EVENT(rcu_quiescent_state_report,
  * state, which can be "dti" for dyntick-idle mode or "kick" when kicking
  * a CPU that has been in dyntick-idle mode for too long.
  */
-TRACE_EVENT(rcu_fqs,
+TRACE_EVENT_RCU(rcu_fqs,
 
        TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent),
 
@@ -436,7 +440,7 @@ TRACE_EVENT(rcu_fqs,
  * events use two separate counters, and that the "++=" and "--=" events
  * for irq/NMI will change the counter by two, otherwise by one.
  */
-TRACE_EVENT(rcu_dyntick,
+TRACE_EVENT_RCU(rcu_dyntick,
 
        TP_PROTO(const char *polarity, long oldnesting, long newnesting, atomic_t dynticks),
 
@@ -468,7 +472,7 @@ TRACE_EVENT(rcu_dyntick,
  * number of lazy callbacks queued, and the fourth element is the
  * total number of callbacks queued.
  */
-TRACE_EVENT(rcu_callback,
+TRACE_EVENT_RCU(rcu_callback,
 
        TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
                 long qlen),
@@ -504,7 +508,7 @@ TRACE_EVENT(rcu_callback,
  * the fourth argument is the number of lazy callbacks queued, and the
  * fifth argument is the total number of callbacks queued.
  */
-TRACE_EVENT(rcu_kfree_callback,
+TRACE_EVENT_RCU(rcu_kfree_callback,
 
        TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
                 long qlen_lazy, long qlen),
@@ -539,7 +543,7 @@ TRACE_EVENT(rcu_kfree_callback,
  * the total number of callbacks queued, and the fourth argument is
  * the current RCU-callback batch limit.
  */
-TRACE_EVENT(rcu_batch_start,
+TRACE_EVENT_RCU(rcu_batch_start,
 
        TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
 
@@ -569,7 +573,7 @@ TRACE_EVENT(rcu_batch_start,
  * The first argument is the type of RCU, and the second argument is
  * a pointer to the RCU callback itself.
  */
-TRACE_EVENT(rcu_invoke_callback,
+TRACE_EVENT_RCU(rcu_invoke_callback,
 
        TP_PROTO(const char *rcuname, struct rcu_head *rhp),
 
@@ -598,7 +602,7 @@ TRACE_EVENT(rcu_invoke_callback,
  * is the offset of the callback within the enclosing RCU-protected
  * data structure.
  */
-TRACE_EVENT(rcu_invoke_kfree_callback,
+TRACE_EVENT_RCU(rcu_invoke_kfree_callback,
 
        TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
 
@@ -631,7 +635,7 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
  * and the sixth argument (risk) is the return value from
  * rcu_is_callbacks_kthread().
  */
-TRACE_EVENT(rcu_batch_end,
+TRACE_EVENT_RCU(rcu_batch_end,
 
        TP_PROTO(const char *rcuname, int callbacks_invoked,
                 char cb, char nr, char iit, char risk),
@@ -673,7 +677,7 @@ TRACE_EVENT(rcu_batch_end,
  * callback address can be NULL.
  */
 #define RCUTORTURENAME_LEN 8
-TRACE_EVENT(rcu_torture_read,
+TRACE_EVENT_RCU(rcu_torture_read,
 
        TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
                 unsigned long secs, unsigned long c_old, unsigned long c),
@@ -721,7 +725,7 @@ TRACE_EVENT(rcu_torture_read,
  * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
  * is the count of remaining callbacks, and "done" is the piggybacking count.
  */
-TRACE_EVENT(rcu_barrier,
+TRACE_EVENT_RCU(rcu_barrier,
 
        TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
 
@@ -748,41 +752,6 @@ TRACE_EVENT(rcu_barrier,
                  __entry->done)
 );
 
-#else /* #ifdef CONFIG_RCU_TRACE */
-
-#define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0)
-#define trace_rcu_future_grace_period(rcuname, gp_seq, gp_seq_req, \
-                                     level, grplo, grphi, event) \
-                                     do { } while (0)
-#define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \
-                                   qsmask) do { } while (0)
-#define trace_rcu_exp_grace_period(rcuname, gqseq, gpevent) \
-       do { } while (0)
-#define trace_rcu_exp_funnel_lock(rcuname, level, grplo, grphi, gpevent) \
-       do { } while (0)
-#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
-#define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0)
-#define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0)
-#define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \
-                                        grplo, grphi, gp_tasks) do { } \
-       while (0)
-#define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0)
-#define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
-#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
-#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
-       do { } while (0)
-#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
-       do { } while (0)
-#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
-#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
-#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
-       do { } while (0)
-#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
-       do { } while (0)
-#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
-
-#endif /* #else #ifdef CONFIG_RCU_TRACE */
-
 #endif /* _TRACE_RCU_H */
 
 /* This part must be outside protection */
index 9a4bdfa..c8c7c7e 100644 (file)
@@ -241,7 +241,6 @@ DECLARE_EVENT_CLASS(sched_process_template,
 DEFINE_EVENT(sched_process_template, sched_process_free,
             TP_PROTO(struct task_struct *p),
             TP_ARGS(p));
-            
 
 /*
  * Tracepoint for a task exiting:
@@ -336,11 +335,20 @@ TRACE_EVENT(sched_process_exec,
                  __entry->pid, __entry->old_pid)
 );
 
+
+#ifdef CONFIG_SCHEDSTATS
+#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT
+#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS
+#else
+#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT_NOP
+#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS_NOP
+#endif
+
 /*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
-DECLARE_EVENT_CLASS(sched_stat_template,
+DECLARE_EVENT_CLASS_SCHEDSTAT(sched_stat_template,
 
        TP_PROTO(struct task_struct *tsk, u64 delay),
 
@@ -363,12 +371,11 @@ DECLARE_EVENT_CLASS(sched_stat_template,
                        (unsigned long long)__entry->delay)
 );
 
-
 /*
  * Tracepoint for accounting wait time (time the task is runnable
  * but not actually running due to scheduler contention).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_wait,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_wait,
             TP_PROTO(struct task_struct *tsk, u64 delay),
             TP_ARGS(tsk, delay));
 
@@ -376,7 +383,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_wait,
  * Tracepoint for accounting sleep time (time the task is not runnable,
  * including iowait, see below).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_sleep,
             TP_PROTO(struct task_struct *tsk, u64 delay),
             TP_ARGS(tsk, delay));
 
@@ -384,14 +391,14 @@ DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
  * Tracepoint for accounting iowait time (time the task is not runnable
  * due to waiting on IO to complete).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_iowait,
             TP_PROTO(struct task_struct *tsk, u64 delay),
             TP_ARGS(tsk, delay));
 
 /*
  * Tracepoint for accounting blocked time (time the task is in uninterruptible).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_blocked,
             TP_PROTO(struct task_struct *tsk, u64 delay),
             TP_ARGS(tsk, delay));
 
index dee7292..a87904d 100644 (file)
@@ -832,9 +832,21 @@ __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
 __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
 #define __NR_io_uring_register 427
 __SYSCALL(__NR_io_uring_register, sys_io_uring_register)
+#define __NR_open_tree 428
+__SYSCALL(__NR_open_tree, sys_open_tree)
+#define __NR_move_mount 429
+__SYSCALL(__NR_move_mount, sys_move_mount)
+#define __NR_fsopen 430
+__SYSCALL(__NR_fsopen, sys_fsopen)
+#define __NR_fsconfig 431
+__SYSCALL(__NR_fsconfig, sys_fsconfig)
+#define __NR_fsmount 432
+__SYSCALL(__NR_fsmount, sys_fsmount)
+#define __NR_fspick 433
+__SYSCALL(__NR_fspick, sys_fspick)
 
 #undef __NR_syscalls
-#define __NR_syscalls 428
+#define __NR_syscalls 434
 
 /*
  * 32 bit systems traditionally used different
index 6d4ea4b..2fe12b4 100644 (file)
@@ -986,8 +986,13 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
 #define KVM_CAP_EXCEPTION_PAYLOAD 164
 #define KVM_CAP_ARM_VM_IPA_SIZE 165
-#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
+#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 /* Obsolete */
 #define KVM_CAP_HYPERV_CPUID 167
+#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
+#define KVM_CAP_PPC_IRQ_XIVE 169
+#define KVM_CAP_ARM_SVE 170
+#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
+#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1145,6 +1150,7 @@ struct kvm_dirty_tlb {
 #define KVM_REG_SIZE_U256      0x0050000000000000ULL
 #define KVM_REG_SIZE_U512      0x0060000000000000ULL
 #define KVM_REG_SIZE_U1024     0x0070000000000000ULL
+#define KVM_REG_SIZE_U2048     0x0080000000000000ULL
 
 struct kvm_reg_list {
        __u64 n; /* number of regs */
@@ -1211,6 +1217,8 @@ enum kvm_device_type {
 #define KVM_DEV_TYPE_ARM_VGIC_V3       KVM_DEV_TYPE_ARM_VGIC_V3
        KVM_DEV_TYPE_ARM_VGIC_ITS,
 #define KVM_DEV_TYPE_ARM_VGIC_ITS      KVM_DEV_TYPE_ARM_VGIC_ITS
+       KVM_DEV_TYPE_XIVE,
+#define KVM_DEV_TYPE_XIVE              KVM_DEV_TYPE_XIVE
        KVM_DEV_TYPE_MAX,
 };
 
@@ -1434,12 +1442,15 @@ struct kvm_enc_region {
 #define KVM_GET_NESTED_STATE         _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
 #define KVM_SET_NESTED_STATE         _IOW(KVMIO,  0xbf, struct kvm_nested_state)
 
-/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */
+/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */
 #define KVM_CLEAR_DIRTY_LOG          _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
 
 /* Available with KVM_CAP_HYPERV_CPUID */
 #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
 
+/* Available with KVM_CAP_ARM_SVE */
+#define KVM_ARM_VCPU_FINALIZE    _IOW(KVMIO,  0xc2, int)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
        /* Guest initialization commands */
index f8f5ccc..b1e9de4 100644 (file)
@@ -36,6 +36,7 @@ enum cld_command {
        Cld_Remove,             /* remove record of this cm_id */
        Cld_Check,              /* is this cm_id allowed? */
        Cld_GraceDone,          /* grace period is complete */
+       Cld_GraceStart,
 };
 
 /* representation of long-form NFSv4 client ID */
index 4b2c93b..4955e1a 100644 (file)
@@ -307,8 +307,10 @@ static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
        tlv_ptr = (struct tlv_desc *)tlv;
        tlv_ptr->tlv_type = htons(type);
        tlv_ptr->tlv_len  = htons(tlv_len);
-       if (len && data)
-               memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
+       if (len && data) {
+               memcpy(TLV_DATA(tlv_ptr), data, len);
+               memset(TLV_DATA(tlv_ptr) + len, 0, TLV_SPACE(len) - tlv_len);
+       }
        return TLV_SPACE(len);
 }
 
@@ -405,8 +407,10 @@ static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
        tcm_hdr->tcm_len   = htonl(msg_len);
        tcm_hdr->tcm_type  = htons(cmd);
        tcm_hdr->tcm_flags = htons(flags);
-       if (data_len && data)
+       if (data_len && data) {
                memcpy(TCM_DATA(msg), data, data_len);
+               memset(TCM_DATA(msg) + data_len, 0, TCM_SPACE(data_len) - msg_len);
+       }
        return TCM_SPACE(data_len);
 }
 
index 42a8bdc..41db513 100644 (file)
@@ -250,7 +250,7 @@ enum rdma_nldev_command {
 
        RDMA_NLDEV_CMD_PORT_GET, /* can dump */
 
-       RDMA_NLDEV_CMD_SYS_GET, /* can dump */
+       RDMA_NLDEV_CMD_SYS_GET,
        RDMA_NLDEV_CMD_SYS_SET,
 
        /* 8 is free to use */
index 9fd9398..1f9bc13 100644 (file)
@@ -1,23 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * linux/include/video/mmp_disp.h
  * Header file for Marvell MMP Display Controller
  *
  * Copyright (C) 2012 Marvell Technology Group Ltd.
  * Authors: Zhou Zhu <zzhu3@marvell.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _MMP_DISP_H_
index 82b84e5..36894c9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DEFCONFIG_LIST
        string
        depends on !UML
@@ -1752,6 +1753,30 @@ config SLAB_FREELIST_HARDENED
          sacrifies to harden the kernel slab allocator against common
          freelist exploit methods.
 
+config SHUFFLE_PAGE_ALLOCATOR
+       bool "Page allocator randomization"
+       default SLAB_FREELIST_RANDOM && ACPI_NUMA
+       help
+         Randomization of the page allocator improves the average
+         utilization of a direct-mapped memory-side-cache. See section
+         5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
+         6.2a specification for an example of how a platform advertises
+         the presence of a memory-side-cache. There are also incidental
+         security benefits as it reduces the predictability of page
+         allocations to compliment SLAB_FREELIST_RANDOM, but the
+         default granularity of shuffling on the "MAX_ORDER - 1" i.e,
+         10th order of pages is selected based on cache utilization
+         benefits on x86.
+
+         While the randomization improves cache utilization it may
+         negatively impact workloads on platforms without a cache. For
+         this reason, by default, the randomization is enabled only
+         after runtime detection of a direct-mapped memory-side-cache.
+         Otherwise, the randomization may be force enabled with the
+         'page_alloc.shuffle' kernel command line parameter.
+
+         Say Y if unsure.
+
 config SLUB_CPU_PARTIAL
        default y
        depends on SLUB && SMP
index f8c230c..2d1ea30 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/ctype.h>
index 435a428..178130f 100644 (file)
@@ -669,7 +669,7 @@ done:
         * If the initrd region is overlapped with crashkernel reserved region,
         * free only memory that is not part of crashkernel region.
         */
-       if (!do_retain_initrd && !kexec_free_initrd())
+       if (!do_retain_initrd && initrd_start && !kexec_free_initrd())
                free_initrd_mem(initrd_start, initrd_end);
        initrd_start = 0;
        initrd_end = 0;
index 5a2c69b..66a196c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/init/main.c
  *
index ef4012e..cba3411 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/init/version.c
  *
index 49f9bf4..bfaae45 100644 (file)
@@ -120,7 +120,9 @@ static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
 static int zero;
 static int one = 1;
 static int int_max = INT_MAX;
-static int ipc_mni = IPCMNI;
+int ipc_mni = IPCMNI;
+int ipc_mni_shift = IPCMNI_SHIFT;
+int ipc_min_cycle = RADIX_TREE_MAP_SIZE;
 
 static struct ctl_table ipc_kern_table[] = {
        {
@@ -246,3 +248,13 @@ static int __init ipc_sysctl_init(void)
 }
 
 device_initcall(ipc_sysctl_init);
+
+static int __init ipc_mni_extend(char *str)
+{
+       ipc_mni = IPCMNI_EXTEND;
+       ipc_mni_shift = IPCMNI_EXTEND_SHIFT;
+       ipc_min_cycle = IPCMNI_EXTEND_MIN_CYCLE;
+       pr_info("IPCMNI extended to %d.\n", ipc_mni);
+       return 0;
+}
+early_param("ipcmni_extend", ipc_mni_extend);
index ba44164..216cad1 100644 (file)
@@ -76,6 +76,7 @@ struct mqueue_inode_info {
        wait_queue_head_t wait_q;
 
        struct rb_root msg_tree;
+       struct rb_node *msg_tree_rightmost;
        struct posix_msg_tree_node *node_cache;
        struct mq_attr attr;
 
@@ -131,6 +132,7 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info)
 {
        struct rb_node **p, *parent = NULL;
        struct posix_msg_tree_node *leaf;
+       bool rightmost = true;
 
        p = &info->msg_tree.rb_node;
        while (*p) {
@@ -139,9 +141,10 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info)
 
                if (likely(leaf->priority == msg->m_type))
                        goto insert_msg;
-               else if (msg->m_type < leaf->priority)
+               else if (msg->m_type < leaf->priority) {
                        p = &(*p)->rb_left;
-               else
+                       rightmost = false;
+               } else
                        p = &(*p)->rb_right;
        }
        if (info->node_cache) {
@@ -154,6 +157,10 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info)
                INIT_LIST_HEAD(&leaf->msg_list);
        }
        leaf->priority = msg->m_type;
+
+       if (rightmost)
+               info->msg_tree_rightmost = &leaf->rb_node;
+
        rb_link_node(&leaf->rb_node, parent, p);
        rb_insert_color(&leaf->rb_node, &info->msg_tree);
 insert_msg:
@@ -163,23 +170,35 @@ insert_msg:
        return 0;
 }
 
+static inline void msg_tree_erase(struct posix_msg_tree_node *leaf,
+                                 struct mqueue_inode_info *info)
+{
+       struct rb_node *node = &leaf->rb_node;
+
+       if (info->msg_tree_rightmost == node)
+               info->msg_tree_rightmost = rb_prev(node);
+
+       rb_erase(node, &info->msg_tree);
+       if (info->node_cache) {
+               kfree(leaf);
+       } else {
+               info->node_cache = leaf;
+       }
+}
+
 static inline struct msg_msg *msg_get(struct mqueue_inode_info *info)
 {
-       struct rb_node **p, *parent = NULL;
+       struct rb_node *parent = NULL;
        struct posix_msg_tree_node *leaf;
        struct msg_msg *msg;
 
 try_again:
-       p = &info->msg_tree.rb_node;
-       while (*p) {
-               parent = *p;
-               /*
-                * During insert, low priorities go to the left and high to the
-                * right.  On receive, we want the highest priorities first, so
-                * walk all the way to the right.
-                */
-               p = &(*p)->rb_right;
-       }
+       /*
+        * During insert, low priorities go to the left and high to the
+        * right.  On receive, we want the highest priorities first, so
+        * walk all the way to the right.
+        */
+       parent = info->msg_tree_rightmost;
        if (!parent) {
                if (info->attr.mq_curmsgs) {
                        pr_warn_once("Inconsistency in POSIX message queue, "
@@ -194,24 +213,14 @@ try_again:
                pr_warn_once("Inconsistency in POSIX message queue, "
                             "empty leaf node but we haven't implemented "
                             "lazy leaf delete!\n");
-               rb_erase(&leaf->rb_node, &info->msg_tree);
-               if (info->node_cache) {
-                       kfree(leaf);
-               } else {
-                       info->node_cache = leaf;
-               }
+               msg_tree_erase(leaf, info);
                goto try_again;
        } else {
                msg = list_first_entry(&leaf->msg_list,
                                       struct msg_msg, m_list);
                list_del(&msg->m_list);
                if (list_empty(&leaf->msg_list)) {
-                       rb_erase(&leaf->rb_node, &info->msg_tree);
-                       if (info->node_cache) {
-                               kfree(leaf);
-                       } else {
-                               info->node_cache = leaf;
-                       }
+                       msg_tree_erase(leaf, info);
                }
        }
        info->attr.mq_curmsgs--;
@@ -254,6 +263,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
                info->qsize = 0;
                info->user = NULL;      /* set when all is ok */
                info->msg_tree = RB_ROOT;
+               info->msg_tree_rightmost = NULL;
                info->node_cache = NULL;
                memset(&info->attr, 0, sizeof(info->attr));
                info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max,
@@ -430,7 +440,8 @@ static void mqueue_evict_inode(struct inode *inode)
        struct user_struct *user;
        unsigned long mq_bytes, mq_treesize;
        struct ipc_namespace *ipc_ns;
-       struct msg_msg *msg;
+       struct msg_msg *msg, *nmsg;
+       LIST_HEAD(tmp_msg);
 
        clear_inode(inode);
 
@@ -441,10 +452,15 @@ static void mqueue_evict_inode(struct inode *inode)
        info = MQUEUE_I(inode);
        spin_lock(&info->lock);
        while ((msg = msg_get(info)) != NULL)
-               free_msg(msg);
+               list_add_tail(&msg->m_list, &tmp_msg);
        kfree(info->node_cache);
        spin_unlock(&info->lock);
 
+       list_for_each_entry_safe(msg, nmsg, &tmp_msg, m_list) {
+               list_del(&msg->m_list);
+               free_msg(msg);
+       }
+
        /* Total amount of bytes accounted for the mqueue */
        mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) +
                min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) *
@@ -605,8 +621,6 @@ static void wq_add(struct mqueue_inode_info *info, int sr,
 {
        struct ext_wait_queue *walk;
 
-       ewp->task = current;
-
        list_for_each_entry(walk, &info->e_wait_q[sr].list, list) {
                if (walk->task->prio <= current->prio) {
                        list_add_tail(&ewp->list, &walk->list);
index 8459802..e655937 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/utsname.h>
 #include <linux/proc_ns.h>
 #include <linux/uaccess.h>
+#include <linux/sched.h>
 
 #include "util.h"
 
@@ -64,6 +65,9 @@ static struct msg_msg *alloc_msg(size_t len)
        pseg = &msg->next;
        while (len > 0) {
                struct msg_msgseg *seg;
+
+               cond_resched();
+
                alen = min(len, DATALEN_SEG);
                seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT);
                if (seg == NULL)
@@ -176,6 +180,8 @@ void free_msg(struct msg_msg *msg)
        kfree(msg);
        while (seg != NULL) {
                struct msg_msgseg *tmp = seg->next;
+
+               cond_resched();
                kfree(seg);
                seg = tmp;
        }
index 095274a..d126d15 100644 (file)
@@ -109,7 +109,7 @@ static const struct rhashtable_params ipc_kht_params = {
  * @ids: ipc identifier set
  *
  * Set up the sequence range to use for the ipc identifier range (limited
- * below IPCMNI) then initialise the keys hashtable and ids idr.
+ * below ipc_mni) then initialise the keys hashtable and ids idr.
  */
 void ipc_init_ids(struct ipc_ids *ids)
 {
@@ -119,6 +119,7 @@ void ipc_init_ids(struct ipc_ids *ids)
        rhashtable_init(&ids->key_ht, &ipc_kht_params);
        idr_init(&ids->ipcs_idr);
        ids->max_idx = -1;
+       ids->last_idx = -1;
 #ifdef CONFIG_CHECKPOINT_RESTORE
        ids->next_id = -1;
 #endif
@@ -192,6 +193,10 @@ static struct kern_ipc_perm *ipc_findkey(struct ipc_ids *ids, key_t key)
  *
  * The caller must own kern_ipc_perm.lock.of the new object.
  * On error, the function returns a (negative) error code.
+ *
+ * To conserve sequence number space, especially with extended ipc_mni,
+ * the sequence number is incremented only when the returned ID is less than
+ * the last one.
  */
 static inline int ipc_idr_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
 {
@@ -215,17 +220,42 @@ static inline int ipc_idr_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
         */
 
        if (next_id < 0) { /* !CHECKPOINT_RESTORE or next_id is unset */
-               new->seq = ids->seq++;
-               if (ids->seq > IPCID_SEQ_MAX)
-                       ids->seq = 0;
-               idx = idr_alloc(&ids->ipcs_idr, new, 0, 0, GFP_NOWAIT);
+               int max_idx;
+
+               max_idx = max(ids->in_use*3/2, ipc_min_cycle);
+               max_idx = min(max_idx, ipc_mni);
+
+               /* allocate the idx, with a NULL struct kern_ipc_perm */
+               idx = idr_alloc_cyclic(&ids->ipcs_idr, NULL, 0, max_idx,
+                                       GFP_NOWAIT);
+
+               if (idx >= 0) {
+                       /*
+                        * idx got allocated successfully.
+                        * Now calculate the sequence number and set the
+                        * pointer for real.
+                        */
+                       if (idx <= ids->last_idx) {
+                               ids->seq++;
+                               if (ids->seq >= ipcid_seq_max())
+                                       ids->seq = 0;
+                       }
+                       ids->last_idx = idx;
+
+                       new->seq = ids->seq;
+                       /* no need for smp_wmb(), this is done
+                        * inside idr_replace, as part of
+                        * rcu_assign_pointer
+                        */
+                       idr_replace(&ids->ipcs_idr, new, idx);
+               }
        } else {
                new->seq = ipcid_to_seqx(next_id);
                idx = idr_alloc(&ids->ipcs_idr, new, ipcid_to_idx(next_id),
                                0, GFP_NOWAIT);
        }
        if (idx >= 0)
-               new->id = SEQ_MULTIPLIER * new->seq + idx;
+               new->id = (new->seq << ipcmni_seq_shift()) + idx;
        return idx;
 }
 
@@ -253,8 +283,8 @@ int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int limit)
        /* 1) Initialize the refcount so that ipc_rcu_putref works */
        refcount_set(&new->refcount, 1);
 
-       if (limit > IPCMNI)
-               limit = IPCMNI;
+       if (limit > ipc_mni)
+               limit = ipc_mni;
 
        if (ids->in_use >= limit)
                return -ENOSPC;
@@ -737,7 +767,7 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
        if (total >= ids->in_use)
                return NULL;
 
-       for (; pos < IPCMNI; pos++) {
+       for (; pos < ipc_mni; pos++) {
                ipc = idr_find(&ids->ipcs_idr, pos);
                if (ipc != NULL) {
                        *new_pos = pos + 1;
index e272be6..0fcf8e7 100644 (file)
 #include <linux/err.h>
 #include <linux/ipc_namespace.h>
 
-#define IPCMNI 32768  /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
-#define SEQ_MULTIPLIER (IPCMNI)
+/*
+ * The IPC ID contains 2 separate numbers - index and sequence number.
+ * By default,
+ *   bits  0-14: index (32k, 15 bits)
+ *   bits 15-30: sequence number (64k, 16 bits)
+ *
+ * When IPCMNI extension mode is turned on, the composition changes:
+ *   bits  0-23: index (16M, 24 bits)
+ *   bits 24-30: sequence number (128, 7 bits)
+ */
+#define IPCMNI_SHIFT           15
+#define IPCMNI_EXTEND_SHIFT    24
+#define IPCMNI_EXTEND_MIN_CYCLE        (RADIX_TREE_MAP_SIZE * RADIX_TREE_MAP_SIZE)
+#define IPCMNI                 (1 << IPCMNI_SHIFT)
+#define IPCMNI_EXTEND          (1 << IPCMNI_EXTEND_SHIFT)
+
+#ifdef CONFIG_SYSVIPC_SYSCTL
+extern int ipc_mni;
+extern int ipc_mni_shift;
+extern int ipc_min_cycle;
+
+#define ipcmni_seq_shift()     ipc_mni_shift
+#define IPCMNI_IDX_MASK                ((1 << ipc_mni_shift) - 1)
+
+#else /* CONFIG_SYSVIPC_SYSCTL */
+
+#define ipc_mni                        IPCMNI
+#define ipc_min_cycle          ((int)RADIX_TREE_MAP_SIZE)
+#define ipcmni_seq_shift()     IPCMNI_SHIFT
+#define IPCMNI_IDX_MASK                ((1 << IPCMNI_SHIFT) - 1)
+#endif /* CONFIG_SYSVIPC_SYSCTL */
 
 void sem_init(void);
 void msg_init(void);
@@ -96,9 +125,9 @@ struct pid_namespace *ipc_seq_pid_ns(struct seq_file *);
 #define IPC_MSG_IDS    1
 #define IPC_SHM_IDS    2
 
-#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER)
-#define ipcid_to_seqx(id) ((id) / SEQ_MULTIPLIER)
-#define IPCID_SEQ_MAX min_t(int, INT_MAX/SEQ_MULTIPLIER, USHRT_MAX)
+#define ipcid_to_idx(id)  ((id) & IPCMNI_IDX_MASK)
+#define ipcid_to_seqx(id) ((id) >> ipcmni_seq_shift())
+#define ipcid_seq_max()          (INT_MAX >> ipcmni_seq_shift())
 
 /* must be called with ids->rwsem acquired for writing */
 int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int);
@@ -123,8 +152,8 @@ static inline int ipc_get_maxidx(struct ipc_ids *ids)
        if (ids->in_use == 0)
                return -1;
 
-       if (ids->in_use == IPCMNI)
-               return IPCMNI - 1;
+       if (ids->in_use == ipc_mni)
+               return ipc_mni - 1;
 
        return ids->max_idx;
 }
@@ -216,10 +245,10 @@ void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
 
 static inline int sem_check_semmni(struct ipc_namespace *ns) {
        /*
-        * Check semmni range [0, IPCMNI]
+        * Check semmni range [0, ipc_mni]
         * semmni is the last element of sem_ctls[4] array
         */
-       return ((ns->sem_ctls[3] < 0) || (ns->sem_ctls[3] > IPCMNI))
+       return ((ns->sem_ctls[3] < 0) || (ns->sem_ctls[3] > ipc_mni))
                ? -ERANGE : 0;
 }
 
index a3bb4cb..68646fe 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config FREEZER
        def_bool PM_SLEEP || CGROUP_FREEZER
index 2a202a8..38ef6d0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Timer Interrupt Frequency Configuration
 #
index bf770d7..e0852dc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # The ARCH_INLINE foo is necessary because select ignores "depends on"
 #
index 0fee5fe..dc0b682 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 choice
        prompt "Preemption Model"
index 298437b..33824f0 100644 (file)
@@ -127,7 +127,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
 $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
 
 quiet_cmd_genikh = CHK     $(obj)/kheaders_data.tar.xz
-cmd_genikh = $(srctree)/kernel/gen_ikh_data.sh $@
+cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_ikh_data.sh $@
 $(obj)/kheaders_data.tar.xz: FORCE
        $(call cmd,genikh)
 
index 938d412..ca52b96 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* tnum: tracked (or tristate) numbers
  *
  * A tnum tracks knowledge about the bits of a value.  Each bit can be either
index 68ca5de..88006be 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "cgroup-internal.h"
 
 #include <linux/ctype.h>
index 327f37c..217cec4 100644 (file)
@@ -3540,17 +3540,84 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
 #ifdef CONFIG_PSI
 static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
 {
-       return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_IO);
+       struct cgroup *cgroup = seq_css(seq)->cgroup;
+       struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
+
+       return psi_show(seq, psi, PSI_IO);
 }
 static int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
 {
-       return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_MEM);
+       struct cgroup *cgroup = seq_css(seq)->cgroup;
+       struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
+
+       return psi_show(seq, psi, PSI_MEM);
 }
 static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
 {
-       return psi_show(seq, &seq_css(seq)->cgroup->psi, PSI_CPU);
+       struct cgroup *cgroup = seq_css(seq)->cgroup;
+       struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
+
+       return psi_show(seq, psi, PSI_CPU);
 }
-#endif
+
+static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf,
+                                         size_t nbytes, enum psi_res res)
+{
+       struct psi_trigger *new;
+       struct cgroup *cgrp;
+
+       cgrp = cgroup_kn_lock_live(of->kn, false);
+       if (!cgrp)
+               return -ENODEV;
+
+       cgroup_get(cgrp);
+       cgroup_kn_unlock(of->kn);
+
+       new = psi_trigger_create(&cgrp->psi, buf, nbytes, res);
+       if (IS_ERR(new)) {
+               cgroup_put(cgrp);
+               return PTR_ERR(new);
+       }
+
+       psi_trigger_replace(&of->priv, new);
+
+       cgroup_put(cgrp);
+
+       return nbytes;
+}
+
+static ssize_t cgroup_io_pressure_write(struct kernfs_open_file *of,
+                                         char *buf, size_t nbytes,
+                                         loff_t off)
+{
+       return cgroup_pressure_write(of, buf, nbytes, PSI_IO);
+}
+
+static ssize_t cgroup_memory_pressure_write(struct kernfs_open_file *of,
+                                         char *buf, size_t nbytes,
+                                         loff_t off)
+{
+       return cgroup_pressure_write(of, buf, nbytes, PSI_MEM);
+}
+
+static ssize_t cgroup_cpu_pressure_write(struct kernfs_open_file *of,
+                                         char *buf, size_t nbytes,
+                                         loff_t off)
+{
+       return cgroup_pressure_write(of, buf, nbytes, PSI_CPU);
+}
+
+static __poll_t cgroup_pressure_poll(struct kernfs_open_file *of,
+                                         poll_table *pt)
+{
+       return psi_trigger_poll(&of->priv, of->file, pt);
+}
+
+static void cgroup_pressure_release(struct kernfs_open_file *of)
+{
+       psi_trigger_replace(&of->priv, NULL);
+}
+#endif /* CONFIG_PSI */
 
 static int cgroup_freeze_show(struct seq_file *seq, void *v)
 {
@@ -4743,20 +4810,26 @@ static struct cftype cgroup_base_files[] = {
 #ifdef CONFIG_PSI
        {
                .name = "io.pressure",
-               .flags = CFTYPE_NOT_ON_ROOT,
                .seq_show = cgroup_io_pressure_show,
+               .write = cgroup_io_pressure_write,
+               .poll = cgroup_pressure_poll,
+               .release = cgroup_pressure_release,
        },
        {
                .name = "memory.pressure",
-               .flags = CFTYPE_NOT_ON_ROOT,
                .seq_show = cgroup_memory_pressure_show,
+               .write = cgroup_memory_pressure_write,
+               .poll = cgroup_pressure_poll,
+               .release = cgroup_pressure_release,
        },
        {
                .name = "cpu.pressure",
-               .flags = CFTYPE_NOT_ON_ROOT,
                .seq_show = cgroup_cpu_pressure_show,
+               .write = cgroup_cpu_pressure_write,
+               .poll = cgroup_pressure_poll,
+               .release = cgroup_pressure_release,
        },
-#endif
+#endif /* CONFIG_PSI */
        { }     /* terminate */
 };
 
index bb95a35..ca19b4c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include "cgroup-internal.h"
 
 #include <linux/sched/cputime.h>
index d8a36c6..b5f7063 100644 (file)
@@ -346,8 +346,11 @@ get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
                return -EFAULT;
        switch (_NSIG_WORDS) {
        case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 );
+               /* fall through */
        case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 );
+               /* fall through */
        case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 );
+               /* fall through */
        case 1: set->sig[0] = v.sig[0] | (((long)v.sig[1]) << 32 );
        }
 #else
index 9ad37b9..be01a4d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Context tracking: Probe on high level context boundaries such as kernel
  * and userspace. This includes syscalls and exceptions entry/exit.
index b64e238..9c23ae0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/crash_dump.h>
 #include <linux/init.h>
index a85edc3..332ee6c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the linux kernel debugger
 #
index 2a12b98..2772575 100644 (file)
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* delayacct.c - per-task delay accounting
  *
  * Copyright (C) Shailabh Nagar, IBM Corp. 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it would 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.
  */
 
 #include <linux/sched.h>
index 83d711f..70f8f8d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config HAS_DMA
        bool
index 6f7619c..13f0cb0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Dynamic DMA mapping support.
  *
index 2166c2d..1803efb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/exit.c
  *
@@ -422,7 +423,7 @@ retry:
         * freed task structure.
         */
        if (atomic_read(&mm->mm_users) <= 1) {
-               mm->owner = NULL;
+               WRITE_ONCE(mm->owner, NULL);
                return;
        }
 
@@ -462,7 +463,7 @@ retry:
         * most likely racing with swapoff (try_to_unuse()) or /proc or
         * ptrace or page migration (get_task_mm()).  Mark owner as NULL.
         */
-       mm->owner = NULL;
+       WRITE_ONCE(mm->owner, NULL);
        return;
 
 assign_new_owner:
@@ -483,7 +484,7 @@ assign_new_owner:
                put_task_struct(c);
                goto retry;
        }
-       mm->owner = c;
+       WRITE_ONCE(mm->owner, c);
        task_unlock(c);
        put_task_struct(c);
 }
index 737db18..b2b87d4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/fork.c
  *
@@ -955,6 +956,15 @@ static void mm_init_aio(struct mm_struct *mm)
 #endif
 }
 
+static __always_inline void mm_clear_owner(struct mm_struct *mm,
+                                          struct task_struct *p)
+{
+#ifdef CONFIG_MEMCG
+       if (mm->owner == p)
+               WRITE_ONCE(mm->owner, NULL);
+#endif
+}
+
 static void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
 {
 #ifdef CONFIG_MEMCG
@@ -1343,6 +1353,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
 free_pt:
        /* don't put binfmt in mmput, we haven't got module yet */
        mm->binfmt = NULL;
+       mm_init_owner(mm, NULL);
        mmput(mm);
 
 fail_nomem:
@@ -1726,6 +1737,21 @@ static int pidfd_create(struct pid *pid)
        return fd;
 }
 
+static void __delayed_free_task(struct rcu_head *rhp)
+{
+       struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
+
+       free_task(tsk);
+}
+
+static __always_inline void delayed_free_task(struct task_struct *tsk)
+{
+       if (IS_ENABLED(CONFIG_MEMCG))
+               call_rcu(&tsk->rcu, __delayed_free_task);
+       else
+               free_task(tsk);
+}
+
 /*
  * This creates a new process as a copy of the old one,
  * but does not actually start it yet.
@@ -2068,7 +2094,7 @@ static __latent_entropy struct task_struct *copy_process(
 #ifdef TIF_SYSCALL_EMU
        clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
 #endif
-       clear_all_latency_tracing(p);
+       clear_tsk_latency_tracing(p);
 
        /* ok, now we should be set up.. */
        p->pid = pid_nr(pid);
@@ -2233,8 +2259,10 @@ bad_fork_cleanup_io:
 bad_fork_cleanup_namespaces:
        exit_task_namespaces(p);
 bad_fork_cleanup_mm:
-       if (p->mm)
+       if (p->mm) {
+               mm_clear_owner(p->mm, p);
                mmput(p->mm);
+       }
 bad_fork_cleanup_signal:
        if (!(clone_flags & CLONE_THREAD))
                free_signal_struct(p->signal);
@@ -2265,7 +2293,7 @@ bad_fork_cleanup_count:
 bad_fork_free:
        p->state = TASK_DEAD;
        put_task_stack(p);
-       free_task(p);
+       delayed_free_task(p);
 fork_out:
        spin_lock_irq(&current->sighand->siglock);
        hlist_del_init(&delayed.node);
index b162b74..c073842 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kernel/freezer.c - Function to freeze a process
  *
index 1e3823f..3941a9c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "GCOV-based kernel profiling"
 
 config GCOV_KERNEL
@@ -53,6 +54,7 @@ config GCOV_PROFILE_ALL
 choice
        prompt "Specify GCOV format"
        depends on GCOV_KERNEL
+       depends on CC_IS_GCC
        ---help---
        The gcov format is usually determined by the GCC version, and the
        default is chosen according to your GCC version. However, there are
@@ -62,7 +64,7 @@ choice
 
 config GCOV_FORMAT_3_4
        bool "GCC 3.4 format"
-       depends on CC_IS_GCC && GCC_VERSION < 40700
+       depends on GCC_VERSION < 40700
        ---help---
        Select this option to use the format defined by GCC 3.4.
 
index ff06d64..d66a74b 100644 (file)
@@ -2,5 +2,6 @@
 ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"'
 
 obj-y := base.o fs.o
-obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o
-obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o
+obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_base.o gcc_3_4.o
+obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_base.o gcc_4_7.o
+obj-$(CONFIG_CC_IS_CLANG) += clang.o
index 9c7c8d5..0ffe9f1 100644 (file)
 #include <linux/sched.h>
 #include "gcov.h"
 
-static int gcov_events_enabled;
-static DEFINE_MUTEX(gcov_lock);
-
-/*
- * __gcov_init is called by gcc-generated constructor code for each object
- * file compiled with -fprofile-arcs.
- */
-void __gcov_init(struct gcov_info *info)
-{
-       static unsigned int gcov_version;
-
-       mutex_lock(&gcov_lock);
-       if (gcov_version == 0) {
-               gcov_version = gcov_info_version(info);
-               /*
-                * Printing gcc's version magic may prove useful for debugging
-                * incompatibility reports.
-                */
-               pr_info("version magic: 0x%x\n", gcov_version);
-       }
-       /*
-        * Add new profiling data structure to list and inform event
-        * listener.
-        */
-       gcov_info_link(info);
-       if (gcov_events_enabled)
-               gcov_event(GCOV_ADD, info);
-       mutex_unlock(&gcov_lock);
-}
-EXPORT_SYMBOL(__gcov_init);
-
-/*
- * These functions may be referenced by gcc-generated profiling code but serve
- * no function for kernel profiling.
- */
-void __gcov_flush(void)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_flush);
-
-void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_add);
-
-void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_single);
-
-void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_delta);
-
-void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_ior);
-
-void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_time_profile);
-
-void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_merge_icall_topn);
-
-void __gcov_exit(void)
-{
-       /* Unused. */
-}
-EXPORT_SYMBOL(__gcov_exit);
+int gcov_events_enabled;
+DEFINE_MUTEX(gcov_lock);
 
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
@@ -144,7 +64,7 @@ static int gcov_module_notifier(struct notifier_block *nb, unsigned long event,
 
        /* Remove entries located in module from linked list. */
        while ((info = gcov_info_next(info))) {
-               if (within_module((unsigned long)info, mod)) {
+               if (gcov_info_within_module(info, mod)) {
                        gcov_info_unlink(prev, info);
                        if (gcov_events_enabled)
                                gcov_event(GCOV_REMOVE, info);
diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c
new file mode 100644 (file)
index 0000000..c94b820
--- /dev/null
@@ -0,0 +1,581 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Google, Inc.
+ * modified from kernel/gcov/gcc_4_7.c
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ *
+ *
+ * LLVM uses profiling data that's deliberately similar to GCC, but has a
+ * very different way of exporting that data.  LLVM calls llvm_gcov_init() once
+ * per module, and provides a couple of callbacks that we can use to ask for
+ * more data.
+ *
+ * We care about the "writeout" callback, which in turn calls back into
+ * compiler-rt/this module to dump all the gathered coverage data to disk:
+ *
+ *    llvm_gcda_start_file()
+ *      llvm_gcda_emit_function()
+ *      llvm_gcda_emit_arcs()
+ *      llvm_gcda_emit_function()
+ *      llvm_gcda_emit_arcs()
+ *      [... repeats for each function ...]
+ *    llvm_gcda_summary_info()
+ *    llvm_gcda_end_file()
+ *
+ * This design is much more stateless and unstructured than gcc's, and is
+ * intended to run at process exit.  This forces us to keep some local state
+ * about which module we're dealing with at the moment.  On the other hand, it
+ * also means we don't depend as much on how LLVM represents profiling data
+ * internally.
+ *
+ * See LLVM's lib/Transforms/Instrumentation/GCOVProfiling.cpp for more
+ * details on how this works, particularly GCOVProfiler::emitProfileArcs(),
+ * GCOVProfiler::insertCounterWriteout(), and
+ * GCOVProfiler::insertFlush().
+ */
+
+#define pr_fmt(fmt)    "gcov: " fmt
+
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/printk.h>
+#include <linux/ratelimit.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include "gcov.h"
+
+typedef void (*llvm_gcov_callback)(void);
+
+struct gcov_info {
+       struct list_head head;
+
+       const char *filename;
+       unsigned int version;
+       u32 checksum;
+
+       struct list_head functions;
+};
+
+struct gcov_fn_info {
+       struct list_head head;
+
+       u32 ident;
+       u32 checksum;
+       u8 use_extra_checksum;
+       u32 cfg_checksum;
+
+       u32 num_counters;
+       u64 *counters;
+       const char *function_name;
+};
+
+static struct gcov_info *current_info;
+
+static LIST_HEAD(clang_gcov_list);
+
+void llvm_gcov_init(llvm_gcov_callback writeout, llvm_gcov_callback flush)
+{
+       struct gcov_info *info = kzalloc(sizeof(*info), GFP_KERNEL);
+
+       if (!info)
+               return;
+
+       INIT_LIST_HEAD(&info->head);
+       INIT_LIST_HEAD(&info->functions);
+
+       mutex_lock(&gcov_lock);
+
+       list_add_tail(&info->head, &clang_gcov_list);
+       current_info = info;
+       writeout();
+       current_info = NULL;
+       if (gcov_events_enabled)
+               gcov_event(GCOV_ADD, info);
+
+       mutex_unlock(&gcov_lock);
+}
+EXPORT_SYMBOL(llvm_gcov_init);
+
+void llvm_gcda_start_file(const char *orig_filename, const char version[4],
+               u32 checksum)
+{
+       current_info->filename = orig_filename;
+       memcpy(&current_info->version, version, sizeof(current_info->version));
+       current_info->checksum = checksum;
+}
+EXPORT_SYMBOL(llvm_gcda_start_file);
+
+void llvm_gcda_emit_function(u32 ident, const char *function_name,
+               u32 func_checksum, u8 use_extra_checksum, u32 cfg_checksum)
+{
+       struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL);
+
+       if (!info)
+               return;
+
+       INIT_LIST_HEAD(&info->head);
+       info->ident = ident;
+       info->checksum = func_checksum;
+       info->use_extra_checksum = use_extra_checksum;
+       info->cfg_checksum = cfg_checksum;
+       if (function_name)
+               info->function_name = kstrdup(function_name, GFP_KERNEL);
+
+       list_add_tail(&info->head, &current_info->functions);
+}
+EXPORT_SYMBOL(llvm_gcda_emit_function);
+
+void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters)
+{
+       struct gcov_fn_info *info = list_last_entry(&current_info->functions,
+                       struct gcov_fn_info, head);
+
+       info->num_counters = num_counters;
+       info->counters = counters;
+}
+EXPORT_SYMBOL(llvm_gcda_emit_arcs);
+
+void llvm_gcda_summary_info(void)
+{
+}
+EXPORT_SYMBOL(llvm_gcda_summary_info);
+
+void llvm_gcda_end_file(void)
+{
+}
+EXPORT_SYMBOL(llvm_gcda_end_file);
+
+/**
+ * gcov_info_filename - return info filename
+ * @info: profiling data set
+ */
+const char *gcov_info_filename(struct gcov_info *info)
+{
+       return info->filename;
+}
+
+/**
+ * gcov_info_version - return info version
+ * @info: profiling data set
+ */
+unsigned int gcov_info_version(struct gcov_info *info)
+{
+       return info->version;
+}
+
+/**
+ * gcov_info_next - return next profiling data set
+ * @info: profiling data set
+ *
+ * Returns next gcov_info following @info or first gcov_info in the chain if
+ * @info is %NULL.
+ */
+struct gcov_info *gcov_info_next(struct gcov_info *info)
+{
+       if (!info)
+               return list_first_entry_or_null(&clang_gcov_list,
+                               struct gcov_info, head);
+       if (list_is_last(&info->head, &clang_gcov_list))
+               return NULL;
+       return list_next_entry(info, head);
+}
+
+/**
+ * gcov_info_link - link/add profiling data set to the list
+ * @info: profiling data set
+ */
+void gcov_info_link(struct gcov_info *info)
+{
+       list_add_tail(&info->head, &clang_gcov_list);
+}
+
+/**
+ * gcov_info_unlink - unlink/remove profiling data set from the list
+ * @prev: previous profiling data set
+ * @info: profiling data set
+ */
+void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
+{
+       /* Generic code unlinks while iterating. */
+       __list_del_entry(&info->head);
+}
+
+/**
+ * gcov_info_within_module - check if a profiling data set belongs to a module
+ * @info: profiling data set
+ * @mod: module
+ *
+ * Returns true if profiling data belongs module, false otherwise.
+ */
+bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
+{
+       return within_module((unsigned long)info->filename, mod);
+}
+
+/* Symbolic links to be created for each profiling data file. */
+const struct gcov_link gcov_link[] = {
+       { OBJ_TREE, "gcno" },   /* Link to .gcno file in $(objtree). */
+       { 0, NULL},
+};
+
+/**
+ * gcov_info_reset - reset profiling data to zero
+ * @info: profiling data set
+ */
+void gcov_info_reset(struct gcov_info *info)
+{
+       struct gcov_fn_info *fn;
+
+       list_for_each_entry(fn, &info->functions, head)
+               memset(fn->counters, 0,
+                               sizeof(fn->counters[0]) * fn->num_counters);
+}
+
+/**
+ * gcov_info_is_compatible - check if profiling data can be added
+ * @info1: first profiling data set
+ * @info2: second profiling data set
+ *
+ * Returns non-zero if profiling data can be added, zero otherwise.
+ */
+int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2)
+{
+       struct gcov_fn_info *fn_ptr1 = list_first_entry_or_null(
+                       &info1->functions, struct gcov_fn_info, head);
+       struct gcov_fn_info *fn_ptr2 = list_first_entry_or_null(
+                       &info2->functions, struct gcov_fn_info, head);
+
+       if (info1->checksum != info2->checksum)
+               return false;
+       if (!fn_ptr1)
+               return fn_ptr1 == fn_ptr2;
+       while (!list_is_last(&fn_ptr1->head, &info1->functions) &&
+               !list_is_last(&fn_ptr2->head, &info2->functions)) {
+               if (fn_ptr1->checksum != fn_ptr2->checksum)
+                       return false;
+               if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum)
+                       return false;
+               if (fn_ptr1->use_extra_checksum &&
+                       fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum)
+                       return false;
+               fn_ptr1 = list_next_entry(fn_ptr1, head);
+               fn_ptr2 = list_next_entry(fn_ptr2, head);
+       }
+       return list_is_last(&fn_ptr1->head, &info1->functions) &&
+               list_is_last(&fn_ptr2->head, &info2->functions);
+}
+
+/**
+ * gcov_info_add - add up profiling data
+ * @dest: profiling data set to which data is added
+ * @source: profiling data set which is added
+ *
+ * Adds profiling counts of @source to @dest.
+ */
+void gcov_info_add(struct gcov_info *dst, struct gcov_info *src)
+{
+       struct gcov_fn_info *dfn_ptr;
+       struct gcov_fn_info *sfn_ptr = list_first_entry_or_null(&src->functions,
+                       struct gcov_fn_info, head);
+
+       list_for_each_entry(dfn_ptr, &dst->functions, head) {
+               u32 i;
+
+               for (i = 0; i < sfn_ptr->num_counters; i++)
+                       dfn_ptr->counters[i] += sfn_ptr->counters[i];
+       }
+}
+
+static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn)
+{
+       size_t cv_size; /* counter values size */
+       struct gcov_fn_info *fn_dup = kmemdup(fn, sizeof(*fn),
+                       GFP_KERNEL);
+       if (!fn_dup)
+               return NULL;
+       INIT_LIST_HEAD(&fn_dup->head);
+
+       fn_dup->function_name = kstrdup(fn->function_name, GFP_KERNEL);
+       if (!fn_dup->function_name)
+               goto err_name;
+
+       cv_size = fn->num_counters * sizeof(fn->counters[0]);
+       fn_dup->counters = vmalloc(cv_size);
+       if (!fn_dup->counters)
+               goto err_counters;
+       memcpy(fn_dup->counters, fn->counters, cv_size);
+
+       return fn_dup;
+
+err_counters:
+       kfree(fn_dup->function_name);
+err_name:
+       kfree(fn_dup);
+       return NULL;
+}
+
+/**
+ * gcov_info_dup - duplicate profiling data set
+ * @info: profiling data set to duplicate
+ *
+ * Return newly allocated duplicate on success, %NULL on error.
+ */
+struct gcov_info *gcov_info_dup(struct gcov_info *info)
+{
+       struct gcov_info *dup;
+       struct gcov_fn_info *fn;
+
+       dup = kmemdup(info, sizeof(*dup), GFP_KERNEL);
+       if (!dup)
+               return NULL;
+       INIT_LIST_HEAD(&dup->head);
+       INIT_LIST_HEAD(&dup->functions);
+       dup->filename = kstrdup(info->filename, GFP_KERNEL);
+       if (!dup->filename)
+               goto err;
+
+       list_for_each_entry(fn, &info->functions, head) {
+               struct gcov_fn_info *fn_dup = gcov_fn_info_dup(fn);
+
+               if (!fn_dup)
+                       goto err;
+               list_add_tail(&fn_dup->head, &dup->functions);
+       }
+
+       return dup;
+
+err:
+       gcov_info_free(dup);
+       return NULL;
+}
+
+/**
+ * gcov_info_free - release memory for profiling data set duplicate
+ * @info: profiling data set duplicate to free
+ */
+void gcov_info_free(struct gcov_info *info)
+{
+       struct gcov_fn_info *fn, *tmp;
+
+       list_for_each_entry_safe(fn, tmp, &info->functions, head) {
+               kfree(fn->function_name);
+               vfree(fn->counters);
+               list_del(&fn->head);
+               kfree(fn);
+       }
+       kfree(info->filename);
+       kfree(info);
+}
+
+#define ITER_STRIDE    PAGE_SIZE
+
+/**
+ * struct gcov_iterator - specifies current file position in logical records
+ * @info: associated profiling data
+ * @buffer: buffer containing file data
+ * @size: size of buffer
+ * @pos: current position in file
+ */
+struct gcov_iterator {
+       struct gcov_info *info;
+       void *buffer;
+       size_t size;
+       loff_t pos;
+};
+
+/**
+ * store_gcov_u32 - store 32 bit number in gcov format to buffer
+ * @buffer: target buffer or NULL
+ * @off: offset into the buffer
+ * @v: value to be stored
+ *
+ * Number format defined by gcc: numbers are recorded in the 32 bit
+ * unsigned binary form of the endianness of the machine generating the
+ * file. Returns the number of bytes stored. If @buffer is %NULL, doesn't
+ * store anything.
+ */
+static size_t store_gcov_u32(void *buffer, size_t off, u32 v)
+{
+       u32 *data;
+
+       if (buffer) {
+               data = buffer + off;
+               *data = v;
+       }
+
+       return sizeof(*data);
+}
+
+/**
+ * store_gcov_u64 - store 64 bit number in gcov format to buffer
+ * @buffer: target buffer or NULL
+ * @off: offset into the buffer
+ * @v: value to be stored
+ *
+ * Number format defined by gcc: numbers are recorded in the 32 bit
+ * unsigned binary form of the endianness of the machine generating the
+ * file. 64 bit numbers are stored as two 32 bit numbers, the low part
+ * first. Returns the number of bytes stored. If @buffer is %NULL, doesn't store
+ * anything.
+ */
+static size_t store_gcov_u64(void *buffer, size_t off, u64 v)
+{
+       u32 *data;
+
+       if (buffer) {
+               data = buffer + off;
+
+               data[0] = (v & 0xffffffffUL);
+               data[1] = (v >> 32);
+       }
+
+       return sizeof(*data) * 2;
+}
+
+/**
+ * convert_to_gcda - convert profiling data set to gcda file format
+ * @buffer: the buffer to store file data or %NULL if no data should be stored
+ * @info: profiling data set to be converted
+ *
+ * Returns the number of bytes that were/would have been stored into the buffer.
+ */
+static size_t convert_to_gcda(char *buffer, struct gcov_info *info)
+{
+       struct gcov_fn_info *fi_ptr;
+       size_t pos = 0;
+
+       /* File header. */
+       pos += store_gcov_u32(buffer, pos, GCOV_DATA_MAGIC);
+       pos += store_gcov_u32(buffer, pos, info->version);
+       pos += store_gcov_u32(buffer, pos, info->checksum);
+
+       list_for_each_entry(fi_ptr, &info->functions, head) {
+               u32 i;
+               u32 len = 2;
+
+               if (fi_ptr->use_extra_checksum)
+                       len++;
+
+               pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION);
+               pos += store_gcov_u32(buffer, pos, len);
+               pos += store_gcov_u32(buffer, pos, fi_ptr->ident);
+               pos += store_gcov_u32(buffer, pos, fi_ptr->checksum);
+               if (fi_ptr->use_extra_checksum)
+                       pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum);
+
+               pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE);
+               pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2);
+               for (i = 0; i < fi_ptr->num_counters; i++)
+                       pos += store_gcov_u64(buffer, pos, fi_ptr->counters[i]);
+       }
+
+       return pos;
+}
+
+/**
+ * gcov_iter_new - allocate and initialize profiling data iterator
+ * @info: profiling data set to be iterated
+ *
+ * Return file iterator on success, %NULL otherwise.
+ */
+struct gcov_iterator *gcov_iter_new(struct gcov_info *info)
+{
+       struct gcov_iterator *iter;
+
+       iter = kzalloc(sizeof(struct gcov_iterator), GFP_KERNEL);
+       if (!iter)
+               goto err_free;
+
+       iter->info = info;
+       /* Dry-run to get the actual buffer size. */
+       iter->size = convert_to_gcda(NULL, info);
+       iter->buffer = vmalloc(iter->size);
+       if (!iter->buffer)
+               goto err_free;
+
+       convert_to_gcda(iter->buffer, info);
+
+       return iter;
+
+err_free:
+       kfree(iter);
+       return NULL;
+}
+
+
+/**
+ * gcov_iter_get_info - return profiling data set for given file iterator
+ * @iter: file iterator
+ */
+void gcov_iter_free(struct gcov_iterator *iter)
+{
+       vfree(iter->buffer);
+       kfree(iter);
+}
+
+/**
+ * gcov_iter_get_info - return profiling data set for given file iterator
+ * @iter: file iterator
+ */
+struct gcov_info *gcov_iter_get_info(struct gcov_iterator *iter)
+{
+       return iter->info;
+}
+
+/**
+ * gcov_iter_start - reset file iterator to starting position
+ * @iter: file iterator
+ */
+void gcov_iter_start(struct gcov_iterator *iter)
+{
+       iter->pos = 0;
+}
+
+/**
+ * gcov_iter_next - advance file iterator to next logical record
+ * @iter: file iterator
+ *
+ * Return zero if new position is valid, non-zero if iterator has reached end.
+ */
+int gcov_iter_next(struct gcov_iterator *iter)
+{
+       if (iter->pos < iter->size)
+               iter->pos += ITER_STRIDE;
+
+       if (iter->pos >= iter->size)
+               return -EINVAL;
+
+       return 0;
+}
+
+/**
+ * gcov_iter_write - write data for current pos to seq_file
+ * @iter: file iterator
+ * @seq: seq_file handle
+ *
+ * Return zero on success, non-zero otherwise.
+ */
+int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq)
+{
+       size_t len;
+
+       if (iter->pos >= iter->size)
+               return -EINVAL;
+
+       len = ITER_STRIDE;
+       if (iter->pos + len > iter->size)
+               len = iter->size - iter->pos;
+
+       seq_write(seq, iter->buffer + iter->pos, len);
+
+       return 0;
+}
index 2dddecb..801ee4b 100644 (file)
@@ -137,6 +137,18 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
                gcov_info_head = info->next;
 }
 
+/**
+ * gcov_info_within_module - check if a profiling data set belongs to a module
+ * @info: profiling data set
+ * @mod: module
+ *
+ * Returns true if profiling data belongs module, false otherwise.
+ */
+bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
+{
+       return within_module((unsigned long)info, mod);
+}
+
 /* Symbolic links to be created for each profiling data file. */
 const struct gcov_link gcov_link[] = {
        { OBJ_TREE, "gcno" },   /* Link to .gcno file in $(objtree). */
index ca5e5c0..ec37563 100644 (file)
@@ -150,6 +150,18 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
                gcov_info_head = info->next;
 }
 
+/**
+ * gcov_info_within_module - check if a profiling data set belongs to a module
+ * @info: profiling data set
+ * @mod: module
+ *
+ * Returns true if profiling data belongs module, false otherwise.
+ */
+bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
+{
+       return within_module((unsigned long)info, mod);
+}
+
 /* Symbolic links to be created for each profiling data file. */
 const struct gcov_link gcov_link[] = {
        { OBJ_TREE, "gcno" },   /* Link to .gcno file in $(objtree). */
diff --git a/kernel/gcov/gcc_base.c b/kernel/gcov/gcc_base.c
new file mode 100644 (file)
index 0000000..3cf736b
--- /dev/null
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/export.h>
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include "gcov.h"
+
+/*
+ * __gcov_init is called by gcc-generated constructor code for each object
+ * file compiled with -fprofile-arcs.
+ */
+void __gcov_init(struct gcov_info *info)
+{
+       static unsigned int gcov_version;
+
+       mutex_lock(&gcov_lock);
+       if (gcov_version == 0) {
+               gcov_version = gcov_info_version(info);
+               /*
+                * Printing gcc's version magic may prove useful for debugging
+                * incompatibility reports.
+                */
+               pr_info("version magic: 0x%x\n", gcov_version);
+       }
+       /*
+        * Add new profiling data structure to list and inform event
+        * listener.
+        */
+       gcov_info_link(info);
+       if (gcov_events_enabled)
+               gcov_event(GCOV_ADD, info);
+       mutex_unlock(&gcov_lock);
+}
+EXPORT_SYMBOL(__gcov_init);
+
+/*
+ * These functions may be referenced by gcc-generated profiling code but serve
+ * no function for kernel profiling.
+ */
+void __gcov_flush(void)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_flush);
+
+void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_add);
+
+void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_single);
+
+void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_delta);
+
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_ior);
+
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_time_profile);
+
+void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_icall_topn);
+
+void __gcov_exit(void)
+{
+       /* Unused. */
+}
+EXPORT_SYMBOL(__gcov_exit);
index de118ad..6ab2c18 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef GCOV_H
 #define GCOV_H GCOV_H
 
+#include <linux/module.h>
 #include <linux/types.h>
 
 /*
@@ -46,6 +47,7 @@ unsigned int gcov_info_version(struct gcov_info *info);
 struct gcov_info *gcov_info_next(struct gcov_info *info);
 void gcov_info_link(struct gcov_info *info);
 void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info);
+bool gcov_info_within_module(struct gcov_info *info, struct module *mod);
 
 /* Base interface. */
 enum gcov_action {
@@ -83,4 +85,7 @@ struct gcov_link {
 };
 extern const struct gcov_link gcov_link[];
 
+extern int gcov_events_enabled;
+extern struct mutex gcov_lock;
+
 #endif /* GCOV_H */
index f108a95..14a625c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Detect Hung Task
  *
index 5f3e2ba..f92d9a6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "IRQ subsystem"
 # Options selectable by the architecture code
 
@@ -91,6 +92,9 @@ config GENERIC_MSI_IRQ_DOMAIN
        select IRQ_DOMAIN_HIERARCHY
        select GENERIC_MSI_IRQ
 
+config IRQ_MSI_IOMMU
+       bool
+
 config HANDLE_DOMAIN_IRQ
        bool
 
index 51128be..29d6c7d 100644 (file)
@@ -1459,6 +1459,33 @@ int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on)
        return -ENOSYS;
 }
 EXPORT_SYMBOL_GPL(irq_chip_set_wake_parent);
+
+/**
+ * irq_chip_request_resources_parent - Request resources on the parent interrupt
+ * @data:      Pointer to interrupt specific data
+ */
+int irq_chip_request_resources_parent(struct irq_data *data)
+{
+       data = data->parent_data;
+
+       if (data->chip->irq_request_resources)
+               return data->chip->irq_request_resources(data);
+
+       return -ENOSYS;
+}
+EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent);
+
+/**
+ * irq_chip_release_resources_parent - Release resources on the parent interrupt
+ * @data:      Pointer to interrupt specific data
+ */
+void irq_chip_release_resources_parent(struct irq_data *data)
+{
+       data = data->parent_data;
+       if (data->chip->irq_release_resources)
+               data->chip->irq_release_resources(data);
+}
+EXPORT_SYMBOL_GPL(irq_chip_release_resources_parent);
 #endif
 
 /**
index 9ed29e4..a453e22 100644 (file)
@@ -1297,7 +1297,7 @@ int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,
 /**
  * __irq_domain_alloc_irqs - Allocate IRQs from domain
  * @domain:    domain to allocate from
- * @irq_base:  allocate specified IRQ nubmer if irq_base >= 0
+ * @irq_base:  allocate specified IRQ number if irq_base >= 0
  * @nr_irqs:   number of IRQs to allocate
  * @node:      NUMA node id for memory allocation
  * @arg:       domain specific argument
index 7328891..d42acaf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra
  *
index de6efde..0bfa10f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * jump label support
  *
index 14934af..95a260f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kallsyms.c: in-kernel printing of symbolic oopses and stack traces.
  *
index 5942eea..621467c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Kernel thread helper functions.
  *   Copyright (C) 2004 IBM Corporation, Rusty Russell.
  *
@@ -11,6 +12,7 @@
 #include <linux/kthread.h>
 #include <linux/completion.h>
 #include <linux/err.h>
+#include <linux/cgroup.h>
 #include <linux/cpuset.h>
 #include <linux/unistd.h>
 #include <linux/file.h>
index 99a5b5f..871734e 100644 (file)
@@ -67,13 +67,10 @@ static struct latency_record latency_record[MAXLR];
 
 int latencytop_enabled;
 
-void clear_all_latency_tracing(struct task_struct *p)
+void clear_tsk_latency_tracing(struct task_struct *p)
 {
        unsigned long flags;
 
-       if (!latencytop_enabled)
-               return;
-
        raw_spin_lock_irqsave(&latency_lock, flags);
        memset(&p->latency_record, 0, sizeof(p->latency_record));
        p->latency_record_count = 0;
@@ -96,9 +93,6 @@ account_global_scheduler_latency(struct task_struct *tsk,
        int firstnonnull = MAXLR + 1;
        int i;
 
-       if (!latencytop_enabled)
-               return;
-
        /* skip kernel threads for now */
        if (!tsk->mm)
                return;
index ec45651..54102de 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HAVE_LIVEPATCH
        bool
        help
index b36ceda..cf9b5bc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 
 livepatch-objs := core.o patch.o shadow.o transition.o
index f6fbaff..2398832 100644 (file)
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * core.c - Kernel Live Patching Core
  *
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
  * Copyright (C) 2014 SUSE
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -1208,14 +1196,6 @@ void klp_module_going(struct module *mod)
 
 static int __init klp_init(void)
 {
-       int ret;
-
-       ret = klp_check_compiler_support();
-       if (ret) {
-               pr_info("Your compiler is too old; turning off.\n");
-               return -EINVAL;
-       }
-
        klp_root_kobj = kobject_create_and_add("livepatch", kernel_kobj);
        if (!klp_root_kobj)
                return -ENOMEM;
index 99cb3ad..bd43537 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * patch.c - livepatch patching functions
  *
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
  * Copyright (C) 2014 SUSE
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 83958c8..e5c9fb2 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * shadow.c - Shadow Variables
  *
  * Copyright (C) 2014 Josh Poimboeuf <jpoimboe@redhat.com>
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /**
index c53370d..abb2a4a 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * transition.c - Kernel Live Patching transition functions
  *
  * Copyright (C) 2015-2016 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index d06190f..c47788f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kernel/lockdep.c
  *
index db57878..0c601ae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kernel/locking/mutex.c
  *
index f17dad9..b6a9cc6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/atomic.h>
 #include <linux/rwsem.h>
 #include <linux/percpu.h>
index 978d63a..38fbf9f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * RT-Mutexes: simple blocking mutual exclusion locks with PI support
  *
index 6b3ee99..0b1f779 100644 (file)
@@ -130,6 +130,7 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
 {
        struct rwsem_waiter *waiter, *tmp;
        long oldcount, woken = 0, adjustment = 0;
+       struct list_head wlist;
 
        /*
         * Take a peek at the queue head waiter such that we can determine
@@ -188,18 +189,43 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
         * of the queue. We know that woken will be at least 1 as we accounted
         * for above. Note we increment the 'active part' of the count by the
         * number of readers before waking any processes up.
+        *
+        * We have to do wakeup in 2 passes to prevent the possibility that
+        * the reader count may be decremented before it is incremented. It
+        * is because the to-be-woken waiter may not have slept yet. So it
+        * may see waiter->task got cleared, finish its critical section and
+        * do an unlock before the reader count increment.
+        *
+        * 1) Collect the read-waiters in a separate list, count them and
+        *    fully increment the reader count in rwsem.
+        * 2) For each waiters in the new list, clear waiter->task and
+        *    put them into wake_q to be woken up later.
         */
-       list_for_each_entry_safe(waiter, tmp, &sem->wait_list, list) {
-               struct task_struct *tsk;
-
+       list_for_each_entry(waiter, &sem->wait_list, list) {
                if (waiter->type == RWSEM_WAITING_FOR_WRITE)
                        break;
 
                woken++;
-               tsk = waiter->task;
+       }
+       list_cut_before(&wlist, &sem->wait_list, &waiter->list);
+
+       adjustment = woken * RWSEM_ACTIVE_READ_BIAS - adjustment;
+       lockevent_cond_inc(rwsem_wake_reader, woken);
+       if (list_empty(&sem->wait_list)) {
+               /* hit end of list above */
+               adjustment -= RWSEM_WAITING_BIAS;
+       }
+
+       if (adjustment)
+               atomic_long_add(adjustment, &sem->count);
+
+       /* 2nd pass */
+       list_for_each_entry_safe(waiter, tmp, &wlist, list) {
+               struct task_struct *tsk;
 
+               tsk = waiter->task;
                get_task_struct(tsk);
-               list_del(&waiter->list);
+
                /*
                 * Ensure calling get_task_struct() before setting the reader
                 * waiter to nil such that rwsem_down_read_failed() cannot
@@ -213,16 +239,6 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
                 */
                wake_q_add_safe(wake_q, tsk);
        }
-
-       adjustment = woken * RWSEM_ACTIVE_READ_BIAS - adjustment;
-       lockevent_cond_inc(rwsem_wake_reader, woken);
-       if (list_empty(&sem->wait_list)) {
-               /* hit end of list above */
-               adjustment -= RWSEM_WAITING_BIAS;
-       }
-
-       if (adjustment)
-               atomic_long_add(adjustment, &sem->count);
 }
 
 /*
index 65a3b7e..3e82f44 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Module-based API test facility for ww_mutexes
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you can access it online at
- * http://www.gnu.org/licenses/gpl-2.0.html.
  */
 
 #include <linux/kernel.h>
index 6196af8..d9f5081 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kdebug.h>
 #include <linux/kprobes.h>
 #include <linux/export.h>
@@ -22,6 +23,7 @@ static int notifier_chain_register(struct notifier_block **nl,
                struct notifier_block *n)
 {
        while ((*nl) != NULL) {
+               WARN_ONCE(((*nl) == n), "double register detected");
                if (n->priority > (*nl)->priority)
                        break;
                nl = &((*nl)->next);
index c1fcaad..4d9f55b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/panic.c
  *
@@ -51,6 +52,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
 #define PANIC_PRINT_TIMER_INFO         0x00000004
 #define PANIC_PRINT_LOCK_INFO          0x00000008
 #define PANIC_PRINT_FTRACE_INFO                0x00000010
+#define PANIC_PRINT_ALL_PRINTK_MSG     0x00000020
 unsigned long panic_print;
 
 ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
@@ -134,6 +136,9 @@ EXPORT_SYMBOL(nmi_panic);
 
 static void panic_print_sys_info(void)
 {
+       if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
+               console_flush_on_panic(CONSOLE_REPLAY_ALL);
+
        if (panic_print & PANIC_PRINT_TASK_INFO)
                show_state();
 
@@ -277,7 +282,7 @@ void panic(const char *fmt, ...)
         * panic() is not being callled from OOPS.
         */
        debug_locks_off();
-       console_flush_on_panic();
+       console_flush_on_panic(CONSOLE_FLUSH_PENDING);
 
        panic_print_sys_info();
 
@@ -306,6 +311,8 @@ void panic(const char *fmt, ...)
                 * shutting down.  But if there is a chance of
                 * rebooting the system it will be rebooted.
                 */
+               if (panic_reboot_mode != REBOOT_UNDEFINED)
+                       reboot_mode = panic_reboot_mode;
                emergency_restart();
        }
 #ifdef __sparc__
@@ -321,6 +328,9 @@ void panic(const char *fmt, ...)
        disabled_wait();
 #endif
        pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
+
+       /* Do not scroll important messages printed above */
+       suppress_printk = 1;
        local_irq_enable();
        for (i = 0; ; i += PANIC_TIMER_STEP) {
                touch_softlockup_watchdog();
index 2088159..e5cad0c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic pidhash and scalable, time-bounded PID allocator
  *
@@ -32,7 +33,6 @@
 #include <linux/init.h>
 #include <linux/rculist.h>
 #include <linux/memblock.h>
-#include <linux/hash.h>
 #include <linux/pid_namespace.h>
 #include <linux/init_task.h>
 #include <linux/syscalls.h>
index aa6e72f..f54bc7c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Pid namespaces
  *
index 9bbaaab..ff8592d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SUSPEND
        bool "Suspend to RAM and standby"
        depends on ARCH_SUSPEND_POSSIBLE
index 9d22131..33e3feb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This module exposes the interface to kernel space for specifying
  * QoS dependencies.  It provides infrastructure for registration of:
index 4a2ffc3..4d052fc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  = printk.o
 obj-$(CONFIG_PRINTK)   += printk_safe.o
 obj-$(CONFIG_A11Y_BRAILLE_CONSOLE)     += braille.o
index 0f18988..c8e6ab6 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * internal.h - printk internal definitions
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/percpu.h>
 
index 02ca827..1888f6a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/printk.c
  *
@@ -86,6 +87,12 @@ static DEFINE_SEMAPHORE(console_sem);
 struct console *console_drivers;
 EXPORT_SYMBOL_GPL(console_drivers);
 
+/*
+ * System may need to suppress printk message under certain
+ * circumstances, like after kernel panic happens.
+ */
+int __read_mostly suppress_printk;
+
 #ifdef CONFIG_LOCKDEP
 static struct lockdep_map console_lock_dep_map = {
        .name = "console_lock"
@@ -1943,6 +1950,10 @@ asmlinkage int vprintk_emit(int facility, int level,
        unsigned long flags;
        u64 curr_log_seq;
 
+       /* Suppress unimportant messages after panic happens */
+       if (unlikely(suppress_printk))
+               return 0;
+
        if (level == LOGLEVEL_SCHED) {
                level = LOGLEVEL_DEFAULT;
                in_sched = true;
@@ -2525,10 +2536,11 @@ void console_unblank(void)
 
 /**
  * console_flush_on_panic - flush console content on panic
+ * @mode: flush all messages in buffer or just the pending ones
  *
  * Immediately output all pending messages no matter what.
  */
-void console_flush_on_panic(void)
+void console_flush_on_panic(enum con_flush_mode mode)
 {
        /*
         * If someone else is holding the console lock, trylock will fail
@@ -2539,6 +2551,15 @@ void console_flush_on_panic(void)
         */
        console_trylock();
        console_may_schedule = 0;
+
+       if (mode == CONSOLE_REPLAY_ALL) {
+               unsigned long flags;
+
+               logbuf_lock_irqsave(flags);
+               console_seq = log_first_seq;
+               console_idx = log_first_idx;
+               logbuf_unlock_irqrestore(flags);
+       }
        console_unlock();
 }
 
index 0913b4d..b4045e7 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * printk_safe.c - Safe printk for printk-deadlock-prone contexts
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/preempt.h>
index 9c08a2c..af7c94b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/profile.c
  *  Simple profiling. Manages a direct-mapped profile hit count buffer,
index 6f357f4..5710d07 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/kernel/ptrace.c
  *
index 3730143..480edf3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RCU-related configuration options
 #
index 0ec7d1d..5ec3ea4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RCU-related debugging configuration options
 #
index 4b58c90..390aab2 100644 (file)
 #define __LINUX_RCU_H
 
 #include <trace/events/rcu.h>
-#ifdef CONFIG_RCU_TRACE
-#define RCU_TRACE(stmt) stmt
-#else /* #ifdef CONFIG_RCU_TRACE */
-#define RCU_TRACE(stmt)
-#endif /* #else #ifdef CONFIG_RCU_TRACE */
 
 /* Offset to allow distinguishing irq vs. task-based idle entry/exit. */
 #define DYNTICK_IRQ_NONIDLE    ((LONG_MAX / 2) + 1)
@@ -216,12 +211,12 @@ static inline bool __rcu_reclaim(const char *rn, struct rcu_head *head)
 
        rcu_lock_acquire(&rcu_callback_map);
        if (__is_kfree_rcu_offset(offset)) {
-               RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset);)
+               trace_rcu_invoke_kfree_callback(rn, head, offset);
                kfree((void *)head - offset);
                rcu_lock_release(&rcu_callback_map);
                return true;
        } else {
-               RCU_TRACE(trace_rcu_invoke_callback(rn, head);)
+               trace_rcu_invoke_callback(rn, head);
                f = head->func;
                WRITE_ONCE(head->func, (rcu_callback_t)0L);
                f(head);
index b4d88a5..980ca3c 100644 (file)
@@ -1969,14 +1969,14 @@ rcu_check_quiescent_state(struct rcu_data *rdp)
  */
 int rcutree_dying_cpu(unsigned int cpu)
 {
-       RCU_TRACE(bool blkd;)
-       RCU_TRACE(struct rcu_data *rdp = this_cpu_ptr(&rcu_data);)
-       RCU_TRACE(struct rcu_node *rnp = rdp->mynode;)
+       bool blkd;
+       struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
+       struct rcu_node *rnp = rdp->mynode;
 
        if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
                return 0;
 
-       RCU_TRACE(blkd = !!(rnp->qsmask & rdp->grpmask);)
+       blkd = !!(rnp->qsmask & rdp->grpmask);
        trace_rcu_grace_period(rcu_state.name, rnp->gp_seq,
                               blkd ? TPS("cpuofl") : TPS("cpuofl-bgp"));
        return 0;
index e1b79b6..c4d472b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/reboot.c
  *
@@ -31,6 +32,7 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
 
 /*
  * This variable is used privately to keep track of whether or not
@@ -519,6 +521,8 @@ EXPORT_SYMBOL_GPL(orderly_reboot);
 static int __init reboot_setup(char *str)
 {
        for (;;) {
+               enum reboot_mode *mode;
+
                /*
                 * Having anything passed on the command line via
                 * reboot= will cause us to disable DMI checking
@@ -526,17 +530,24 @@ static int __init reboot_setup(char *str)
                 */
                reboot_default = 0;
 
+               if (!strncmp(str, "panic_", 6)) {
+                       mode = &panic_reboot_mode;
+                       str += 6;
+               } else {
+                       mode = &reboot_mode;
+               }
+
                switch (*str) {
                case 'w':
-                       reboot_mode = REBOOT_WARM;
+                       *mode = REBOOT_WARM;
                        break;
 
                case 'c':
-                       reboot_mode = REBOOT_COLD;
+                       *mode = REBOOT_COLD;
                        break;
 
                case 'h':
-                       reboot_mode = REBOOT_HARD;
+                       *mode = REBOOT_HARD;
                        break;
 
                case 's':
@@ -553,11 +564,11 @@ static int __init reboot_setup(char *str)
                                if (rc)
                                        return rc;
                        } else
-                               reboot_mode = REBOOT_SOFT;
+                               *mode = REBOOT_SOFT;
                        break;
                }
                case 'g':
-                       reboot_mode = REBOOT_GPIO;
+                       *mode = REBOOT_GPIO;
                        break;
 
                case 'b':
index 8c15f84..158f04e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     linux/kernel/resource.c
  *
index e3e3b97..1152259 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sched_clock() for unstable CPU clocks
  *
index 102dfcf..874c427 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  kernel/sched/core.c
  *
index ba4a143..2305ce8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Simple CPU accounting cgroup controller
  */
index f5516ba..8094093 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic entry points for the idle threads and
  * implementation of the idle task scheduling class.
index 6873020..123ea07 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Housekeeping management. Manage the targets for routine code that can run on
  *  any CPU: unbound workqueues, timers, kthreads and any offloadable work.
index 0e97ca9..7acc632 100644 (file)
@@ -4,6 +4,9 @@
  * Copyright (c) 2018 Facebook, Inc.
  * Author: Johannes Weiner <hannes@cmpxchg.org>
  *
+ * Polling support by Suren Baghdasaryan <surenb@google.com>
+ * Copyright (c) 2018 Google, Inc.
+ *
  * When CPU, memory and IO are contended, tasks experience delays that
  * reduce throughput and introduce latencies into the workload. Memory
  * and IO contention, in addition, can cause a full loss of forward
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
 #include <linux/seqlock.h>
+#include <linux/uaccess.h>
 #include <linux/cgroup.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/ctype.h>
+#include <linux/file.h>
+#include <linux/poll.h>
 #include <linux/psi.h>
 #include "sched.h"
 
@@ -140,9 +147,9 @@ static int psi_bug __read_mostly;
 DEFINE_STATIC_KEY_FALSE(psi_disabled);
 
 #ifdef CONFIG_PSI_DEFAULT_DISABLED
-bool psi_enable;
+static bool psi_enable;
 #else
-bool psi_enable = true;
+static bool psi_enable = true;
 #endif
 static int __init setup_psi(char *str)
 {
@@ -156,16 +163,21 @@ __setup("psi=", setup_psi);
 #define EXP_60s                1981            /* 1/exp(2s/60s) */
 #define EXP_300s       2034            /* 1/exp(2s/300s) */
 
+/* PSI trigger definitions */
+#define WINDOW_MIN_US 500000   /* Min window size is 500ms */
+#define WINDOW_MAX_US 10000000 /* Max window size is 10s */
+#define UPDATES_PER_WINDOW 10  /* 10 updates per window */
+
 /* Sampling frequency in nanoseconds */
 static u64 psi_period __read_mostly;
 
 /* System-level pressure and stall tracking */
 static DEFINE_PER_CPU(struct psi_group_cpu, system_group_pcpu);
-static struct psi_group psi_system = {
+struct psi_group psi_system = {
        .pcpu = &system_group_pcpu,
 };
 
-static void psi_update_work(struct work_struct *work);
+static void psi_avgs_work(struct work_struct *work);
 
 static void group_init(struct psi_group *group)
 {
@@ -173,9 +185,20 @@ static void group_init(struct psi_group *group)
 
        for_each_possible_cpu(cpu)
                seqcount_init(&per_cpu_ptr(group->pcpu, cpu)->seq);
-       group->next_update = sched_clock() + psi_period;
-       INIT_DELAYED_WORK(&group->clock_work, psi_update_work);
-       mutex_init(&group->stat_lock);
+       group->avg_next_update = sched_clock() + psi_period;
+       INIT_DELAYED_WORK(&group->avgs_work, psi_avgs_work);
+       mutex_init(&group->avgs_lock);
+       /* Init trigger-related members */
+       atomic_set(&group->poll_scheduled, 0);
+       mutex_init(&group->trigger_lock);
+       INIT_LIST_HEAD(&group->triggers);
+       memset(group->nr_triggers, 0, sizeof(group->nr_triggers));
+       group->poll_states = 0;
+       group->poll_min_period = U32_MAX;
+       memset(group->polling_total, 0, sizeof(group->polling_total));
+       group->polling_next_update = ULLONG_MAX;
+       group->polling_until = 0;
+       rcu_assign_pointer(group->poll_kworker, NULL);
 }
 
 void __init psi_init(void)
@@ -210,20 +233,24 @@ static bool test_state(unsigned int *tasks, enum psi_states state)
        }
 }
 
-static void get_recent_times(struct psi_group *group, int cpu, u32 *times)
+static void get_recent_times(struct psi_group *group, int cpu,
+                            enum psi_aggregators aggregator, u32 *times,
+                            u32 *pchanged_states)
 {
        struct psi_group_cpu *groupc = per_cpu_ptr(group->pcpu, cpu);
-       unsigned int tasks[NR_PSI_TASK_COUNTS];
        u64 now, state_start;
+       enum psi_states s;
        unsigned int seq;
-       int s;
+       u32 state_mask;
+
+       *pchanged_states = 0;
 
        /* Snapshot a coherent view of the CPU state */
        do {
                seq = read_seqcount_begin(&groupc->seq);
                now = cpu_clock(cpu);
                memcpy(times, groupc->times, sizeof(groupc->times));
-               memcpy(tasks, groupc->tasks, sizeof(groupc->tasks));
+               state_mask = groupc->state_mask;
                state_start = groupc->state_start;
        } while (read_seqcount_retry(&groupc->seq, seq));
 
@@ -239,13 +266,15 @@ static void get_recent_times(struct psi_group *group, int cpu, u32 *times)
                 * (u32) and our reported pressure close to what's
                 * actually happening.
                 */
-               if (test_state(tasks, s))
+               if (state_mask & (1 << s))
                        times[s] += now - state_start;
 
-               delta = times[s] - groupc->times_prev[s];
-               groupc->times_prev[s] = times[s];
+               delta = times[s] - groupc->times_prev[aggregator][s];
+               groupc->times_prev[aggregator][s] = times[s];
 
                times[s] = delta;
+               if (delta)
+                       *pchanged_states |= (1 << s);
        }
 }
 
@@ -269,17 +298,16 @@ static void calc_avgs(unsigned long avg[3], int missed_periods,
        avg[2] = calc_load(avg[2], EXP_300s, pct);
 }
 
-static bool update_stats(struct psi_group *group)
+static void collect_percpu_times(struct psi_group *group,
+                                enum psi_aggregators aggregator,
+                                u32 *pchanged_states)
 {
        u64 deltas[NR_PSI_STATES - 1] = { 0, };
-       unsigned long missed_periods = 0;
        unsigned long nonidle_total = 0;
-       u64 now, expires, period;
+       u32 changed_states = 0;
        int cpu;
        int s;
 
-       mutex_lock(&group->stat_lock);
-
        /*
         * Collect the per-cpu time buckets and average them into a
         * single time sample that is normalized to wallclock time.
@@ -291,8 +319,11 @@ static bool update_stats(struct psi_group *group)
        for_each_possible_cpu(cpu) {
                u32 times[NR_PSI_STATES];
                u32 nonidle;
+               u32 cpu_changed_states;
 
-               get_recent_times(group, cpu, times);
+               get_recent_times(group, cpu, aggregator, times,
+                               &cpu_changed_states);
+               changed_states |= cpu_changed_states;
 
                nonidle = nsecs_to_jiffies(times[PSI_NONIDLE]);
                nonidle_total += nonidle;
@@ -315,13 +346,22 @@ static bool update_stats(struct psi_group *group)
 
        /* total= */
        for (s = 0; s < NR_PSI_STATES - 1; s++)
-               group->total[s] += div_u64(deltas[s], max(nonidle_total, 1UL));
+               group->total[aggregator][s] +=
+                               div_u64(deltas[s], max(nonidle_total, 1UL));
+
+       if (pchanged_states)
+               *pchanged_states = changed_states;
+}
+
+static u64 update_averages(struct psi_group *group, u64 now)
+{
+       unsigned long missed_periods = 0;
+       u64 expires, period;
+       u64 avg_next_update;
+       int s;
 
        /* avgX= */
-       now = sched_clock();
-       expires = group->next_update;
-       if (now < expires)
-               goto out;
+       expires = group->avg_next_update;
        if (now - expires >= psi_period)
                missed_periods = div_u64(now - expires, psi_period);
 
@@ -332,14 +372,14 @@ static bool update_stats(struct psi_group *group)
         * But the deltas we sample out of the per-cpu buckets above
         * are based on the actual time elapsing between clock ticks.
         */
-       group->next_update = expires + ((1 + missed_periods) * psi_period);
-       period = now - (group->last_update + (missed_periods * psi_period));
-       group->last_update = now;
+       avg_next_update = expires + ((1 + missed_periods) * psi_period);
+       period = now - (group->avg_last_update + (missed_periods * psi_period));
+       group->avg_last_update = now;
 
        for (s = 0; s < NR_PSI_STATES - 1; s++) {
                u32 sample;
 
-               sample = group->total[s] - group->total_prev[s];
+               sample = group->total[PSI_AVGS][s] - group->avg_total[s];
                /*
                 * Due to the lockless sampling of the time buckets,
                 * recorded time deltas can slip into the next period,
@@ -359,23 +399,30 @@ static bool update_stats(struct psi_group *group)
                 */
                if (sample > period)
                        sample = period;
-               group->total_prev[s] += sample;
+               group->avg_total[s] += sample;
                calc_avgs(group->avg[s], missed_periods, sample, period);
        }
-out:
-       mutex_unlock(&group->stat_lock);
-       return nonidle_total;
+
+       return avg_next_update;
 }
 
-static void psi_update_work(struct work_struct *work)
+static void psi_avgs_work(struct work_struct *work)
 {
        struct delayed_work *dwork;
        struct psi_group *group;
+       u32 changed_states;
        bool nonidle;
+       u64 now;
 
        dwork = to_delayed_work(work);
-       group = container_of(dwork, struct psi_group, clock_work);
+       group = container_of(dwork, struct psi_group, avgs_work);
+
+       mutex_lock(&group->avgs_lock);
 
+       now = sched_clock();
+
+       collect_percpu_times(group, PSI_AVGS, &changed_states);
+       nonidle = changed_states & (1 << PSI_NONIDLE);
        /*
         * If there is task activity, periodically fold the per-cpu
         * times and feed samples into the running averages. If things
@@ -383,18 +430,196 @@ static void psi_update_work(struct work_struct *work)
         * Once restarted, we'll catch up the running averages in one
         * go - see calc_avgs() and missed_periods.
         */
-
-       nonidle = update_stats(group);
+       if (now >= group->avg_next_update)
+               group->avg_next_update = update_averages(group, now);
 
        if (nonidle) {
-               unsigned long delay = 0;
-               u64 now;
+               schedule_delayed_work(dwork, nsecs_to_jiffies(
+                               group->avg_next_update - now) + 1);
+       }
+
+       mutex_unlock(&group->avgs_lock);
+}
+
+/* Trigger tracking window manupulations */
+static void window_reset(struct psi_window *win, u64 now, u64 value,
+                        u64 prev_growth)
+{
+       win->start_time = now;
+       win->start_value = value;
+       win->prev_growth = prev_growth;
+}
+
+/*
+ * PSI growth tracking window update and growth calculation routine.
+ *
+ * This approximates a sliding tracking window by interpolating
+ * partially elapsed windows using historical growth data from the
+ * previous intervals. This minimizes memory requirements (by not storing
+ * all the intermediate values in the previous window) and simplifies
+ * the calculations. It works well because PSI signal changes only in
+ * positive direction and over relatively small window sizes the growth
+ * is close to linear.
+ */
+static u64 window_update(struct psi_window *win, u64 now, u64 value)
+{
+       u64 elapsed;
+       u64 growth;
+
+       elapsed = now - win->start_time;
+       growth = value - win->start_value;
+       /*
+        * After each tracking window passes win->start_value and
+        * win->start_time get reset and win->prev_growth stores
+        * the average per-window growth of the previous window.
+        * win->prev_growth is then used to interpolate additional
+        * growth from the previous window assuming it was linear.
+        */
+       if (elapsed > win->size)
+               window_reset(win, now, value, growth);
+       else {
+               u32 remaining;
+
+               remaining = win->size - elapsed;
+               growth += div_u64(win->prev_growth * remaining, win->size);
+       }
+
+       return growth;
+}
+
+static void init_triggers(struct psi_group *group, u64 now)
+{
+       struct psi_trigger *t;
+
+       list_for_each_entry(t, &group->triggers, node)
+               window_reset(&t->win, now,
+                               group->total[PSI_POLL][t->state], 0);
+       memcpy(group->polling_total, group->total[PSI_POLL],
+                  sizeof(group->polling_total));
+       group->polling_next_update = now + group->poll_min_period;
+}
+
+static u64 update_triggers(struct psi_group *group, u64 now)
+{
+       struct psi_trigger *t;
+       bool new_stall = false;
+       u64 *total = group->total[PSI_POLL];
+
+       /*
+        * On subsequent updates, calculate growth deltas and let
+        * watchers know when their specified thresholds are exceeded.
+        */
+       list_for_each_entry(t, &group->triggers, node) {
+               u64 growth;
+
+               /* Check for stall activity */
+               if (group->polling_total[t->state] == total[t->state])
+                       continue;
+
+               /*
+                * Multiple triggers might be looking at the same state,
+                * remember to update group->polling_total[] once we've
+                * been through all of them. Also remember to extend the
+                * polling time if we see new stall activity.
+                */
+               new_stall = true;
+
+               /* Calculate growth since last update */
+               growth = window_update(&t->win, now, total[t->state]);
+               if (growth < t->threshold)
+                       continue;
+
+               /* Limit event signaling to once per window */
+               if (now < t->last_event_time + t->win.size)
+                       continue;
+
+               /* Generate an event */
+               if (cmpxchg(&t->event, 0, 1) == 0)
+                       wake_up_interruptible(&t->event_wait);
+               t->last_event_time = now;
+       }
+
+       if (new_stall)
+               memcpy(group->polling_total, total,
+                               sizeof(group->polling_total));
+
+       return now + group->poll_min_period;
+}
+
+/*
+ * Schedule polling if it's not already scheduled. It's safe to call even from
+ * hotpath because even though kthread_queue_delayed_work takes worker->lock
+ * spinlock that spinlock is never contended due to poll_scheduled atomic
+ * preventing such competition.
+ */
+static void psi_schedule_poll_work(struct psi_group *group, unsigned long delay)
+{
+       struct kthread_worker *kworker;
+
+       /* Do not reschedule if already scheduled */
+       if (atomic_cmpxchg(&group->poll_scheduled, 0, 1) != 0)
+               return;
+
+       rcu_read_lock();
 
-               now = sched_clock();
-               if (group->next_update > now)
-                       delay = nsecs_to_jiffies(group->next_update - now) + 1;
-               schedule_delayed_work(dwork, delay);
+       kworker = rcu_dereference(group->poll_kworker);
+       /*
+        * kworker might be NULL in case psi_trigger_destroy races with
+        * psi_task_change (hotpath) which can't use locks
+        */
+       if (likely(kworker))
+               kthread_queue_delayed_work(kworker, &group->poll_work, delay);
+       else
+               atomic_set(&group->poll_scheduled, 0);
+
+       rcu_read_unlock();
+}
+
+static void psi_poll_work(struct kthread_work *work)
+{
+       struct kthread_delayed_work *dwork;
+       struct psi_group *group;
+       u32 changed_states;
+       u64 now;
+
+       dwork = container_of(work, struct kthread_delayed_work, work);
+       group = container_of(dwork, struct psi_group, poll_work);
+
+       atomic_set(&group->poll_scheduled, 0);
+
+       mutex_lock(&group->trigger_lock);
+
+       now = sched_clock();
+
+       collect_percpu_times(group, PSI_POLL, &changed_states);
+
+       if (changed_states & group->poll_states) {
+               /* Initialize trigger windows when entering polling mode */
+               if (now > group->polling_until)
+                       init_triggers(group, now);
+
+               /*
+                * Keep the monitor active for at least the duration of the
+                * minimum tracking window as long as monitor states are
+                * changing.
+                */
+               group->polling_until = now +
+                       group->poll_min_period * UPDATES_PER_WINDOW;
+       }
+
+       if (now > group->polling_until) {
+               group->polling_next_update = ULLONG_MAX;
+               goto out;
        }
+
+       if (now >= group->polling_next_update)
+               group->polling_next_update = update_triggers(group, now);
+
+       psi_schedule_poll_work(group,
+               nsecs_to_jiffies(group->polling_next_update - now) + 1);
+
+out:
+       mutex_unlock(&group->trigger_lock);
 }
 
 static void record_times(struct psi_group_cpu *groupc, int cpu,
@@ -407,15 +632,15 @@ static void record_times(struct psi_group_cpu *groupc, int cpu,
        delta = now - groupc->state_start;
        groupc->state_start = now;
 
-       if (test_state(groupc->tasks, PSI_IO_SOME)) {
+       if (groupc->state_mask & (1 << PSI_IO_SOME)) {
                groupc->times[PSI_IO_SOME] += delta;
-               if (test_state(groupc->tasks, PSI_IO_FULL))
+               if (groupc->state_mask & (1 << PSI_IO_FULL))
                        groupc->times[PSI_IO_FULL] += delta;
        }
 
-       if (test_state(groupc->tasks, PSI_MEM_SOME)) {
+       if (groupc->state_mask & (1 << PSI_MEM_SOME)) {
                groupc->times[PSI_MEM_SOME] += delta;
-               if (test_state(groupc->tasks, PSI_MEM_FULL))
+               if (groupc->state_mask & (1 << PSI_MEM_FULL))
                        groupc->times[PSI_MEM_FULL] += delta;
                else if (memstall_tick) {
                        u32 sample;
@@ -436,18 +661,20 @@ static void record_times(struct psi_group_cpu *groupc, int cpu,
                }
        }
 
-       if (test_state(groupc->tasks, PSI_CPU_SOME))
+       if (groupc->state_mask & (1 << PSI_CPU_SOME))
                groupc->times[PSI_CPU_SOME] += delta;
 
-       if (test_state(groupc->tasks, PSI_NONIDLE))
+       if (groupc->state_mask & (1 << PSI_NONIDLE))
                groupc->times[PSI_NONIDLE] += delta;
 }
 
-static void psi_group_change(struct psi_group *group, int cpu,
-                            unsigned int clear, unsigned int set)
+static u32 psi_group_change(struct psi_group *group, int cpu,
+                           unsigned int clear, unsigned int set)
 {
        struct psi_group_cpu *groupc;
        unsigned int t, m;
+       enum psi_states s;
+       u32 state_mask = 0;
 
        groupc = per_cpu_ptr(group->pcpu, cpu);
 
@@ -480,7 +707,16 @@ static void psi_group_change(struct psi_group *group, int cpu,
                if (set & (1 << t))
                        groupc->tasks[t]++;
 
+       /* Calculate state mask representing active states */
+       for (s = 0; s < NR_PSI_STATES; s++) {
+               if (test_state(groupc->tasks, s))
+                       state_mask |= (1 << s);
+       }
+       groupc->state_mask = state_mask;
+
        write_seqcount_end(&groupc->seq);
+
+       return state_mask;
 }
 
 static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
@@ -537,13 +773,17 @@ void psi_task_change(struct task_struct *task, int clear, int set)
         */
        if (unlikely((clear & TSK_RUNNING) &&
                     (task->flags & PF_WQ_WORKER) &&
-                    wq_worker_last_func(task) == psi_update_work))
+                    wq_worker_last_func(task) == psi_avgs_work))
                wake_clock = false;
 
        while ((group = iterate_groups(task, &iter))) {
-               psi_group_change(group, cpu, clear, set);
-               if (wake_clock && !delayed_work_pending(&group->clock_work))
-                       schedule_delayed_work(&group->clock_work, PSI_FREQ);
+               u32 state_mask = psi_group_change(group, cpu, clear, set);
+
+               if (state_mask & group->poll_states)
+                       psi_schedule_poll_work(group, 1);
+
+               if (wake_clock && !delayed_work_pending(&group->avgs_work))
+                       schedule_delayed_work(&group->avgs_work, PSI_FREQ);
        }
 }
 
@@ -640,8 +880,10 @@ void psi_cgroup_free(struct cgroup *cgroup)
        if (static_branch_likely(&psi_disabled))
                return;
 
-       cancel_delayed_work_sync(&cgroup->psi.clock_work);
+       cancel_delayed_work_sync(&cgroup->psi.avgs_work);
        free_percpu(cgroup->psi.pcpu);
+       /* All triggers must be removed by now */
+       WARN_ONCE(cgroup->psi.poll_states, "psi: trigger leak\n");
 }
 
 /**
@@ -697,11 +939,18 @@ void cgroup_move_task(struct task_struct *task, struct css_set *to)
 int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
 {
        int full;
+       u64 now;
 
        if (static_branch_likely(&psi_disabled))
                return -EOPNOTSUPP;
 
-       update_stats(group);
+       /* Update averages before reporting them */
+       mutex_lock(&group->avgs_lock);
+       now = sched_clock();
+       collect_percpu_times(group, PSI_AVGS, NULL);
+       if (now >= group->avg_next_update)
+               group->avg_next_update = update_averages(group, now);
+       mutex_unlock(&group->avgs_lock);
 
        for (full = 0; full < 2 - (res == PSI_CPU); full++) {
                unsigned long avg[3];
@@ -710,7 +959,8 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)
 
                for (w = 0; w < 3; w++)
                        avg[w] = group->avg[res * 2 + full][w];
-               total = div_u64(group->total[res * 2 + full], NSEC_PER_USEC);
+               total = div_u64(group->total[PSI_AVGS][res * 2 + full],
+                               NSEC_PER_USEC);
 
                seq_printf(m, "%s avg10=%lu.%02lu avg60=%lu.%02lu avg300=%lu.%02lu total=%llu\n",
                           full ? "full" : "some",
@@ -753,25 +1003,270 @@ static int psi_cpu_open(struct inode *inode, struct file *file)
        return single_open(file, psi_cpu_show, NULL);
 }
 
+struct psi_trigger *psi_trigger_create(struct psi_group *group,
+                       char *buf, size_t nbytes, enum psi_res res)
+{
+       struct psi_trigger *t;
+       enum psi_states state;
+       u32 threshold_us;
+       u32 window_us;
+
+       if (static_branch_likely(&psi_disabled))
+               return ERR_PTR(-EOPNOTSUPP);
+
+       if (sscanf(buf, "some %u %u", &threshold_us, &window_us) == 2)
+               state = PSI_IO_SOME + res * 2;
+       else if (sscanf(buf, "full %u %u", &threshold_us, &window_us) == 2)
+               state = PSI_IO_FULL + res * 2;
+       else
+               return ERR_PTR(-EINVAL);
+
+       if (state >= PSI_NONIDLE)
+               return ERR_PTR(-EINVAL);
+
+       if (window_us < WINDOW_MIN_US ||
+               window_us > WINDOW_MAX_US)
+               return ERR_PTR(-EINVAL);
+
+       /* Check threshold */
+       if (threshold_us == 0 || threshold_us > window_us)
+               return ERR_PTR(-EINVAL);
+
+       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       if (!t)
+               return ERR_PTR(-ENOMEM);
+
+       t->group = group;
+       t->state = state;
+       t->threshold = threshold_us * NSEC_PER_USEC;
+       t->win.size = window_us * NSEC_PER_USEC;
+       window_reset(&t->win, 0, 0, 0);
+
+       t->event = 0;
+       t->last_event_time = 0;
+       init_waitqueue_head(&t->event_wait);
+       kref_init(&t->refcount);
+
+       mutex_lock(&group->trigger_lock);
+
+       if (!rcu_access_pointer(group->poll_kworker)) {
+               struct sched_param param = {
+                       .sched_priority = MAX_RT_PRIO - 1,
+               };
+               struct kthread_worker *kworker;
+
+               kworker = kthread_create_worker(0, "psimon");
+               if (IS_ERR(kworker)) {
+                       kfree(t);
+                       mutex_unlock(&group->trigger_lock);
+                       return ERR_CAST(kworker);
+               }
+               sched_setscheduler(kworker->task, SCHED_FIFO, &param);
+               kthread_init_delayed_work(&group->poll_work,
+                               psi_poll_work);
+               rcu_assign_pointer(group->poll_kworker, kworker);
+       }
+
+       list_add(&t->node, &group->triggers);
+       group->poll_min_period = min(group->poll_min_period,
+               div_u64(t->win.size, UPDATES_PER_WINDOW));
+       group->nr_triggers[t->state]++;
+       group->poll_states |= (1 << t->state);
+
+       mutex_unlock(&group->trigger_lock);
+
+       return t;
+}
+
+static void psi_trigger_destroy(struct kref *ref)
+{
+       struct psi_trigger *t = container_of(ref, struct psi_trigger, refcount);
+       struct psi_group *group = t->group;
+       struct kthread_worker *kworker_to_destroy = NULL;
+
+       if (static_branch_likely(&psi_disabled))
+               return;
+
+       /*
+        * Wakeup waiters to stop polling. Can happen if cgroup is deleted
+        * from under a polling process.
+        */
+       wake_up_interruptible(&t->event_wait);
+
+       mutex_lock(&group->trigger_lock);
+
+       if (!list_empty(&t->node)) {
+               struct psi_trigger *tmp;
+               u64 period = ULLONG_MAX;
+
+               list_del(&t->node);
+               group->nr_triggers[t->state]--;
+               if (!group->nr_triggers[t->state])
+                       group->poll_states &= ~(1 << t->state);
+               /* reset min update period for the remaining triggers */
+               list_for_each_entry(tmp, &group->triggers, node)
+                       period = min(period, div_u64(tmp->win.size,
+                                       UPDATES_PER_WINDOW));
+               group->poll_min_period = period;
+               /* Destroy poll_kworker when the last trigger is destroyed */
+               if (group->poll_states == 0) {
+                       group->polling_until = 0;
+                       kworker_to_destroy = rcu_dereference_protected(
+                                       group->poll_kworker,
+                                       lockdep_is_held(&group->trigger_lock));
+                       rcu_assign_pointer(group->poll_kworker, NULL);
+               }
+       }
+
+       mutex_unlock(&group->trigger_lock);
+
+       /*
+        * Wait for both *trigger_ptr from psi_trigger_replace and
+        * poll_kworker RCUs to complete their read-side critical sections
+        * before destroying the trigger and optionally the poll_kworker
+        */
+       synchronize_rcu();
+       /*
+        * Destroy the kworker after releasing trigger_lock to prevent a
+        * deadlock while waiting for psi_poll_work to acquire trigger_lock
+        */
+       if (kworker_to_destroy) {
+               kthread_cancel_delayed_work_sync(&group->poll_work);
+               kthread_destroy_worker(kworker_to_destroy);
+       }
+       kfree(t);
+}
+
+void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *new)
+{
+       struct psi_trigger *old = *trigger_ptr;
+
+       if (static_branch_likely(&psi_disabled))
+               return;
+
+       rcu_assign_pointer(*trigger_ptr, new);
+       if (old)
+               kref_put(&old->refcount, psi_trigger_destroy);
+}
+
+__poll_t psi_trigger_poll(void **trigger_ptr,
+                               struct file *file, poll_table *wait)
+{
+       __poll_t ret = DEFAULT_POLLMASK;
+       struct psi_trigger *t;
+
+       if (static_branch_likely(&psi_disabled))
+               return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI;
+
+       rcu_read_lock();
+
+       t = rcu_dereference(*(void __rcu __force **)trigger_ptr);
+       if (!t) {
+               rcu_read_unlock();
+               return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI;
+       }
+       kref_get(&t->refcount);
+
+       rcu_read_unlock();
+
+       poll_wait(file, &t->event_wait, wait);
+
+       if (cmpxchg(&t->event, 1, 0) == 1)
+               ret |= EPOLLPRI;
+
+       kref_put(&t->refcount, psi_trigger_destroy);
+
+       return ret;
+}
+
+static ssize_t psi_write(struct file *file, const char __user *user_buf,
+                        size_t nbytes, enum psi_res res)
+{
+       char buf[32];
+       size_t buf_size;
+       struct seq_file *seq;
+       struct psi_trigger *new;
+
+       if (static_branch_likely(&psi_disabled))
+               return -EOPNOTSUPP;
+
+       buf_size = min(nbytes, (sizeof(buf) - 1));
+       if (copy_from_user(buf, user_buf, buf_size))
+               return -EFAULT;
+
+       buf[buf_size - 1] = '\0';
+
+       new = psi_trigger_create(&psi_system, buf, nbytes, res);
+       if (IS_ERR(new))
+               return PTR_ERR(new);
+
+       seq = file->private_data;
+       /* Take seq->lock to protect seq->private from concurrent writes */
+       mutex_lock(&seq->lock);
+       psi_trigger_replace(&seq->private, new);
+       mutex_unlock(&seq->lock);
+
+       return nbytes;
+}
+
+static ssize_t psi_io_write(struct file *file, const char __user *user_buf,
+                           size_t nbytes, loff_t *ppos)
+{
+       return psi_write(file, user_buf, nbytes, PSI_IO);
+}
+
+static ssize_t psi_memory_write(struct file *file, const char __user *user_buf,
+                               size_t nbytes, loff_t *ppos)
+{
+       return psi_write(file, user_buf, nbytes, PSI_MEM);
+}
+
+static ssize_t psi_cpu_write(struct file *file, const char __user *user_buf,
+                            size_t nbytes, loff_t *ppos)
+{
+       return psi_write(file, user_buf, nbytes, PSI_CPU);
+}
+
+static __poll_t psi_fop_poll(struct file *file, poll_table *wait)
+{
+       struct seq_file *seq = file->private_data;
+
+       return psi_trigger_poll(&seq->private, file, wait);
+}
+
+static int psi_fop_release(struct inode *inode, struct file *file)
+{
+       struct seq_file *seq = file->private_data;
+
+       psi_trigger_replace(&seq->private, NULL);
+       return single_release(inode, file);
+}
+
 static const struct file_operations psi_io_fops = {
        .open           = psi_io_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = single_release,
+       .write          = psi_io_write,
+       .poll           = psi_fop_poll,
+       .release        = psi_fop_release,
 };
 
 static const struct file_operations psi_memory_fops = {
        .open           = psi_memory_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = single_release,
+       .write          = psi_memory_write,
+       .poll           = psi_fop_poll,
+       .release        = psi_fop_release,
 };
 
 static const struct file_operations psi_cpu_fops = {
        .open           = psi_cpu_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = single_release,
+       .write          = psi_cpu_write,
+       .poll           = psi_fop_poll,
+       .release        = psi_fop_release,
 };
 
 static int __init psi_proc_init(void)
index 6eb1f8e..fa0f9ad 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic waiting primitives.
  *
index c67c6d2..45eba18 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * The implementation of the wait_bit*() and related waiting APIs:
  */
index 62f9aea..d7b9d14 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/kernel/signal.c
  *
@@ -840,6 +841,7 @@ static int check_kill_permission(int sig, struct kernel_siginfo *info,
                         */
                        if (!sid || sid == task_session(current))
                                break;
+                       /* fall through */
                default:
                        return -EPERM;
                }
@@ -2112,6 +2114,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, kernel_siginfo_t
                preempt_enable_no_resched();
                cgroup_enter_frozen();
                freezable_schedule();
+               cgroup_leave_frozen(true);
        } else {
                /*
                 * By the time we got the lock, our tracer went away.
index f4cf1b0..d155374 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic helpers for smp ipi calls
  *
index c230c2d..2efe1e2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common SMP CPU bringup/teardown functions
  */
index 27bafc1..5667f1d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kernel/stacktrace.c
  *
index ba158f6..7d1008b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sysctl.c: General linux system control interface
  *
@@ -2886,8 +2887,10 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
                        if (neg)
                                continue;
                        val = convmul * val / convdiv;
-                       if ((min && val < *min) || (max && val > *max))
-                               continue;
+                       if ((min && val < *min) || (max && val > *max)) {
+                               err = -EINVAL;
+                               break;
+                       }
                        *i = val;
                } else {
                        val = convdiv * (*i) / convmul;
@@ -3170,17 +3173,19 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
 
        if (write) {
                char *kbuf, *p;
+               size_t skipped = 0;
 
-               if (left > PAGE_SIZE - 1)
+               if (left > PAGE_SIZE - 1) {
                        left = PAGE_SIZE - 1;
+                       /* How much of the buffer we'll skip this pass */
+                       skipped = *lenp - left;
+               }
 
                p = kbuf = memdup_user_nul(buffer, left);
                if (IS_ERR(kbuf))
                        return PTR_ERR(kbuf);
 
-               tmp_bitmap = kcalloc(BITS_TO_LONGS(bitmap_len),
-                                    sizeof(unsigned long),
-                                    GFP_KERNEL);
+               tmp_bitmap = bitmap_zalloc(bitmap_len, GFP_KERNEL);
                if (!tmp_bitmap) {
                        kfree(kbuf);
                        return -ENOMEM;
@@ -3189,9 +3194,22 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
                while (!err && left) {
                        unsigned long val_a, val_b;
                        bool neg;
+                       size_t saved_left;
 
+                       /* In case we stop parsing mid-number, we can reset */
+                       saved_left = left;
                        err = proc_get_long(&p, &left, &val_a, &neg, tr_a,
                                             sizeof(tr_a), &c);
+                       /*
+                        * If we consumed the entirety of a truncated buffer or
+                        * only one char is left (may be a "-"), then stop here,
+                        * reset, & come back for more.
+                        */
+                       if ((left <= 1) && skipped) {
+                               left = saved_left;
+                               break;
+                       }
+
                        if (err)
                                break;
                        if (val_a >= bitmap_len || neg) {
@@ -3209,6 +3227,15 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
                                err = proc_get_long(&p, &left, &val_b,
                                                     &neg, tr_b, sizeof(tr_b),
                                                     &c);
+                               /*
+                                * If we consumed all of a truncated buffer or
+                                * then stop here, reset, & come back for more.
+                                */
+                               if (!left && skipped) {
+                                       left = saved_left;
+                                       break;
+                               }
+
                                if (err)
                                        break;
                                if (val_b >= bitmap_len || neg ||
@@ -3227,6 +3254,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
                        proc_skip_char(&p, &left, '\n');
                }
                kfree(kbuf);
+               left += skipped;
        } else {
                unsigned long bit_a, bit_b = 0;
 
@@ -3271,7 +3299,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
                *ppos += *lenp;
        }
 
-       kfree(tmp_bitmap);
+       bitmap_free(tmp_bitmap);
        return err;
 }
 
index 7bca480..76c997f 100644 (file)
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * test_kprobes.c - simple sanity test for *probes
  *
  * Copyright IBM Corp. 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it would 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.
  */
 
 #define pr_fmt(fmt) "Kprobe smoke test: " fmt
index e2c038d..fcc4235 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Timer subsystem related configuration options
 #
index ac5555e..8de4f78 100644 (file)
@@ -691,7 +691,7 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc,
                time_constant = max(time_constant, 0l);
        }
 
-       if (txc->modes & ADJ_TAI && txc->constant > 0)
+       if (txc->modes & ADJ_TAI && txc->constant >= 0)
                *time_tai = txc->constant;
 
        if (txc->modes & ADJ_OFFSET)
index 5d965ce..564e5fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Architectures that offer an FUNCTION_TRACER implementation should
 #  select HAVE_FUNCTION_TRACER:
index b920358..a12aff8 100644 (file)
 #define INIT_OPS_HASH(opsname) \
        .func_hash              = &opsname.local_hash,                  \
        .local_hash.regex_lock  = __MUTEX_INITIALIZER(opsname.local_hash.regex_lock),
-#define ASSIGN_OPS_HASH(opsname, val) \
-       .func_hash              = val, \
-       .local_hash.regex_lock  = __MUTEX_INITIALIZER(opsname.local_hash.regex_lock),
 #else
 #define INIT_OPS_HASH(opsname)
-#define ASSIGN_OPS_HASH(opsname, val)
 #endif
 
 enum {
@@ -3880,7 +3876,7 @@ static int ftrace_hash_move_and_update_ops(struct ftrace_ops *ops,
 static bool module_exists(const char *module)
 {
        /* All modules have the symbol __this_module */
-       const char this_mod[] = "__this_module";
+       static const char this_mod[] = "__this_module";
        char modname[MAX_PARAM_PREFIX_LEN + sizeof(this_mod) + 2];
        unsigned long val;
        int n;
@@ -6265,6 +6261,9 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
        preempt_disable_notrace();
 
        do_for_each_ftrace_op(op, ftrace_ops_list) {
+               /* Stub functions don't need to be called nor tested */
+               if (op->flags & FTRACE_OPS_FL_STUB)
+                       continue;
                /*
                 * Check the following for each ops before calling their func:
                 *  if RCU flag is set, then rcu_is_watching() must be true
index 4ee8d8a..05b0b31 100644 (file)
@@ -4979,7 +4979,7 @@ static __init int rb_write_something(struct rb_test_data *data, bool nested)
        cnt = data->cnt + (nested ? 27 : 0);
 
        /* Multiply cnt by ~e, to make some unique increment */
-       size = (data->cnt * 68 / 25) % (sizeof(rb_string) - 1);
+       size = (cnt * 68 / 25) % (sizeof(rb_string) - 1);
 
        len = size + sizeof(struct rb_item);
 
index ffba678..0564f6d 100644 (file)
@@ -362,7 +362,7 @@ static void ring_buffer_producer(void)
                        hit--; /* make it non zero */
                }
 
-               /* Caculate the average time in nanosecs */
+               /* Calculate the average time in nanosecs */
                avg = NSEC_PER_MSEC / (hit + missed);
                trace_printk("%ld ns per entry\n", avg);
        }
index ec43999..2c92b3d 100644 (file)
@@ -1727,6 +1727,10 @@ static __init int init_trace_selftests(void)
        pr_info("Running postponed tracer tests:\n");
 
        list_for_each_entry_safe(p, n, &postponed_selftests, list) {
+               /* This loop can take minutes when sanitizers are enabled, so
+                * lets make sure we allow RCU processing.
+                */
+               cond_resched();
                ret = run_tracer_selftest(p->type);
                /* If the test fails, then warn and remove from available_tracers */
                if (ret < 0) {
@@ -3045,6 +3049,7 @@ void trace_printk_init_buffers(void)
        if (global_trace.trace_buffer.buffer)
                tracing_start_cmdline_record();
 }
+EXPORT_SYMBOL_GPL(trace_printk_init_buffers);
 
 void trace_printk_start_comm(void)
 {
@@ -3205,6 +3210,7 @@ int trace_array_printk(struct trace_array *tr,
        va_end(ap);
        return ret;
 }
+EXPORT_SYMBOL_GPL(trace_array_printk);
 
 __printf(3, 4)
 int trace_array_printk_buf(struct ring_buffer *buffer,
@@ -3483,33 +3489,68 @@ static void s_stop(struct seq_file *m, void *p)
 }
 
 static void
+get_total_entries_cpu(struct trace_buffer *buf, unsigned long *total,
+                     unsigned long *entries, int cpu)
+{
+       unsigned long count;
+
+       count = ring_buffer_entries_cpu(buf->buffer, cpu);
+       /*
+        * If this buffer has skipped entries, then we hold all
+        * entries for the trace and we need to ignore the
+        * ones before the time stamp.
+        */
+       if (per_cpu_ptr(buf->data, cpu)->skipped_entries) {
+               count -= per_cpu_ptr(buf->data, cpu)->skipped_entries;
+               /* total is the same as the entries */
+               *total = count;
+       } else
+               *total = count +
+                       ring_buffer_overrun_cpu(buf->buffer, cpu);
+       *entries = count;
+}
+
+static void
 get_total_entries(struct trace_buffer *buf,
                  unsigned long *total, unsigned long *entries)
 {
-       unsigned long count;
+       unsigned long t, e;
        int cpu;
 
        *total = 0;
        *entries = 0;
 
        for_each_tracing_cpu(cpu) {
-               count = ring_buffer_entries_cpu(buf->buffer, cpu);
-               /*
-                * If this buffer has skipped entries, then we hold all
-                * entries for the trace and we need to ignore the
-                * ones before the time stamp.
-                */
-               if (per_cpu_ptr(buf->data, cpu)->skipped_entries) {
-                       count -= per_cpu_ptr(buf->data, cpu)->skipped_entries;
-                       /* total is the same as the entries */
-                       *total += count;
-               } else
-                       *total += count +
-                               ring_buffer_overrun_cpu(buf->buffer, cpu);
-               *entries += count;
+               get_total_entries_cpu(buf, &t, &e, cpu);
+               *total += t;
+               *entries += e;
        }
 }
 
+unsigned long trace_total_entries_cpu(struct trace_array *tr, int cpu)
+{
+       unsigned long total, entries;
+
+       if (!tr)
+               tr = &global_trace;
+
+       get_total_entries_cpu(&tr->trace_buffer, &total, &entries, cpu);
+
+       return entries;
+}
+
+unsigned long trace_total_entries(struct trace_array *tr)
+{
+       unsigned long total, entries;
+
+       if (!tr)
+               tr = &global_trace;
+
+       get_total_entries(&tr->trace_buffer, &total, &entries);
+
+       return entries;
+}
+
 static void print_lat_help_header(struct seq_file *m)
 {
        seq_puts(m, "#                  _------=> CPU#            \n"
@@ -3548,25 +3589,18 @@ static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file
                                       unsigned int flags)
 {
        bool tgid = flags & TRACE_ITER_RECORD_TGID;
-       const char tgid_space[] = "          ";
-       const char space[] = "  ";
+       const char *space = "          ";
+       int prec = tgid ? 10 : 2;
 
        print_event_info(buf, m);
 
-       seq_printf(m, "#                          %s  _-----=> irqs-off\n",
-                  tgid ? tgid_space : space);
-       seq_printf(m, "#                          %s / _----=> need-resched\n",
-                  tgid ? tgid_space : space);
-       seq_printf(m, "#                          %s| / _---=> hardirq/softirq\n",
-                  tgid ? tgid_space : space);
-       seq_printf(m, "#                          %s|| / _--=> preempt-depth\n",
-                  tgid ? tgid_space : space);
-       seq_printf(m, "#                          %s||| /     delay\n",
-                  tgid ? tgid_space : space);
-       seq_printf(m, "#           TASK-PID %sCPU#  ||||    TIMESTAMP  FUNCTION\n",
-                  tgid ? "   TGID   " : space);
-       seq_printf(m, "#              | |   %s  |   ||||       |         |\n",
-                  tgid ? "     |    " : space);
+       seq_printf(m, "#                          %.*s  _-----=> irqs-off\n", prec, space);
+       seq_printf(m, "#                          %.*s / _----=> need-resched\n", prec, space);
+       seq_printf(m, "#                          %.*s| / _---=> hardirq/softirq\n", prec, space);
+       seq_printf(m, "#                          %.*s|| / _--=> preempt-depth\n", prec, space);
+       seq_printf(m, "#                          %.*s||| /     delay\n", prec, space);
+       seq_printf(m, "#           TASK-PID %.*sCPU#  ||||    TIMESTAMP  FUNCTION\n", prec, "   TGID   ");
+       seq_printf(m, "#              | |   %.*s  |   ||||       |         |\n", prec, "     |    ");
 }
 
 void
@@ -4692,6 +4726,7 @@ static const char readme_msg[] =
        "  trace_pipe\t\t- A consuming read to see the contents of the buffer\n"
        "  current_tracer\t- function and latency tracers\n"
        "  available_tracers\t- list of configured tracers for current_tracer\n"
+       "  error_log\t- error log for failed commands (that support it)\n"
        "  buffer_size_kb\t- view and modify size of per cpu buffer\n"
        "  buffer_total_size_kb  - view total size of all cpu buffers\n\n"
        "  trace_clock\t\t-change the clock used to order events\n"
@@ -4712,7 +4747,7 @@ static const char readme_msg[] =
        "  instances\t\t- Make sub-buffers with: mkdir instances/foo\n"
        "\t\t\t  Remove sub-buffer with rmdir\n"
        "  trace_options\t\t- Set format or modify how tracing happens\n"
-       "\t\t\t  Disable an option by adding a suffix 'no' to the\n"
+       "\t\t\t  Disable an option by prefixing 'no' to the\n"
        "\t\t\t  option name\n"
        "  saved_cmdlines_size\t- echo command number in here to store comm-pid list\n"
 #ifdef CONFIG_DYNAMIC_FTRACE
@@ -6296,13 +6331,13 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
        struct ring_buffer *buffer;
        struct print_entry *entry;
        unsigned long irq_flags;
-       const char faulted[] = "<faulted>";
        ssize_t written;
        int size;
        int len;
 
 /* Used in tracing_mark_raw_write() as well */
-#define FAULTED_SIZE (sizeof(faulted) - 1) /* '\0' is already accounted for */
+#define FAULTED_STR "<faulted>"
+#define FAULTED_SIZE (sizeof(FAULTED_STR) - 1) /* '\0' is already accounted for */
 
        if (tracing_disabled)
                return -EINVAL;
@@ -6334,7 +6369,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 
        len = __copy_from_user_inatomic(&entry->buf, ubuf, cnt);
        if (len) {
-               memcpy(&entry->buf, faulted, FAULTED_SIZE);
+               memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE);
                cnt = FAULTED_SIZE;
                written = -EFAULT;
        } else
@@ -6375,7 +6410,6 @@ tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
        struct ring_buffer_event *event;
        struct ring_buffer *buffer;
        struct raw_data_entry *entry;
-       const char faulted[] = "<faulted>";
        unsigned long irq_flags;
        ssize_t written;
        int size;
@@ -6415,7 +6449,7 @@ tracing_mark_raw_write(struct file *filp, const char __user *ubuf,
        len = __copy_from_user_inatomic(&entry->id, ubuf, cnt);
        if (len) {
                entry->id = -1;
-               memcpy(&entry->buf, faulted, FAULTED_SIZE);
+               memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE);
                written = -EFAULT;
        } else
                written = cnt;
@@ -6868,6 +6902,238 @@ static const struct file_operations snapshot_raw_fops = {
 
 #endif /* CONFIG_TRACER_SNAPSHOT */
 
+#define TRACING_LOG_ERRS_MAX   8
+#define TRACING_LOG_LOC_MAX    128
+
+#define CMD_PREFIX "  Command: "
+
+struct err_info {
+       const char      **errs; /* ptr to loc-specific array of err strings */
+       u8              type;   /* index into errs -> specific err string */
+       u8              pos;    /* MAX_FILTER_STR_VAL = 256 */
+       u64             ts;
+};
+
+struct tracing_log_err {
+       struct list_head        list;
+       struct err_info         info;
+       char                    loc[TRACING_LOG_LOC_MAX]; /* err location */
+       char                    cmd[MAX_FILTER_STR_VAL]; /* what caused err */
+};
+
+static DEFINE_MUTEX(tracing_err_log_lock);
+
+struct tracing_log_err *get_tracing_log_err(struct trace_array *tr)
+{
+       struct tracing_log_err *err;
+
+       if (tr->n_err_log_entries < TRACING_LOG_ERRS_MAX) {
+               err = kzalloc(sizeof(*err), GFP_KERNEL);
+               if (!err)
+                       err = ERR_PTR(-ENOMEM);
+               tr->n_err_log_entries++;
+
+               return err;
+       }
+
+       err = list_first_entry(&tr->err_log, struct tracing_log_err, list);
+       list_del(&err->list);
+
+       return err;
+}
+
+/**
+ * err_pos - find the position of a string within a command for error careting
+ * @cmd: The tracing command that caused the error
+ * @str: The string to position the caret at within @cmd
+ *
+ * Finds the position of the first occurence of @str within @cmd.  The
+ * return value can be passed to tracing_log_err() for caret placement
+ * within @cmd.
+ *
+ * Returns the index within @cmd of the first occurence of @str or 0
+ * if @str was not found.
+ */
+unsigned int err_pos(char *cmd, const char *str)
+{
+       char *found;
+
+       if (WARN_ON(!strlen(cmd)))
+               return 0;
+
+       found = strstr(cmd, str);
+       if (found)
+               return found - cmd;
+
+       return 0;
+}
+
+/**
+ * tracing_log_err - write an error to the tracing error log
+ * @tr: The associated trace array for the error (NULL for top level array)
+ * @loc: A string describing where the error occurred
+ * @cmd: The tracing command that caused the error
+ * @errs: The array of loc-specific static error strings
+ * @type: The index into errs[], which produces the specific static err string
+ * @pos: The position the caret should be placed in the cmd
+ *
+ * Writes an error into tracing/error_log of the form:
+ *
+ * <loc>: error: <text>
+ *   Command: <cmd>
+ *              ^
+ *
+ * tracing/error_log is a small log file containing the last
+ * TRACING_LOG_ERRS_MAX errors (8).  Memory for errors isn't allocated
+ * unless there has been a tracing error, and the error log can be
+ * cleared and have its memory freed by writing the empty string in
+ * truncation mode to it i.e. echo > tracing/error_log.
+ *
+ * NOTE: the @errs array along with the @type param are used to
+ * produce a static error string - this string is not copied and saved
+ * when the error is logged - only a pointer to it is saved.  See
+ * existing callers for examples of how static strings are typically
+ * defined for use with tracing_log_err().
+ */
+void tracing_log_err(struct trace_array *tr,
+                    const char *loc, const char *cmd,
+                    const char **errs, u8 type, u8 pos)
+{
+       struct tracing_log_err *err;
+
+       if (!tr)
+               tr = &global_trace;
+
+       mutex_lock(&tracing_err_log_lock);
+       err = get_tracing_log_err(tr);
+       if (PTR_ERR(err) == -ENOMEM) {
+               mutex_unlock(&tracing_err_log_lock);
+               return;
+       }
+
+       snprintf(err->loc, TRACING_LOG_LOC_MAX, "%s: error: ", loc);
+       snprintf(err->cmd, MAX_FILTER_STR_VAL,"\n" CMD_PREFIX "%s\n", cmd);
+
+       err->info.errs = errs;
+       err->info.type = type;
+       err->info.pos = pos;
+       err->info.ts = local_clock();
+
+       list_add_tail(&err->list, &tr->err_log);
+       mutex_unlock(&tracing_err_log_lock);
+}
+
+static void clear_tracing_err_log(struct trace_array *tr)
+{
+       struct tracing_log_err *err, *next;
+
+       mutex_lock(&tracing_err_log_lock);
+       list_for_each_entry_safe(err, next, &tr->err_log, list) {
+               list_del(&err->list);
+               kfree(err);
+       }
+
+       tr->n_err_log_entries = 0;
+       mutex_unlock(&tracing_err_log_lock);
+}
+
+static void *tracing_err_log_seq_start(struct seq_file *m, loff_t *pos)
+{
+       struct trace_array *tr = m->private;
+
+       mutex_lock(&tracing_err_log_lock);
+
+       return seq_list_start(&tr->err_log, *pos);
+}
+
+static void *tracing_err_log_seq_next(struct seq_file *m, void *v, loff_t *pos)
+{
+       struct trace_array *tr = m->private;
+
+       return seq_list_next(v, &tr->err_log, pos);
+}
+
+static void tracing_err_log_seq_stop(struct seq_file *m, void *v)
+{
+       mutex_unlock(&tracing_err_log_lock);
+}
+
+static void tracing_err_log_show_pos(struct seq_file *m, u8 pos)
+{
+       u8 i;
+
+       for (i = 0; i < sizeof(CMD_PREFIX) - 1; i++)
+               seq_putc(m, ' ');
+       for (i = 0; i < pos; i++)
+               seq_putc(m, ' ');
+       seq_puts(m, "^\n");
+}
+
+static int tracing_err_log_seq_show(struct seq_file *m, void *v)
+{
+       struct tracing_log_err *err = v;
+
+       if (err) {
+               const char *err_text = err->info.errs[err->info.type];
+               u64 sec = err->info.ts;
+               u32 nsec;
+
+               nsec = do_div(sec, NSEC_PER_SEC);
+               seq_printf(m, "[%5llu.%06u] %s%s", sec, nsec / 1000,
+                          err->loc, err_text);
+               seq_printf(m, "%s", err->cmd);
+               tracing_err_log_show_pos(m, err->info.pos);
+       }
+
+       return 0;
+}
+
+static const struct seq_operations tracing_err_log_seq_ops = {
+       .start  = tracing_err_log_seq_start,
+       .next   = tracing_err_log_seq_next,
+       .stop   = tracing_err_log_seq_stop,
+       .show   = tracing_err_log_seq_show
+};
+
+static int tracing_err_log_open(struct inode *inode, struct file *file)
+{
+       struct trace_array *tr = inode->i_private;
+       int ret = 0;
+
+       if (trace_array_get(tr) < 0)
+               return -ENODEV;
+
+       /* If this file was opened for write, then erase contents */
+       if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC))
+               clear_tracing_err_log(tr);
+
+       if (file->f_mode & FMODE_READ) {
+               ret = seq_open(file, &tracing_err_log_seq_ops);
+               if (!ret) {
+                       struct seq_file *m = file->private_data;
+                       m->private = tr;
+               } else {
+                       trace_array_put(tr);
+               }
+       }
+       return ret;
+}
+
+static ssize_t tracing_err_log_write(struct file *file,
+                                    const char __user *buffer,
+                                    size_t count, loff_t *ppos)
+{
+       return count;
+}
+
+static const struct file_operations tracing_err_log_fops = {
+       .open           = tracing_err_log_open,
+       .write          = tracing_err_log_write,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = tracing_release_generic_tr,
+};
+
 static int tracing_buffers_open(struct inode *inode, struct file *filp)
 {
        struct trace_array *tr = inode->i_private;
@@ -8033,7 +8299,7 @@ static void update_tracer_options(struct trace_array *tr)
        mutex_unlock(&trace_types_lock);
 }
 
-static int instance_mkdir(const char *name)
+struct trace_array *trace_array_create(const char *name)
 {
        struct trace_array *tr;
        int ret;
@@ -8072,6 +8338,7 @@ static int instance_mkdir(const char *name)
        INIT_LIST_HEAD(&tr->systems);
        INIT_LIST_HEAD(&tr->events);
        INIT_LIST_HEAD(&tr->hist_vars);
+       INIT_LIST_HEAD(&tr->err_log);
 
        if (allocate_trace_buffers(tr, trace_buf_size) < 0)
                goto out_free_tr;
@@ -8097,7 +8364,7 @@ static int instance_mkdir(const char *name)
        mutex_unlock(&trace_types_lock);
        mutex_unlock(&event_mutex);
 
-       return 0;
+       return tr;
 
  out_free_tr:
        free_trace_buffers(tr);
@@ -8109,33 +8376,21 @@ static int instance_mkdir(const char *name)
        mutex_unlock(&trace_types_lock);
        mutex_unlock(&event_mutex);
 
-       return ret;
+       return ERR_PTR(ret);
+}
+EXPORT_SYMBOL_GPL(trace_array_create);
 
+static int instance_mkdir(const char *name)
+{
+       return PTR_ERR_OR_ZERO(trace_array_create(name));
 }
 
-static int instance_rmdir(const char *name)
+static int __remove_instance(struct trace_array *tr)
 {
-       struct trace_array *tr;
-       int found = 0;
-       int ret;
        int i;
 
-       mutex_lock(&event_mutex);
-       mutex_lock(&trace_types_lock);
-
-       ret = -ENODEV;
-       list_for_each_entry(tr, &ftrace_trace_arrays, list) {
-               if (tr->name && strcmp(tr->name, name) == 0) {
-                       found = 1;
-                       break;
-               }
-       }
-       if (!found)
-               goto out_unlock;
-
-       ret = -EBUSY;
        if (tr->ref || (tr->current_trace && tr->current_trace->ref))
-               goto out_unlock;
+               return -EBUSY;
 
        list_del(&tr->list);
 
@@ -8161,10 +8416,46 @@ static int instance_rmdir(const char *name)
        free_cpumask_var(tr->tracing_cpumask);
        kfree(tr->name);
        kfree(tr);
+       tr = NULL;
 
-       ret = 0;
+       return 0;
+}
+
+int trace_array_destroy(struct trace_array *tr)
+{
+       int ret;
+
+       if (!tr)
+               return -EINVAL;
+
+       mutex_lock(&event_mutex);
+       mutex_lock(&trace_types_lock);
+
+       ret = __remove_instance(tr);
+
+       mutex_unlock(&trace_types_lock);
+       mutex_unlock(&event_mutex);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(trace_array_destroy);
+
+static int instance_rmdir(const char *name)
+{
+       struct trace_array *tr;
+       int ret;
+
+       mutex_lock(&event_mutex);
+       mutex_lock(&trace_types_lock);
+
+       ret = -ENODEV;
+       list_for_each_entry(tr, &ftrace_trace_arrays, list) {
+               if (tr->name && strcmp(tr->name, name) == 0) {
+                       ret = __remove_instance(tr);
+                       break;
+               }
+       }
 
- out_unlock:
        mutex_unlock(&trace_types_lock);
        mutex_unlock(&event_mutex);
 
@@ -8254,6 +8545,9 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
                          tr, &snapshot_fops);
 #endif
 
+       trace_create_file("error_log", 0644, d_tracer,
+                         tr, &tracing_err_log_fops);
+
        for_each_tracing_cpu(cpu)
                tracing_init_tracefs_percpu(tr, cpu);
 
@@ -8839,6 +9133,7 @@ __init static int tracer_alloc_buffers(void)
        INIT_LIST_HEAD(&global_trace.systems);
        INIT_LIST_HEAD(&global_trace.events);
        INIT_LIST_HEAD(&global_trace.hist_vars);
+       INIT_LIST_HEAD(&global_trace.err_log);
        list_add(&global_trace.list, &ftrace_trace_arrays);
 
        apply_trace_boot_options();
index 639047b..1974ce8 100644 (file)
@@ -293,11 +293,13 @@ struct trace_array {
        int                     nr_topts;
        bool                    clear_trace;
        int                     buffer_percent;
+       unsigned int            n_err_log_entries;
        struct tracer           *current_trace;
        unsigned int            trace_flags;
        unsigned char           trace_flags_index[TRACE_FLAGS_MAX_SIZE];
        unsigned int            flags;
        raw_spinlock_t          start_lock;
+       struct list_head        err_log;
        struct dentry           *dir;
        struct dentry           *options;
        struct dentry           *percpu_dir;
@@ -719,6 +721,9 @@ void trace_init_global_iter(struct trace_iterator *iter);
 
 void tracing_iter_reset(struct trace_iterator *iter, int cpu);
 
+unsigned long trace_total_entries_cpu(struct trace_array *tr, int cpu);
+unsigned long trace_total_entries(struct trace_array *tr);
+
 void trace_function(struct trace_array *tr,
                    unsigned long ip,
                    unsigned long parent_ip,
@@ -1545,7 +1550,8 @@ extern int apply_subsystem_event_filter(struct trace_subsystem_dir *dir,
 extern void print_subsystem_event_filter(struct event_subsystem *system,
                                         struct trace_seq *s);
 extern int filter_assign_type(const char *type);
-extern int create_event_filter(struct trace_event_call *call,
+extern int create_event_filter(struct trace_array *tr,
+                              struct trace_event_call *call,
                               char *filter_str, bool set_str,
                               struct event_filter **filterp);
 extern void free_event_filter(struct event_filter *filter);
@@ -1876,6 +1882,11 @@ extern ssize_t trace_parse_run_command(struct file *file,
                const char __user *buffer, size_t count, loff_t *ppos,
                int (*createfn)(int, char**));
 
+extern unsigned int err_pos(char *cmd, const char *str);
+extern void tracing_log_err(struct trace_array *tr,
+                           const char *loc, const char *cmd,
+                           const char **errs, u8 type, u8 pos);
+
 /*
  * Normal trace_printk() and friends allocates special buffers
  * to do the manipulation, as well as saves the print formats
index 5b3b0c3..0ce3db6 100644 (file)
@@ -832,6 +832,7 @@ static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(ftrace_set_clr_event);
 
 /**
  * trace_set_clr_event - enable or disable an event
@@ -1318,9 +1319,6 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
        char buf[32];
        int len;
 
-       if (*ppos)
-               return 0;
-
        if (unlikely(!id))
                return -ENODEV;
 
index 05a6649..d3e5931 100644 (file)
@@ -66,7 +66,8 @@ static const char * ops[] = { OPS };
        C(INVALID_FILTER,       "Meaningless filter expression"),       \
        C(IP_FIELD_ONLY,        "Only 'ip' field is supported for function trace"), \
        C(INVALID_VALUE,        "Invalid value (did you forget quotes)?"), \
-       C(NO_FILTER,            "No filter found"),
+       C(ERRNO,                "Error"),                               \
+       C(NO_FILTER,            "No filter found")
 
 #undef C
 #define C(a, b)                FILT_ERR_##a
@@ -76,7 +77,7 @@ enum { ERRORS };
 #undef C
 #define C(a, b)                b
 
-static char *err_text[] = { ERRORS };
+static const char *err_text[] = { ERRORS };
 
 /* Called after a '!' character but "!=" and "!~" are not "not"s */
 static bool is_not(const char *str)
@@ -919,7 +920,8 @@ static void remove_filter_string(struct event_filter *filter)
        filter->filter_string = NULL;
 }
 
-static void append_filter_err(struct filter_parse_error *pe,
+static void append_filter_err(struct trace_array *tr,
+                             struct filter_parse_error *pe,
                              struct event_filter *filter)
 {
        struct trace_seq *s;
@@ -947,8 +949,14 @@ static void append_filter_err(struct filter_parse_error *pe,
        if (pe->lasterr > 0) {
                trace_seq_printf(s, "\n%*s", pos, "^");
                trace_seq_printf(s, "\nparse_error: %s\n", err_text[pe->lasterr]);
+               tracing_log_err(tr, "event filter parse error",
+                               filter->filter_string, err_text,
+                               pe->lasterr, pe->lasterr_pos);
        } else {
                trace_seq_printf(s, "\nError: (%d)\n", pe->lasterr);
+               tracing_log_err(tr, "event filter parse error",
+                               filter->filter_string, err_text,
+                               FILT_ERR_ERRNO, 0);
        }
        trace_seq_putc(s, 0);
        buf = kmemdup_nul(s->buffer, s->seq.len, GFP_KERNEL);
@@ -1214,30 +1222,30 @@ static int parse_pred(const char *str, void *data,
                 * (perf doesn't use it) and grab everything.
                 */
                if (strcmp(field->name, "ip") != 0) {
-                        parse_error(pe, FILT_ERR_IP_FIELD_ONLY, pos + i);
-                        goto err_free;
-                }
-                pred->fn = filter_pred_none;
-
-                /*
-                 * Quotes are not required, but if they exist then we need
-                 * to read them till we hit a matching one.
-                 */
-                if (str[i] == '\'' || str[i] == '"')
-                        q = str[i];
-                else
-                        q = 0;
-
-                for (i++; str[i]; i++) {
-                        if (q && str[i] == q)
-                                break;
-                        if (!q && (str[i] == ')' || str[i] == '&' ||
-                                   str[i] == '|'))
-                                break;
-                }
-                /* Skip quotes */
-                if (q)
-                        s++;
+                       parse_error(pe, FILT_ERR_IP_FIELD_ONLY, pos + i);
+                       goto err_free;
+               }
+               pred->fn = filter_pred_none;
+
+               /*
+                * Quotes are not required, but if they exist then we need
+                * to read them till we hit a matching one.
+                */
+               if (str[i] == '\'' || str[i] == '"')
+                       q = str[i];
+               else
+                       q = 0;
+
+               for (i++; str[i]; i++) {
+                       if (q && str[i] == q)
+                               break;
+                       if (!q && (str[i] == ')' || str[i] == '&' ||
+                                  str[i] == '|'))
+                               break;
+               }
+               /* Skip quotes */
+               if (q)
+                       s++;
                len = i - s;
                if (len >= MAX_FILTER_STR_VAL) {
                        parse_error(pe, FILT_ERR_OPERAND_TOO_LONG, pos + i);
@@ -1600,7 +1608,7 @@ static int process_system_preds(struct trace_subsystem_dir *dir,
                if (err) {
                        filter_disable(file);
                        parse_error(pe, FILT_ERR_BAD_SUBSYS_FILTER, 0);
-                       append_filter_err(pe, filter);
+                       append_filter_err(tr, pe, filter);
                } else
                        event_set_filtered_flag(file);
 
@@ -1712,7 +1720,8 @@ static void create_filter_finish(struct filter_parse_error *pe)
  * information if @set_str is %true and the caller is responsible for
  * freeing it.
  */
-static int create_filter(struct trace_event_call *call,
+static int create_filter(struct trace_array *tr,
+                        struct trace_event_call *call,
                         char *filter_string, bool set_str,
                         struct event_filter **filterp)
 {
@@ -1729,17 +1738,18 @@ static int create_filter(struct trace_event_call *call,
 
        err = process_preds(call, filter_string, *filterp, pe);
        if (err && set_str)
-               append_filter_err(pe, *filterp);
+               append_filter_err(tr, pe, *filterp);
        create_filter_finish(pe);
 
        return err;
 }
 
-int create_event_filter(struct trace_event_call *call,
+int create_event_filter(struct trace_array *tr,
+                       struct trace_event_call *call,
                        char *filter_str, bool set_str,
                        struct event_filter **filterp)
 {
-       return create_filter(call, filter_str, set_str, filterp);
+       return create_filter(tr, call, filter_str, set_str, filterp);
 }
 
 /**
@@ -1766,7 +1776,7 @@ static int create_system_filter(struct trace_subsystem_dir *dir,
                        kfree((*filterp)->filter_string);
                        (*filterp)->filter_string = NULL;
                } else {
-                       append_filter_err(pe, *filterp);
+                       append_filter_err(tr, pe, *filterp);
                }
        }
        create_filter_finish(pe);
@@ -1797,7 +1807,7 @@ int apply_event_filter(struct trace_event_file *file, char *filter_string)
                return 0;
        }
 
-       err = create_filter(call, filter_string, true, &filter);
+       err = create_filter(file->tr, call, filter_string, true, &filter);
 
        /*
         * Always swap the call filter with the new filter
@@ -2053,7 +2063,7 @@ int ftrace_profile_set_filter(struct perf_event *event, int event_id,
        if (event->filter)
                goto out_unlock;
 
-       err = create_filter(call, filter_str, false, &filter);
+       err = create_filter(NULL, call, filter_str, false, &filter);
        if (err)
                goto free_filter;
 
@@ -2202,8 +2212,8 @@ static __init int ftrace_test_event_filter(void)
                struct test_filter_data_t *d = &test_filter_data[i];
                int err;
 
-               err = create_filter(&event_ftrace_test_filter, d->filter,
-                                   false, &filter);
+               err = create_filter(NULL, &event_ftrace_test_filter,
+                                   d->filter, false, &filter);
                if (err) {
                        printk(KERN_INFO
                               "Failed to get filter for '%s', err %d\n",
index a1d2042..7fca345 100644 (file)
 
 #define STR_VAR_LEN_MAX                32 /* must be multiple of sizeof(u64) */
 
+#define ERRORS                                                         \
+       C(NONE,                 "No error"),                            \
+       C(DUPLICATE_VAR,        "Variable already defined"),            \
+       C(VAR_NOT_UNIQUE,       "Variable name not unique, need to use fully qualified name (subsys.event.var) for variable"), \
+       C(TOO_MANY_VARS,        "Too many variables defined"),          \
+       C(MALFORMED_ASSIGNMENT, "Malformed assignment"),                \
+       C(NAMED_MISMATCH,       "Named hist trigger doesn't match existing named trigger (includes variables)"), \
+       C(TRIGGER_EEXIST,       "Hist trigger already exists"),         \
+       C(TRIGGER_ENOENT_CLEAR, "Can't clear or continue a nonexistent hist trigger"), \
+       C(SET_CLOCK_FAIL,       "Couldn't set trace_clock"),            \
+       C(BAD_FIELD_MODIFIER,   "Invalid field modifier"),              \
+       C(TOO_MANY_SUBEXPR,     "Too many subexpressions (3 max)"),     \
+       C(TIMESTAMP_MISMATCH,   "Timestamp units in expression don't match"), \
+       C(TOO_MANY_FIELD_VARS,  "Too many field variables defined"),    \
+       C(EVENT_FILE_NOT_FOUND, "Event file not found"),                \
+       C(HIST_NOT_FOUND,       "Matching event histogram not found"),  \
+       C(HIST_CREATE_FAIL,     "Couldn't create histogram for field"), \
+       C(SYNTH_VAR_NOT_FOUND,  "Couldn't find synthetic variable"),    \
+       C(SYNTH_EVENT_NOT_FOUND,"Couldn't find synthetic event"),       \
+       C(SYNTH_TYPE_MISMATCH,  "Param type doesn't match synthetic event field type"), \
+       C(SYNTH_COUNT_MISMATCH, "Param count doesn't match synthetic event field count"), \
+       C(FIELD_VAR_PARSE_FAIL, "Couldn't parse field variable"),       \
+       C(VAR_CREATE_FIND_FAIL, "Couldn't create or find variable"),    \
+       C(ONX_NOT_VAR,          "For onmax(x) or onchange(x), x must be a variable"), \
+       C(ONX_VAR_NOT_FOUND,    "Couldn't find onmax or onchange variable"), \
+       C(ONX_VAR_CREATE_FAIL,  "Couldn't create onmax or onchange variable"), \
+       C(FIELD_VAR_CREATE_FAIL,"Couldn't create field variable"),      \
+       C(TOO_MANY_PARAMS,      "Too many action params"),              \
+       C(PARAM_NOT_FOUND,      "Couldn't find param"),                 \
+       C(INVALID_PARAM,        "Invalid action param"),                \
+       C(ACTION_NOT_FOUND,     "No action found"),                     \
+       C(NO_SAVE_PARAMS,       "No params found for save()"),          \
+       C(TOO_MANY_SAVE_ACTIONS,"Can't have more than one save() action per hist"), \
+       C(ACTION_MISMATCH,      "Handler doesn't support action"),      \
+       C(NO_CLOSING_PAREN,     "No closing paren found"),              \
+       C(SUBSYS_NOT_FOUND,     "Missing subsystem"),                   \
+       C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"),     \
+       C(INVALID_REF_KEY,      "Using variable references as keys not supported"), \
+       C(VAR_NOT_FOUND,        "Couldn't find variable"),              \
+       C(FIELD_NOT_FOUND,      "Couldn't find field"),
+
+#undef C
+#define C(a, b)                HIST_ERR_##a
+
+enum { ERRORS };
+
+#undef C
+#define C(a, b)                b
+
+static const char *err_text[] = { ERRORS };
+
 struct hist_field;
 
 typedef u64 (*hist_field_fn_t) (struct hist_field *field,
@@ -535,62 +586,49 @@ static struct track_data *track_data_alloc(unsigned int key_len,
        return data;
 }
 
-static char last_hist_cmd[MAX_FILTER_STR_VAL];
-static char hist_err_str[MAX_FILTER_STR_VAL];
+static char last_cmd[MAX_FILTER_STR_VAL];
+static char last_cmd_loc[MAX_FILTER_STR_VAL];
 
-static void last_cmd_set(char *str)
+static int errpos(char *str)
 {
-       if (!str)
-               return;
-
-       strncpy(last_hist_cmd, str, MAX_FILTER_STR_VAL - 1);
+       return err_pos(last_cmd, str);
 }
 
-static void hist_err(char *str, char *var)
+static void last_cmd_set(struct trace_event_file *file, char *str)
 {
-       int maxlen = MAX_FILTER_STR_VAL - 1;
+       const char *system = NULL, *name = NULL;
+       struct trace_event_call *call;
 
        if (!str)
                return;
 
-       if (strlen(hist_err_str))
-               return;
+       strncpy(last_cmd, str, MAX_FILTER_STR_VAL - 1);
 
-       if (!var)
-               var = "";
+       if (file) {
+               call = file->event_call;
 
-       if (strlen(hist_err_str) + strlen(str) + strlen(var) > maxlen)
-               return;
+               system = call->class->system;
+               if (system) {
+                       name = trace_event_name(call);
+                       if (!name)
+                               system = NULL;
+               }
+       }
 
-       strcat(hist_err_str, str);
-       strcat(hist_err_str, var);
+       if (system)
+               snprintf(last_cmd_loc, MAX_FILTER_STR_VAL, "hist:%s:%s", system, name);
 }
 
-static void hist_err_event(char *str, char *system, char *event, char *var)
+static void hist_err(struct trace_array *tr, u8 err_type, u8 err_pos)
 {
-       char err[MAX_FILTER_STR_VAL];
-
-       if (system && var)
-               snprintf(err, MAX_FILTER_STR_VAL, "%s.%s.%s", system, event, var);
-       else if (system)
-               snprintf(err, MAX_FILTER_STR_VAL, "%s.%s", system, event);
-       else
-               strscpy(err, var, MAX_FILTER_STR_VAL);
-
-       hist_err(str, err);
+       tracing_log_err(tr, last_cmd_loc, last_cmd, err_text,
+                       err_type, err_pos);
 }
 
 static void hist_err_clear(void)
 {
-       hist_err_str[0] = '\0';
-}
-
-static bool have_hist_err(void)
-{
-       if (strlen(hist_err_str))
-               return true;
-
-       return false;
+       last_cmd[0] = '\0';
+       last_cmd_loc[0] = '\0';
 }
 
 struct synth_trace_event {
@@ -1719,7 +1757,7 @@ static struct trace_event_file *find_var_file(struct trace_array *tr,
 
                if (find_var_field(var_hist_data, var_name)) {
                        if (found) {
-                               hist_err_event("Variable name not unique, need to use fully qualified name (subsys.event.var) for variable: ", system, event_name, var_name);
+                               hist_err(tr, HIST_ERR_VAR_NOT_UNIQUE, errpos(var_name));
                                return NULL;
                        }
 
@@ -1770,7 +1808,8 @@ find_match_var(struct hist_trigger_data *hist_data, char *var_name)
                        hist_field = find_file_var(file, var_name);
                        if (hist_field) {
                                if (found) {
-                                       hist_err_event("Variable name not unique, need to use fully qualified name (subsys.event.var) for variable: ", system, event_name, var_name);
+                                       hist_err(tr, HIST_ERR_VAR_NOT_UNIQUE,
+                                                errpos(var_name));
                                        return ERR_PTR(-EINVAL);
                                }
 
@@ -2002,11 +2041,11 @@ static int parse_action(char *str, struct hist_trigger_attrs *attrs)
                attrs->n_actions++;
                ret = 0;
        }
-
        return ret;
 }
 
-static int parse_assignment(char *str, struct hist_trigger_attrs *attrs)
+static int parse_assignment(struct trace_array *tr,
+                           char *str, struct hist_trigger_attrs *attrs)
 {
        int ret = 0;
 
@@ -2062,7 +2101,7 @@ static int parse_assignment(char *str, struct hist_trigger_attrs *attrs)
                char *assignment;
 
                if (attrs->n_assignments == TRACING_MAP_VARS_MAX) {
-                       hist_err("Too many variables defined: ", str);
+                       hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(str));
                        ret = -EINVAL;
                        goto out;
                }
@@ -2079,7 +2118,8 @@ static int parse_assignment(char *str, struct hist_trigger_attrs *attrs)
        return ret;
 }
 
-static struct hist_trigger_attrs *parse_hist_trigger_attrs(char *trigger_str)
+static struct hist_trigger_attrs *
+parse_hist_trigger_attrs(struct trace_array *tr, char *trigger_str)
 {
        struct hist_trigger_attrs *attrs;
        int ret = 0;
@@ -2092,7 +2132,7 @@ static struct hist_trigger_attrs *parse_hist_trigger_attrs(char *trigger_str)
                char *str = strsep(&trigger_str, ":");
 
                if (strchr(str, '=')) {
-                       ret = parse_assignment(str, attrs);
+                       ret = parse_assignment(tr, str, attrs);
                        if (ret)
                                goto free;
                } else if (strcmp(str, "pause") == 0)
@@ -2648,6 +2688,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data,
                                        char *var_name)
 {
        struct hist_field *var_field = NULL, *ref_field = NULL;
+       struct trace_array *tr = hist_data->event_file->tr;
 
        if (!is_var_ref(var_name))
                return NULL;
@@ -2660,8 +2701,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data,
                                           system, event_name);
 
        if (!ref_field)
-               hist_err_event("Couldn't find variable: $",
-                              system, event_name, var_name);
+               hist_err(tr, HIST_ERR_VAR_NOT_FOUND, errpos(var_name));
 
        return ref_field;
 }
@@ -2672,6 +2712,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
 {
        struct ftrace_event_field *field = NULL;
        char *field_name, *modifier, *str;
+       struct trace_array *tr = file->tr;
 
        modifier = str = kstrdup(field_str, GFP_KERNEL);
        if (!modifier)
@@ -2695,7 +2736,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
                else if (strcmp(modifier, "usecs") == 0)
                        *flags |= HIST_FIELD_FL_TIMESTAMP_USECS;
                else {
-                       hist_err("Invalid field modifier: ", modifier);
+                       hist_err(tr, HIST_ERR_BAD_FIELD_MODIFIER, errpos(modifier));
                        field = ERR_PTR(-EINVAL);
                        goto out;
                }
@@ -2711,7 +2752,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
        else {
                field = trace_find_event_field(file->event_call, field_name);
                if (!field || !field->size) {
-                       hist_err("Couldn't find field: ", field_name);
+                       hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name));
                        field = ERR_PTR(-EINVAL);
                        goto out;
                }
@@ -2773,7 +2814,8 @@ static struct hist_field *parse_atom(struct hist_trigger_data *hist_data,
 
        s = local_field_var_ref(hist_data, ref_system, ref_event, ref_var);
        if (!s) {
-               hist_field = parse_var_ref(hist_data, ref_system, ref_event, ref_var);
+               hist_field = parse_var_ref(hist_data, ref_system,
+                                          ref_event, ref_var);
                if (hist_field) {
                        if (var_name) {
                                hist_field = create_alias(hist_data, hist_field, var_name);
@@ -2822,7 +2864,7 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data,
        /* we support only -(xxx) i.e. explicit parens required */
 
        if (level > 3) {
-               hist_err("Too many subexpressions (3 max): ", str);
+               hist_err(file->tr, HIST_ERR_TOO_MANY_SUBEXPR, errpos(str));
                ret = -EINVAL;
                goto free;
        }
@@ -2877,7 +2919,8 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data,
        return ERR_PTR(ret);
 }
 
-static int check_expr_operands(struct hist_field *operand1,
+static int check_expr_operands(struct trace_array *tr,
+                              struct hist_field *operand1,
                               struct hist_field *operand2)
 {
        unsigned long operand1_flags = operand1->flags;
@@ -2905,7 +2948,7 @@ static int check_expr_operands(struct hist_field *operand1,
 
        if ((operand1_flags & HIST_FIELD_FL_TIMESTAMP_USECS) !=
            (operand2_flags & HIST_FIELD_FL_TIMESTAMP_USECS)) {
-               hist_err("Timestamp units in expression don't match", NULL);
+               hist_err(tr, HIST_ERR_TIMESTAMP_MISMATCH, 0);
                return -EINVAL;
        }
 
@@ -2923,7 +2966,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
        char *sep, *operand1_str;
 
        if (level > 3) {
-               hist_err("Too many subexpressions (3 max): ", str);
+               hist_err(file->tr, HIST_ERR_TOO_MANY_SUBEXPR, errpos(str));
                return ERR_PTR(-EINVAL);
        }
 
@@ -2968,7 +3011,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
                goto free;
        }
 
-       ret = check_expr_operands(operand1, operand2);
+       ret = check_expr_operands(file->tr, operand1, operand2);
        if (ret)
                goto free;
 
@@ -3161,16 +3204,14 @@ create_field_var_hist(struct hist_trigger_data *target_hist_data,
        int ret;
 
        if (target_hist_data->n_field_var_hists >= SYNTH_FIELDS_MAX) {
-               hist_err_event("trace action: Too many field variables defined: ",
-                              subsys_name, event_name, field_name);
+               hist_err(tr, HIST_ERR_TOO_MANY_FIELD_VARS, errpos(field_name));
                return ERR_PTR(-EINVAL);
        }
 
        file = event_file(tr, subsys_name, event_name);
 
        if (IS_ERR(file)) {
-               hist_err_event("trace action: Event file not found: ",
-                              subsys_name, event_name, field_name);
+               hist_err(tr, HIST_ERR_EVENT_FILE_NOT_FOUND, errpos(field_name));
                ret = PTR_ERR(file);
                return ERR_PTR(ret);
        }
@@ -3183,8 +3224,7 @@ create_field_var_hist(struct hist_trigger_data *target_hist_data,
         */
        hist_data = find_compatible_hist(target_hist_data, file);
        if (!hist_data) {
-               hist_err_event("trace action: Matching event histogram not found: ",
-                              subsys_name, event_name, field_name);
+               hist_err(tr, HIST_ERR_HIST_NOT_FOUND, errpos(field_name));
                return ERR_PTR(-EINVAL);
        }
 
@@ -3245,8 +3285,7 @@ create_field_var_hist(struct hist_trigger_data *target_hist_data,
                kfree(cmd);
                kfree(var_hist->cmd);
                kfree(var_hist);
-               hist_err_event("trace action: Couldn't create histogram for field: ",
-                              subsys_name, event_name, field_name);
+               hist_err(tr, HIST_ERR_HIST_CREATE_FAIL, errpos(field_name));
                return ERR_PTR(ret);
        }
 
@@ -3258,8 +3297,7 @@ create_field_var_hist(struct hist_trigger_data *target_hist_data,
        if (IS_ERR_OR_NULL(event_var)) {
                kfree(var_hist->cmd);
                kfree(var_hist);
-               hist_err_event("trace action: Couldn't find synthetic variable: ",
-                              subsys_name, event_name, field_name);
+               hist_err(tr, HIST_ERR_SYNTH_VAR_NOT_FOUND, errpos(field_name));
                return ERR_PTR(-EINVAL);
        }
 
@@ -3392,25 +3430,26 @@ static struct field_var *create_field_var(struct hist_trigger_data *hist_data,
 {
        struct hist_field *val = NULL, *var = NULL;
        unsigned long flags = HIST_FIELD_FL_VAR;
+       struct trace_array *tr = file->tr;
        struct field_var *field_var;
        int ret = 0;
 
        if (hist_data->n_field_vars >= SYNTH_FIELDS_MAX) {
-               hist_err("Too many field variables defined: ", field_name);
+               hist_err(tr, HIST_ERR_TOO_MANY_FIELD_VARS, errpos(field_name));
                ret = -EINVAL;
                goto err;
        }
 
        val = parse_atom(hist_data, file, field_name, &flags, NULL);
        if (IS_ERR(val)) {
-               hist_err("Couldn't parse field variable: ", field_name);
+               hist_err(tr, HIST_ERR_FIELD_VAR_PARSE_FAIL, errpos(field_name));
                ret = PTR_ERR(val);
                goto err;
        }
 
        var = create_var(hist_data, file, field_name, val->size, val->type);
        if (IS_ERR(var)) {
-               hist_err("Couldn't create or find variable: ", field_name);
+               hist_err(tr, HIST_ERR_VAR_CREATE_FIND_FAIL, errpos(field_name));
                kfree(val);
                ret = PTR_ERR(var);
                goto err;
@@ -3737,19 +3776,20 @@ static int track_data_create(struct hist_trigger_data *hist_data,
 {
        struct hist_field *var_field, *ref_field, *track_var = NULL;
        struct trace_event_file *file = hist_data->event_file;
+       struct trace_array *tr = file->tr;
        char *track_data_var_str;
        int ret = 0;
 
        track_data_var_str = data->track_data.var_str;
        if (track_data_var_str[0] != '$') {
-               hist_err("For onmax(x) or onchange(x), x must be a variable: ", track_data_var_str);
+               hist_err(tr, HIST_ERR_ONX_NOT_VAR, errpos(track_data_var_str));
                return -EINVAL;
        }
        track_data_var_str++;
 
        var_field = find_target_event_var(hist_data, NULL, NULL, track_data_var_str);
        if (!var_field) {
-               hist_err("Couldn't find onmax or onchange variable: ", track_data_var_str);
+               hist_err(tr, HIST_ERR_ONX_VAR_NOT_FOUND, errpos(track_data_var_str));
                return -EINVAL;
        }
 
@@ -3762,7 +3802,7 @@ static int track_data_create(struct hist_trigger_data *hist_data,
        if (data->handler == HANDLER_ONMAX)
                track_var = create_var(hist_data, file, "__max", sizeof(u64), "u64");
        if (IS_ERR(track_var)) {
-               hist_err("Couldn't create onmax variable: ", "__max");
+               hist_err(tr, HIST_ERR_ONX_VAR_CREATE_FAIL, 0);
                ret = PTR_ERR(track_var);
                goto out;
        }
@@ -3770,7 +3810,7 @@ static int track_data_create(struct hist_trigger_data *hist_data,
        if (data->handler == HANDLER_ONCHANGE)
                track_var = create_var(hist_data, file, "__change", sizeof(u64), "u64");
        if (IS_ERR(track_var)) {
-               hist_err("Couldn't create onchange variable: ", "__change");
+               hist_err(tr, HIST_ERR_ONX_VAR_CREATE_FAIL, 0);
                ret = PTR_ERR(track_var);
                goto out;
        }
@@ -3781,7 +3821,8 @@ static int track_data_create(struct hist_trigger_data *hist_data,
        return ret;
 }
 
-static int parse_action_params(char *params, struct action_data *data)
+static int parse_action_params(struct trace_array *tr, char *params,
+                              struct action_data *data)
 {
        char *param, *saved_param;
        bool first_param = true;
@@ -3789,20 +3830,20 @@ static int parse_action_params(char *params, struct action_data *data)
 
        while (params) {
                if (data->n_params >= SYNTH_FIELDS_MAX) {
-                       hist_err("Too many action params", "");
+                       hist_err(tr, HIST_ERR_TOO_MANY_PARAMS, 0);
                        goto out;
                }
 
                param = strsep(&params, ",");
                if (!param) {
-                       hist_err("No action param found", "");
+                       hist_err(tr, HIST_ERR_PARAM_NOT_FOUND, 0);
                        ret = -EINVAL;
                        goto out;
                }
 
                param = strstrip(param);
                if (strlen(param) < 2) {
-                       hist_err("Invalid action param: ", param);
+                       hist_err(tr, HIST_ERR_INVALID_PARAM, errpos(param));
                        ret = -EINVAL;
                        goto out;
                }
@@ -3826,7 +3867,7 @@ static int parse_action_params(char *params, struct action_data *data)
        return ret;
 }
 
-static int action_parse(char *str, struct action_data *data,
+static int action_parse(struct trace_array *tr, char *str, struct action_data *data,
                        enum handler_id handler)
 {
        char *action_name;
@@ -3834,14 +3875,14 @@ static int action_parse(char *str, struct action_data *data,
 
        strsep(&str, ".");
        if (!str) {
-               hist_err("action parsing: No action found", "");
+               hist_err(tr, HIST_ERR_ACTION_NOT_FOUND, 0);
                ret = -EINVAL;
                goto out;
        }
 
        action_name = strsep(&str, "(");
        if (!action_name || !str) {
-               hist_err("action parsing: No action found", "");
+               hist_err(tr, HIST_ERR_ACTION_NOT_FOUND, 0);
                ret = -EINVAL;
                goto out;
        }
@@ -3850,12 +3891,12 @@ static int action_parse(char *str, struct action_data *data,
                char *params = strsep(&str, ")");
 
                if (!params) {
-                       hist_err("action parsing: No params found for %s", "save");
+                       hist_err(tr, HIST_ERR_NO_SAVE_PARAMS, 0);
                        ret = -EINVAL;
                        goto out;
                }
 
-               ret = parse_action_params(params, data);
+               ret = parse_action_params(tr, params, data);
                if (ret)
                        goto out;
 
@@ -3864,7 +3905,7 @@ static int action_parse(char *str, struct action_data *data,
                else if (handler == HANDLER_ONCHANGE)
                        data->track_data.check_val = check_track_val_changed;
                else {
-                       hist_err("action parsing: Handler doesn't support action: ", action_name);
+                       hist_err(tr, HIST_ERR_ACTION_MISMATCH, errpos(action_name));
                        ret = -EINVAL;
                        goto out;
                }
@@ -3876,7 +3917,7 @@ static int action_parse(char *str, struct action_data *data,
                char *params = strsep(&str, ")");
 
                if (!str) {
-                       hist_err("action parsing: No closing paren found: %s", params);
+                       hist_err(tr, HIST_ERR_NO_CLOSING_PAREN, errpos(params));
                        ret = -EINVAL;
                        goto out;
                }
@@ -3886,7 +3927,7 @@ static int action_parse(char *str, struct action_data *data,
                else if (handler == HANDLER_ONCHANGE)
                        data->track_data.check_val = check_track_val_changed;
                else {
-                       hist_err("action parsing: Handler doesn't support action: ", action_name);
+                       hist_err(tr, HIST_ERR_ACTION_MISMATCH, errpos(action_name));
                        ret = -EINVAL;
                        goto out;
                }
@@ -3901,7 +3942,7 @@ static int action_parse(char *str, struct action_data *data,
                        data->use_trace_keyword = true;
 
                if (params) {
-                       ret = parse_action_params(params, data);
+                       ret = parse_action_params(tr, params, data);
                        if (ret)
                                goto out;
                }
@@ -3954,7 +3995,7 @@ static struct action_data *track_data_parse(struct hist_trigger_data *hist_data,
                goto free;
        }
 
-       ret = action_parse(str, data, handler);
+       ret = action_parse(hist_data->event_file->tr, str, data, handler);
        if (ret)
                goto free;
  out:
@@ -4024,6 +4065,7 @@ trace_action_find_var(struct hist_trigger_data *hist_data,
                      struct action_data *data,
                      char *system, char *event, char *var)
 {
+       struct trace_array *tr = hist_data->event_file->tr;
        struct hist_field *hist_field;
 
        var++; /* skip '$' */
@@ -4039,7 +4081,7 @@ trace_action_find_var(struct hist_trigger_data *hist_data,
        }
 
        if (!hist_field)
-               hist_err_event("trace action: Couldn't find param: $", system, event, var);
+               hist_err(tr, HIST_ERR_PARAM_NOT_FOUND, errpos(var));
 
        return hist_field;
 }
@@ -4097,6 +4139,7 @@ trace_action_create_field_var(struct hist_trigger_data *hist_data,
 static int trace_action_create(struct hist_trigger_data *hist_data,
                               struct action_data *data)
 {
+       struct trace_array *tr = hist_data->event_file->tr;
        char *event_name, *param, *system = NULL;
        struct hist_field *hist_field, *var_ref;
        unsigned int i, var_ref_idx;
@@ -4114,7 +4157,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
 
        event = find_synth_event(synth_event_name);
        if (!event) {
-               hist_err("trace action: Couldn't find synthetic event: ", synth_event_name);
+               hist_err(tr, HIST_ERR_SYNTH_EVENT_NOT_FOUND, errpos(synth_event_name));
                return -EINVAL;
        }
 
@@ -4175,15 +4218,14 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
                        continue;
                }
 
-               hist_err_event("trace action: Param type doesn't match synthetic event field type: ",
-                              system, event_name, param);
+               hist_err(tr, HIST_ERR_SYNTH_TYPE_MISMATCH, errpos(param));
                kfree(p);
                ret = -EINVAL;
                goto err;
        }
 
        if (field_pos != event->n_fields) {
-               hist_err("trace action: Param count doesn't match synthetic event field count: ", event->name);
+               hist_err(tr, HIST_ERR_SYNTH_COUNT_MISMATCH, errpos(event->name));
                ret = -EINVAL;
                goto err;
        }
@@ -4202,6 +4244,7 @@ static int action_create(struct hist_trigger_data *hist_data,
                         struct action_data *data)
 {
        struct trace_event_file *file = hist_data->event_file;
+       struct trace_array *tr = file->tr;
        struct track_data *track_data;
        struct field_var *field_var;
        unsigned int i;
@@ -4229,7 +4272,7 @@ static int action_create(struct hist_trigger_data *hist_data,
        if (data->action == ACTION_SAVE) {
                if (hist_data->n_save_vars) {
                        ret = -EEXIST;
-                       hist_err("save action: Can't have more than one save() action per hist", "");
+                       hist_err(tr, HIST_ERR_TOO_MANY_SAVE_ACTIONS, 0);
                        goto out;
                }
 
@@ -4242,7 +4285,8 @@ static int action_create(struct hist_trigger_data *hist_data,
 
                        field_var = create_target_field_var(hist_data, NULL, NULL, param);
                        if (IS_ERR(field_var)) {
-                               hist_err("save action: Couldn't create field variable: ", param);
+                               hist_err(tr, HIST_ERR_FIELD_VAR_CREATE_FAIL,
+                                        errpos(param));
                                ret = PTR_ERR(field_var);
                                kfree(param);
                                goto out;
@@ -4276,19 +4320,18 @@ static struct action_data *onmatch_parse(struct trace_array *tr, char *str)
 
        match_event = strsep(&str, ")");
        if (!match_event || !str) {
-               hist_err("onmatch: Missing closing paren: ", match_event);
+               hist_err(tr, HIST_ERR_NO_CLOSING_PAREN, errpos(match_event));
                goto free;
        }
 
        match_event_system = strsep(&match_event, ".");
        if (!match_event) {
-               hist_err("onmatch: Missing subsystem for match event: ", match_event_system);
+               hist_err(tr, HIST_ERR_SUBSYS_NOT_FOUND, errpos(match_event_system));
                goto free;
        }
 
        if (IS_ERR(event_file(tr, match_event_system, match_event))) {
-               hist_err_event("onmatch: Invalid subsystem or event name: ",
-                              match_event_system, match_event, NULL);
+               hist_err(tr, HIST_ERR_INVALID_SUBSYS_EVENT, errpos(match_event));
                goto free;
        }
 
@@ -4304,7 +4347,7 @@ static struct action_data *onmatch_parse(struct trace_array *tr, char *str)
                goto free;
        }
 
-       ret = action_parse(str, data, HANDLER_ONMATCH);
+       ret = action_parse(tr, str, data, HANDLER_ONMATCH);
        if (ret)
                goto free;
  out:
@@ -4373,13 +4416,14 @@ static int create_var_field(struct hist_trigger_data *hist_data,
                            struct trace_event_file *file,
                            char *var_name, char *expr_str)
 {
+       struct trace_array *tr = hist_data->event_file->tr;
        unsigned long flags = 0;
 
        if (WARN_ON(val_idx >= TRACING_MAP_VALS_MAX + TRACING_MAP_VARS_MAX))
                return -EINVAL;
 
        if (find_var(hist_data, file, var_name) && !hist_data->remove) {
-               hist_err("Variable already defined: ", var_name);
+               hist_err(tr, HIST_ERR_DUPLICATE_VAR, errpos(var_name));
                return -EINVAL;
        }
 
@@ -4436,8 +4480,8 @@ static int create_key_field(struct hist_trigger_data *hist_data,
                            struct trace_event_file *file,
                            char *field_str)
 {
+       struct trace_array *tr = hist_data->event_file->tr;
        struct hist_field *hist_field = NULL;
-
        unsigned long flags = 0;
        unsigned int key_size;
        int ret = 0;
@@ -4460,7 +4504,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
                }
 
                if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
-                       hist_err("Using variable references as keys not supported: ", field_str);
+                       hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str));
                        destroy_hist_field(hist_field, 0);
                        ret = -EINVAL;
                        goto out;
@@ -4561,6 +4605,7 @@ static void free_var_defs(struct hist_trigger_data *hist_data)
 
 static int parse_var_defs(struct hist_trigger_data *hist_data)
 {
+       struct trace_array *tr = hist_data->event_file->tr;
        char *s, *str, *var_name, *field_str;
        unsigned int i, j, n_vars = 0;
        int ret = 0;
@@ -4574,13 +4619,14 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
 
                        var_name = strsep(&field_str, "=");
                        if (!var_name || !field_str) {
-                               hist_err("Malformed assignment: ", var_name);
+                               hist_err(tr, HIST_ERR_MALFORMED_ASSIGNMENT,
+                                        errpos(var_name));
                                ret = -EINVAL;
                                goto free;
                        }
 
                        if (n_vars == TRACING_MAP_VARS_MAX) {
-                               hist_err("Too many variables defined: ", var_name);
+                               hist_err(tr, HIST_ERR_TOO_MANY_VARS, errpos(var_name));
                                ret = -EINVAL;
                                goto free;
                        }
@@ -5431,11 +5477,6 @@ static int hist_show(struct seq_file *m, void *v)
                        hist_trigger_show(m, data, n++);
        }
 
-       if (have_hist_err()) {
-               seq_printf(m, "\nERROR: %s\n", hist_err_str);
-               seq_printf(m, "  Last command: %s\n", last_hist_cmd);
-       }
-
  out_unlock:
        mutex_unlock(&event_mutex);
 
@@ -5800,6 +5841,7 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
 {
        struct hist_trigger_data *hist_data = data->private_data;
        struct event_trigger_data *test, *named_data = NULL;
+       struct trace_array *tr = file->tr;
        int ret = 0;
 
        if (hist_data->attrs->name) {
@@ -5807,7 +5849,7 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
                if (named_data) {
                        if (!hist_trigger_match(data, named_data, named_data,
                                                true)) {
-                               hist_err("Named hist trigger doesn't match existing named trigger (includes variables): ", hist_data->attrs->name);
+                               hist_err(tr, HIST_ERR_NAMED_MISMATCH, errpos(hist_data->attrs->name));
                                ret = -EINVAL;
                                goto out;
                        }
@@ -5828,7 +5870,7 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
                        else if (hist_data->attrs->clear)
                                hist_clear(test);
                        else {
-                               hist_err("Hist trigger already exists", NULL);
+                               hist_err(tr, HIST_ERR_TRIGGER_EEXIST, 0);
                                ret = -EEXIST;
                        }
                        goto out;
@@ -5836,7 +5878,7 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
        }
  new:
        if (hist_data->attrs->cont || hist_data->attrs->clear) {
-               hist_err("Can't clear or continue a nonexistent hist trigger", NULL);
+               hist_err(tr, HIST_ERR_TRIGGER_ENOENT_CLEAR, 0);
                ret = -ENOENT;
                goto out;
        }
@@ -5861,7 +5903,7 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
 
                ret = tracing_set_clock(file->tr, hist_data->attrs->clock);
                if (ret) {
-                       hist_err("Couldn't set trace_clock: ", clock);
+                       hist_err(tr, HIST_ERR_SET_CLOCK_FAIL, errpos(clock));
                        goto out;
                }
 
@@ -6037,8 +6079,8 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
        lockdep_assert_held(&event_mutex);
 
        if (glob && strlen(glob)) {
-               last_cmd_set(param);
                hist_err_clear();
+               last_cmd_set(file, param);
        }
 
        if (!param)
@@ -6079,7 +6121,7 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
                trigger = strstrip(trigger);
        }
 
-       attrs = parse_hist_trigger_attrs(trigger);
+       attrs = parse_hist_trigger_attrs(file->tr, trigger);
        if (IS_ERR(attrs))
                return PTR_ERR(attrs);
 
index cd12ecb..2a2912c 100644 (file)
@@ -731,7 +731,8 @@ int set_trigger_filter(char *filter_str,
                goto out;
 
        /* The filter is for the 'trigger' event, not the triggered event */
-       ret = create_event_filter(file->event_call, filter_str, false, &filter);
+       ret = create_event_filter(file->tr, file->event_call,
+                                 filter_str, false, &filter);
        /*
         * If create_event_filter() fails, filter still needs to be freed.
         * Which the calling code will do with data->filter.
index 810d78a..6c1ae6b 100644 (file)
 #include "trace.h"
 #include "trace_output.h"
 
-static void ftrace_dump_buf(int skip_lines, long cpu_file)
+static struct trace_iterator iter;
+static struct ring_buffer_iter *buffer_iter[CONFIG_NR_CPUS];
+
+static void ftrace_dump_buf(int skip_entries, long cpu_file)
 {
-       /* use static because iter can be a bit big for the stack */
-       static struct trace_iterator iter;
-       static struct ring_buffer_iter *buffer_iter[CONFIG_NR_CPUS];
        struct trace_array *tr;
        unsigned int old_userobj;
        int cnt = 0, cpu;
 
-       trace_init_global_iter(&iter);
-       iter.buffer_iter = buffer_iter;
        tr = iter.tr;
 
-       for_each_tracing_cpu(cpu) {
-               atomic_inc(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
-       }
-
        old_userobj = tr->trace_flags;
 
        /* don't look at user memory in panic mode */
        tr->trace_flags &= ~TRACE_ITER_SYM_USEROBJ;
 
        kdb_printf("Dumping ftrace buffer:\n");
+       if (skip_entries)
+               kdb_printf("(skipping %d entries)\n", skip_entries);
 
        /* reset all but tr, trace, and overruns */
        memset(&iter.seq, 0,
@@ -70,11 +66,11 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file)
                        kdb_printf("---------------------------------\n");
                cnt++;
 
-               if (!skip_lines) {
+               if (!skip_entries) {
                        print_trace_line(&iter);
                        trace_printk_seq(&iter.seq);
                } else {
-                       skip_lines--;
+                       skip_entries--;
                }
 
                if (KDB_FLAG(CMD_INTERRUPT))
@@ -90,10 +86,6 @@ out:
        tr->trace_flags = old_userobj;
 
        for_each_tracing_cpu(cpu) {
-               atomic_dec(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
-       }
-
-       for_each_tracing_cpu(cpu) {
                if (iter.buffer_iter[cpu]) {
                        ring_buffer_read_finish(iter.buffer_iter[cpu]);
                        iter.buffer_iter[cpu] = NULL;
@@ -106,17 +98,19 @@ out:
  */
 static int kdb_ftdump(int argc, const char **argv)
 {
-       int skip_lines = 0;
+       int skip_entries = 0;
        long cpu_file;
        char *cp;
+       int cnt;
+       int cpu;
 
        if (argc > 2)
                return KDB_ARGCOUNT;
 
        if (argc) {
-               skip_lines = simple_strtol(argv[1], &cp, 0);
+               skip_entries = simple_strtol(argv[1], &cp, 0);
                if (*cp)
-                       skip_lines = 0;
+                       skip_entries = 0;
        }
 
        if (argc == 2) {
@@ -129,7 +123,29 @@ static int kdb_ftdump(int argc, const char **argv)
        }
 
        kdb_trap_printk++;
-       ftrace_dump_buf(skip_lines, cpu_file);
+
+       trace_init_global_iter(&iter);
+       iter.buffer_iter = buffer_iter;
+
+       for_each_tracing_cpu(cpu) {
+               atomic_inc(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
+       }
+
+       /* A negative skip_entries means skip all but the last entries */
+       if (skip_entries < 0) {
+               if (cpu_file == RING_BUFFER_ALL_CPUS)
+                       cnt = trace_total_entries(NULL);
+               else
+                       cnt = trace_total_entries_cpu(NULL, cpu_file);
+               skip_entries = max(cnt + skip_entries, 0);
+       }
+
+       ftrace_dump_buf(skip_entries, cpu_file);
+
+       for_each_tracing_cpu(cpu) {
+               atomic_dec(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled);
+       }
+
        kdb_trap_printk--;
 
        return 0;
@@ -137,8 +153,9 @@ static int kdb_ftdump(int argc, const char **argv)
 
 static __init int kdb_ftrace_register(void)
 {
-       kdb_register_flags("ftdump", kdb_ftdump, "[skip_#lines] [cpu]",
-                           "Dump ftrace log", 0, KDB_ENABLE_ALWAYS_SAFE);
+       kdb_register_flags("ftdump", kdb_ftdump, "[skip_#entries] [cpu]",
+                           "Dump ftrace log; -skip dumps last #entries", 0,
+                           KDB_ENABLE_ALWAYS_SAFE);
        return 0;
 }
 
index 5d5129b..7d73624 100644 (file)
@@ -441,13 +441,8 @@ static int __register_trace_kprobe(struct trace_kprobe *tk)
        else
                ret = register_kprobe(&tk->rp.kp);
 
-       if (ret == 0) {
+       if (ret == 0)
                tk->tp.flags |= TP_FLAG_REGISTERED;
-       } else if (ret == -EILSEQ) {
-               pr_warn("Probing address(0x%p) is not an instruction boundary.\n",
-                       tk->rp.kp.addr);
-               ret = -EINVAL;
-       }
        return ret;
 }
 
@@ -591,7 +586,7 @@ static int trace_kprobe_create(int argc, const char *argv[])
         * Type of args:
         *  FETCHARG:TYPE : use TYPE instead of unsigned long.
         */
-       struct trace_kprobe *tk;
+       struct trace_kprobe *tk = NULL;
        int i, len, ret = 0;
        bool is_return = false;
        char *symbol = NULL, *tmp = NULL;
@@ -615,44 +610,50 @@ static int trace_kprobe_create(int argc, const char *argv[])
        if (argc < 2)
                return -ECANCELED;
 
+       trace_probe_log_init("trace_kprobe", argc, argv);
+
        event = strchr(&argv[0][1], ':');
        if (event)
                event++;
 
        if (isdigit(argv[0][1])) {
                if (!is_return) {
-                       pr_info("Maxactive is not for kprobe");
-                       return -EINVAL;
+                       trace_probe_log_err(1, MAXACT_NO_KPROBE);
+                       goto parse_error;
                }
                if (event)
                        len = event - &argv[0][1] - 1;
                else
                        len = strlen(&argv[0][1]);
-               if (len > MAX_EVENT_NAME_LEN - 1)
-                       return -E2BIG;
+               if (len > MAX_EVENT_NAME_LEN - 1) {
+                       trace_probe_log_err(1, BAD_MAXACT);
+                       goto parse_error;
+               }
                memcpy(buf, &argv[0][1], len);
                buf[len] = '\0';
                ret = kstrtouint(buf, 0, &maxactive);
                if (ret || !maxactive) {
-                       pr_info("Invalid maxactive number\n");
-                       return ret;
+                       trace_probe_log_err(1, BAD_MAXACT);
+                       goto parse_error;
                }
                /* kretprobes instances are iterated over via a list. The
                 * maximum should stay reasonable.
                 */
                if (maxactive > KRETPROBE_MAXACTIVE_MAX) {
-                       pr_info("Maxactive is too big (%d > %d).\n",
-                               maxactive, KRETPROBE_MAXACTIVE_MAX);
-                       return -E2BIG;
+                       trace_probe_log_err(1, MAXACT_TOO_BIG);
+                       goto parse_error;
                }
        }
 
        /* try to parse an address. if that fails, try to read the
         * input as a symbol. */
        if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
+               trace_probe_log_set_index(1);
                /* Check whether uprobe event specified */
-               if (strchr(argv[1], '/') && strchr(argv[1], ':'))
-                       return -ECANCELED;
+               if (strchr(argv[1], '/') && strchr(argv[1], ':')) {
+                       ret = -ECANCELED;
+                       goto error;
+               }
                /* a symbol specified */
                symbol = kstrdup(argv[1], GFP_KERNEL);
                if (!symbol)
@@ -660,23 +661,23 @@ static int trace_kprobe_create(int argc, const char *argv[])
                /* TODO: support .init module functions */
                ret = traceprobe_split_symbol_offset(symbol, &offset);
                if (ret || offset < 0 || offset > UINT_MAX) {
-                       pr_info("Failed to parse either an address or a symbol.\n");
-                       goto out;
+                       trace_probe_log_err(0, BAD_PROBE_ADDR);
+                       goto parse_error;
                }
                if (kprobe_on_func_entry(NULL, symbol, offset))
                        flags |= TPARG_FL_FENTRY;
                if (offset && is_return && !(flags & TPARG_FL_FENTRY)) {
-                       pr_info("Given offset is not valid for return probe.\n");
-                       ret = -EINVAL;
-                       goto out;
+                       trace_probe_log_err(0, BAD_RETPROBE);
+                       goto parse_error;
                }
        }
-       argc -= 2; argv += 2;
 
+       trace_probe_log_set_index(0);
        if (event) {
-               ret = traceprobe_parse_event_name(&event, &group, buf);
+               ret = traceprobe_parse_event_name(&event, &group, buf,
+                                                 event - argv[0]);
                if (ret)
-                       goto out;
+                       goto parse_error;
        } else {
                /* Make a new event name */
                if (symbol)
@@ -691,13 +692,14 @@ static int trace_kprobe_create(int argc, const char *argv[])
 
        /* setup a probe */
        tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
-                              argc, is_return);
+                              argc - 2, is_return);
        if (IS_ERR(tk)) {
                ret = PTR_ERR(tk);
-               /* This must return -ENOMEM otherwise there is a bug */
+               /* This must return -ENOMEM, else there is a bug */
                WARN_ON_ONCE(ret != -ENOMEM);
-               goto out;
+               goto out;       /* We know tk is not allocated */
        }
+       argc -= 2; argv += 2;
 
        /* parse arguments */
        for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
@@ -707,19 +709,32 @@ static int trace_kprobe_create(int argc, const char *argv[])
                        goto error;
                }
 
+               trace_probe_log_set_index(i + 2);
                ret = traceprobe_parse_probe_arg(&tk->tp, i, tmp, flags);
                kfree(tmp);
                if (ret)
-                       goto error;
+                       goto error;     /* This can be -ENOMEM */
        }
 
        ret = register_trace_kprobe(tk);
-       if (ret)
+       if (ret) {
+               trace_probe_log_set_index(1);
+               if (ret == -EILSEQ)
+                       trace_probe_log_err(0, BAD_INSN_BNDRY);
+               else if (ret == -ENOENT)
+                       trace_probe_log_err(0, BAD_PROBE_ADDR);
+               else if (ret != -ENOMEM)
+                       trace_probe_log_err(0, FAIL_REG_PROBE);
                goto error;
+       }
+
 out:
+       trace_probe_log_clear();
        kfree(symbol);
        return ret;
 
+parse_error:
+       ret = -EINVAL;
 error:
        free_trace_kprobe(tk);
        goto out;
index 8f8411e..a347fac 100644 (file)
 
 #include "trace_probe.h"
 
+#undef C
+#define C(a, b)                b
+
+static const char *trace_probe_err_text[] = { ERRORS };
+
 static const char *reserved_field_names[] = {
        "common_type",
        "common_flags",
@@ -133,6 +138,60 @@ fail:
        return NULL;
 }
 
+static struct trace_probe_log trace_probe_log;
+
+void trace_probe_log_init(const char *subsystem, int argc, const char **argv)
+{
+       trace_probe_log.subsystem = subsystem;
+       trace_probe_log.argc = argc;
+       trace_probe_log.argv = argv;
+       trace_probe_log.index = 0;
+}
+
+void trace_probe_log_clear(void)
+{
+       memset(&trace_probe_log, 0, sizeof(trace_probe_log));
+}
+
+void trace_probe_log_set_index(int index)
+{
+       trace_probe_log.index = index;
+}
+
+void __trace_probe_log_err(int offset, int err_type)
+{
+       char *command, *p;
+       int i, len = 0, pos = 0;
+
+       if (!trace_probe_log.argv)
+               return;
+
+       /* Recalcurate the length and allocate buffer */
+       for (i = 0; i < trace_probe_log.argc; i++) {
+               if (i == trace_probe_log.index)
+                       pos = len;
+               len += strlen(trace_probe_log.argv[i]) + 1;
+       }
+       command = kzalloc(len, GFP_KERNEL);
+       if (!command)
+               return;
+
+       /* And make a command string from argv array */
+       p = command;
+       for (i = 0; i < trace_probe_log.argc; i++) {
+               len = strlen(trace_probe_log.argv[i]);
+               strcpy(p, trace_probe_log.argv[i]);
+               p[len] = ' ';
+               p += len + 1;
+       }
+       *(p - 1) = '\0';
+
+       tracing_log_err(NULL, trace_probe_log.subsystem, command,
+                       trace_probe_err_text, err_type, pos + offset);
+
+       kfree(command);
+}
+
 /* Split symbol and offset. */
 int traceprobe_split_symbol_offset(char *symbol, long *offset)
 {
@@ -156,7 +215,7 @@ int traceprobe_split_symbol_offset(char *symbol, long *offset)
 
 /* @buf must has MAX_EVENT_NAME_LEN size */
 int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
-                               char *buf)
+                               char *buf, int offset)
 {
        const char *slash, *event = *pevent;
        int len;
@@ -164,32 +223,33 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
        slash = strchr(event, '/');
        if (slash) {
                if (slash == event) {
-                       pr_info("Group name is not specified\n");
+                       trace_probe_log_err(offset, NO_GROUP_NAME);
                        return -EINVAL;
                }
                if (slash - event + 1 > MAX_EVENT_NAME_LEN) {
-                       pr_info("Group name is too long\n");
-                       return -E2BIG;
+                       trace_probe_log_err(offset, GROUP_TOO_LONG);
+                       return -EINVAL;
                }
                strlcpy(buf, event, slash - event + 1);
                if (!is_good_name(buf)) {
-                       pr_info("Group name must follow the same rules as C identifiers\n");
+                       trace_probe_log_err(offset, BAD_GROUP_NAME);
                        return -EINVAL;
                }
                *pgroup = buf;
                *pevent = slash + 1;
+               offset += slash - event + 1;
                event = *pevent;
        }
        len = strlen(event);
        if (len == 0) {
-               pr_info("Event name is not specified\n");
+               trace_probe_log_err(offset, NO_EVENT_NAME);
                return -EINVAL;
        } else if (len > MAX_EVENT_NAME_LEN) {
-               pr_info("Event name is too long\n");
-               return -E2BIG;
+               trace_probe_log_err(offset, EVENT_TOO_LONG);
+               return -EINVAL;
        }
        if (!is_good_name(event)) {
-               pr_info("Event name must follow the same rules as C identifiers\n");
+               trace_probe_log_err(offset, BAD_EVENT_NAME);
                return -EINVAL;
        }
        return 0;
@@ -198,56 +258,67 @@ int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
 #define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
 
 static int parse_probe_vars(char *arg, const struct fetch_type *t,
-                           struct fetch_insn *code, unsigned int flags)
+                       struct fetch_insn *code, unsigned int flags, int offs)
 {
        unsigned long param;
        int ret = 0;
        int len;
 
        if (strcmp(arg, "retval") == 0) {
-               if (flags & TPARG_FL_RETURN)
+               if (flags & TPARG_FL_RETURN) {
                        code->op = FETCH_OP_RETVAL;
-               else
+               } else {
+                       trace_probe_log_err(offs, RETVAL_ON_PROBE);
                        ret = -EINVAL;
+               }
        } else if ((len = str_has_prefix(arg, "stack"))) {
                if (arg[len] == '\0') {
                        code->op = FETCH_OP_STACKP;
                } else if (isdigit(arg[len])) {
                        ret = kstrtoul(arg + len, 10, &param);
-                       if (ret || ((flags & TPARG_FL_KERNEL) &&
-                                   param > PARAM_MAX_STACK))
+                       if (ret) {
+                               goto inval_var;
+                       } else if ((flags & TPARG_FL_KERNEL) &&
+                                   param > PARAM_MAX_STACK) {
+                               trace_probe_log_err(offs, BAD_STACK_NUM);
                                ret = -EINVAL;
-                       else {
+                       else {
                                code->op = FETCH_OP_STACK;
                                code->param = (unsigned int)param;
                        }
                } else
-                       ret = -EINVAL;
+                       goto inval_var;
        } else if (strcmp(arg, "comm") == 0) {
                code->op = FETCH_OP_COMM;
 #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API
        } else if (((flags & TPARG_FL_MASK) ==
                    (TPARG_FL_KERNEL | TPARG_FL_FENTRY)) &&
                   (len = str_has_prefix(arg, "arg"))) {
-               if (!isdigit(arg[len]))
-                       return -EINVAL;
                ret = kstrtoul(arg + len, 10, &param);
-               if (ret || !param || param > PARAM_MAX_STACK)
+               if (ret) {
+                       goto inval_var;
+               } else if (!param || param > PARAM_MAX_STACK) {
+                       trace_probe_log_err(offs, BAD_ARG_NUM);
                        return -EINVAL;
+               }
                code->op = FETCH_OP_ARG;
                code->param = (unsigned int)param - 1;
 #endif
        } else
-               ret = -EINVAL;
+               goto inval_var;
 
        return ret;
+
+inval_var:
+       trace_probe_log_err(offs, BAD_VAR);
+       return -EINVAL;
 }
 
 /* Recursive argument parser */
 static int
 parse_probe_arg(char *arg, const struct fetch_type *type,
                struct fetch_insn **pcode, struct fetch_insn *end,
-               unsigned int flags)
+               unsigned int flags, int offs)
 {
        struct fetch_insn *code = *pcode;
        unsigned long param;
@@ -257,7 +328,7 @@ parse_probe_arg(char *arg, const struct fetch_type *type,
 
        switch (arg[0]) {
        case '$':
-               ret = parse_probe_vars(arg + 1, type, code, flags);
+               ret = parse_probe_vars(arg + 1, type, code, flags, offs);
                break;
 
        case '%':       /* named register */
@@ -266,47 +337,57 @@ parse_probe_arg(char *arg, const struct fetch_type *type,
                        code->op = FETCH_OP_REG;
                        code->param = (unsigned int)ret;
                        ret = 0;
-               }
+               } else
+                       trace_probe_log_err(offs, BAD_REG_NAME);
                break;
 
        case '@':       /* memory, file-offset or symbol */
                if (isdigit(arg[1])) {
                        ret = kstrtoul(arg + 1, 0, &param);
-                       if (ret)
+                       if (ret) {
+                               trace_probe_log_err(offs, BAD_MEM_ADDR);
                                break;
+                       }
                        /* load address */
                        code->op = FETCH_OP_IMM;
                        code->immediate = param;
                } else if (arg[1] == '+') {
                        /* kprobes don't support file offsets */
-                       if (flags & TPARG_FL_KERNEL)
+                       if (flags & TPARG_FL_KERNEL) {
+                               trace_probe_log_err(offs, FILE_ON_KPROBE);
                                return -EINVAL;
-
+                       }
                        ret = kstrtol(arg + 2, 0, &offset);
-                       if (ret)
+                       if (ret) {
+                               trace_probe_log_err(offs, BAD_FILE_OFFS);
                                break;
+                       }
 
                        code->op = FETCH_OP_FOFFS;
                        code->immediate = (unsigned long)offset;  // imm64?
                } else {
                        /* uprobes don't support symbols */
-                       if (!(flags & TPARG_FL_KERNEL))
+                       if (!(flags & TPARG_FL_KERNEL)) {
+                               trace_probe_log_err(offs, SYM_ON_UPROBE);
                                return -EINVAL;
-
+                       }
                        /* Preserve symbol for updating */
                        code->op = FETCH_NOP_SYMBOL;
                        code->data = kstrdup(arg + 1, GFP_KERNEL);
                        if (!code->data)
                                return -ENOMEM;
-                       if (++code == end)
-                               return -E2BIG;
-
+                       if (++code == end) {
+                               trace_probe_log_err(offs, TOO_MANY_OPS);
+                               return -EINVAL;
+                       }
                        code->op = FETCH_OP_IMM;
                        code->immediate = 0;
                }
                /* These are fetching from memory */
-               if (++code == end)
-                       return -E2BIG;
+               if (++code == end) {
+                       trace_probe_log_err(offs, TOO_MANY_OPS);
+                       return -EINVAL;
+               }
                *pcode = code;
                code->op = FETCH_OP_DEREF;
                code->offset = offset;
@@ -317,28 +398,38 @@ parse_probe_arg(char *arg, const struct fetch_type *type,
                /* fall through */
        case '-':
                tmp = strchr(arg, '(');
-               if (!tmp)
+               if (!tmp) {
+                       trace_probe_log_err(offs, DEREF_NEED_BRACE);
                        return -EINVAL;
-
+               }
                *tmp = '\0';
                ret = kstrtol(arg, 0, &offset);
-               if (ret)
+               if (ret) {
+                       trace_probe_log_err(offs, BAD_DEREF_OFFS);
                        break;
-
+               }
+               offs += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);
                arg = tmp + 1;
                tmp = strrchr(arg, ')');
-
-               if (tmp) {
+               if (!tmp) {
+                       trace_probe_log_err(offs + strlen(arg),
+                                           DEREF_OPEN_BRACE);
+                       return -EINVAL;
+               } else {
                        const struct fetch_type *t2 = find_fetch_type(NULL);
 
                        *tmp = '\0';
-                       ret = parse_probe_arg(arg, t2, &code, end, flags);
+                       ret = parse_probe_arg(arg, t2, &code, end, flags, offs);
                        if (ret)
                                break;
-                       if (code->op == FETCH_OP_COMM)
+                       if (code->op == FETCH_OP_COMM) {
+                               trace_probe_log_err(offs, COMM_CANT_DEREF);
                                return -EINVAL;
-                       if (++code == end)
-                               return -E2BIG;
+                       }
+                       if (++code == end) {
+                               trace_probe_log_err(offs, TOO_MANY_OPS);
+                               return -EINVAL;
+                       }
                        *pcode = code;
 
                        code->op = FETCH_OP_DEREF;
@@ -348,6 +439,7 @@ parse_probe_arg(char *arg, const struct fetch_type *type,
        }
        if (!ret && code->op == FETCH_OP_NOP) {
                /* Parsed, but do not find fetch method */
+               trace_probe_log_err(offs, BAD_FETCH_ARG);
                ret = -EINVAL;
        }
        return ret;
@@ -379,7 +471,7 @@ static int __parse_bitfield_probe_arg(const char *bf,
                return -EINVAL;
        code++;
        if (code->op != FETCH_OP_NOP)
-               return -E2BIG;
+               return -EINVAL;
        *pcode = code;
 
        code->op = FETCH_OP_MOD_BF;
@@ -392,44 +484,66 @@ static int __parse_bitfield_probe_arg(const char *bf,
 
 /* String length checking wrapper */
 static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
-               struct probe_arg *parg, unsigned int flags)
+               struct probe_arg *parg, unsigned int flags, int offset)
 {
        struct fetch_insn *code, *scode, *tmp = NULL;
-       char *t, *t2;
+       char *t, *t2, *t3;
        int ret, len;
 
-       if (strlen(arg) > MAX_ARGSTR_LEN) {
-               pr_info("Argument is too long.: %s\n",  arg);
-               return -ENOSPC;
+       len = strlen(arg);
+       if (len > MAX_ARGSTR_LEN) {
+               trace_probe_log_err(offset, ARG_TOO_LONG);
+               return -EINVAL;
+       } else if (len == 0) {
+               trace_probe_log_err(offset, NO_ARG_BODY);
+               return -EINVAL;
        }
+
        parg->comm = kstrdup(arg, GFP_KERNEL);
-       if (!parg->comm) {
-               pr_info("Failed to allocate memory for command '%s'.\n", arg);
+       if (!parg->comm)
                return -ENOMEM;
-       }
+
        t = strchr(arg, ':');
        if (t) {
                *t = '\0';
                t2 = strchr(++t, '[');
                if (t2) {
-                       *t2 = '\0';
-                       parg->count = simple_strtoul(t2 + 1, &t2, 0);
-                       if (strcmp(t2, "]") || parg->count == 0)
+                       *t2++ = '\0';
+                       t3 = strchr(t2, ']');
+                       if (!t3) {
+                               offset += t2 + strlen(t2) - arg;
+                               trace_probe_log_err(offset,
+                                                   ARRAY_NO_CLOSE);
+                               return -EINVAL;
+                       } else if (t3[1] != '\0') {
+                               trace_probe_log_err(offset + t3 + 1 - arg,
+                                                   BAD_ARRAY_SUFFIX);
                                return -EINVAL;
-                       if (parg->count > MAX_ARRAY_LEN)
-                               return -E2BIG;
+                       }
+                       *t3 = '\0';
+                       if (kstrtouint(t2, 0, &parg->count) || !parg->count) {
+                               trace_probe_log_err(offset + t2 - arg,
+                                                   BAD_ARRAY_NUM);
+                               return -EINVAL;
+                       }
+                       if (parg->count > MAX_ARRAY_LEN) {
+                               trace_probe_log_err(offset + t2 - arg,
+                                                   ARRAY_TOO_BIG);
+                               return -EINVAL;
+                       }
                }
        }
-       /*
-        * The default type of $comm should be "string", and it can't be
-        * dereferenced.
-        */
-       if (!t && strcmp(arg, "$comm") == 0)
+
+       /* Since $comm can not be dereferred, we can find $comm by strcmp */
+       if (strcmp(arg, "$comm") == 0) {
+               /* The type of $comm must be "string", and not an array. */
+               if (parg->count || (t && strcmp(t, "string")))
+                       return -EINVAL;
                parg->type = find_fetch_type("string");
-       else
+       else
                parg->type = find_fetch_type(t);
        if (!parg->type) {
-               pr_info("Unsupported type: %s\n", t);
+               trace_probe_log_err(offset + (t ? (t - arg) : 0), BAD_TYPE);
                return -EINVAL;
        }
        parg->offset = *size;
@@ -444,13 +558,13 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
                         parg->count);
        }
 
-       code = tmp = kzalloc(sizeof(*code) * FETCH_INSN_MAX, GFP_KERNEL);
+       code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL);
        if (!code)
                return -ENOMEM;
        code[FETCH_INSN_MAX - 1].op = FETCH_OP_END;
 
        ret = parse_probe_arg(arg, parg->type, &code, &code[FETCH_INSN_MAX - 1],
-                             flags);
+                             flags, offset);
        if (ret)
                goto fail;
 
@@ -458,7 +572,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
        if (!strcmp(parg->type->name, "string")) {
                if (code->op != FETCH_OP_DEREF && code->op != FETCH_OP_IMM &&
                    code->op != FETCH_OP_COMM) {
-                       pr_info("string only accepts memory or address.\n");
+                       trace_probe_log_err(offset + (t ? (t - arg) : 0),
+                                           BAD_STRING);
                        ret = -EINVAL;
                        goto fail;
                }
@@ -470,7 +585,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
                         */
                        code++;
                        if (code->op != FETCH_OP_NOP) {
-                               ret = -E2BIG;
+                               trace_probe_log_err(offset, TOO_MANY_OPS);
+                               ret = -EINVAL;
                                goto fail;
                        }
                }
@@ -483,7 +599,8 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
        } else {
                code++;
                if (code->op != FETCH_OP_NOP) {
-                       ret = -E2BIG;
+                       trace_probe_log_err(offset, TOO_MANY_OPS);
+                       ret = -EINVAL;
                        goto fail;
                }
                code->op = FETCH_OP_ST_RAW;
@@ -493,20 +610,24 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
        /* Modify operation */
        if (t != NULL) {
                ret = __parse_bitfield_probe_arg(t, parg->type, &code);
-               if (ret)
+               if (ret) {
+                       trace_probe_log_err(offset + t - arg, BAD_BITFIELD);
                        goto fail;
+               }
        }
        /* Loop(Array) operation */
        if (parg->count) {
                if (scode->op != FETCH_OP_ST_MEM &&
                    scode->op != FETCH_OP_ST_STRING) {
-                       pr_info("array only accepts memory or address\n");
+                       trace_probe_log_err(offset + (t ? (t - arg) : 0),
+                                           BAD_STRING);
                        ret = -EINVAL;
                        goto fail;
                }
                code++;
                if (code->op != FETCH_OP_NOP) {
-                       ret = -E2BIG;
+                       trace_probe_log_err(offset, TOO_MANY_OPS);
+                       ret = -EINVAL;
                        goto fail;
                }
                code->op = FETCH_OP_LP_ARRAY;
@@ -516,7 +637,7 @@ static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size,
        code->op = FETCH_OP_END;
 
        /* Shrink down the code buffer */
-       parg->code = kzalloc(sizeof(*code) * (code - tmp + 1), GFP_KERNEL);
+       parg->code = kcalloc(code - tmp + 1, sizeof(*code), GFP_KERNEL);
        if (!parg->code)
                ret = -ENOMEM;
        else
@@ -555,15 +676,19 @@ int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, char *arg,
 {
        struct probe_arg *parg = &tp->args[i];
        char *body;
-       int ret;
 
        /* Increment count for freeing args in error case */
        tp->nr_args++;
 
        body = strchr(arg, '=');
        if (body) {
-               if (body - arg > MAX_ARG_NAME_LEN || body == arg)
+               if (body - arg > MAX_ARG_NAME_LEN) {
+                       trace_probe_log_err(0, ARG_NAME_TOO_LONG);
+                       return -EINVAL;
+               } else if (body == arg) {
+                       trace_probe_log_err(0, NO_ARG_NAME);
                        return -EINVAL;
+               }
                parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL);
                body++;
        } else {
@@ -575,22 +700,16 @@ int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, char *arg,
                return -ENOMEM;
 
        if (!is_good_name(parg->name)) {
-               pr_info("Invalid argument[%d] name: %s\n",
-                       i, parg->name);
+               trace_probe_log_err(0, BAD_ARG_NAME);
                return -EINVAL;
        }
-
        if (traceprobe_conflict_field_name(parg->name, tp->args, i)) {
-               pr_info("Argument[%d]: '%s' conflicts with another field.\n",
-                       i, parg->name);
+               trace_probe_log_err(0, USED_ARG_NAME);
                return -EINVAL;
        }
-
        /* Parse fetch argument */
-       ret = traceprobe_parse_probe_arg_body(body, &tp->size, parg, flags);
-       if (ret)
-               pr_info("Parse error at argument[%d]. (%d)\n", i, ret);
-       return ret;
+       return traceprobe_parse_probe_arg_body(body, &tp->size, parg, flags,
+                                              body - arg);
 }
 
 void traceprobe_free_probe_arg(struct probe_arg *arg)
index 2177c20..f9a8c63 100644 (file)
@@ -124,6 +124,7 @@ struct fetch_insn {
 
 /* fetch + deref*N + store + mod + end <= 16, this allows N=12, enough */
 #define FETCH_INSN_MAX 16
+#define FETCH_TOKEN_COMM       (-ECOMM)
 
 /* Fetch type information table */
 struct fetch_type {
@@ -280,8 +281,8 @@ extern int traceprobe_update_arg(struct probe_arg *arg);
 extern void traceprobe_free_probe_arg(struct probe_arg *arg);
 
 extern int traceprobe_split_symbol_offset(char *symbol, long *offset);
-extern int traceprobe_parse_event_name(const char **pevent,
-                                      const char **pgroup, char *buf);
+int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
+                               char *buf, int offset);
 
 extern int traceprobe_set_print_fmt(struct trace_probe *tp, bool is_return);
 
@@ -298,3 +299,76 @@ extern void destroy_local_trace_uprobe(struct trace_event_call *event_call);
 #endif
 extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
                                        size_t offset, struct trace_probe *tp);
+
+#undef ERRORS
+#define ERRORS \
+       C(FILE_NOT_FOUND,       "Failed to find the given file"),       \
+       C(NO_REGULAR_FILE,      "Not a regular file"),                  \
+       C(BAD_REFCNT,           "Invalid reference counter offset"),    \
+       C(REFCNT_OPEN_BRACE,    "Reference counter brace is not closed"), \
+       C(BAD_REFCNT_SUFFIX,    "Reference counter has wrong suffix"),  \
+       C(BAD_UPROBE_OFFS,      "Invalid uprobe offset"),               \
+       C(MAXACT_NO_KPROBE,     "Maxactive is not for kprobe"),         \
+       C(BAD_MAXACT,           "Invalid maxactive number"),            \
+       C(MAXACT_TOO_BIG,       "Maxactive is too big"),                \
+       C(BAD_PROBE_ADDR,       "Invalid probed address or symbol"),    \
+       C(BAD_RETPROBE,         "Retprobe address must be an function entry"), \
+       C(NO_GROUP_NAME,        "Group name is not specified"),         \
+       C(GROUP_TOO_LONG,       "Group name is too long"),              \
+       C(BAD_GROUP_NAME,       "Group name must follow the same rules as C identifiers"), \
+       C(NO_EVENT_NAME,        "Event name is not specified"),         \
+       C(EVENT_TOO_LONG,       "Event name is too long"),              \
+       C(BAD_EVENT_NAME,       "Event name must follow the same rules as C identifiers"), \
+       C(RETVAL_ON_PROBE,      "$retval is not available on probe"),   \
+       C(BAD_STACK_NUM,        "Invalid stack number"),                \
+       C(BAD_ARG_NUM,          "Invalid argument number"),             \
+       C(BAD_VAR,              "Invalid $-valiable specified"),        \
+       C(BAD_REG_NAME,         "Invalid register name"),               \
+       C(BAD_MEM_ADDR,         "Invalid memory address"),              \
+       C(FILE_ON_KPROBE,       "File offset is not available with kprobe"), \
+       C(BAD_FILE_OFFS,        "Invalid file offset value"),           \
+       C(SYM_ON_UPROBE,        "Symbol is not available with uprobe"), \
+       C(TOO_MANY_OPS,         "Dereference is too much nested"),      \
+       C(DEREF_NEED_BRACE,     "Dereference needs a brace"),           \
+       C(BAD_DEREF_OFFS,       "Invalid dereference offset"),          \
+       C(DEREF_OPEN_BRACE,     "Dereference brace is not closed"),     \
+       C(COMM_CANT_DEREF,      "$comm can not be dereferenced"),       \
+       C(BAD_FETCH_ARG,        "Invalid fetch argument"),              \
+       C(ARRAY_NO_CLOSE,       "Array is not closed"),                 \
+       C(BAD_ARRAY_SUFFIX,     "Array has wrong suffix"),              \
+       C(BAD_ARRAY_NUM,        "Invalid array size"),                  \
+       C(ARRAY_TOO_BIG,        "Array number is too big"),             \
+       C(BAD_TYPE,             "Unknown type is specified"),           \
+       C(BAD_STRING,           "String accepts only memory argument"), \
+       C(BAD_BITFIELD,         "Invalid bitfield"),                    \
+       C(ARG_NAME_TOO_LONG,    "Argument name is too long"),           \
+       C(NO_ARG_NAME,          "Argument name is not specified"),      \
+       C(BAD_ARG_NAME,         "Argument name must follow the same rules as C identifiers"), \
+       C(USED_ARG_NAME,        "This argument name is already used"),  \
+       C(ARG_TOO_LONG,         "Argument expression is too long"),     \
+       C(NO_ARG_BODY,          "No argument expression"),              \
+       C(BAD_INSN_BNDRY,       "Probe point is not an instruction boundary"),\
+       C(FAIL_REG_PROBE,       "Failed to register probe event"),
+
+#undef C
+#define C(a, b)                TP_ERR_##a
+
+/* Define TP_ERR_ */
+enum { ERRORS };
+
+/* Error text is defined in trace_probe.c */
+
+struct trace_probe_log {
+       const char      *subsystem;
+       const char      **argv;
+       int             argc;
+       int             index;
+};
+
+void trace_probe_log_init(const char *subsystem, int argc, const char **argv);
+void trace_probe_log_set_index(int index);
+void trace_probe_log_clear(void);
+void __trace_probe_log_err(int offset, int err);
+
+#define trace_probe_log_err(offs, err) \
+       __trace_probe_log_err(offs, TP_ERR_##err)
index 4737bb8..c30c61f 100644 (file)
@@ -88,7 +88,7 @@ stage3:
        /* 3rd stage: store value to buffer */
        if (unlikely(!dest)) {
                if (code->op == FETCH_OP_ST_STRING) {
-                       ret += fetch_store_strlen(val + code->offset);
+                       ret = fetch_store_strlen(val + code->offset);
                        code++;
                        goto array;
                } else
index 9d402e7..69ee8ef 100644 (file)
@@ -792,7 +792,10 @@ trace_selftest_startup_function_graph(struct tracer *trace,
        /* check the trace buffer */
        ret = trace_test_buffer(&tr->trace_buffer, &count);
 
-       trace->reset(tr);
+       /* Need to also simulate the tr->reset to remove this fgraph_ops */
+       tracing_stop_cmdline_record();
+       unregister_ftrace_graph(&fgraph_ops);
+
        tracing_start();
 
        if (!ret && !count) {
index be78d99..eb7e06b 100644 (file)
@@ -156,7 +156,10 @@ fetch_store_string(unsigned long addr, void *dest, void *base)
        if (unlikely(!maxlen))
                return -ENOMEM;
 
-       ret = strncpy_from_user(dst, src, maxlen);
+       if (addr == FETCH_TOKEN_COMM)
+               ret = strlcpy(dst, current->comm, maxlen);
+       else
+               ret = strncpy_from_user(dst, src, maxlen);
        if (ret >= 0) {
                if (ret == maxlen)
                        dst[ret - 1] = '\0';
@@ -180,7 +183,10 @@ fetch_store_strlen(unsigned long addr)
        int len;
        void __user *vaddr = (void __force __user *) addr;
 
-       len = strnlen_user(vaddr, MAX_STRING_SIZE);
+       if (addr == FETCH_TOKEN_COMM)
+               len = strlen(current->comm) + 1;
+       else
+               len = strnlen_user(vaddr, MAX_STRING_SIZE);
 
        return (len > MAX_STRING_SIZE) ? 0 : len;
 }
@@ -220,6 +226,9 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest,
        case FETCH_OP_IMM:
                val = code->immediate;
                break;
+       case FETCH_OP_COMM:
+               val = FETCH_TOKEN_COMM;
+               break;
        case FETCH_OP_FOFFS:
                val = translate_user_vaddr(code->immediate);
                break;
@@ -457,13 +466,19 @@ static int trace_uprobe_create(int argc, const char **argv)
                return -ECANCELED;
        }
 
+       trace_probe_log_init("trace_uprobe", argc, argv);
+       trace_probe_log_set_index(1);   /* filename is the 2nd argument */
+
        *arg++ = '\0';
        ret = kern_path(filename, LOOKUP_FOLLOW, &path);
        if (ret) {
+               trace_probe_log_err(0, FILE_NOT_FOUND);
                kfree(filename);
+               trace_probe_log_clear();
                return ret;
        }
        if (!d_is_reg(path.dentry)) {
+               trace_probe_log_err(0, NO_REGULAR_FILE);
                ret = -EINVAL;
                goto fail_address_parse;
        }
@@ -472,9 +487,16 @@ static int trace_uprobe_create(int argc, const char **argv)
        rctr = strchr(arg, '(');
        if (rctr) {
                rctr_end = strchr(rctr, ')');
-               if (rctr > rctr_end || *(rctr_end + 1) != 0) {
+               if (!rctr_end) {
+                       ret = -EINVAL;
+                       rctr_end = rctr + strlen(rctr);
+                       trace_probe_log_err(rctr_end - filename,
+                                           REFCNT_OPEN_BRACE);
+                       goto fail_address_parse;
+               } else if (rctr_end[1] != '\0') {
                        ret = -EINVAL;
-                       pr_info("Invalid reference counter offset.\n");
+                       trace_probe_log_err(rctr_end + 1 - filename,
+                                           BAD_REFCNT_SUFFIX);
                        goto fail_address_parse;
                }
 
@@ -482,22 +504,23 @@ static int trace_uprobe_create(int argc, const char **argv)
                *rctr_end = '\0';
                ret = kstrtoul(rctr, 0, &ref_ctr_offset);
                if (ret) {
-                       pr_info("Invalid reference counter offset.\n");
+                       trace_probe_log_err(rctr - filename, BAD_REFCNT);
                        goto fail_address_parse;
                }
        }
 
        /* Parse uprobe offset. */
        ret = kstrtoul(arg, 0, &offset);
-       if (ret)
+       if (ret) {
+               trace_probe_log_err(arg - filename, BAD_UPROBE_OFFS);
                goto fail_address_parse;
-
-       argc -= 2;
-       argv += 2;
+       }
 
        /* setup a probe */
+       trace_probe_log_set_index(0);
        if (event) {
-               ret = traceprobe_parse_event_name(&event, &group, buf);
+               ret = traceprobe_parse_event_name(&event, &group, buf,
+                                                 event - argv[0]);
                if (ret)
                        goto fail_address_parse;
        } else {
@@ -519,6 +542,9 @@ static int trace_uprobe_create(int argc, const char **argv)
                kfree(tail);
        }
 
+       argc -= 2;
+       argv += 2;
+
        tu = alloc_trace_uprobe(group, event, argc, is_return);
        if (IS_ERR(tu)) {
                ret = PTR_ERR(tu);
@@ -539,6 +565,7 @@ static int trace_uprobe_create(int argc, const char **argv)
                        goto error;
                }
 
+               trace_probe_log_set_index(i + 2);
                ret = traceprobe_parse_probe_arg(&tu->tp, i, tmp,
                                        is_return ? TPARG_FL_RETURN : 0);
                kfree(tmp);
@@ -547,20 +574,20 @@ static int trace_uprobe_create(int argc, const char **argv)
        }
 
        ret = register_trace_uprobe(tu);
-       if (ret)
-               goto error;
-       return 0;
+       if (!ret)
+               goto out;
 
 error:
        free_trace_uprobe(tu);
+out:
+       trace_probe_log_clear();
        return ret;
 
 fail_address_parse:
+       trace_probe_log_clear();
        path_put(&path);
        kfree(filename);
 
-       pr_info("Failed to parse address or file.\n");
-
        return ret;
 }
 
index d937cba..7f255b5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * umh - the kernel usermode helper
  */
index ff536f9..483c996 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Uniprocessor-only support functions.  The counterpart to kernel/smp.c
  */
index 9586b67..870ecd7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/user-return-notifier.h>
 #include <linux/percpu.h>
index 0df9b16..78b17e3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * The "user cache".
  *
@@ -185,7 +186,7 @@ struct user_struct *alloc_uid(kuid_t uid)
        if (!up) {
                new = kmem_cache_zalloc(uid_cachep, GFP_KERNEL);
                if (!new)
-                       goto out_unlock;
+                       return NULL;
 
                new->uid = uid;
                refcount_set(&new->__count, 1);
@@ -199,8 +200,6 @@ struct user_struct *alloc_uid(kuid_t uid)
                spin_lock_irq(&uidhash_lock);
                up = uid_hash_find(uid, hashent);
                if (up) {
-                       key_put(new->uid_keyring);
-                       key_put(new->session_keyring);
                        kmem_cache_free(uid_cachep, new);
                } else {
                        uid_hash_insert(new, hashent);
@@ -210,9 +209,6 @@ struct user_struct *alloc_uid(kuid_t uid)
        }
 
        return up;
-
-out_unlock:
-       return NULL;
 }
 
 static int __init uid_cache_init(void)
index 9657315..95aea04 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kernel/workqueue.c - generic async execution with shared worker pool
  *
index 5d24c0b..6f7aad2 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_842_COMPRESS) += 842_compress.o
 obj-$(CONFIG_842_DECOMPRESS) += 842_decompress.o
index f323b85..90623a0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Library configuration
 #
@@ -46,9 +47,6 @@ config HAVE_ARCH_BITREVERSE
          This option enables the use of hardware bit-reversal instructions on
          architectures which support such operations.
 
-config RATIONAL
-       bool
-
 config GENERIC_STRNCPY_FROM_USER
        bool
 
@@ -61,6 +59,8 @@ config GENERIC_NET_UTILS
 config GENERIC_FIND_FIRST_BIT
        bool
 
+source "lib/math/Kconfig"
+
 config NO_GENERIC_PCI_IOPORT_MAP
        bool
 
@@ -531,12 +531,6 @@ config LRU_CACHE
 config CLZ_TAB
        bool
 
-config CORDIC
-       tristate "CORDIC algorithm"
-       help
-         This option provides an implementation of the CORDIC algorithm;
-         calculations are in fixed point. Module will be called cordic.
-
 config DDR
        bool "JEDEC DDR data"
        help
@@ -608,6 +602,10 @@ config ARCH_NO_SG_CHAIN
 config ARCH_HAS_PMEM_API
        bool
 
+# use memcpy to implement user copies for nommu architectures
+config UACCESS_MEMCPY
+       bool
+
 config ARCH_HAS_UACCESS_FLUSHCACHE
        bool
 
@@ -628,9 +626,6 @@ config SBITMAP
 config PARMAN
        tristate "parman" if COMPILE_TEST
 
-config PRIME_NUMBERS
-       tristate
-
 config STRING_SELFTEST
        tristate "Test string functions"
 
index d695ec1..cbdfae3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Kernel hacking"
 
 menu "printk and dmesg options"
@@ -318,6 +319,20 @@ config HEADERS_CHECK
          exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
          your build tree), to make sure they're suitable.
 
+config OPTIMIZE_INLINING
+       bool "Allow compiler to uninline functions marked 'inline'"
+       help
+         This option determines if the kernel forces gcc to inline the functions
+         developers have marked 'inline'. Doing so takes away freedom from gcc to
+         do what it thinks is best, which is desirable for the gcc 3.x series of
+         compilers. The gcc 4.x series have a rewritten inlining algorithm and
+         enabling this option will generate a smaller kernel there. Hopefully
+         this algorithm is so good that allowing gcc 4.x and above to make the
+         decision will become the default in the future. Until then this option
+         is there to test gcc for this.
+
+         If unsure, say N.
+
 config DEBUG_SECTION_MISMATCH
        bool "Enable full Section mismatch analysis"
        help
@@ -446,6 +461,15 @@ config DEBUG_KERNEL
          Say Y here if you are developing drivers or trying to debug and
          identify kernel problems.
 
+config DEBUG_MISC
+       bool "Miscellaneous debug code"
+       default DEBUG_KERNEL
+       depends on DEBUG_KERNEL
+       help
+         Say Y here if you need to enable miscellaneous debug code that should
+         be under a more specific debug option but isn't.
+
+
 menu "Memory Debugging"
 
 source "mm/Kconfig.debug"
@@ -519,10 +543,6 @@ config DEBUG_SLAB
          allocation as well as poisoning memory on free to catch use of freed
          memory. This can make kmalloc/kfree-intensive workloads much slower.
 
-config DEBUG_SLAB_LEAK
-       bool "Memory leak debugging"
-       depends on DEBUG_SLAB
-
 config SLUB_DEBUG_ON
        bool "SLUB debugging on by default"
        depends on SLUB && SLUB_DEBUG
@@ -1358,7 +1378,7 @@ config DEBUG_LIST
 
          If unsure, say N.
 
-config DEBUG_PI_LIST
+config DEBUG_PLIST
        bool "Debug priority linked list manipulation"
        depends on DEBUG_KERNEL
        help
index 9950b66..4fafba1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # This config refers to the generic KASAN mode.
 config HAVE_ARCH_KASAN
        bool
index ab4ff0e..bbe397d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config HAVE_ARCH_KGDB
        bool
index a2ae4a8..0e04fcb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ARCH_HAS_UBSAN_SANITIZE_ALL
        bool
 
index 83d7df2..fb76970 100644 (file)
@@ -30,7 +30,7 @@ endif
 
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
         rbtree.o radix-tree.o timerqueue.o xarray.o \
-        idr.o int_sqrt.o extable.o \
+        idr.o extable.o \
         sha1.o chacha.o irq_regs.o argv_split.o \
         flex_proportions.o ratelimit.o show_mem.o \
         is_single_threaded.o plist.o decompress.o kobject_uevent.o \
@@ -44,11 +44,11 @@ lib-$(CONFIG_SMP) += cpumask.o
 lib-y  += kobject.o klist.o
 obj-y  += lockref.o
 
-obj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \
+obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \
         bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \
-        gcd.o lcm.o list_sort.o uuid.o iov_iter.o clz_ctz.o \
+        list_sort.o uuid.o iov_iter.o clz_ctz.o \
         bsearch.o find_bit.o llist.o memweight.o kfifo.o \
-        percpu-refcount.o rhashtable.o reciprocal_div.o \
+        percpu-refcount.o rhashtable.o \
         once.o refcount.o usercopy.o errseq.o bucket_locks.o \
         generic-radix-tree.o
 obj-$(CONFIG_STRING_SELFTEST) += test_string.o
@@ -102,6 +102,8 @@ endif
 obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o
 CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)
 
+obj-y += math/
+
 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
 obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
 obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
@@ -121,7 +123,6 @@ obj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
 
 obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-$(CONFIG_PACKING)  += packing.o
-obj-$(CONFIG_RATIONAL) += rational.o
 obj-$(CONFIG_CRC_CCITT)        += crc-ccitt.o
 obj-$(CONFIG_CRC16)    += crc16.o
 obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o
@@ -195,8 +196,6 @@ obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
 
 obj-$(CONFIG_CPU_RMAP) += cpu_rmap.o
 
-obj-$(CONFIG_CORDIC) += cordic.o
-
 obj-$(CONFIG_DQL) += dynamic_queue_limits.o
 
 obj-$(CONFIG_GLOB) += glob.o
@@ -238,8 +237,6 @@ obj-$(CONFIG_ASN1) += asn1_decoder.o
 
 obj-$(CONFIG_FONT_SUPPORT) += fonts/
 
-obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
-
 hostprogs-y    := gen_crc32table
 hostprogs-y    += gen_crc64table
 clean-files    := crc32table.h
index 98872e9..f235434 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <asm/page.h>
 
+#include "kstrtox.h"
+
 /**
  * DOC: bitmap introduction
  *
@@ -477,12 +479,128 @@ int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp,
 }
 EXPORT_SYMBOL(bitmap_print_to_pagebuf);
 
+/*
+ * Region 9-38:4/10 describes the following bitmap structure:
+ * 0      9  12    18                  38
+ * .........****......****......****......
+ *         ^  ^     ^                   ^
+ *      start  off   group_len        end
+ */
+struct region {
+       unsigned int start;
+       unsigned int off;
+       unsigned int group_len;
+       unsigned int end;
+};
+
+static int bitmap_set_region(const struct region *r,
+                               unsigned long *bitmap, int nbits)
+{
+       unsigned int start;
+
+       if (r->end >= nbits)
+               return -ERANGE;
+
+       for (start = r->start; start <= r->end; start += r->group_len)
+               bitmap_set(bitmap, start, min(r->end - start + 1, r->off));
+
+       return 0;
+}
+
+static int bitmap_check_region(const struct region *r)
+{
+       if (r->start > r->end || r->group_len == 0 || r->off > r->group_len)
+               return -EINVAL;
+
+       return 0;
+}
+
+static const char *bitmap_getnum(const char *str, unsigned int *num)
+{
+       unsigned long long n;
+       unsigned int len;
+
+       len = _parse_integer(str, 10, &n);
+       if (!len)
+               return ERR_PTR(-EINVAL);
+       if (len & KSTRTOX_OVERFLOW || n != (unsigned int)n)
+               return ERR_PTR(-EOVERFLOW);
+
+       *num = n;
+       return str + len;
+}
+
+static inline bool end_of_str(char c)
+{
+       return c == '\0' || c == '\n';
+}
+
+static inline bool __end_of_region(char c)
+{
+       return isspace(c) || c == ',';
+}
+
+static inline bool end_of_region(char c)
+{
+       return __end_of_region(c) || end_of_str(c);
+}
+
+/*
+ * The format allows commas and whitespases at the beginning
+ * of the region.
+ */
+static const char *bitmap_find_region(const char *str)
+{
+       while (__end_of_region(*str))
+               str++;
+
+       return end_of_str(*str) ? NULL : str;
+}
+
+static const char *bitmap_parse_region(const char *str, struct region *r)
+{
+       str = bitmap_getnum(str, &r->start);
+       if (IS_ERR(str))
+               return str;
+
+       if (end_of_region(*str))
+               goto no_end;
+
+       if (*str != '-')
+               return ERR_PTR(-EINVAL);
+
+       str = bitmap_getnum(str + 1, &r->end);
+       if (IS_ERR(str))
+               return str;
+
+       if (end_of_region(*str))
+               goto no_pattern;
+
+       if (*str != ':')
+               return ERR_PTR(-EINVAL);
+
+       str = bitmap_getnum(str + 1, &r->off);
+       if (IS_ERR(str))
+               return str;
+
+       if (*str != '/')
+               return ERR_PTR(-EINVAL);
+
+       return bitmap_getnum(str + 1, &r->group_len);
+
+no_end:
+       r->end = r->start;
+no_pattern:
+       r->off = r->end + 1;
+       r->group_len = r->end + 1;
+
+       return end_of_str(*str) ? NULL : str;
+}
+
 /**
- * __bitmap_parselist - convert list format ASCII string to bitmap
- * @buf: read nul-terminated user string from this buffer
- * @buflen: buffer size in bytes.  If string is smaller than this
- *    then it must be terminated with a \0.
- * @is_user: location of buffer, 0 indicates kernel space
+ * bitmap_parselist - convert list format ASCII string to bitmap
+ * @buf: read user string from this buffer; must be terminated
+ *    with a \0 or \n.
  * @maskp: write resulting mask here
  * @nmaskbits: number of bits in mask to be written
  *
@@ -498,127 +616,38 @@ EXPORT_SYMBOL(bitmap_print_to_pagebuf);
  *
  * Returns: 0 on success, -errno on invalid input strings. Error values:
  *
- *   - ``-EINVAL``: second number in range smaller than first
+ *   - ``-EINVAL``: wrong region format
  *   - ``-EINVAL``: invalid character in string
  *   - ``-ERANGE``: bit number specified too large for mask
+ *   - ``-EOVERFLOW``: integer overflow in the input parameters
  */
-static int __bitmap_parselist(const char *buf, unsigned int buflen,
-               int is_user, unsigned long *maskp,
-               int nmaskbits)
+int bitmap_parselist(const char *buf, unsigned long *maskp, int nmaskbits)
 {
-       unsigned int a, b, old_a, old_b;
-       unsigned int group_size, used_size, off;
-       int c, old_c, totaldigits, ndigits;
-       const char __user __force *ubuf = (const char __user __force *)buf;
-       int at_start, in_range, in_partial_range;
+       struct region r;
+       long ret;
 
-       totaldigits = c = 0;
-       old_a = old_b = 0;
-       group_size = used_size = 0;
        bitmap_zero(maskp, nmaskbits);
-       do {
-               at_start = 1;
-               in_range = 0;
-               in_partial_range = 0;
-               a = b = 0;
-               ndigits = totaldigits;
-
-               /* Get the next cpu# or a range of cpu#'s */
-               while (buflen) {
-                       old_c = c;
-                       if (is_user) {
-                               if (__get_user(c, ubuf++))
-                                       return -EFAULT;
-                       } else
-                               c = *buf++;
-                       buflen--;
-                       if (isspace(c))
-                               continue;
-
-                       /* A '\0' or a ',' signal the end of a cpu# or range */
-                       if (c == '\0' || c == ',')
-                               break;
-                       /*
-                       * whitespaces between digits are not allowed,
-                       * but it's ok if whitespaces are on head or tail.
-                       * when old_c is whilespace,
-                       * if totaldigits == ndigits, whitespace is on head.
-                       * if whitespace is on tail, it should not run here.
-                       * as c was ',' or '\0',
-                       * the last code line has broken the current loop.
-                       */
-                       if ((totaldigits != ndigits) && isspace(old_c))
-                               return -EINVAL;
 
-                       if (c == '/') {
-                               used_size = a;
-                               at_start = 1;
-                               in_range = 0;
-                               a = b = 0;
-                               continue;
-                       }
+       while (buf) {
+               buf = bitmap_find_region(buf);
+               if (buf == NULL)
+                       return 0;
 
-                       if (c == ':') {
-                               old_a = a;
-                               old_b = b;
-                               at_start = 1;
-                               in_range = 0;
-                               in_partial_range = 1;
-                               a = b = 0;
-                               continue;
-                       }
+               buf = bitmap_parse_region(buf, &r);
+               if (IS_ERR(buf))
+                       return PTR_ERR(buf);
 
-                       if (c == '-') {
-                               if (at_start || in_range)
-                                       return -EINVAL;
-                               b = 0;
-                               in_range = 1;
-                               at_start = 1;
-                               continue;
-                       }
+               ret = bitmap_check_region(&r);
+               if (ret)
+                       return ret;
 
-                       if (!isdigit(c))
-                               return -EINVAL;
+               ret = bitmap_set_region(&r, maskp, nmaskbits);
+               if (ret)
+                       return ret;
+       }
 
-                       b = b * 10 + (c - '0');
-                       if (!in_range)
-                               a = b;
-                       at_start = 0;
-                       totaldigits++;
-               }
-               if (ndigits == totaldigits)
-                       continue;
-               if (in_partial_range) {
-                       group_size = a;
-                       a = old_a;
-                       b = old_b;
-                       old_a = old_b = 0;
-               } else {
-                       used_size = group_size = b - a + 1;
-               }
-               /* if no digit is after '-', it's wrong*/
-               if (at_start && in_range)
-                       return -EINVAL;
-               if (!(a <= b) || group_size == 0 || !(used_size <= group_size))
-                       return -EINVAL;
-               if (b >= nmaskbits)
-                       return -ERANGE;
-               while (a <= b) {
-                       off = min(b - a + 1, used_size);
-                       bitmap_set(maskp, a, off);
-                       a += group_size;
-               }
-       } while (buflen && c == ',');
        return 0;
 }
-
-int bitmap_parselist(const char *bp, unsigned long *maskp, int nmaskbits)
-{
-       char *nl  = strchrnul(bp, '\n');
-       int len = nl - bp;
-
-       return __bitmap_parselist(bp, len, 0, maskp, nmaskbits);
-}
 EXPORT_SYMBOL(bitmap_parselist);
 
 
@@ -632,23 +661,27 @@ EXPORT_SYMBOL(bitmap_parselist);
  * @nmaskbits: size of bitmap, in bits.
  *
  * Wrapper for bitmap_parselist(), providing it with user buffer.
- *
- * We cannot have this as an inline function in bitmap.h because it needs
- * linux/uaccess.h to get the access_ok() declaration and this causes
- * cyclic dependencies.
  */
 int bitmap_parselist_user(const char __user *ubuf,
                        unsigned int ulen, unsigned long *maskp,
                        int nmaskbits)
 {
-       if (!access_ok(ubuf, ulen))
-               return -EFAULT;
-       return __bitmap_parselist((const char __force *)ubuf,
-                                       ulen, 1, maskp, nmaskbits);
+       char *buf;
+       int ret;
+
+       buf = memdup_user_nul(ubuf, ulen);
+       if (IS_ERR(buf))
+               return PTR_ERR(buf);
+
+       ret = bitmap_parselist(buf, maskp, nmaskbits);
+
+       kfree(buf);
+       return ret;
 }
 EXPORT_SYMBOL(bitmap_parselist_user);
 
 
+#ifdef CONFIG_NUMA
 /**
  * bitmap_pos_to_ord - find ordinal of set bit at given position in bitmap
  *     @buf: pointer to a bitmap
@@ -757,7 +790,6 @@ void bitmap_remap(unsigned long *dst, const unsigned long *src,
                        set_bit(bitmap_ord_to_pos(new, n % w, nbits), dst);
        }
 }
-EXPORT_SYMBOL(bitmap_remap);
 
 /**
  * bitmap_bitremap - Apply map defined by a pair of bitmaps to a single bit
@@ -795,7 +827,6 @@ int bitmap_bitremap(int oldbit, const unsigned long *old,
        else
                return bitmap_ord_to_pos(new, n % w, bits);
 }
-EXPORT_SYMBOL(bitmap_bitremap);
 
 /**
  * bitmap_onto - translate one bitmap relative to another
@@ -930,7 +961,6 @@ void bitmap_onto(unsigned long *dst, const unsigned long *orig,
                m++;
        }
 }
-EXPORT_SYMBOL(bitmap_onto);
 
 /**
  * bitmap_fold - fold larger bitmap into smaller, modulo specified size
@@ -955,7 +985,7 @@ void bitmap_fold(unsigned long *dst, const unsigned long *orig,
        for_each_set_bit(oldbit, orig, nbits)
                set_bit(oldbit % sz, dst);
 }
-EXPORT_SYMBOL(bitmap_fold);
+#endif /* CONFIG_NUMA */
 
 /*
  * Common code for bitmap_*_region() routines.
index 40ffda9..81b56e0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #ifndef CONFIG_HAVE_ARCH_BITREVERSE
 #include <linux/types.h>
 #include <linux/module.h>
index ce51749..a75ee30 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * lib/debug_locks.c
  *
index e26aa4f..3cb21b2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/random.h>
index 3ecdd52..37baa79 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Font configuration
 #
index 7660d88..c94586b 100644 (file)
@@ -10,7 +10,6 @@
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 
-#ifndef __HAVE_ARCH_SW_HWEIGHT
 unsigned int __sw_hweight32(unsigned int w)
 {
 #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
@@ -27,7 +26,6 @@ unsigned int __sw_hweight32(unsigned int w)
 #endif
 }
 EXPORT_SYMBOL(__sw_hweight32);
-#endif
 
 unsigned int __sw_hweight16(unsigned int w)
 {
@@ -46,7 +44,6 @@ unsigned int __sw_hweight8(unsigned int w)
 }
 EXPORT_SYMBOL(__sw_hweight8);
 
-#ifndef __HAVE_ARCH_SW_HWEIGHT
 unsigned long __sw_hweight64(__u64 w)
 {
 #if BITS_PER_LONG == 32
@@ -69,4 +66,3 @@ unsigned long __sw_hweight64(__u64 w)
 #endif
 }
 EXPORT_SYMBOL(__sw_hweight64);
-#endif
index cb1db9b..c34e256 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/bitmap.h>
 #include <linux/bug.h>
 #include <linux/export.h>
index c85f660..593ce56 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/interval_tree.h>
 #include <linux/interval_tree_generic.h>
 #include <linux/compiler.h>
index 75509a1..f37f4d4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/interval_tree.h>
index f74fa83..f99c41d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/bvec.h>
 #include <linux/uio.h>
index 8575992..06e900c 100644 (file)
@@ -7,33 +7,41 @@
 #include <linux/list_sort.h>
 #include <linux/list.h>
 
-#define MAX_LIST_LENGTH_BITS 20
+typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *,
+               struct list_head const *, struct list_head const *);
 
 /*
  * Returns a list organized in an intermediate format suited
  * to chaining of merge() calls: null-terminated, no reserved or
  * sentinel head node, "prev" links not maintained.
  */
-static struct list_head *merge(void *priv,
-                               int (*cmp)(void *priv, struct list_head *a,
-                                       struct list_head *b),
+__attribute__((nonnull(2,3,4)))
+static struct list_head *merge(void *priv, cmp_func cmp,
                                struct list_head *a, struct list_head *b)
 {
-       struct list_head head, *tail = &head;
+       struct list_head *head, **tail = &head;
 
-       while (a && b) {
+       for (;;) {
                /* if equal, take 'a' -- important for sort stability */
-               if ((*cmp)(priv, a, b) <= 0) {
-                       tail->next = a;
+               if (cmp(priv, a, b) <= 0) {
+                       *tail = a;
+                       tail = &a->next;
                        a = a->next;
+                       if (!a) {
+                               *tail = b;
+                               break;
+                       }
                } else {
-                       tail->next = b;
+                       *tail = b;
+                       tail = &b->next;
                        b = b->next;
+                       if (!b) {
+                               *tail = a;
+                               break;
+                       }
                }
-               tail = tail->next;
        }
-       tail->next = a?:b;
-       return head.next;
+       return head;
 }
 
 /*
@@ -43,44 +51,52 @@ static struct list_head *merge(void *priv,
  * prev-link restoration pass, or maintaining the prev links
  * throughout.
  */
-static void merge_and_restore_back_links(void *priv,
-                               int (*cmp)(void *priv, struct list_head *a,
-                                       struct list_head *b),
-                               struct list_head *head,
-                               struct list_head *a, struct list_head *b)
+__attribute__((nonnull(2,3,4,5)))
+static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
+                       struct list_head *a, struct list_head *b)
 {
        struct list_head *tail = head;
        u8 count = 0;
 
-       while (a && b) {
+       for (;;) {
                /* if equal, take 'a' -- important for sort stability */
-               if ((*cmp)(priv, a, b) <= 0) {
+               if (cmp(priv, a, b) <= 0) {
                        tail->next = a;
                        a->prev = tail;
+                       tail = a;
                        a = a->next;
+                       if (!a)
+                               break;
                } else {
                        tail->next = b;
                        b->prev = tail;
+                       tail = b;
                        b = b->next;
+                       if (!b) {
+                               b = a;
+                               break;
+                       }
                }
-               tail = tail->next;
        }
-       tail->next = a ? : b;
 
+       /* Finish linking remainder of list b on to tail */
+       tail->next = b;
        do {
                /*
-                * In worst cases this loop may run many iterations.
+                * If the merge is highly unbalanced (e.g. the input is
+                * already sorted), this loop may run many iterations.
                 * Continue callbacks to the client even though no
                 * element comparison is needed, so the client's cmp()
                 * routine can invoke cond_resched() periodically.
                 */
-               if (unlikely(!(++count)))
-                       (*cmp)(priv, tail->next, tail->next);
-
-               tail->next->prev = tail;
-               tail = tail->next;
-       } while (tail->next);
-
+               if (unlikely(!++count))
+                       cmp(priv, b, b);
+               b->prev = tail;
+               tail = b;
+               b = b->next;
+       } while (b);
+
+       /* And the final links to make a circular doubly-linked list */
        tail->next = head;
        head->prev = tail;
 }
@@ -91,55 +107,149 @@ static void merge_and_restore_back_links(void *priv,
  * @head: the list to sort
  * @cmp: the elements comparison function
  *
- * This function implements "merge sort", which has O(nlog(n))
- * complexity.
+ * The comparison funtion @cmp must return > 0 if @a should sort after
+ * @b ("@a > @b" if you want an ascending sort), and <= 0 if @a should
+ * sort before @b *or* their original order should be preserved.  It is
+ * always called with the element that came first in the input in @a,
+ * and list_sort is a stable sort, so it is not necessary to distinguish
+ * the @a < @b and @a == @b cases.
+ *
+ * This is compatible with two styles of @cmp function:
+ * - The traditional style which returns <0 / =0 / >0, or
+ * - Returning a boolean 0/1.
+ * The latter offers a chance to save a few cycles in the comparison
+ * (which is used by e.g. plug_ctx_cmp() in block/blk-mq.c).
+ *
+ * A good way to write a multi-word comparison is
+ *     if (a->high != b->high)
+ *             return a->high > b->high;
+ *     if (a->middle != b->middle)
+ *             return a->middle > b->middle;
+ *     return a->low > b->low;
+ *
+ *
+ * This mergesort is as eager as possible while always performing at least
+ * 2:1 balanced merges.  Given two pending sublists of size 2^k, they are
+ * merged to a size-2^(k+1) list as soon as we have 2^k following elements.
+ *
+ * Thus, it will avoid cache thrashing as long as 3*2^k elements can
+ * fit into the cache.  Not quite as good as a fully-eager bottom-up
+ * mergesort, but it does use 0.2*n fewer comparisons, so is faster in
+ * the common case that everything fits into L1.
+ *
+ *
+ * The merging is controlled by "count", the number of elements in the
+ * pending lists.  This is beautiully simple code, but rather subtle.
  *
- * The comparison function @cmp must return a negative value if @a
- * should sort before @b, and a positive value if @a should sort after
- * @b. If @a and @b are equivalent, and their original relative
- * ordering is to be preserved, @cmp must return 0.
+ * Each time we increment "count", we set one bit (bit k) and clear
+ * bits k-1 .. 0.  Each time this happens (except the very first time
+ * for each bit, when count increments to 2^k), we merge two lists of
+ * size 2^k into one list of size 2^(k+1).
+ *
+ * This merge happens exactly when the count reaches an odd multiple of
+ * 2^k, which is when we have 2^k elements pending in smaller lists,
+ * so it's safe to merge away two lists of size 2^k.
+ *
+ * After this happens twice, we have created two lists of size 2^(k+1),
+ * which will be merged into a list of size 2^(k+2) before we create
+ * a third list of size 2^(k+1), so there are never more than two pending.
+ *
+ * The number of pending lists of size 2^k is determined by the
+ * state of bit k of "count" plus two extra pieces of information:
+ * - The state of bit k-1 (when k == 0, consider bit -1 always set), and
+ * - Whether the higher-order bits are zero or non-zero (i.e.
+ *   is count >= 2^(k+1)).
+ * There are six states we distinguish.  "x" represents some arbitrary
+ * bits, and "y" represents some arbitrary non-zero bits:
+ * 0:  00x: 0 pending of size 2^k;           x pending of sizes < 2^k
+ * 1:  01x: 0 pending of size 2^k; 2^(k-1) + x pending of sizes < 2^k
+ * 2: x10x: 0 pending of size 2^k; 2^k     + x pending of sizes < 2^k
+ * 3: x11x: 1 pending of size 2^k; 2^(k-1) + x pending of sizes < 2^k
+ * 4: y00x: 1 pending of size 2^k; 2^k     + x pending of sizes < 2^k
+ * 5: y01x: 2 pending of size 2^k; 2^(k-1) + x pending of sizes < 2^k
+ * (merge and loop back to state 2)
+ *
+ * We gain lists of size 2^k in the 2->3 and 4->5 transitions (because
+ * bit k-1 is set while the more significant bits are non-zero) and
+ * merge them away in the 5->2 transition.  Note in particular that just
+ * before the 5->2 transition, all lower-order bits are 11 (state 3),
+ * so there is one list of each smaller size.
+ *
+ * When we reach the end of the input, we merge all the pending
+ * lists, from smallest to largest.  If you work through cases 2 to
+ * 5 above, you can see that the number of elements we merge with a list
+ * of size 2^k varies from 2^(k-1) (cases 3 and 5 when x == 0) to
+ * 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1).
  */
+__attribute__((nonnull(2,3)))
 void list_sort(void *priv, struct list_head *head,
                int (*cmp)(void *priv, struct list_head *a,
                        struct list_head *b))
 {
-       struct list_head *part[MAX_LIST_LENGTH_BITS+1]; /* sorted partial lists
-                                               -- last slot is a sentinel */
-       int lev;  /* index into part[] */
-       int max_lev = 0;
-       struct list_head *list;
+       struct list_head *list = head->next, *pending = NULL;
+       size_t count = 0;       /* Count of pending */
 
-       if (list_empty(head))
+       if (list == head->prev) /* Zero or one elements */
                return;
 
-       memset(part, 0, sizeof(part));
-
+       /* Convert to a null-terminated singly-linked list. */
        head->prev->next = NULL;
-       list = head->next;
-
-       while (list) {
-               struct list_head *cur = list;
-               list = list->next;
-               cur->next = NULL;
 
-               for (lev = 0; part[lev]; lev++) {
-                       cur = merge(priv, cmp, part[lev], cur);
-                       part[lev] = NULL;
-               }
-               if (lev > max_lev) {
-                       if (unlikely(lev >= ARRAY_SIZE(part)-1)) {
-                               printk_once(KERN_DEBUG "list too long for efficiency\n");
-                               lev--;
-                       }
-                       max_lev = lev;
+       /*
+        * Data structure invariants:
+        * - All lists are singly linked and null-terminated; prev
+        *   pointers are not maintained.
+        * - pending is a prev-linked "list of lists" of sorted
+        *   sublists awaiting further merging.
+        * - Each of the sorted sublists is power-of-two in size.
+        * - Sublists are sorted by size and age, smallest & newest at front.
+        * - There are zero to two sublists of each size.
+        * - A pair of pending sublists are merged as soon as the number
+        *   of following pending elements equals their size (i.e.
+        *   each time count reaches an odd multiple of that size).
+        *   That ensures each later final merge will be at worst 2:1.
+        * - Each round consists of:
+        *   - Merging the two sublists selected by the highest bit
+        *     which flips when count is incremented, and
+        *   - Adding an element from the input as a size-1 sublist.
+        */
+       do {
+               size_t bits;
+               struct list_head **tail = &pending;
+
+               /* Find the least-significant clear bit in count */
+               for (bits = count; bits & 1; bits >>= 1)
+                       tail = &(*tail)->prev;
+               /* Do the indicated merge */
+               if (likely(bits)) {
+                       struct list_head *a = *tail, *b = a->prev;
+
+                       a = merge(priv, (cmp_func)cmp, b, a);
+                       /* Install the merged result in place of the inputs */
+                       a->prev = b->prev;
+                       *tail = a;
                }
-               part[lev] = cur;
-       }
 
-       for (lev = 0; lev < max_lev; lev++)
-               if (part[lev])
-                       list = merge(priv, cmp, part[lev], list);
-
-       merge_and_restore_back_links(priv, cmp, head, part[max_lev], list);
+               /* Move one element from input list to pending */
+               list->prev = pending;
+               pending = list;
+               list = list->next;
+               pending->next = NULL;
+               count++;
+       } while (list);
+
+       /* End of input; merge together all the pending lists. */
+       list = pending;
+       pending = pending->prev;
+       for (;;) {
+               struct list_head *next = pending->prev;
+
+               if (!next)
+                       break;
+               list = merge(priv, (cmp_func)cmp, pending, list);
+               pending = next;
+       }
+       /* The final merge, rebuilding prev links */
+       merge_final(priv, (cmp_func)cmp, head, pending, list);
 }
 EXPORT_SYMBOL(list_sort);
index f7b1132..5b42242 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -O3
 
 obj-$(CONFIG_LZ4_COMPRESS) += lz4_compress.o
index f0f7d7c..2f58faf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 lzo_compress-objs := lzo1x_compress.o
 lzo_decompress-objs := lzo1x_decompress_safe.o
 
index a8ede77..ba16c08 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  LZO1X Compressor from LZO
  *
index 9e07e9e..2717c79 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  LZO1X Decompressor from LZO
  *
diff --git a/lib/math/Kconfig b/lib/math/Kconfig
new file mode 100644 (file)
index 0000000..15bd50d
--- /dev/null
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config CORDIC
+       tristate "CORDIC algorithm"
+       help
+         This option provides an implementation of the CORDIC algorithm;
+         calculations are in fixed point. Module will be called cordic.
+
+config PRIME_NUMBERS
+       tristate
+
+config RATIONAL
+       bool
diff --git a/lib/math/Makefile b/lib/math/Makefile
new file mode 100644 (file)
index 0000000..be6909e
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += div64.o gcd.o lcm.o int_pow.o int_sqrt.o reciprocal_div.o
+
+obj-$(CONFIG_CORDIC)           += cordic.o
+obj-$(CONFIG_PRIME_NUMBERS)    += prime_numbers.o
+obj-$(CONFIG_RATIONAL)         += rational.o
similarity index 100%
rename from lib/cordic.c
rename to lib/math/cordic.c
similarity index 99%
rename from lib/div64.c
rename to lib/math/div64.c
index ee146bb..368ca7f 100644 (file)
@@ -10,7 +10,7 @@
  * Generic C version of 64bit/32bit division and modulo, with
  * 64bit result and 32bit remainder.
  *
- * The fast case for (n>>32 == 0) is handled inline by do_div(). 
+ * The fast case for (n>>32 == 0) is handled inline by do_div().
  *
  * Code generated for this function might be very inefficient
  * for some CPUs. __div64_32() can be overridden by linking arch-specific
similarity index 97%
rename from lib/gcd.c
rename to lib/math/gcd.c
index 7948ab2..e3b0422 100644 (file)
--- a/lib/gcd.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/gcd.h>
 #include <linux/export.h>
diff --git a/lib/math/int_pow.c b/lib/math/int_pow.c
new file mode 100644 (file)
index 0000000..622fc1a
--- /dev/null
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * An integer based power function
+ *
+ * Derived from drivers/video/backlight/pwm_bl.c
+ */
+
+#include <linux/export.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+/**
+ * int_pow - computes the exponentiation of the given base and exponent
+ * @base: base which will be raised to the given power
+ * @exp: power to be raised to
+ *
+ * Computes: pow(base, exp), i.e. @base raised to the @exp power
+ */
+u64 int_pow(u64 base, unsigned int exp)
+{
+       u64 result = 1;
+
+       while (exp) {
+               if (exp & 1)
+                       result *= base;
+               exp >>= 1;
+               base *= base;
+       }
+
+       return result;
+}
+EXPORT_SYMBOL_GPL(int_pow);
similarity index 100%
rename from lib/int_sqrt.c
rename to lib/math/int_sqrt.c
similarity index 91%
rename from lib/lcm.c
rename to lib/math/lcm.c
index 03d7fcb..6e0b2e7 100644 (file)
--- a/lib/lcm.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/compiler.h>
 #include <linux/gcd.h>
 #include <linux/export.h>
similarity index 99%
rename from lib/prime_numbers.c
rename to lib/math/prime_numbers.c
index 550eec4..052f5b7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "prime numbers: " fmt "\n"
 
 #include <linux/module.h>
similarity index 100%
rename from lib/rational.c
rename to lib/math/rational.c
index e6239bf..2c46dde 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/memory.h>
index 13e9c62..bb930f2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
index eb4a04a..3d2ba7c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 
 #include "notifier-error-inject.h"
index 8dc7986..b26f164 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
index da54318..071a76c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "%s: " fmt "\n", __func__
 
 #include <linux/kernel.h>
index 0b5d14d..4a3d70b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 
 /* validate @native and @pcp counter values match @expected */
index 199408f..0d86ed7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * lib/plist.c
  *
@@ -14,8 +15,6 @@
  * Simplifications of the original code by
  * Oleg Nesterov <oleg@tv-sign.ru>
  *
- * Licensed under the FSF's GNU Public License v2 or later.
- *
  * Based on simple lists (include/linux/list.h).
  *
  * This file contains the add / del functions which are considered to
@@ -26,7 +25,7 @@
 #include <linux/bug.h>
 #include <linux/plist.h>
 
-#ifdef CONFIG_DEBUG_PI_LIST
+#ifdef CONFIG_DEBUG_PLIST
 
 static struct plist_head test_head;
 
@@ -173,7 +172,7 @@ void plist_requeue(struct plist_node *node, struct plist_head *head)
        plist_check_head(head);
 }
 
-#ifdef CONFIG_DEBUG_PI_LIST
+#ifdef CONFIG_DEBUG_PLIST
 #include <linux/sched.h>
 #include <linux/sched/clock.h>
 #include <linux/module.h>
index c094b2d..5d89f0d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/suspend.h>
index b7055b2..62b8ee9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/rbtree_augmented.h>
index c3d7136..ba9d7a3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # This is a modified version of reed solomon lib,
 #
index d1c1e63..cff20df 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/scatterlist.h>
 #include <linux/mempool.h>
index d6b7a20..50855ea 100644 (file)
@@ -1,8 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * A fast, small, non-recursive O(nlog n) sort for the Linux kernel
+ * A fast, small, non-recursive O(n log n) sort for the Linux kernel
  *
- * Jan 23 2005  Matt Mackall <mpm@selenic.com>
+ * This performs n*log2(n) + 0.37*n + o(n) comparisons on average,
+ * and 1.5*n*log2(n) + O(n) in the (very contrived) worst case.
+ *
+ * Glibc qsort() manages n*log2(n) - 1.26*n for random inputs (1.63*n
+ * better) at the expense of stack usage and much larger code to avoid
+ * quicksort's O(n^2) worst case.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/export.h>
 #include <linux/sort.h>
 
-static int alignment_ok(const void *base, int align)
+/**
+ * is_aligned - is this pointer & size okay for word-wide copying?
+ * @base: pointer to data
+ * @size: size of each element
+ * @align: required alignment (typically 4 or 8)
+ *
+ * Returns true if elements can be copied using word loads and stores.
+ * The size must be a multiple of the alignment, and the base address must
+ * be if we do not have CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
+ *
+ * For some reason, gcc doesn't know to optimize "if (a & mask || b & mask)"
+ * to "if ((a | b) & mask)", so we do that by hand.
+ */
+__attribute_const__ __always_inline
+static bool is_aligned(const void *base, size_t size, unsigned char align)
 {
-       return IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) ||
-               ((unsigned long)base & (align - 1)) == 0;
+       unsigned char lsbits = (unsigned char)size;
+
+       (void)base;
+#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
+       lsbits |= (unsigned char)(uintptr_t)base;
+#endif
+       return (lsbits & (align - 1)) == 0;
 }
 
-static void u32_swap(void *a, void *b, int size)
+/**
+ * swap_words_32 - swap two elements in 32-bit chunks
+ * @a, @b: pointers to the elements
+ * @size: element size (must be a multiple of 4)
+ *
+ * Exchange the two objects in memory.  This exploits base+index addressing,
+ * which basically all CPUs have, to minimize loop overhead computations.
+ *
+ * For some reason, on x86 gcc 7.3.0 adds a redundant test of n at the
+ * bottom of the loop, even though the zero flag is stil valid from the
+ * subtract (since the intervening mov instructions don't alter the flags).
+ * Gcc 8.1.0 doesn't have that problem.
+ */
+static void swap_words_32(void *a, void *b, size_t n)
 {
-       u32 t = *(u32 *)a;
-       *(u32 *)a = *(u32 *)b;
-       *(u32 *)b = t;
+       do {
+               u32 t = *(u32 *)(a + (n -= 4));
+               *(u32 *)(a + n) = *(u32 *)(b + n);
+               *(u32 *)(b + n) = t;
+       } while (n);
 }
 
-static void u64_swap(void *a, void *b, int size)
+/**
+ * swap_words_64 - swap two elements in 64-bit chunks
+ * @a, @b: pointers to the elements
+ * @size: element size (must be a multiple of 8)
+ *
+ * Exchange the two objects in memory.  This exploits base+index
+ * addressing, which basically all CPUs have, to minimize loop overhead
+ * computations.
+ *
+ * We'd like to use 64-bit loads if possible.  If they're not, emulating
+ * one requires base+index+4 addressing which x86 has but most other
+ * processors do not.  If CONFIG_64BIT, we definitely have 64-bit loads,
+ * but it's possible to have 64-bit loads without 64-bit pointers (e.g.
+ * x32 ABI).  Are there any cases the kernel needs to worry about?
+ */
+static void swap_words_64(void *a, void *b, size_t n)
 {
-       u64 t = *(u64 *)a;
-       *(u64 *)a = *(u64 *)b;
-       *(u64 *)b = t;
+       do {
+#ifdef CONFIG_64BIT
+               u64 t = *(u64 *)(a + (n -= 8));
+               *(u64 *)(a + n) = *(u64 *)(b + n);
+               *(u64 *)(b + n) = t;
+#else
+               /* Use two 32-bit transfers to avoid base+index+4 addressing */
+               u32 t = *(u32 *)(a + (n -= 4));
+               *(u32 *)(a + n) = *(u32 *)(b + n);
+               *(u32 *)(b + n) = t;
+
+               t = *(u32 *)(a + (n -= 4));
+               *(u32 *)(a + n) = *(u32 *)(b + n);
+               *(u32 *)(b + n) = t;
+#endif
+       } while (n);
 }
 
-static void generic_swap(void *a, void *b, int size)
+/**
+ * swap_bytes - swap two elements a byte at a time
+ * @a, @b: pointers to the elements
+ * @size: element size
+ *
+ * This is the fallback if alignment doesn't allow using larger chunks.
+ */
+static void swap_bytes(void *a, void *b, size_t n)
 {
-       char t;
-
        do {
-               t = *(char *)a;
-               *(char *)a++ = *(char *)b;
-               *(char *)b++ = t;
-       } while (--size > 0);
+               char t = ((char *)a)[--n];
+               ((char *)a)[n] = ((char *)b)[n];
+               ((char *)b)[n] = t;
+       } while (n);
+}
+
+typedef void (*swap_func_t)(void *a, void *b, int size);
+
+/*
+ * The values are arbitrary as long as they can't be confused with
+ * a pointer, but small integers make for the smallest compare
+ * instructions.
+ */
+#define SWAP_WORDS_64 (swap_func_t)0
+#define SWAP_WORDS_32 (swap_func_t)1
+#define SWAP_BYTES    (swap_func_t)2
+
+/*
+ * The function pointer is last to make tail calls most efficient if the
+ * compiler decides not to inline this function.
+ */
+static void do_swap(void *a, void *b, size_t size, swap_func_t swap_func)
+{
+       if (swap_func == SWAP_WORDS_64)
+               swap_words_64(a, b, size);
+       else if (swap_func == SWAP_WORDS_32)
+               swap_words_32(a, b, size);
+       else if (swap_func == SWAP_BYTES)
+               swap_bytes(a, b, size);
+       else
+               swap_func(a, b, (int)size);
+}
+
+/**
+ * parent - given the offset of the child, find the offset of the parent.
+ * @i: the offset of the heap element whose parent is sought.  Non-zero.
+ * @lsbit: a precomputed 1-bit mask, equal to "size & -size"
+ * @size: size of each element
+ *
+ * In terms of array indexes, the parent of element j = @i/@size is simply
+ * (j-1)/2.  But when working in byte offsets, we can't use implicit
+ * truncation of integer divides.
+ *
+ * Fortunately, we only need one bit of the quotient, not the full divide.
+ * @size has a least significant bit.  That bit will be clear if @i is
+ * an even multiple of @size, and set if it's an odd multiple.
+ *
+ * Logically, we're doing "if (i & lsbit) i -= size;", but since the
+ * branch is unpredictable, it's done with a bit of clever branch-free
+ * code instead.
+ */
+__attribute_const__ __always_inline
+static size_t parent(size_t i, unsigned int lsbit, size_t size)
+{
+       i -= size;
+       i -= size & -(i & lsbit);
+       return i / 2;
 }
 
 /**
@@ -50,57 +175,78 @@ static void generic_swap(void *a, void *b, int size)
  * @cmp_func: pointer to comparison function
  * @swap_func: pointer to swap function or NULL
  *
- * This function does a heapsort on the given array. You may provide a
- * swap_func function optimized to your element type.
+ * This function does a heapsort on the given array.  You may provide
+ * a swap_func function if you need to do something more than a memory
+ * copy (e.g. fix up pointers or auxiliary data), but the built-in swap
+ * avoids a slow retpoline and so is significantly faster.
  *
  * Sorting time is O(n log n) both on average and worst-case. While
- * qsort is about 20% faster on average, it suffers from exploitable
+ * quicksort is slightly faster on average, it suffers from exploitable
  * O(n*n) worst-case behavior and extra memory requirements that make
  * it less suitable for kernel use.
  */
-
 void sort(void *base, size_t num, size_t size,
          int (*cmp_func)(const void *, const void *),
          void (*swap_func)(void *, void *, int size))
 {
        /* pre-scale counters for performance */
-       int i = (num/2 - 1) * size, n = num * size, c, r;
+       size_t n = num * size, a = (num/2) * size;
+       const unsigned int lsbit = size & -size;  /* Used to find parent */
+
+       if (!a)         /* num < 2 || size == 0 */
+               return;
 
        if (!swap_func) {
-               if (size == 4 && alignment_ok(base, 4))
-                       swap_func = u32_swap;
-               else if (size == 8 && alignment_ok(base, 8))
-                       swap_func = u64_swap;
+               if (is_aligned(base, size, 8))
+                       swap_func = SWAP_WORDS_64;
+               else if (is_aligned(base, size, 4))
+                       swap_func = SWAP_WORDS_32;
                else
-                       swap_func = generic_swap;
+                       swap_func = SWAP_BYTES;
        }
 
-       /* heapify */
-       for ( ; i >= 0; i -= size) {
-               for (r = i; r * 2 + size < n; r  = c) {
-                       c = r * 2 + size;
-                       if (c < n - size &&
-                                       cmp_func(base + c, base + c + size) < 0)
-                               c += size;
-                       if (cmp_func(base + r, base + c) >= 0)
-                               break;
-                       swap_func(base + r, base + c, size);
-               }
-       }
+       /*
+        * Loop invariants:
+        * 1. elements [a,n) satisfy the heap property (compare greater than
+        *    all of their children),
+        * 2. elements [n,num*size) are sorted, and
+        * 3. a <= b <= c <= d <= n (whenever they are valid).
+        */
+       for (;;) {
+               size_t b, c, d;
+
+               if (a)                  /* Building heap: sift down --a */
+                       a -= size;
+               else if (n -= size)     /* Sorting: Extract root to --n */
+                       do_swap(base, base + n, size, swap_func);
+               else                    /* Sort complete */
+                       break;
 
-       /* sort */
-       for (i = n - size; i > 0; i -= size) {
-               swap_func(base, base + i, size);
-               for (r = 0; r * 2 + size < i; r = c) {
-                       c = r * 2 + size;
-                       if (c < i - size &&
-                                       cmp_func(base + c, base + c + size) < 0)
-                               c += size;
-                       if (cmp_func(base + r, base + c) >= 0)
-                               break;
-                       swap_func(base + r, base + c, size);
+               /*
+                * Sift element at "a" down into heap.  This is the
+                * "bottom-up" variant, which significantly reduces
+                * calls to cmp_func(): we find the sift-down path all
+                * the way to the leaves (one compare per level), then
+                * backtrack to find where to insert the target element.
+                *
+                * Because elements tend to sift down close to the leaves,
+                * this uses fewer compares than doing two per level
+                * on the way down.  (A bit more than half as many on
+                * average, 3/4 worst-case.)
+                */
+               for (b = a; c = 2*b + size, (d = c + size) < n;)
+                       b = cmp_func(base + c, base + d) >= 0 ? c : d;
+               if (d == n)     /* Special case last leaf with no sibling */
+                       b = c;
+
+               /* Now backtrack from "b" to the correct location for "a" */
+               while (b != a && cmp_func(base + a, base + b) >= 0)
+                       b = parent(b, lsbit, size);
+               c = b;                  /* Where "a" belongs */
+               while (b != a) {        /* Shift it into place */
+                       b = parent(b, lsbit, size);
+                       do_swap(base + b, base + c, size, swap_func);
                }
        }
 }
-
 EXPORT_SYMBOL(sort);
index 29c490e..4403e19 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Helpers for formatting and printing strings
  *
index 792d906..51a98f7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Test cases for printf facility.
  */
@@ -11,6 +12,7 @@
 #include <linux/printk.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/uaccess.h>
 
 #include "../tools/testing/selftests/kselftest_module.h"
 
@@ -226,7 +228,8 @@ static const unsigned long exp[] __initconst = {
        BITMAP_FROM_U64(0xffffffff),
        BITMAP_FROM_U64(0xfffffffe),
        BITMAP_FROM_U64(0x3333333311111111ULL),
-       BITMAP_FROM_U64(0xffffffff77777777ULL)
+       BITMAP_FROM_U64(0xffffffff77777777ULL),
+       BITMAP_FROM_U64(0),
 };
 
 static const unsigned long exp2[] __initconst = {
@@ -249,55 +252,93 @@ static const struct test_bitmap_parselist parselist_tests[] __initconst = {
        {0, "1-31:4/4",                 &exp[9 * step], 32, 0},
        {0, "0-31:1/4,32-63:2/4",       &exp[10 * step], 64, 0},
        {0, "0-31:3/4,32-63:4/4",       &exp[11 * step], 64, 0},
+       {0, "  ,,  0-31:3/4  ,, 32-63:4/4  ,,  ",       &exp[11 * step], 64, 0},
 
        {0, "0-31:1/4,32-63:2/4,64-95:3/4,96-127:4/4",  exp2, 128, 0},
 
        {0, "0-2047:128/256", NULL, 2048, PARSE_TIME},
 
+       {0, "",                         &exp[12 * step], 8, 0},
+       {0, "\n",                       &exp[12 * step], 8, 0},
+       {0, ",,  ,,  , ,  ,",           &exp[12 * step], 8, 0},
+       {0, " ,  ,,  , ,   ",           &exp[12 * step], 8, 0},
+       {0, " ,  ,,  , ,   \n",         &exp[12 * step], 8, 0},
+
        {-EINVAL, "-1", NULL, 8, 0},
        {-EINVAL, "-0", NULL, 8, 0},
        {-EINVAL, "10-1", NULL, 8, 0},
        {-EINVAL, "0-31:", NULL, 8, 0},
        {-EINVAL, "0-31:0", NULL, 8, 0},
+       {-EINVAL, "0-31:0/", NULL, 8, 0},
        {-EINVAL, "0-31:0/0", NULL, 8, 0},
        {-EINVAL, "0-31:1/0", NULL, 8, 0},
        {-EINVAL, "0-31:10/1", NULL, 8, 0},
+       {-EOVERFLOW, "0-98765432123456789:10/1", NULL, 8, 0},
+
+       {-EINVAL, "a-31", NULL, 8, 0},
+       {-EINVAL, "0-a1", NULL, 8, 0},
+       {-EINVAL, "a-31:10/1", NULL, 8, 0},
+       {-EINVAL, "0-31:a/1", NULL, 8, 0},
+       {-EINVAL, "0-\n", NULL, 8, 0},
 };
 
-static void __init test_bitmap_parselist(void)
+static void __init __test_bitmap_parselist(int is_user)
 {
        int i;
        int err;
-       cycles_t cycles;
+       ktime_t time;
        DECLARE_BITMAP(bmap, 2048);
+       char *mode = is_user ? "_user"  : "";
 
        for (i = 0; i < ARRAY_SIZE(parselist_tests); i++) {
 #define ptest parselist_tests[i]
 
-               cycles = get_cycles();
-               err = bitmap_parselist(ptest.in, bmap, ptest.nbits);
-               cycles = get_cycles() - cycles;
+               if (is_user) {
+                       mm_segment_t orig_fs = get_fs();
+                       size_t len = strlen(ptest.in);
+
+                       set_fs(KERNEL_DS);
+                       time = ktime_get();
+                       err = bitmap_parselist_user(ptest.in, len,
+                                                   bmap, ptest.nbits);
+                       time = ktime_get() - time;
+                       set_fs(orig_fs);
+               } else {
+                       time = ktime_get();
+                       err = bitmap_parselist(ptest.in, bmap, ptest.nbits);
+                       time = ktime_get() - time;
+               }
 
                if (err != ptest.errno) {
-                       pr_err("test %d: input is %s, errno is %d, expected %d\n",
-                                       i, ptest.in, err, ptest.errno);
+                       pr_err("parselist%s: %d: input is %s, errno is %d, expected %d\n",
+                                       mode, i, ptest.in, err, ptest.errno);
                        continue;
                }
 
                if (!err && ptest.expected
                         && !__bitmap_equal(bmap, ptest.expected, ptest.nbits)) {
-                       pr_err("test %d: input is %s, result is 0x%lx, expected 0x%lx\n",
-                                       i, ptest.in, bmap[0], *ptest.expected);
+                       pr_err("parselist%s: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
+                                       mode, i, ptest.in, bmap[0],
+                                       *ptest.expected);
                        continue;
                }
 
                if (ptest.flags & PARSE_TIME)
-                       pr_err("test %d: input is '%s' OK, Time: %llu\n",
-                                       i, ptest.in,
-                                       (unsigned long long)cycles);
+                       pr_err("parselist%s: %d: input is '%s' OK, Time: %llu\n",
+                                       mode, i, ptest.in, time);
        }
 }
 
+static void __init test_bitmap_parselist(void)
+{
+       __test_bitmap_parselist(0);
+}
+
+static void __init test_bitmap_parselist_user(void)
+{
+       __test_bitmap_parselist(1);
+}
+
 #define EXP_BYTES      (sizeof(exp) * 8)
 
 static void __init test_bitmap_arr32(void)
@@ -370,6 +411,7 @@ static void __init selftest(void)
        test_copy();
        test_bitmap_arr32();
        test_bitmap_parselist();
+       test_bitmap_parselist_user();
        test_mem_optimisations();
 }
 
index bf864c7..b7cc0aa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/export.h>
index 7222093..787c146 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This module provides an interface to trigger and test firmware loading.
  *
index cac20c5..0ee40b4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Test cases for <linux/hash.h> and <linux/stringhash.h>
  * This just verifies that various ways of computing a hash
index 5474f3f..1f017d3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "list_sort_test: " fmt
 
 #include <linux/kernel.h>
index 319b66f..debd19e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This module emits "Hello, world" on printk when loaded.
  *
index 93da0a5..944eb50 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Test cases for printf facility.
  */
index 385c0ed..52edbe1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/sort.h>
 #include <linux/slab.h>
 #include <linux/module.h>
index 0fcdb82..bf8def0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/printk.h>
 #include <linux/slab.h>
index 3dd801c..566dad3 100644 (file)
@@ -47,6 +47,9 @@ struct test_sysctl_data {
        unsigned int uint_0001;
 
        char string_0001[65];
+
+#define SYSCTL_TEST_BITMAP_SIZE        65536
+       unsigned long *bitmap_0001;
 };
 
 static struct test_sysctl_data test_data = {
@@ -102,6 +105,13 @@ static struct ctl_table test_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dostring,
        },
+       {
+               .procname       = "bitmap_0001",
+               .data           = &test_data.bitmap_0001,
+               .maxlen         = SYSCTL_TEST_BITMAP_SIZE,
+               .mode           = 0644,
+               .proc_handler   = proc_do_large_bitmap,
+       },
        { }
 };
 
@@ -129,15 +139,21 @@ static struct ctl_table_header *test_sysctl_header;
 
 static int __init test_sysctl_init(void)
 {
+       test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL);
+       if (!test_data.bitmap_0001)
+               return -ENOMEM;
        test_sysctl_header = register_sysctl_table(test_sysctl_root_table);
-       if (!test_sysctl_header)
+       if (!test_sysctl_header) {
+               kfree(test_data.bitmap_0001);
                return -ENOMEM;
+       }
        return 0;
 }
 late_initcall(test_sysctl_init);
 
 static void __exit test_sysctl_exit(void)
 {
+       kfree(test_data.bitmap_0001);
        if (test_sysctl_header)
                unregister_sysctl_table(test_sysctl_header);
 }
index f832b09..8bbefca 100644 (file)
@@ -384,12 +384,11 @@ static int test_func(void *private)
 {
        struct test_driver *t = private;
        int random_array[ARRAY_SIZE(test_case_array)];
-       int index, i, j, ret;
+       int index, i, j;
        ktime_t kt;
        u64 delta;
 
-       ret = set_cpus_allowed_ptr(current, cpumask_of(t->cpu));
-       if (ret < 0)
+       if (set_cpus_allowed_ptr(current, cpumask_of(t->cpu)) < 0)
                pr_err("Failed to set affinity to %d CPU\n", t->cpu);
 
        for (i = 0; i < ARRAY_SIZE(test_case_array); i++)
@@ -415,8 +414,7 @@ static int test_func(void *private)
 
                kt = ktime_get();
                for (j = 0; j < test_repeat_count; j++) {
-                       ret = test_case_array[index].test_func();
-                       if (!ret)
+                       if (!test_case_array[index].test_func())
                                per_cpu_test_data[t->cpu][index].test_passed++;
                        else
                                per_cpu_test_data[t->cpu][index].test_failed++;
index 2f003cf..6393704 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/lib/vsprintf.c
  *
index 12d2d77..2252874 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config XZ_DEC
        tristate "XZ decompression support"
        select CRC32
index a7fa769..fa6af81 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XZ_DEC) += xz_dec.o
 xz_dec-y := xz_dec_syms.o xz_dec_stream.o xz_dec_lzma2.o
 xz_dec-$(CONFIG_XZ_DEC_BCJ) += xz_dec_bcj.o
index 86275e3..2622e03 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # This is a modified version of zlib, which does all memory
 # allocation ahead of time.
index ccfe25f..72fe4b7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/lib/zlib_deflate/deflate_syms.c
  *
index 49f8ce5..27327d3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # This is a modified version of zlib, which does all memory
 # allocation ahead of time.
index 67329fe..9720114 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/lib/zlib_inflate/inflate_syms.c
  *
index 7920cbb..f5d778e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o
 obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
 
index ee8d1f3..f0c76ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 menu "Memory Management options"
 
index e980ceb..fa6d792 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config PAGE_EXTENSION
        bool "Extend memmap on extra space for more information on page"
        ---help---
index d210cc9..ac5e5ba 100644 (file)
@@ -33,7 +33,7 @@ mmu-$(CONFIG_MMU)     += process_vm_access.o
 endif
 
 obj-y                  := filemap.o mempool.o oom_kill.o fadvise.o \
-                          maccess.o page_alloc.o page-writeback.o \
+                          maccess.o page-writeback.o \
                           readahead.o swap.o truncate.o vmscan.o shmem.o \
                           util.o mmzone.o vmstat.o backing-dev.o \
                           mm_init.o mmu_context.o percpu.o slab_common.o \
@@ -41,6 +41,11 @@ obj-y                        := filemap.o mempool.o oom_kill.o fadvise.o \
                           interval_tree.o list_lru.o workingset.o \
                           debug.o $(mmu-y)
 
+# Give 'page_alloc' its own module-parameter namespace
+page-alloc-y := page_alloc.o
+page-alloc-$(CONFIG_SHUFFLE_PAGE_ALLOCATOR) += shuffle.o
+
+obj-y += page-alloc.o
 obj-y += init-mm.o
 obj-y += memblock.o
 
index 72e6d0c..909dae4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/wait.h>
 #include <linux/backing-dev.h>
index ef858d5..ba739b7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm/balloon_compaction.c
  *
index 6cc4bea..9febc8c 100644 (file)
@@ -1230,7 +1230,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
 
        /* Pageblock boundaries */
        start_pfn = pageblock_start_pfn(pfn);
-       end_pfn = min(start_pfn + pageblock_nr_pages, zone_end_pfn(cc->zone));
+       end_pfn = min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)) - 1;
 
        /* Scan before */
        if (start_pfn != pfn) {
@@ -1241,7 +1241,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
 
        /* Scan after */
        start_pfn = pfn + nr_isolated;
-       if (start_pfn != end_pfn)
+       if (start_pfn < end_pfn)
                isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);
 
        /* Skip this pageblock in the future as it's full or nearly full */
@@ -1888,13 +1888,13 @@ static enum compact_result __compact_finished(struct compact_control *cc)
                bool can_steal;
 
                /* Job done if page is free of the right migratetype */
-               if (!list_empty(&area->free_list[migratetype]))
+               if (!free_area_empty(area, migratetype))
                        return COMPACT_SUCCESS;
 
 #ifdef CONFIG_CMA
                /* MIGRATE_MOVABLE can fallback on MIGRATE_CMA */
                if (migratetype == MIGRATE_MOVABLE &&
-                       !list_empty(&area->free_list[MIGRATE_CMA]))
+                       !free_area_empty(area, MIGRATE_CMA))
                        return COMPACT_SUCCESS;
 #endif
                /*
index eee9c22..8345bb6 100644 (file)
@@ -67,7 +67,7 @@ void __dump_page(struct page *page, const char *reason)
         */
        mapcount = PageSlab(page) ? 0 : page_mapcount(page);
 
-       pr_warn("page:%px count:%d mapcount:%d mapping:%px index:%#lx",
+       pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx",
                  page, page_ref_count(page), mapcount,
                  page->mapping, page_to_pgoff(page));
        if (PageCompound(page))
index c5af80c..df2006b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     linux/mm/filemap.c
  *
index 2c08248..f173fcb 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/err.h>
index 81718c5..ac843d3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Generic hugetlb support.
  * (C) Nadia Yvette Chambers, April 2004
index b6ac706..1a7497d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Inject a hwpoison memory failure on a arbitrary pfn */
 #include <linux/module.h>
 #include <linux/debugfs.h>
index 0730bf8..0bdf315 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2013 Red Hat, Inc. and Parallels Inc. All rights reserved.
  * Authors: David Chinner and Glauber Costa
index ec00be5..482d4d6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Access kernel memory without faulting.
  */
index 2879330..e50a2db 100644 (file)
@@ -687,10 +687,119 @@ mem_cgroup_largest_soft_limit_node(struct mem_cgroup_tree_per_node *mctz)
        return mz;
 }
 
-static unsigned long memcg_sum_events(struct mem_cgroup *memcg,
-                                     int event)
+/**
+ * __mod_memcg_state - update cgroup memory statistics
+ * @memcg: the memory cgroup
+ * @idx: the stat item - can be enum memcg_stat_item or enum node_stat_item
+ * @val: delta to add to the counter, can be negative
+ */
+void __mod_memcg_state(struct mem_cgroup *memcg, int idx, int val)
+{
+       long x;
+
+       if (mem_cgroup_disabled())
+               return;
+
+       x = val + __this_cpu_read(memcg->vmstats_percpu->stat[idx]);
+       if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) {
+               struct mem_cgroup *mi;
+
+               atomic_long_add(x, &memcg->vmstats_local[idx]);
+               for (mi = memcg; mi; mi = parent_mem_cgroup(mi))
+                       atomic_long_add(x, &mi->vmstats[idx]);
+               x = 0;
+       }
+       __this_cpu_write(memcg->vmstats_percpu->stat[idx], x);
+}
+
+static struct mem_cgroup_per_node *
+parent_nodeinfo(struct mem_cgroup_per_node *pn, int nid)
+{
+       struct mem_cgroup *parent;
+
+       parent = parent_mem_cgroup(pn->memcg);
+       if (!parent)
+               return NULL;
+       return mem_cgroup_nodeinfo(parent, nid);
+}
+
+/**
+ * __mod_lruvec_state - update lruvec memory statistics
+ * @lruvec: the lruvec
+ * @idx: the stat item
+ * @val: delta to add to the counter, can be negative
+ *
+ * The lruvec is the intersection of the NUMA node and a cgroup. This
+ * function updates the all three counters that are affected by a
+ * change of state at this level: per-node, per-cgroup, per-lruvec.
+ */
+void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
+                       int val)
 {
-       return atomic_long_read(&memcg->events[event]);
+       pg_data_t *pgdat = lruvec_pgdat(lruvec);
+       struct mem_cgroup_per_node *pn;
+       struct mem_cgroup *memcg;
+       long x;
+
+       /* Update node */
+       __mod_node_page_state(pgdat, idx, val);
+
+       if (mem_cgroup_disabled())
+               return;
+
+       pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
+       memcg = pn->memcg;
+
+       /* Update memcg */
+       __mod_memcg_state(memcg, idx, val);
+
+       /* Update lruvec */
+       x = val + __this_cpu_read(pn->lruvec_stat_cpu->count[idx]);
+       if (unlikely(abs(x) > MEMCG_CHARGE_BATCH)) {
+               struct mem_cgroup_per_node *pi;
+
+               atomic_long_add(x, &pn->lruvec_stat_local[idx]);
+               for (pi = pn; pi; pi = parent_nodeinfo(pi, pgdat->node_id))
+                       atomic_long_add(x, &pi->lruvec_stat[idx]);
+               x = 0;
+       }
+       __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x);
+}
+
+/**
+ * __count_memcg_events - account VM events in a cgroup
+ * @memcg: the memory cgroup
+ * @idx: the event item
+ * @count: the number of events that occured
+ */
+void __count_memcg_events(struct mem_cgroup *memcg, enum vm_event_item idx,
+                         unsigned long count)
+{
+       unsigned long x;
+
+       if (mem_cgroup_disabled())
+               return;
+
+       x = count + __this_cpu_read(memcg->vmstats_percpu->events[idx]);
+       if (unlikely(x > MEMCG_CHARGE_BATCH)) {
+               struct mem_cgroup *mi;
+
+               atomic_long_add(x, &memcg->vmevents_local[idx]);
+               for (mi = memcg; mi; mi = parent_mem_cgroup(mi))
+                       atomic_long_add(x, &mi->vmevents[idx]);
+               x = 0;
+       }
+       __this_cpu_write(memcg->vmstats_percpu->events[idx], x);
+}
+
+static unsigned long memcg_events(struct mem_cgroup *memcg, int event)
+{
+       return atomic_long_read(&memcg->vmevents[event]);
+}
+
+static unsigned long memcg_events_local(struct mem_cgroup *memcg, int event)
+{
+       return atomic_long_read(&memcg->vmevents_local[event]);
 }
 
 static void mem_cgroup_charge_statistics(struct mem_cgroup *memcg,
@@ -722,7 +831,7 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *memcg,
                nr_pages = -nr_pages; /* for event */
        }
 
-       __this_cpu_add(memcg->stat_cpu->nr_page_events, nr_pages);
+       __this_cpu_add(memcg->vmstats_percpu->nr_page_events, nr_pages);
 }
 
 static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg,
@@ -730,8 +839,8 @@ static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg,
 {
        unsigned long val, next;
 
-       val = __this_cpu_read(memcg->stat_cpu->nr_page_events);
-       next = __this_cpu_read(memcg->stat_cpu->targets[target]);
+       val = __this_cpu_read(memcg->vmstats_percpu->nr_page_events);
+       next = __this_cpu_read(memcg->vmstats_percpu->targets[target]);
        /* from time_after() in jiffies.h */
        if ((long)(next - val) < 0) {
                switch (target) {
@@ -747,7 +856,7 @@ static bool mem_cgroup_event_ratelimit(struct mem_cgroup *memcg,
                default:
                        break;
                }
-               __this_cpu_write(memcg->stat_cpu->targets[target], next);
+               __this_cpu_write(memcg->vmstats_percpu->targets[target], next);
                return true;
        }
        return false;
@@ -1325,12 +1434,14 @@ void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg)
                        if (memcg1_stats[i] == MEMCG_SWAP && !do_swap_account)
                                continue;
                        pr_cont(" %s:%luKB", memcg1_stat_names[i],
-                               K(memcg_page_state(iter, memcg1_stats[i])));
+                               K(memcg_page_state_local(iter,
+                                                        memcg1_stats[i])));
                }
 
                for (i = 0; i < NR_LRU_LISTS; i++)
                        pr_cont(" %s:%luKB", mem_cgroup_lru_names[i],
-                               K(memcg_page_state(iter, NR_LRU_BASE + i)));
+                               K(memcg_page_state_local(iter,
+                                                        NR_LRU_BASE + i)));
 
                pr_cont("\n");
        }
@@ -2076,7 +2187,7 @@ static void drain_all_stock(struct mem_cgroup *root_memcg)
 static int memcg_hotplug_cpu_dead(unsigned int cpu)
 {
        struct memcg_stock_pcp *stock;
-       struct mem_cgroup *memcg;
+       struct mem_cgroup *memcg, *mi;
 
        stock = &per_cpu(memcg_stock, cpu);
        drain_stock(stock);
@@ -2088,9 +2199,12 @@ static int memcg_hotplug_cpu_dead(unsigned int cpu)
                        int nid;
                        long x;
 
-                       x = this_cpu_xchg(memcg->stat_cpu->count[i], 0);
-                       if (x)
-                               atomic_long_add(x, &memcg->stat[i]);
+                       x = this_cpu_xchg(memcg->vmstats_percpu->stat[i], 0);
+                       if (x) {
+                               atomic_long_add(x, &memcg->vmstats_local[i]);
+                               for (mi = memcg; mi; mi = parent_mem_cgroup(mi))
+                                       atomic_long_add(x, &memcg->vmstats[i]);
+                       }
 
                        if (i >= NR_VM_NODE_STAT_ITEMS)
                                continue;
@@ -2100,17 +2214,24 @@ static int memcg_hotplug_cpu_dead(unsigned int cpu)
 
                                pn = mem_cgroup_nodeinfo(memcg, nid);
                                x = this_cpu_xchg(pn->lruvec_stat_cpu->count[i], 0);
-                               if (x)
-                                       atomic_long_add(x, &pn->lruvec_stat[i]);
+                               if (x) {
+                                       atomic_long_add(x, &pn->lruvec_stat_local[i]);
+                                       do {
+                                               atomic_long_add(x, &pn->lruvec_stat[i]);
+                                       } while ((pn = parent_nodeinfo(pn, nid)));
+                               }
                        }
                }
 
                for (i = 0; i < NR_VM_EVENT_ITEMS; i++) {
                        long x;
 
-                       x = this_cpu_xchg(memcg->stat_cpu->events[i], 0);
-                       if (x)
-                               atomic_long_add(x, &memcg->events[i]);
+                       x = this_cpu_xchg(memcg->vmstats_percpu->events[i], 0);
+                       if (x) {
+                               atomic_long_add(x, &memcg->vmevents_local[i]);
+                               for (mi = memcg; mi; mi = parent_mem_cgroup(mi))
+                                       atomic_long_add(x, &memcg->vmevents[i]);
+                       }
                }
        }
 
@@ -2940,50 +3061,15 @@ static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css,
        return retval;
 }
 
-struct accumulated_stats {
-       unsigned long stat[MEMCG_NR_STAT];
-       unsigned long events[NR_VM_EVENT_ITEMS];
-       unsigned long lru_pages[NR_LRU_LISTS];
-       const unsigned int *stats_array;
-       const unsigned int *events_array;
-       int stats_size;
-       int events_size;
-};
-
-static void accumulate_memcg_tree(struct mem_cgroup *memcg,
-                                 struct accumulated_stats *acc)
-{
-       struct mem_cgroup *mi;
-       int i;
-
-       for_each_mem_cgroup_tree(mi, memcg) {
-               for (i = 0; i < acc->stats_size; i++)
-                       acc->stat[i] += memcg_page_state(mi,
-                               acc->stats_array ? acc->stats_array[i] : i);
-
-               for (i = 0; i < acc->events_size; i++)
-                       acc->events[i] += memcg_sum_events(mi,
-                               acc->events_array ? acc->events_array[i] : i);
-
-               for (i = 0; i < NR_LRU_LISTS; i++)
-                       acc->lru_pages[i] += memcg_page_state(mi,
-                                                             NR_LRU_BASE + i);
-       }
-}
-
 static unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
 {
-       unsigned long val = 0;
+       unsigned long val;
 
        if (mem_cgroup_is_root(memcg)) {
-               struct mem_cgroup *iter;
-
-               for_each_mem_cgroup_tree(iter, memcg) {
-                       val += memcg_page_state(iter, MEMCG_CACHE);
-                       val += memcg_page_state(iter, MEMCG_RSS);
-                       if (swap)
-                               val += memcg_page_state(iter, MEMCG_SWAP);
-               }
+               val = memcg_page_state(memcg, MEMCG_CACHE) +
+                       memcg_page_state(memcg, MEMCG_RSS);
+               if (swap)
+                       val += memcg_page_state(memcg, MEMCG_SWAP);
        } else {
                if (!swap)
                        val = page_counter_read(&memcg->memory);
@@ -3324,7 +3410,7 @@ static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
        for_each_lru(lru) {
                if (!(BIT(lru) & lru_mask))
                        continue;
-               nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
+               nr += lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
        }
        return nr;
 }
@@ -3338,7 +3424,7 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
        for_each_lru(lru) {
                if (!(BIT(lru) & lru_mask))
                        continue;
-               nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
+               nr += memcg_page_state_local(memcg, NR_LRU_BASE + lru);
        }
        return nr;
 }
@@ -3414,7 +3500,6 @@ static int memcg_stat_show(struct seq_file *m, void *v)
        unsigned long memory, memsw;
        struct mem_cgroup *mi;
        unsigned int i;
-       struct accumulated_stats acc;
 
        BUILD_BUG_ON(ARRAY_SIZE(memcg1_stat_names) != ARRAY_SIZE(memcg1_stats));
        BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
@@ -3423,17 +3508,17 @@ static int memcg_stat_show(struct seq_file *m, void *v)
                if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
                        continue;
                seq_printf(m, "%s %lu\n", memcg1_stat_names[i],
-                          memcg_page_state(memcg, memcg1_stats[i]) *
+                          memcg_page_state_local(memcg, memcg1_stats[i]) *
                           PAGE_SIZE);
        }
 
        for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
                seq_printf(m, "%s %lu\n", memcg1_event_names[i],
-                          memcg_sum_events(memcg, memcg1_events[i]));
+                          memcg_events_local(memcg, memcg1_events[i]));
 
        for (i = 0; i < NR_LRU_LISTS; i++)
                seq_printf(m, "%s %lu\n", mem_cgroup_lru_names[i],
-                          memcg_page_state(memcg, NR_LRU_BASE + i) *
+                          memcg_page_state_local(memcg, NR_LRU_BASE + i) *
                           PAGE_SIZE);
 
        /* Hierarchical information */
@@ -3448,27 +3533,21 @@ static int memcg_stat_show(struct seq_file *m, void *v)
                seq_printf(m, "hierarchical_memsw_limit %llu\n",
                           (u64)memsw * PAGE_SIZE);
 
-       memset(&acc, 0, sizeof(acc));
-       acc.stats_size = ARRAY_SIZE(memcg1_stats);
-       acc.stats_array = memcg1_stats;
-       acc.events_size = ARRAY_SIZE(memcg1_events);
-       acc.events_array = memcg1_events;
-       accumulate_memcg_tree(memcg, &acc);
-
        for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
                if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
                        continue;
                seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
-                          (u64)acc.stat[i] * PAGE_SIZE);
+                          (u64)memcg_page_state(memcg, i) * PAGE_SIZE);
        }
 
        for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
                seq_printf(m, "total_%s %llu\n", memcg1_event_names[i],
-                          (u64)acc.events[i]);
+                          (u64)memcg_events(memcg, i));
 
        for (i = 0; i < NR_LRU_LISTS; i++)
                seq_printf(m, "total_%s %llu\n", mem_cgroup_lru_names[i],
-                          (u64)acc.lru_pages[i] * PAGE_SIZE);
+                          (u64)memcg_page_state(memcg, NR_LRU_BASE + i) *
+                          PAGE_SIZE);
 
 #ifdef CONFIG_DEBUG_VM
        {
@@ -3901,11 +3980,11 @@ struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb)
  */
 static unsigned long memcg_exact_page_state(struct mem_cgroup *memcg, int idx)
 {
-       long x = atomic_long_read(&memcg->stat[idx]);
+       long x = atomic_long_read(&memcg->vmstats[idx]);
        int cpu;
 
        for_each_online_cpu(cpu)
-               x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx];
+               x += per_cpu_ptr(memcg->vmstats_percpu, cpu)->stat[idx];
        if (x < 0)
                x = 0;
        return x;
@@ -4445,7 +4524,7 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg)
 
        for_each_node(node)
                free_mem_cgroup_per_node_info(memcg, node);
-       free_percpu(memcg->stat_cpu);
+       free_percpu(memcg->vmstats_percpu);
        kfree(memcg);
 }
 
@@ -4474,8 +4553,8 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
        if (memcg->id.id < 0)
                goto fail;
 
-       memcg->stat_cpu = alloc_percpu(struct mem_cgroup_stat_cpu);
-       if (!memcg->stat_cpu)
+       memcg->vmstats_percpu = alloc_percpu(struct memcg_vmstats_percpu);
+       if (!memcg->vmstats_percpu)
                goto fail;
 
        for_each_node(node)
@@ -5561,7 +5640,6 @@ static int memory_events_show(struct seq_file *m, void *v)
 static int memory_stat_show(struct seq_file *m, void *v)
 {
        struct mem_cgroup *memcg = mem_cgroup_from_seq(m);
-       struct accumulated_stats acc;
        int i;
 
        /*
@@ -5575,31 +5653,27 @@ static int memory_stat_show(struct seq_file *m, void *v)
         * Current memory state:
         */
 
-       memset(&acc, 0, sizeof(acc));
-       acc.stats_size = MEMCG_NR_STAT;
-       acc.events_size = NR_VM_EVENT_ITEMS;
-       accumulate_memcg_tree(memcg, &acc);
-
        seq_printf(m, "anon %llu\n",
-                  (u64)acc.stat[MEMCG_RSS] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, MEMCG_RSS) * PAGE_SIZE);
        seq_printf(m, "file %llu\n",
-                  (u64)acc.stat[MEMCG_CACHE] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, MEMCG_CACHE) * PAGE_SIZE);
        seq_printf(m, "kernel_stack %llu\n",
-                  (u64)acc.stat[MEMCG_KERNEL_STACK_KB] * 1024);
+                  (u64)memcg_page_state(memcg, MEMCG_KERNEL_STACK_KB) * 1024);
        seq_printf(m, "slab %llu\n",
-                  (u64)(acc.stat[NR_SLAB_RECLAIMABLE] +
-                        acc.stat[NR_SLAB_UNRECLAIMABLE]) * PAGE_SIZE);
+                  (u64)(memcg_page_state(memcg, NR_SLAB_RECLAIMABLE) +
+                        memcg_page_state(memcg, NR_SLAB_UNRECLAIMABLE)) *
+                  PAGE_SIZE);
        seq_printf(m, "sock %llu\n",
-                  (u64)acc.stat[MEMCG_SOCK] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, MEMCG_SOCK) * PAGE_SIZE);
 
        seq_printf(m, "shmem %llu\n",
-                  (u64)acc.stat[NR_SHMEM] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_SHMEM) * PAGE_SIZE);
        seq_printf(m, "file_mapped %llu\n",
-                  (u64)acc.stat[NR_FILE_MAPPED] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_FILE_MAPPED) * PAGE_SIZE);
        seq_printf(m, "file_dirty %llu\n",
-                  (u64)acc.stat[NR_FILE_DIRTY] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_FILE_DIRTY) * PAGE_SIZE);
        seq_printf(m, "file_writeback %llu\n",
-                  (u64)acc.stat[NR_WRITEBACK] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_WRITEBACK) * PAGE_SIZE);
 
        /*
         * TODO: We should eventually replace our own MEMCG_RSS_HUGE counter
@@ -5608,43 +5682,47 @@ static int memory_stat_show(struct seq_file *m, void *v)
         * where the page->mem_cgroup is set up and stable.
         */
        seq_printf(m, "anon_thp %llu\n",
-                  (u64)acc.stat[MEMCG_RSS_HUGE] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, MEMCG_RSS_HUGE) * PAGE_SIZE);
 
        for (i = 0; i < NR_LRU_LISTS; i++)
                seq_printf(m, "%s %llu\n", mem_cgroup_lru_names[i],
-                          (u64)acc.lru_pages[i] * PAGE_SIZE);
+                          (u64)memcg_page_state(memcg, NR_LRU_BASE + i) *
+                          PAGE_SIZE);
 
        seq_printf(m, "slab_reclaimable %llu\n",
-                  (u64)acc.stat[NR_SLAB_RECLAIMABLE] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_SLAB_RECLAIMABLE) *
+                  PAGE_SIZE);
        seq_printf(m, "slab_unreclaimable %llu\n",
-                  (u64)acc.stat[NR_SLAB_UNRECLAIMABLE] * PAGE_SIZE);
+                  (u64)memcg_page_state(memcg, NR_SLAB_UNRECLAIMABLE) *
+                  PAGE_SIZE);
 
        /* Accumulated memory events */
 
-       seq_printf(m, "pgfault %lu\n", acc.events[PGFAULT]);
-       seq_printf(m, "pgmajfault %lu\n", acc.events[PGMAJFAULT]);
+       seq_printf(m, "pgfault %lu\n", memcg_events(memcg, PGFAULT));
+       seq_printf(m, "pgmajfault %lu\n", memcg_events(memcg, PGMAJFAULT));
 
        seq_printf(m, "workingset_refault %lu\n",
-                  acc.stat[WORKINGSET_REFAULT]);
+                  memcg_page_state(memcg, WORKINGSET_REFAULT));
        seq_printf(m, "workingset_activate %lu\n",
-                  acc.stat[WORKINGSET_ACTIVATE]);
+                  memcg_page_state(memcg, WORKINGSET_ACTIVATE));
        seq_printf(m, "workingset_nodereclaim %lu\n",
-                  acc.stat[WORKINGSET_NODERECLAIM]);
-
-       seq_printf(m, "pgrefill %lu\n", acc.events[PGREFILL]);
-       seq_printf(m, "pgscan %lu\n", acc.events[PGSCAN_KSWAPD] +
-                  acc.events[PGSCAN_DIRECT]);
-       seq_printf(m, "pgsteal %lu\n", acc.events[PGSTEAL_KSWAPD] +
-                  acc.events[PGSTEAL_DIRECT]);
-       seq_printf(m, "pgactivate %lu\n", acc.events[PGACTIVATE]);
-       seq_printf(m, "pgdeactivate %lu\n", acc.events[PGDEACTIVATE]);
-       seq_printf(m, "pglazyfree %lu\n", acc.events[PGLAZYFREE]);
-       seq_printf(m, "pglazyfreed %lu\n", acc.events[PGLAZYFREED]);
+                  memcg_page_state(memcg, WORKINGSET_NODERECLAIM));
+
+       seq_printf(m, "pgrefill %lu\n", memcg_events(memcg, PGREFILL));
+       seq_printf(m, "pgscan %lu\n", memcg_events(memcg, PGSCAN_KSWAPD) +
+                  memcg_events(memcg, PGSCAN_DIRECT));
+       seq_printf(m, "pgsteal %lu\n", memcg_events(memcg, PGSTEAL_KSWAPD) +
+                  memcg_events(memcg, PGSTEAL_DIRECT));
+       seq_printf(m, "pgactivate %lu\n", memcg_events(memcg, PGACTIVATE));
+       seq_printf(m, "pgdeactivate %lu\n", memcg_events(memcg, PGDEACTIVATE));
+       seq_printf(m, "pglazyfree %lu\n", memcg_events(memcg, PGLAZYFREE));
+       seq_printf(m, "pglazyfreed %lu\n", memcg_events(memcg, PGLAZYFREED));
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-       seq_printf(m, "thp_fault_alloc %lu\n", acc.events[THP_FAULT_ALLOC]);
+       seq_printf(m, "thp_fault_alloc %lu\n",
+                  memcg_events(memcg, THP_FAULT_ALLOC));
        seq_printf(m, "thp_collapse_alloc %lu\n",
-                  acc.events[THP_COLLAPSE_ALLOC]);
+                  memcg_events(memcg, THP_COLLAPSE_ALLOC));
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
        return 0;
@@ -6080,7 +6158,7 @@ static void uncharge_batch(const struct uncharge_gather *ug)
        __mod_memcg_state(ug->memcg, MEMCG_RSS_HUGE, -ug->nr_huge);
        __mod_memcg_state(ug->memcg, NR_SHMEM, -ug->nr_shmem);
        __count_memcg_events(ug->memcg, PGPGOUT, ug->pgpgout);
-       __this_cpu_add(ug->memcg->stat_cpu->nr_page_events, nr_pages);
+       __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, nr_pages);
        memcg_check_events(ug->memcg, ug->dummy_page);
        local_irq_restore(flags);
 
index 96f1d47..ddf20bd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/memory.c
  *
index 6c0c4f4..e096c98 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/memory_hotplug.c
  *
@@ -39,6 +40,7 @@
 #include <asm/tlbflush.h>
 
 #include "internal.h"
+#include "shuffle.h"
 
 /*
  * online_page_callback contains pointer to current page onlining function.
@@ -891,6 +893,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
        zone->zone_pgdat->node_present_pages += onlined_pages;
        pgdat_resize_unlock(zone->zone_pgdat, &flags);
 
+       shuffle_zone(zone);
+
        if (onlined_pages) {
                node_states_set_node(nid, &arg);
                if (need_zonelists_rebuild)
index 218099b..c3f058b 100644 (file)
@@ -169,6 +169,22 @@ out:
        return 0;
 }
 
+static inline bool can_do_mincore(struct vm_area_struct *vma)
+{
+       if (vma_is_anonymous(vma))
+               return true;
+       if (!vma->vm_file)
+               return false;
+       /*
+        * Reveal pagecache information only for non-anonymous mappings that
+        * correspond to the files the calling process could (if tried) open
+        * for writing; otherwise we'd be including shared non-exclusive
+        * mappings, which opens a side channel.
+        */
+       return inode_owner_or_capable(file_inode(vma->vm_file)) ||
+               inode_permission(file_inode(vma->vm_file), MAY_WRITE) == 0;
+}
+
 /*
  * Do a chunk of "sys_mincore()". We've already checked
  * all the arguments, we hold the mmap semaphore: we should
@@ -189,8 +205,13 @@ static long do_mincore(unsigned long addr, unsigned long pages, unsigned char *v
        vma = find_vma(current->mm, addr);
        if (!vma || addr < vma->vm_start)
                return -ENOMEM;
-       mincore_walk.mm = vma->vm_mm;
        end = min(vma->vm_end, addr + (pages << PAGE_SHIFT));
+       if (!can_do_mincore(vma)) {
+               unsigned long pages = DIV_ROUND_UP(end - addr, PAGE_SIZE);
+               memset(vec, 1, pages);
+               return pages;
+       }
+       mincore_walk.mm = vma->vm_mm;
        err = walk_page_range(addr, end, &mincore_walk);
        if (err < 0)
                return err;
index 3391710..5c91838 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm_init.c - Memory initialisation verification and debugging
  *
index bd7b9f2..7e8c3e8 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm/mmap.c
  *
@@ -2735,9 +2736,17 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
                return -EINVAL;
 
        len = PAGE_ALIGN(len);
+       end = start + len;
        if (len == 0)
                return -EINVAL;
 
+       /*
+        * arch_unmap() might do unmaps itself.  It must be called
+        * and finish any rbtree manipulation before this code
+        * runs and also starts to manipulate the rbtree.
+        */
+       arch_unmap(mm, start, end);
+
        /* Find the first overlapping VMA */
        vma = find_vma(mm, start);
        if (!vma)
@@ -2746,7 +2755,6 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
        /* we have  start < vma->vm_end  */
 
        /* if it doesn't overlap, we have nothing.. */
-       end = start + len;
        if (vma->vm_start >= end)
                return 0;
 
@@ -2816,12 +2824,6 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
        /* Detach vmas from rbtree */
        detach_vmas_to_be_unmapped(mm, vma, prev, end);
 
-       /*
-        * mpx unmap needs to be called with mmap_sem held for write.
-        * It is safe to call it before unmap_region().
-        */
-       arch_unmap(mm, vma, start, end);
-
        if (downgrade)
                downgrade_write(&mm->mmap_sem);
 
index b492fd1..d8c02fb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/nommu.c
  *
index 539c91d..5a58778 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/oom_kill.c
  * 
index 0765648..bdbe8b6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm/page-writeback.c
  *
index f2f3fb4..d66bc8a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/page_alloc.c
  *
@@ -43,6 +44,7 @@
 #include <linux/mempolicy.h>
 #include <linux/memremap.h>
 #include <linux/stop_machine.h>
+#include <linux/random.h>
 #include <linux/sort.h>
 #include <linux/pfn.h>
 #include <linux/backing-dev.h>
@@ -72,6 +74,7 @@
 #include <asm/tlbflush.h>
 #include <asm/div64.h>
 #include "internal.h"
+#include "shuffle.h"
 
 /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
 static DEFINE_MUTEX(pcp_batch_high_lock);
@@ -755,12 +758,6 @@ static inline void set_page_order(struct page *page, unsigned int order)
        __SetPageBuddy(page);
 }
 
-static inline void rmv_page_order(struct page *page)
-{
-       __ClearPageBuddy(page);
-       set_page_private(page, 0);
-}
-
 /*
  * This function checks whether a page is free && is the buddy
  * we can coalesce a page and its buddy if
@@ -918,13 +915,10 @@ continue_merging:
                 * Our buddy is free or it is CONFIG_DEBUG_PAGEALLOC guard page,
                 * merge with it and move up one order.
                 */
-               if (page_is_guard(buddy)) {
+               if (page_is_guard(buddy))
                        clear_page_guard(zone, buddy, order, migratetype);
-               } else {
-                       list_del(&buddy->lru);
-                       zone->free_area[order].nr_free--;
-                       rmv_page_order(buddy);
-               }
+               else
+                       del_page_from_free_area(buddy, &zone->free_area[order]);
                combined_pfn = buddy_pfn & pfn;
                page = page + (combined_pfn - pfn);
                pfn = combined_pfn;
@@ -966,7 +960,8 @@ done_merging:
         * so it's less likely to be used soon and more likely to be merged
         * as a higher order page
         */
-       if ((order < MAX_ORDER-2) && pfn_valid_within(buddy_pfn)) {
+       if ((order < MAX_ORDER-2) && pfn_valid_within(buddy_pfn)
+                       && !is_shuffle_order(order)) {
                struct page *higher_page, *higher_buddy;
                combined_pfn = buddy_pfn & pfn;
                higher_page = page + (combined_pfn - pfn);
@@ -974,15 +969,18 @@ done_merging:
                higher_buddy = higher_page + (buddy_pfn - combined_pfn);
                if (pfn_valid_within(buddy_pfn) &&
                    page_is_buddy(higher_page, higher_buddy, order + 1)) {
-                       list_add_tail(&page->lru,
-                               &zone->free_area[order].free_list[migratetype]);
-                       goto out;
+                       add_to_free_area_tail(page, &zone->free_area[order],
+                                             migratetype);
+                       return;
                }
        }
 
-       list_add(&page->lru, &zone->free_area[order].free_list[migratetype]);
-out:
-       zone->free_area[order].nr_free++;
+       if (is_shuffle_order(order))
+               add_to_free_area_random(page, &zone->free_area[order],
+                               migratetype);
+       else
+               add_to_free_area(page, &zone->free_area[order], migratetype);
+
 }
 
 /*
@@ -1874,9 +1872,9 @@ _deferred_grow_zone(struct zone *zone, unsigned int order)
 void __init page_alloc_init_late(void)
 {
        struct zone *zone;
+       int nid;
 
 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
-       int nid;
 
        /* There will be num_node_state(N_MEMORY) threads */
        atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));
@@ -1900,6 +1898,9 @@ void __init page_alloc_init_late(void)
        /* Discard memblock private memory */
        memblock_discard();
 
+       for_each_node_state(nid, N_MEMORY)
+               shuffle_free_memory(NODE_DATA(nid));
+
        for_each_populated_zone(zone)
                set_zone_contiguous(zone);
 }
@@ -1970,8 +1971,7 @@ static inline void expand(struct zone *zone, struct page *page,
                if (set_page_guard(zone, &page[size], high, migratetype))
                        continue;
 
-               list_add(&page[size].lru, &area->free_list[migratetype]);
-               area->nr_free++;
+               add_to_free_area(&page[size], area, migratetype);
                set_page_order(&page[size], high);
        }
 }
@@ -1986,7 +1986,7 @@ static void check_new_page_bad(struct page *page)
        if (unlikely(page->mapping != NULL))
                bad_reason = "non-NULL mapping";
        if (unlikely(page_ref_count(page) != 0))
-               bad_reason = "nonzero _count";
+               bad_reason = "nonzero _refcount";
        if (unlikely(page->flags & __PG_HWPOISON)) {
                bad_reason = "HWPoisoned (hardware-corrupted)";
                bad_flags = __PG_HWPOISON;
@@ -2113,13 +2113,10 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
        /* Find a page of the appropriate size in the preferred list */
        for (current_order = order; current_order < MAX_ORDER; ++current_order) {
                area = &(zone->free_area[current_order]);
-               page = list_first_entry_or_null(&area->free_list[migratetype],
-                                                       struct page, lru);
+               page = get_page_from_free_area(area, migratetype);
                if (!page)
                        continue;
-               list_del(&page->lru);
-               rmv_page_order(page);
-               area->nr_free--;
+               del_page_from_free_area(page, area);
                expand(zone, page, order, current_order, area, migratetype);
                set_pcppage_migratetype(page, migratetype);
                return page;
@@ -2205,8 +2202,7 @@ static int move_freepages(struct zone *zone,
                }
 
                order = page_order(page);
-               list_move(&page->lru,
-                         &zone->free_area[order].free_list[migratetype]);
+               move_to_free_area(page, &zone->free_area[order], migratetype);
                page += 1 << order;
                pages_moved += 1 << order;
        }
@@ -2394,7 +2390,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page,
 
 single_page:
        area = &zone->free_area[current_order];
-       list_move(&page->lru, &area->free_list[start_type]);
+       move_to_free_area(page, area, start_type);
 }
 
 /*
@@ -2418,7 +2414,7 @@ int find_suitable_fallback(struct free_area *area, unsigned int order,
                if (fallback_mt == MIGRATE_TYPES)
                        break;
 
-               if (list_empty(&area->free_list[fallback_mt]))
+               if (free_area_empty(area, fallback_mt))
                        continue;
 
                if (can_steal_fallback(order, migratetype))
@@ -2505,9 +2501,7 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac,
                for (order = 0; order < MAX_ORDER; order++) {
                        struct free_area *area = &(zone->free_area[order]);
 
-                       page = list_first_entry_or_null(
-                                       &area->free_list[MIGRATE_HIGHATOMIC],
-                                       struct page, lru);
+                       page = get_page_from_free_area(area, MIGRATE_HIGHATOMIC);
                        if (!page)
                                continue;
 
@@ -2630,8 +2624,7 @@ find_smallest:
        VM_BUG_ON(current_order == MAX_ORDER);
 
 do_steal:
-       page = list_first_entry(&area->free_list[fallback_mt],
-                                                       struct page, lru);
+       page = get_page_from_free_area(area, fallback_mt);
 
        steal_suitable_fallback(zone, page, alloc_flags, start_migratetype,
                                                                can_steal);
@@ -3068,6 +3061,7 @@ EXPORT_SYMBOL_GPL(split_page);
 
 int __isolate_free_page(struct page *page, unsigned int order)
 {
+       struct free_area *area = &page_zone(page)->free_area[order];
        unsigned long watermark;
        struct zone *zone;
        int mt;
@@ -3092,9 +3086,8 @@ int __isolate_free_page(struct page *page, unsigned int order)
        }
 
        /* Remove page from free list */
-       list_del(&page->lru);
-       zone->free_area[order].nr_free--;
-       rmv_page_order(page);
+
+       del_page_from_free_area(page, area);
 
        /*
         * Set the pageblock if the isolated page is at least half of a
@@ -3391,13 +3384,13 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
                        continue;
 
                for (mt = 0; mt < MIGRATE_PCPTYPES; mt++) {
-                       if (!list_empty(&area->free_list[mt]))
+                       if (!free_area_empty(area, mt))
                                return true;
                }
 
 #ifdef CONFIG_CMA
                if ((alloc_flags & ALLOC_CMA) &&
-                   !list_empty(&area->free_list[MIGRATE_CMA])) {
+                   !free_area_empty(area, MIGRATE_CMA)) {
                        return true;
                }
 #endif
@@ -5324,7 +5317,7 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 
                        types[order] = 0;
                        for (type = 0; type < MIGRATE_TYPES; type++) {
-                               if (!list_empty(&area->free_list[type]))
+                               if (!free_area_empty(area, type))
                                        types[order] |= 1 << type;
                        }
                }
@@ -8497,9 +8490,7 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
                pr_info("remove from free list %lx %d %lx\n",
                        pfn, 1 << order, end_pfn);
 #endif
-               list_del(&page->lru);
-               rmv_page_order(page);
-               zone->free_area[order].nr_free--;
+               del_page_from_free_area(page, &zone->free_area[order]);
                for (i = 0; i < (1 << order); i++)
                        SetPageReserved((page+i));
                pfn += (1 << order);
index a459365..2fe72cd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm/readahead.c - address_space-level file readahead.
  *
diff --git a/mm/shuffle.c b/mm/shuffle.c
new file mode 100644 (file)
index 0000000..3ce1248
--- /dev/null
@@ -0,0 +1,207 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/mmzone.h>
+#include <linux/random.h>
+#include <linux/moduleparam.h>
+#include "internal.h"
+#include "shuffle.h"
+
+DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
+static unsigned long shuffle_state __ro_after_init;
+
+/*
+ * Depending on the architecture, module parameter parsing may run
+ * before, or after the cache detection. SHUFFLE_FORCE_DISABLE prevents,
+ * or reverts the enabling of the shuffle implementation. SHUFFLE_ENABLE
+ * attempts to turn on the implementation, but aborts if it finds
+ * SHUFFLE_FORCE_DISABLE already set.
+ */
+__meminit void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
+{
+       if (ctl == SHUFFLE_FORCE_DISABLE)
+               set_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state);
+
+       if (test_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state)) {
+               if (test_and_clear_bit(SHUFFLE_ENABLE, &shuffle_state))
+                       static_branch_disable(&page_alloc_shuffle_key);
+       } else if (ctl == SHUFFLE_ENABLE
+                       && !test_and_set_bit(SHUFFLE_ENABLE, &shuffle_state))
+               static_branch_enable(&page_alloc_shuffle_key);
+}
+
+static bool shuffle_param;
+extern int shuffle_show(char *buffer, const struct kernel_param *kp)
+{
+       return sprintf(buffer, "%c\n", test_bit(SHUFFLE_ENABLE, &shuffle_state)
+                       ? 'Y' : 'N');
+}
+
+static __meminit int shuffle_store(const char *val,
+               const struct kernel_param *kp)
+{
+       int rc = param_set_bool(val, kp);
+
+       if (rc < 0)
+               return rc;
+       if (shuffle_param)
+               page_alloc_shuffle(SHUFFLE_ENABLE);
+       else
+               page_alloc_shuffle(SHUFFLE_FORCE_DISABLE);
+       return 0;
+}
+module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400);
+
+/*
+ * For two pages to be swapped in the shuffle, they must be free (on a
+ * 'free_area' lru), have the same order, and have the same migratetype.
+ */
+static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
+{
+       struct page *page;
+
+       /*
+        * Given we're dealing with randomly selected pfns in a zone we
+        * need to ask questions like...
+        */
+
+       /* ...is the pfn even in the memmap? */
+       if (!pfn_valid_within(pfn))
+               return NULL;
+
+       /* ...is the pfn in a present section or a hole? */
+       if (!pfn_present(pfn))
+               return NULL;
+
+       /* ...is the page free and currently on a free_area list? */
+       page = pfn_to_page(pfn);
+       if (!PageBuddy(page))
+               return NULL;
+
+       /*
+        * ...is the page on the same list as the page we will
+        * shuffle it with?
+        */
+       if (page_order(page) != order)
+               return NULL;
+
+       return page;
+}
+
+/*
+ * Fisher-Yates shuffle the freelist which prescribes iterating through an
+ * array, pfns in this case, and randomly swapping each entry with another in
+ * the span, end_pfn - start_pfn.
+ *
+ * To keep the implementation simple it does not attempt to correct for sources
+ * of bias in the distribution, like modulo bias or pseudo-random number
+ * generator bias. I.e. the expectation is that this shuffling raises the bar
+ * for attacks that exploit the predictability of page allocations, but need not
+ * be a perfect shuffle.
+ */
+#define SHUFFLE_RETRY 10
+void __meminit __shuffle_zone(struct zone *z)
+{
+       unsigned long i, flags;
+       unsigned long start_pfn = z->zone_start_pfn;
+       unsigned long end_pfn = zone_end_pfn(z);
+       const int order = SHUFFLE_ORDER;
+       const int order_pages = 1 << order;
+
+       spin_lock_irqsave(&z->lock, flags);
+       start_pfn = ALIGN(start_pfn, order_pages);
+       for (i = start_pfn; i < end_pfn; i += order_pages) {
+               unsigned long j;
+               int migratetype, retry;
+               struct page *page_i, *page_j;
+
+               /*
+                * We expect page_i, in the sub-range of a zone being added
+                * (@start_pfn to @end_pfn), to more likely be valid compared to
+                * page_j randomly selected in the span @zone_start_pfn to
+                * @spanned_pages.
+                */
+               page_i = shuffle_valid_page(i, order);
+               if (!page_i)
+                       continue;
+
+               for (retry = 0; retry < SHUFFLE_RETRY; retry++) {
+                       /*
+                        * Pick a random order aligned page in the zone span as
+                        * a swap target. If the selected pfn is a hole, retry
+                        * up to SHUFFLE_RETRY attempts find a random valid pfn
+                        * in the zone.
+                        */
+                       j = z->zone_start_pfn +
+                               ALIGN_DOWN(get_random_long() % z->spanned_pages,
+                                               order_pages);
+                       page_j = shuffle_valid_page(j, order);
+                       if (page_j && page_j != page_i)
+                               break;
+               }
+               if (retry >= SHUFFLE_RETRY) {
+                       pr_debug("%s: failed to swap %#lx\n", __func__, i);
+                       continue;
+               }
+
+               /*
+                * Each migratetype corresponds to its own list, make sure the
+                * types match otherwise we're moving pages to lists where they
+                * do not belong.
+                */
+               migratetype = get_pageblock_migratetype(page_i);
+               if (get_pageblock_migratetype(page_j) != migratetype) {
+                       pr_debug("%s: migratetype mismatch %#lx\n", __func__, i);
+                       continue;
+               }
+
+               list_swap(&page_i->lru, &page_j->lru);
+
+               pr_debug("%s: swap: %#lx -> %#lx\n", __func__, i, j);
+
+               /* take it easy on the zone lock */
+               if ((i % (100 * order_pages)) == 0) {
+                       spin_unlock_irqrestore(&z->lock, flags);
+                       cond_resched();
+                       spin_lock_irqsave(&z->lock, flags);
+               }
+       }
+       spin_unlock_irqrestore(&z->lock, flags);
+}
+
+/**
+ * shuffle_free_memory - reduce the predictability of the page allocator
+ * @pgdat: node page data
+ */
+void __meminit __shuffle_free_memory(pg_data_t *pgdat)
+{
+       struct zone *z;
+
+       for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
+               shuffle_zone(z);
+}
+
+void add_to_free_area_random(struct page *page, struct free_area *area,
+               int migratetype)
+{
+       static u64 rand;
+       static u8 rand_bits;
+
+       /*
+        * The lack of locking is deliberate. If 2 threads race to
+        * update the rand state it just adds to the entropy.
+        */
+       if (rand_bits == 0) {
+               rand_bits = 64;
+               rand = get_random_u64();
+       }
+
+       if (rand & 1)
+               add_to_free_area(page, area, migratetype);
+       else
+               add_to_free_area_tail(page, area, migratetype);
+       rand_bits--;
+       rand >>= 1;
+}
diff --git a/mm/shuffle.h b/mm/shuffle.h
new file mode 100644 (file)
index 0000000..777a257
--- /dev/null
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2018 Intel Corporation. All rights reserved.
+#ifndef _MM_SHUFFLE_H
+#define _MM_SHUFFLE_H
+#include <linux/jump_label.h>
+
+/*
+ * SHUFFLE_ENABLE is called from the command line enabling path, or by
+ * platform-firmware enabling that indicates the presence of a
+ * direct-mapped memory-side-cache. SHUFFLE_FORCE_DISABLE is called from
+ * the command line path and overrides any previous or future
+ * SHUFFLE_ENABLE.
+ */
+enum mm_shuffle_ctl {
+       SHUFFLE_ENABLE,
+       SHUFFLE_FORCE_DISABLE,
+};
+
+#define SHUFFLE_ORDER (MAX_ORDER-1)
+
+#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
+DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
+extern void page_alloc_shuffle(enum mm_shuffle_ctl ctl);
+extern void __shuffle_free_memory(pg_data_t *pgdat);
+static inline void shuffle_free_memory(pg_data_t *pgdat)
+{
+       if (!static_branch_unlikely(&page_alloc_shuffle_key))
+               return;
+       __shuffle_free_memory(pgdat);
+}
+
+extern void __shuffle_zone(struct zone *z);
+static inline void shuffle_zone(struct zone *z)
+{
+       if (!static_branch_unlikely(&page_alloc_shuffle_key))
+               return;
+       __shuffle_zone(z);
+}
+
+static inline bool is_shuffle_order(int order)
+{
+       if (!static_branch_unlikely(&page_alloc_shuffle_key))
+               return false;
+       return order >= SHUFFLE_ORDER;
+}
+#else
+static inline void shuffle_free_memory(pg_data_t *pgdat)
+{
+}
+
+static inline void shuffle_zone(struct zone *z)
+{
+}
+
+static inline void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
+{
+}
+
+static inline bool is_shuffle_order(int order)
+{
+       return false;
+}
+#endif
+#endif /* _MM_SHUFFLE_H */
index 2915d91..f7117ad 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -362,29 +362,6 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp)
 
 #endif
 
-#ifdef CONFIG_DEBUG_SLAB_LEAK
-
-static inline bool is_store_user_clean(struct kmem_cache *cachep)
-{
-       return atomic_read(&cachep->store_user_clean) == 1;
-}
-
-static inline void set_store_user_clean(struct kmem_cache *cachep)
-{
-       atomic_set(&cachep->store_user_clean, 1);
-}
-
-static inline void set_store_user_dirty(struct kmem_cache *cachep)
-{
-       if (is_store_user_clean(cachep))
-               atomic_set(&cachep->store_user_clean, 0);
-}
-
-#else
-static inline void set_store_user_dirty(struct kmem_cache *cachep) {}
-
-#endif
-
 /*
  * Do not go above this order unless 0 objects fit into the slab or
  * overridden on the command line.
@@ -2552,11 +2529,6 @@ static void *slab_get_obj(struct kmem_cache *cachep, struct page *page)
        objp = index_to_obj(cachep, page, get_free_obj(page, page->active));
        page->active++;
 
-#if DEBUG
-       if (cachep->flags & SLAB_STORE_USER)
-               set_store_user_dirty(cachep);
-#endif
-
        return objp;
 }
 
@@ -2762,10 +2734,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
                *dbg_redzone1(cachep, objp) = RED_INACTIVE;
                *dbg_redzone2(cachep, objp) = RED_INACTIVE;
        }
-       if (cachep->flags & SLAB_STORE_USER) {
-               set_store_user_dirty(cachep);
+       if (cachep->flags & SLAB_STORE_USER)
                *dbg_userword(cachep, objp) = (void *)caller;
-       }
 
        objnr = obj_to_index(cachep, page, objp);
 
@@ -4184,200 +4154,6 @@ ssize_t slabinfo_write(struct file *file, const char __user *buffer,
        return res;
 }
 
-#ifdef CONFIG_DEBUG_SLAB_LEAK
-
-static inline int add_caller(unsigned long *n, unsigned long v)
-{
-       unsigned long *p;
-       int l;
-       if (!v)
-               return 1;
-       l = n[1];
-       p = n + 2;
-       while (l) {
-               int i = l/2;
-               unsigned long *q = p + 2 * i;
-               if (*q == v) {
-                       q[1]++;
-                       return 1;
-               }
-               if (*q > v) {
-                       l = i;
-               } else {
-                       p = q + 2;
-                       l -= i + 1;
-               }
-       }
-       if (++n[1] == n[0])
-               return 0;
-       memmove(p + 2, p, n[1] * 2 * sizeof(unsigned long) - ((void *)p - (void *)n));
-       p[0] = v;
-       p[1] = 1;
-       return 1;
-}
-
-static void handle_slab(unsigned long *n, struct kmem_cache *c,
-                                               struct page *page)
-{
-       void *p;
-       int i, j;
-       unsigned long v;
-
-       if (n[0] == n[1])
-               return;
-       for (i = 0, p = page->s_mem; i < c->num; i++, p += c->size) {
-               bool active = true;
-
-               for (j = page->active; j < c->num; j++) {
-                       if (get_free_obj(page, j) == i) {
-                               active = false;
-                               break;
-                       }
-               }
-
-               if (!active)
-                       continue;
-
-               /*
-                * probe_kernel_read() is used for DEBUG_PAGEALLOC. page table
-                * mapping is established when actual object allocation and
-                * we could mistakenly access the unmapped object in the cpu
-                * cache.
-                */
-               if (probe_kernel_read(&v, dbg_userword(c, p), sizeof(v)))
-                       continue;
-
-               if (!add_caller(n, v))
-                       return;
-       }
-}
-
-static void show_symbol(struct seq_file *m, unsigned long address)
-{
-#ifdef CONFIG_KALLSYMS
-       unsigned long offset, size;
-       char modname[MODULE_NAME_LEN], name[KSYM_NAME_LEN];
-
-       if (lookup_symbol_attrs(address, &size, &offset, modname, name) == 0) {
-               seq_printf(m, "%s+%#lx/%#lx", name, offset, size);
-               if (modname[0])
-                       seq_printf(m, " [%s]", modname);
-               return;
-       }
-#endif
-       seq_printf(m, "%px", (void *)address);
-}
-
-static int leaks_show(struct seq_file *m, void *p)
-{
-       struct kmem_cache *cachep = list_entry(p, struct kmem_cache,
-                                              root_caches_node);
-       struct page *page;
-       struct kmem_cache_node *n;
-       const char *name;
-       unsigned long *x = m->private;
-       int node;
-       int i;
-
-       if (!(cachep->flags & SLAB_STORE_USER))
-               return 0;
-       if (!(cachep->flags & SLAB_RED_ZONE))
-               return 0;
-
-       /*
-        * Set store_user_clean and start to grab stored user information
-        * for all objects on this cache. If some alloc/free requests comes
-        * during the processing, information would be wrong so restart
-        * whole processing.
-        */
-       do {
-               drain_cpu_caches(cachep);
-               /*
-                * drain_cpu_caches() could make kmemleak_object and
-                * debug_objects_cache dirty, so reset afterwards.
-                */
-               set_store_user_clean(cachep);
-
-               x[1] = 0;
-
-               for_each_kmem_cache_node(cachep, node, n) {
-
-                       check_irq_on();
-                       spin_lock_irq(&n->list_lock);
-
-                       list_for_each_entry(page, &n->slabs_full, slab_list)
-                               handle_slab(x, cachep, page);
-                       list_for_each_entry(page, &n->slabs_partial, slab_list)
-                               handle_slab(x, cachep, page);
-                       spin_unlock_irq(&n->list_lock);
-               }
-       } while (!is_store_user_clean(cachep));
-
-       name = cachep->name;
-       if (x[0] == x[1]) {
-               /* Increase the buffer size */
-               mutex_unlock(&slab_mutex);
-               m->private = kcalloc(x[0] * 4, sizeof(unsigned long),
-                                    GFP_KERNEL);
-               if (!m->private) {
-                       /* Too bad, we are really out */
-                       m->private = x;
-                       mutex_lock(&slab_mutex);
-                       return -ENOMEM;
-               }
-               *(unsigned long *)m->private = x[0] * 2;
-               kfree(x);
-               mutex_lock(&slab_mutex);
-               /* Now make sure this entry will be retried */
-               m->count = m->size;
-               return 0;
-       }
-       for (i = 0; i < x[1]; i++) {
-               seq_printf(m, "%s: %lu ", name, x[2*i+3]);
-               show_symbol(m, x[2*i+2]);
-               seq_putc(m, '\n');
-       }
-
-       return 0;
-}
-
-static const struct seq_operations slabstats_op = {
-       .start = slab_start,
-       .next = slab_next,
-       .stop = slab_stop,
-       .show = leaks_show,
-};
-
-static int slabstats_open(struct inode *inode, struct file *file)
-{
-       unsigned long *n;
-
-       n = __seq_open_private(file, &slabstats_op, PAGE_SIZE);
-       if (!n)
-               return -ENOMEM;
-
-       *n = PAGE_SIZE / (2 * sizeof(unsigned long));
-
-       return 0;
-}
-
-static const struct file_operations proc_slabstats_operations = {
-       .open           = slabstats_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = seq_release_private,
-};
-#endif
-
-static int __init slab_proc_init(void)
-{
-#ifdef CONFIG_DEBUG_SLAB_LEAK
-       proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations);
-#endif
-       return 0;
-}
-module_init(slab_proc_init);
-
 #ifdef CONFIG_HARDENED_USERCOPY
 /*
  * Rejects incorrectly sized objects and objects that are to be copied
index 3a75722..7ede3ed 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/swap.c
  *
index cf63b5f..596ac98 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/swapfile.c
  *
index b7d3c99..8563339 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mm/truncate.c - code for taking down pages from address_spaces
  *
index e2e4f8c..91682a2 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/string.h>
index e5e9e1f..233af69 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/vmalloc.c
  *
@@ -32,6 +33,7 @@
 #include <linux/compiler.h>
 #include <linux/llist.h>
 #include <linux/bitops.h>
+#include <linux/rbtree_augmented.h>
 
 #include <linux/uaccess.h>
 #include <asm/tlbflush.h>
@@ -324,6 +326,9 @@ EXPORT_SYMBOL(vmalloc_to_pfn);
 
 /*** Global kva allocator ***/
 
+#define DEBUG_AUGMENT_PROPAGATE_CHECK 0
+#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 0
+
 #define VM_LAZY_FREE   0x02
 #define VM_VM_AREA     0x04
 
@@ -332,14 +337,67 @@ static DEFINE_SPINLOCK(vmap_area_lock);
 LIST_HEAD(vmap_area_list);
 static LLIST_HEAD(vmap_purge_list);
 static struct rb_root vmap_area_root = RB_ROOT;
+static bool vmap_initialized __read_mostly;
+
+/*
+ * This kmem_cache is used for vmap_area objects. Instead of
+ * allocating from slab we reuse an object from this cache to
+ * make things faster. Especially in "no edge" splitting of
+ * free block.
+ */
+static struct kmem_cache *vmap_area_cachep;
+
+/*
+ * This linked list is used in pair with free_vmap_area_root.
+ * It gives O(1) access to prev/next to perform fast coalescing.
+ */
+static LIST_HEAD(free_vmap_area_list);
 
-/* The vmap cache globals are protected by vmap_area_lock */
-static struct rb_node *free_vmap_cache;
-static unsigned long cached_hole_size;
-static unsigned long cached_vstart;
-static unsigned long cached_align;
+/*
+ * This augment red-black tree represents the free vmap space.
+ * All vmap_area objects in this tree are sorted by va->va_start
+ * address. It is used for allocation and merging when a vmap
+ * object is released.
+ *
+ * Each vmap_area node contains a maximum available free block
+ * of its sub-tree, right or left. Therefore it is possible to
+ * find a lowest match of free area.
+ */
+static struct rb_root free_vmap_area_root = RB_ROOT;
 
-static unsigned long vmap_area_pcpu_hole;
+static __always_inline unsigned long
+va_size(struct vmap_area *va)
+{
+       return (va->va_end - va->va_start);
+}
+
+static __always_inline unsigned long
+get_subtree_max_size(struct rb_node *node)
+{
+       struct vmap_area *va;
+
+       va = rb_entry_safe(node, struct vmap_area, rb_node);
+       return va ? va->subtree_max_size : 0;
+}
+
+/*
+ * Gets called when remove the node and rotate.
+ */
+static __always_inline unsigned long
+compute_subtree_max_size(struct vmap_area *va)
+{
+       return max3(va_size(va),
+               get_subtree_max_size(va->rb_node.rb_left),
+               get_subtree_max_size(va->rb_node.rb_right));
+}
+
+RB_DECLARE_CALLBACKS(static, free_vmap_area_rb_augment_cb,
+       struct vmap_area, rb_node, unsigned long, subtree_max_size,
+       compute_subtree_max_size)
+
+static void purge_vmap_area_lazy(void);
+static BLOCKING_NOTIFIER_HEAD(vmap_notify_list);
+static unsigned long lazy_max_pages(void);
 
 static struct vmap_area *__find_vmap_area(unsigned long addr)
 {
@@ -360,41 +418,610 @@ static struct vmap_area *__find_vmap_area(unsigned long addr)
        return NULL;
 }
 
-static void __insert_vmap_area(struct vmap_area *va)
-{
-       struct rb_node **p = &vmap_area_root.rb_node;
-       struct rb_node *parent = NULL;
-       struct rb_node *tmp;
+/*
+ * This function returns back addresses of parent node
+ * and its left or right link for further processing.
+ */
+static __always_inline struct rb_node **
+find_va_links(struct vmap_area *va,
+       struct rb_root *root, struct rb_node *from,
+       struct rb_node **parent)
+{
+       struct vmap_area *tmp_va;
+       struct rb_node **link;
+
+       if (root) {
+               link = &root->rb_node;
+               if (unlikely(!*link)) {
+                       *parent = NULL;
+                       return link;
+               }
+       } else {
+               link = &from;
+       }
 
-       while (*p) {
-               struct vmap_area *tmp_va;
+       /*
+        * Go to the bottom of the tree. When we hit the last point
+        * we end up with parent rb_node and correct direction, i name
+        * it link, where the new va->rb_node will be attached to.
+        */
+       do {
+               tmp_va = rb_entry(*link, struct vmap_area, rb_node);
 
-               parent = *p;
-               tmp_va = rb_entry(parent, struct vmap_area, rb_node);
-               if (va->va_start < tmp_va->va_end)
-                       p = &(*p)->rb_left;
-               else if (va->va_end > tmp_va->va_start)
-                       p = &(*p)->rb_right;
+               /*
+                * During the traversal we also do some sanity check.
+                * Trigger the BUG() if there are sides(left/right)
+                * or full overlaps.
+                */
+               if (va->va_start < tmp_va->va_end &&
+                               va->va_end <= tmp_va->va_start)
+                       link = &(*link)->rb_left;
+               else if (va->va_end > tmp_va->va_start &&
+                               va->va_start >= tmp_va->va_end)
+                       link = &(*link)->rb_right;
                else
                        BUG();
+       } while (*link);
+
+       *parent = &tmp_va->rb_node;
+       return link;
+}
+
+static __always_inline struct list_head *
+get_va_next_sibling(struct rb_node *parent, struct rb_node **link)
+{
+       struct list_head *list;
+
+       if (unlikely(!parent))
+               /*
+                * The red-black tree where we try to find VA neighbors
+                * before merging or inserting is empty, i.e. it means
+                * there is no free vmap space. Normally it does not
+                * happen but we handle this case anyway.
+                */
+               return NULL;
+
+       list = &rb_entry(parent, struct vmap_area, rb_node)->list;
+       return (&parent->rb_right == link ? list->next : list);
+}
+
+static __always_inline void
+link_va(struct vmap_area *va, struct rb_root *root,
+       struct rb_node *parent, struct rb_node **link, struct list_head *head)
+{
+       /*
+        * VA is still not in the list, but we can
+        * identify its future previous list_head node.
+        */
+       if (likely(parent)) {
+               head = &rb_entry(parent, struct vmap_area, rb_node)->list;
+               if (&parent->rb_right != link)
+                       head = head->prev;
        }
 
-       rb_link_node(&va->rb_node, parent, p);
-       rb_insert_color(&va->rb_node, &vmap_area_root);
+       /* Insert to the rb-tree */
+       rb_link_node(&va->rb_node, parent, link);
+       if (root == &free_vmap_area_root) {
+               /*
+                * Some explanation here. Just perform simple insertion
+                * to the tree. We do not set va->subtree_max_size to
+                * its current size before calling rb_insert_augmented().
+                * It is because of we populate the tree from the bottom
+                * to parent levels when the node _is_ in the tree.
+                *
+                * Therefore we set subtree_max_size to zero after insertion,
+                * to let __augment_tree_propagate_from() puts everything to
+                * the correct order later on.
+                */
+               rb_insert_augmented(&va->rb_node,
+                       root, &free_vmap_area_rb_augment_cb);
+               va->subtree_max_size = 0;
+       } else {
+               rb_insert_color(&va->rb_node, root);
+       }
 
-       /* address-sort this list */
-       tmp = rb_prev(&va->rb_node);
-       if (tmp) {
-               struct vmap_area *prev;
-               prev = rb_entry(tmp, struct vmap_area, rb_node);
-               list_add_rcu(&va->list, &prev->list);
-       } else
-               list_add_rcu(&va->list, &vmap_area_list);
+       /* Address-sort this list */
+       list_add(&va->list, head);
 }
 
-static void purge_vmap_area_lazy(void);
+static __always_inline void
+unlink_va(struct vmap_area *va, struct rb_root *root)
+{
+       /*
+        * During merging a VA node can be empty, therefore
+        * not linked with the tree nor list. Just check it.
+        */
+       if (!RB_EMPTY_NODE(&va->rb_node)) {
+               if (root == &free_vmap_area_root)
+                       rb_erase_augmented(&va->rb_node,
+                               root, &free_vmap_area_rb_augment_cb);
+               else
+                       rb_erase(&va->rb_node, root);
 
-static BLOCKING_NOTIFIER_HEAD(vmap_notify_list);
+               list_del(&va->list);
+               RB_CLEAR_NODE(&va->rb_node);
+       }
+}
+
+#if DEBUG_AUGMENT_PROPAGATE_CHECK
+static void
+augment_tree_propagate_check(struct rb_node *n)
+{
+       struct vmap_area *va;
+       struct rb_node *node;
+       unsigned long size;
+       bool found = false;
+
+       if (n == NULL)
+               return;
+
+       va = rb_entry(n, struct vmap_area, rb_node);
+       size = va->subtree_max_size;
+       node = n;
+
+       while (node) {
+               va = rb_entry(node, struct vmap_area, rb_node);
+
+               if (get_subtree_max_size(node->rb_left) == size) {
+                       node = node->rb_left;
+               } else {
+                       if (va_size(va) == size) {
+                               found = true;
+                               break;
+                       }
+
+                       node = node->rb_right;
+               }
+       }
+
+       if (!found) {
+               va = rb_entry(n, struct vmap_area, rb_node);
+               pr_emerg("tree is corrupted: %lu, %lu\n",
+                       va_size(va), va->subtree_max_size);
+       }
+
+       augment_tree_propagate_check(n->rb_left);
+       augment_tree_propagate_check(n->rb_right);
+}
+#endif
+
+/*
+ * This function populates subtree_max_size from bottom to upper
+ * levels starting from VA point. The propagation must be done
+ * when VA size is modified by changing its va_start/va_end. Or
+ * in case of newly inserting of VA to the tree.
+ *
+ * It means that __augment_tree_propagate_from() must be called:
+ * - After VA has been inserted to the tree(free path);
+ * - After VA has been shrunk(allocation path);
+ * - After VA has been increased(merging path).
+ *
+ * Please note that, it does not mean that upper parent nodes
+ * and their subtree_max_size are recalculated all the time up
+ * to the root node.
+ *
+ *       4--8
+ *        /\
+ *       /  \
+ *      /    \
+ *    2--2  8--8
+ *
+ * For example if we modify the node 4, shrinking it to 2, then
+ * no any modification is required. If we shrink the node 2 to 1
+ * its subtree_max_size is updated only, and set to 1. If we shrink
+ * the node 8 to 6, then its subtree_max_size is set to 6 and parent
+ * node becomes 4--6.
+ */
+static __always_inline void
+augment_tree_propagate_from(struct vmap_area *va)
+{
+       struct rb_node *node = &va->rb_node;
+       unsigned long new_va_sub_max_size;
+
+       while (node) {
+               va = rb_entry(node, struct vmap_area, rb_node);
+               new_va_sub_max_size = compute_subtree_max_size(va);
+
+               /*
+                * If the newly calculated maximum available size of the
+                * subtree is equal to the current one, then it means that
+                * the tree is propagated correctly. So we have to stop at
+                * this point to save cycles.
+                */
+               if (va->subtree_max_size == new_va_sub_max_size)
+                       break;
+
+               va->subtree_max_size = new_va_sub_max_size;
+               node = rb_parent(&va->rb_node);
+       }
+
+#if DEBUG_AUGMENT_PROPAGATE_CHECK
+       augment_tree_propagate_check(free_vmap_area_root.rb_node);
+#endif
+}
+
+static void
+insert_vmap_area(struct vmap_area *va,
+       struct rb_root *root, struct list_head *head)
+{
+       struct rb_node **link;
+       struct rb_node *parent;
+
+       link = find_va_links(va, root, NULL, &parent);
+       link_va(va, root, parent, link, head);
+}
+
+static void
+insert_vmap_area_augment(struct vmap_area *va,
+       struct rb_node *from, struct rb_root *root,
+       struct list_head *head)
+{
+       struct rb_node **link;
+       struct rb_node *parent;
+
+       if (from)
+               link = find_va_links(va, NULL, from, &parent);
+       else
+               link = find_va_links(va, root, NULL, &parent);
+
+       link_va(va, root, parent, link, head);
+       augment_tree_propagate_from(va);
+}
+
+/*
+ * Merge de-allocated chunk of VA memory with previous
+ * and next free blocks. If coalesce is not done a new
+ * free area is inserted. If VA has been merged, it is
+ * freed.
+ */
+static __always_inline void
+merge_or_add_vmap_area(struct vmap_area *va,
+       struct rb_root *root, struct list_head *head)
+{
+       struct vmap_area *sibling;
+       struct list_head *next;
+       struct rb_node **link;
+       struct rb_node *parent;
+       bool merged = false;
+
+       /*
+        * Find a place in the tree where VA potentially will be
+        * inserted, unless it is merged with its sibling/siblings.
+        */
+       link = find_va_links(va, root, NULL, &parent);
+
+       /*
+        * Get next node of VA to check if merging can be done.
+        */
+       next = get_va_next_sibling(parent, link);
+       if (unlikely(next == NULL))
+               goto insert;
+
+       /*
+        * start            end
+        * |                |
+        * |<------VA------>|<-----Next----->|
+        *                  |                |
+        *                  start            end
+        */
+       if (next != head) {
+               sibling = list_entry(next, struct vmap_area, list);
+               if (sibling->va_start == va->va_end) {
+                       sibling->va_start = va->va_start;
+
+                       /* Check and update the tree if needed. */
+                       augment_tree_propagate_from(sibling);
+
+                       /* Remove this VA, it has been merged. */
+                       unlink_va(va, root);
+
+                       /* Free vmap_area object. */
+                       kmem_cache_free(vmap_area_cachep, va);
+
+                       /* Point to the new merged area. */
+                       va = sibling;
+                       merged = true;
+               }
+       }
+
+       /*
+        * start            end
+        * |                |
+        * |<-----Prev----->|<------VA------>|
+        *                  |                |
+        *                  start            end
+        */
+       if (next->prev != head) {
+               sibling = list_entry(next->prev, struct vmap_area, list);
+               if (sibling->va_end == va->va_start) {
+                       sibling->va_end = va->va_end;
+
+                       /* Check and update the tree if needed. */
+                       augment_tree_propagate_from(sibling);
+
+                       /* Remove this VA, it has been merged. */
+                       unlink_va(va, root);
+
+                       /* Free vmap_area object. */
+                       kmem_cache_free(vmap_area_cachep, va);
+
+                       return;
+               }
+       }
+
+insert:
+       if (!merged) {
+               link_va(va, root, parent, link, head);
+               augment_tree_propagate_from(va);
+       }
+}
+
+static __always_inline bool
+is_within_this_va(struct vmap_area *va, unsigned long size,
+       unsigned long align, unsigned long vstart)
+{
+       unsigned long nva_start_addr;
+
+       if (va->va_start > vstart)
+               nva_start_addr = ALIGN(va->va_start, align);
+       else
+               nva_start_addr = ALIGN(vstart, align);
+
+       /* Can be overflowed due to big size or alignment. */
+       if (nva_start_addr + size < nva_start_addr ||
+                       nva_start_addr < vstart)
+               return false;
+
+       return (nva_start_addr + size <= va->va_end);
+}
+
+/*
+ * Find the first free block(lowest start address) in the tree,
+ * that will accomplish the request corresponding to passing
+ * parameters.
+ */
+static __always_inline struct vmap_area *
+find_vmap_lowest_match(unsigned long size,
+       unsigned long align, unsigned long vstart)
+{
+       struct vmap_area *va;
+       struct rb_node *node;
+       unsigned long length;
+
+       /* Start from the root. */
+       node = free_vmap_area_root.rb_node;
+
+       /* Adjust the search size for alignment overhead. */
+       length = size + align - 1;
+
+       while (node) {
+               va = rb_entry(node, struct vmap_area, rb_node);
+
+               if (get_subtree_max_size(node->rb_left) >= length &&
+                               vstart < va->va_start) {
+                       node = node->rb_left;
+               } else {
+                       if (is_within_this_va(va, size, align, vstart))
+                               return va;
+
+                       /*
+                        * Does not make sense to go deeper towards the right
+                        * sub-tree if it does not have a free block that is
+                        * equal or bigger to the requested search length.
+                        */
+                       if (get_subtree_max_size(node->rb_right) >= length) {
+                               node = node->rb_right;
+                               continue;
+                       }
+
+                       /*
+                        * OK. We roll back and find the fist right sub-tree,
+                        * that will satisfy the search criteria. It can happen
+                        * only once due to "vstart" restriction.
+                        */
+                       while ((node = rb_parent(node))) {
+                               va = rb_entry(node, struct vmap_area, rb_node);
+                               if (is_within_this_va(va, size, align, vstart))
+                                       return va;
+
+                               if (get_subtree_max_size(node->rb_right) >= length &&
+                                               vstart <= va->va_start) {
+                                       node = node->rb_right;
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       return NULL;
+}
+
+#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK
+#include <linux/random.h>
+
+static struct vmap_area *
+find_vmap_lowest_linear_match(unsigned long size,
+       unsigned long align, unsigned long vstart)
+{
+       struct vmap_area *va;
+
+       list_for_each_entry(va, &free_vmap_area_list, list) {
+               if (!is_within_this_va(va, size, align, vstart))
+                       continue;
+
+               return va;
+       }
+
+       return NULL;
+}
+
+static void
+find_vmap_lowest_match_check(unsigned long size)
+{
+       struct vmap_area *va_1, *va_2;
+       unsigned long vstart;
+       unsigned int rnd;
+
+       get_random_bytes(&rnd, sizeof(rnd));
+       vstart = VMALLOC_START + rnd;
+
+       va_1 = find_vmap_lowest_match(size, 1, vstart);
+       va_2 = find_vmap_lowest_linear_match(size, 1, vstart);
+
+       if (va_1 != va_2)
+               pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n",
+                       va_1, va_2, vstart);
+}
+#endif
+
+enum fit_type {
+       NOTHING_FIT = 0,
+       FL_FIT_TYPE = 1,        /* full fit */
+       LE_FIT_TYPE = 2,        /* left edge fit */
+       RE_FIT_TYPE = 3,        /* right edge fit */
+       NE_FIT_TYPE = 4         /* no edge fit */
+};
+
+static __always_inline enum fit_type
+classify_va_fit_type(struct vmap_area *va,
+       unsigned long nva_start_addr, unsigned long size)
+{
+       enum fit_type type;
+
+       /* Check if it is within VA. */
+       if (nva_start_addr < va->va_start ||
+                       nva_start_addr + size > va->va_end)
+               return NOTHING_FIT;
+
+       /* Now classify. */
+       if (va->va_start == nva_start_addr) {
+               if (va->va_end == nva_start_addr + size)
+                       type = FL_FIT_TYPE;
+               else
+                       type = LE_FIT_TYPE;
+       } else if (va->va_end == nva_start_addr + size) {
+               type = RE_FIT_TYPE;
+       } else {
+               type = NE_FIT_TYPE;
+       }
+
+       return type;
+}
+
+static __always_inline int
+adjust_va_to_fit_type(struct vmap_area *va,
+       unsigned long nva_start_addr, unsigned long size,
+       enum fit_type type)
+{
+       struct vmap_area *lva;
+
+       if (type == FL_FIT_TYPE) {
+               /*
+                * No need to split VA, it fully fits.
+                *
+                * |               |
+                * V      NVA      V
+                * |---------------|
+                */
+               unlink_va(va, &free_vmap_area_root);
+               kmem_cache_free(vmap_area_cachep, va);
+       } else if (type == LE_FIT_TYPE) {
+               /*
+                * Split left edge of fit VA.
+                *
+                * |       |
+                * V  NVA  V   R
+                * |-------|-------|
+                */
+               va->va_start += size;
+       } else if (type == RE_FIT_TYPE) {
+               /*
+                * Split right edge of fit VA.
+                *
+                *         |       |
+                *     L   V  NVA  V
+                * |-------|-------|
+                */
+               va->va_end = nva_start_addr;
+       } else if (type == NE_FIT_TYPE) {
+               /*
+                * Split no edge of fit VA.
+                *
+                *     |       |
+                *   L V  NVA  V R
+                * |---|-------|---|
+                */
+               lva = kmem_cache_alloc(vmap_area_cachep, GFP_NOWAIT);
+               if (unlikely(!lva))
+                       return -1;
+
+               /*
+                * Build the remainder.
+                */
+               lva->va_start = va->va_start;
+               lva->va_end = nva_start_addr;
+
+               /*
+                * Shrink this VA to remaining size.
+                */
+               va->va_start = nva_start_addr + size;
+       } else {
+               return -1;
+       }
+
+       if (type != FL_FIT_TYPE) {
+               augment_tree_propagate_from(va);
+
+               if (type == NE_FIT_TYPE)
+                       insert_vmap_area_augment(lva, &va->rb_node,
+                               &free_vmap_area_root, &free_vmap_area_list);
+       }
+
+       return 0;
+}
+
+/*
+ * Returns a start address of the newly allocated area, if success.
+ * Otherwise a vend is returned that indicates failure.
+ */
+static __always_inline unsigned long
+__alloc_vmap_area(unsigned long size, unsigned long align,
+       unsigned long vstart, unsigned long vend, int node)
+{
+       unsigned long nva_start_addr;
+       struct vmap_area *va;
+       enum fit_type type;
+       int ret;
+
+       va = find_vmap_lowest_match(size, align, vstart);
+       if (unlikely(!va))
+               return vend;
+
+       if (va->va_start > vstart)
+               nva_start_addr = ALIGN(va->va_start, align);
+       else
+               nva_start_addr = ALIGN(vstart, align);
+
+       /* Check the "vend" restriction. */
+       if (nva_start_addr + size > vend)
+               return vend;
+
+       /* Classify what we have found. */
+       type = classify_va_fit_type(va, nva_start_addr, size);
+       if (WARN_ON_ONCE(type == NOTHING_FIT))
+               return vend;
+
+       /* Update the free vmap_area. */
+       ret = adjust_va_to_fit_type(va, nva_start_addr, size, type);
+       if (ret)
+               return vend;
+
+#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK
+       find_vmap_lowest_match_check(size);
+#endif
+
+       return nva_start_addr;
+}
 
 /*
  * Allocate a region of KVA of the specified size and alignment, within the
@@ -406,18 +1033,19 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
                                int node, gfp_t gfp_mask)
 {
        struct vmap_area *va;
-       struct rb_node *n;
        unsigned long addr;
        int purged = 0;
-       struct vmap_area *first;
 
        BUG_ON(!size);
        BUG_ON(offset_in_page(size));
        BUG_ON(!is_power_of_2(align));
 
+       if (unlikely(!vmap_initialized))
+               return ERR_PTR(-EBUSY);
+
        might_sleep();
 
-       va = kmalloc_node(sizeof(struct vmap_area),
+       va = kmem_cache_alloc_node(vmap_area_cachep,
                        gfp_mask & GFP_RECLAIM_MASK, node);
        if (unlikely(!va))
                return ERR_PTR(-ENOMEM);
@@ -430,87 +1058,20 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
 
 retry:
        spin_lock(&vmap_area_lock);
-       /*
-        * Invalidate cache if we have more permissive parameters.
-        * cached_hole_size notes the largest hole noticed _below_
-        * the vmap_area cached in free_vmap_cache: if size fits
-        * into that hole, we want to scan from vstart to reuse
-        * the hole instead of allocating above free_vmap_cache.
-        * Note that __free_vmap_area may update free_vmap_cache
-        * without updating cached_hole_size or cached_align.
-        */
-       if (!free_vmap_cache ||
-                       size < cached_hole_size ||
-                       vstart < cached_vstart ||
-                       align < cached_align) {
-nocache:
-               cached_hole_size = 0;
-               free_vmap_cache = NULL;
-       }
-       /* record if we encounter less permissive parameters */
-       cached_vstart = vstart;
-       cached_align = align;
-
-       /* find starting point for our search */
-       if (free_vmap_cache) {
-               first = rb_entry(free_vmap_cache, struct vmap_area, rb_node);
-               addr = ALIGN(first->va_end, align);
-               if (addr < vstart)
-                       goto nocache;
-               if (addr + size < addr)
-                       goto overflow;
 
-       } else {
-               addr = ALIGN(vstart, align);
-               if (addr + size < addr)
-                       goto overflow;
-
-               n = vmap_area_root.rb_node;
-               first = NULL;
-
-               while (n) {
-                       struct vmap_area *tmp;
-                       tmp = rb_entry(n, struct vmap_area, rb_node);
-                       if (tmp->va_end >= addr) {
-                               first = tmp;
-                               if (tmp->va_start <= addr)
-                                       break;
-                               n = n->rb_left;
-                       } else
-                               n = n->rb_right;
-               }
-
-               if (!first)
-                       goto found;
-       }
-
-       /* from the starting point, walk areas until a suitable hole is found */
-       while (addr + size > first->va_start && addr + size <= vend) {
-               if (addr + cached_hole_size < first->va_start)
-                       cached_hole_size = first->va_start - addr;
-               addr = ALIGN(first->va_end, align);
-               if (addr + size < addr)
-                       goto overflow;
-
-               if (list_is_last(&first->list, &vmap_area_list))
-                       goto found;
-
-               first = list_next_entry(first, list);
-       }
-
-found:
        /*
-        * Check also calculated address against the vstart,
-        * because it can be 0 because of big align request.
+        * If an allocation fails, the "vend" address is
+        * returned. Therefore trigger the overflow path.
         */
-       if (addr + size > vend || addr < vstart)
+       addr = __alloc_vmap_area(size, align, vstart, vend, node);
+       if (unlikely(addr == vend))
                goto overflow;
 
        va->va_start = addr;
        va->va_end = addr + size;
        va->flags = 0;
-       __insert_vmap_area(va);
-       free_vmap_cache = &va->rb_node;
+       insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+
        spin_unlock(&vmap_area_lock);
 
        BUG_ON(!IS_ALIGNED(va->va_start, align));
@@ -539,7 +1100,8 @@ overflow:
        if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
                pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
                        size);
-       kfree(va);
+
+       kmem_cache_free(vmap_area_cachep, va);
        return ERR_PTR(-EBUSY);
 }
 
@@ -559,35 +1121,16 @@ static void __free_vmap_area(struct vmap_area *va)
 {
        BUG_ON(RB_EMPTY_NODE(&va->rb_node));
 
-       if (free_vmap_cache) {
-               if (va->va_end < cached_vstart) {
-                       free_vmap_cache = NULL;
-               } else {
-                       struct vmap_area *cache;
-                       cache = rb_entry(free_vmap_cache, struct vmap_area, rb_node);
-                       if (va->va_start <= cache->va_start) {
-                               free_vmap_cache = rb_prev(&va->rb_node);
-                               /*
-                                * We don't try to update cached_hole_size or
-                                * cached_align, but it won't go very wrong.
-                                */
-                       }
-               }
-       }
-       rb_erase(&va->rb_node, &vmap_area_root);
-       RB_CLEAR_NODE(&va->rb_node);
-       list_del_rcu(&va->list);
-
        /*
-        * Track the highest possible candidate for pcpu area
-        * allocation.  Areas outside of vmalloc area can be returned
-        * here too, consider only end addresses which fall inside
-        * vmalloc area proper.
+        * Remove from the busy tree/list.
         */
-       if (va->va_end > VMALLOC_START && va->va_end <= VMALLOC_END)
-               vmap_area_pcpu_hole = max(vmap_area_pcpu_hole, va->va_end);
+       unlink_va(va, &vmap_area_root);
 
-       kfree_rcu(va, rcu_head);
+       /*
+        * Merge VA with its neighbors, otherwise just add it.
+        */
+       merge_or_add_vmap_area(va,
+               &free_vmap_area_root, &free_vmap_area_list);
 }
 
 /*
@@ -633,7 +1176,7 @@ static unsigned long lazy_max_pages(void)
        return log * (32UL * 1024 * 1024 / PAGE_SIZE);
 }
 
-static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
+static atomic_long_t vmap_lazy_nr = ATOMIC_LONG_INIT(0);
 
 /*
  * Serialize vmap purging.  There is no actual criticial section protected
@@ -651,7 +1194,7 @@ static void purge_fragmented_blocks_allcpus(void);
  */
 void set_iounmap_nonlazy(void)
 {
-       atomic_set(&vmap_lazy_nr, lazy_max_pages()+1);
+       atomic_long_set(&vmap_lazy_nr, lazy_max_pages()+1);
 }
 
 /*
@@ -659,34 +1202,40 @@ void set_iounmap_nonlazy(void)
  */
 static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end)
 {
+       unsigned long resched_threshold;
        struct llist_node *valist;
        struct vmap_area *va;
        struct vmap_area *n_va;
-       bool do_free = false;
 
        lockdep_assert_held(&vmap_purge_lock);
 
        valist = llist_del_all(&vmap_purge_list);
+       if (unlikely(valist == NULL))
+               return false;
+
+       /*
+        * TODO: to calculate a flush range without looping.
+        * The list can be up to lazy_max_pages() elements.
+        */
        llist_for_each_entry(va, valist, purge_list) {
                if (va->va_start < start)
                        start = va->va_start;
                if (va->va_end > end)
                        end = va->va_end;
-               do_free = true;
        }
 
-       if (!do_free)
-               return false;
-
        flush_tlb_kernel_range(start, end);
+       resched_threshold = lazy_max_pages() << 1;
 
        spin_lock(&vmap_area_lock);
        llist_for_each_entry_safe(va, n_va, valist, purge_list) {
-               int nr = (va->va_end - va->va_start) >> PAGE_SHIFT;
+               unsigned long nr = (va->va_end - va->va_start) >> PAGE_SHIFT;
 
                __free_vmap_area(va);
-               atomic_sub(nr, &vmap_lazy_nr);
-               cond_resched_lock(&vmap_area_lock);
+               atomic_long_sub(nr, &vmap_lazy_nr);
+
+               if (atomic_long_read(&vmap_lazy_nr) < resched_threshold)
+                       cond_resched_lock(&vmap_area_lock);
        }
        spin_unlock(&vmap_area_lock);
        return true;
@@ -722,10 +1271,10 @@ static void purge_vmap_area_lazy(void)
  */
 static void free_vmap_area_noflush(struct vmap_area *va)
 {
-       int nr_lazy;
+       unsigned long nr_lazy;
 
-       nr_lazy = atomic_add_return((va->va_end - va->va_start) >> PAGE_SHIFT,
-                                   &vmap_lazy_nr);
+       nr_lazy = atomic_long_add_return((va->va_end - va->va_start) >>
+                               PAGE_SHIFT, &vmap_lazy_nr);
 
        /* After this point, we may free va at any time */
        llist_add(&va->purge_list, &vmap_purge_list);
@@ -788,8 +1337,6 @@ static struct vmap_area *find_vmap_area(unsigned long addr)
 
 #define VMAP_BLOCK_SIZE                (VMAP_BBMAP_BITS * PAGE_SIZE)
 
-static bool vmap_initialized __read_mostly = false;
-
 struct vmap_block_queue {
        spinlock_t lock;
        struct list_head free;
@@ -1250,12 +1797,58 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align)
        vm_area_add_early(vm);
 }
 
+static void vmap_init_free_space(void)
+{
+       unsigned long vmap_start = 1;
+       const unsigned long vmap_end = ULONG_MAX;
+       struct vmap_area *busy, *free;
+
+       /*
+        *     B     F     B     B     B     F
+        * -|-----|.....|-----|-----|-----|.....|-
+        *  |           The KVA space           |
+        *  |<--------------------------------->|
+        */
+       list_for_each_entry(busy, &vmap_area_list, list) {
+               if (busy->va_start - vmap_start > 0) {
+                       free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
+                       if (!WARN_ON_ONCE(!free)) {
+                               free->va_start = vmap_start;
+                               free->va_end = busy->va_start;
+
+                               insert_vmap_area_augment(free, NULL,
+                                       &free_vmap_area_root,
+                                               &free_vmap_area_list);
+                       }
+               }
+
+               vmap_start = busy->va_end;
+       }
+
+       if (vmap_end - vmap_start > 0) {
+               free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
+               if (!WARN_ON_ONCE(!free)) {
+                       free->va_start = vmap_start;
+                       free->va_end = vmap_end;
+
+                       insert_vmap_area_augment(free, NULL,
+                               &free_vmap_area_root,
+                                       &free_vmap_area_list);
+               }
+       }
+}
+
 void __init vmalloc_init(void)
 {
        struct vmap_area *va;
        struct vm_struct *tmp;
        int i;
 
+       /*
+        * Create the cache for vmap_area objects.
+        */
+       vmap_area_cachep = KMEM_CACHE(vmap_area, SLAB_PANIC);
+
        for_each_possible_cpu(i) {
                struct vmap_block_queue *vbq;
                struct vfree_deferred *p;
@@ -1270,16 +1863,21 @@ void __init vmalloc_init(void)
 
        /* Import existing vmlist entries. */
        for (tmp = vmlist; tmp; tmp = tmp->next) {
-               va = kzalloc(sizeof(struct vmap_area), GFP_NOWAIT);
+               va = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT);
+               if (WARN_ON_ONCE(!va))
+                       continue;
+
                va->flags = VM_VM_AREA;
                va->va_start = (unsigned long)tmp->addr;
                va->va_end = va->va_start + tmp->size;
                va->vm = tmp;
-               __insert_vmap_area(va);
+               insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
        }
 
-       vmap_area_pcpu_hole = VMALLOC_END;
-
+       /*
+        * Now we can initialize a free vmap space.
+        */
+       vmap_init_free_space();
        vmap_initialized = true;
 }
 
@@ -2471,81 +3069,64 @@ static struct vmap_area *node_to_va(struct rb_node *n)
 }
 
 /**
- * pvm_find_next_prev - find the next and prev vmap_area surrounding @end
- * @end: target address
- * @pnext: out arg for the next vmap_area
- * @pprev: out arg for the previous vmap_area
- *
- * Returns: %true if either or both of next and prev are found,
- *         %false if no vmap_area exists
+ * pvm_find_va_enclose_addr - find the vmap_area @addr belongs to
+ * @addr: target address
  *
- * Find vmap_areas end addresses of which enclose @end.  ie. if not
- * NULL, *pnext->va_end > @end and *pprev->va_end <= @end.
+ * Returns: vmap_area if it is found. If there is no such area
+ *   the first highest(reverse order) vmap_area is returned
+ *   i.e. va->va_start < addr && va->va_end < addr or NULL
+ *   if there are no any areas before @addr.
  */
-static bool pvm_find_next_prev(unsigned long end,
-                              struct vmap_area **pnext,
-                              struct vmap_area **pprev)
+static struct vmap_area *
+pvm_find_va_enclose_addr(unsigned long addr)
 {
-       struct rb_node *n = vmap_area_root.rb_node;
-       struct vmap_area *va = NULL;
+       struct vmap_area *va, *tmp;
+       struct rb_node *n;
+
+       n = free_vmap_area_root.rb_node;
+       va = NULL;
 
        while (n) {
-               va = rb_entry(n, struct vmap_area, rb_node);
-               if (end < va->va_end)
-                       n = n->rb_left;
-               else if (end > va->va_end)
+               tmp = rb_entry(n, struct vmap_area, rb_node);
+               if (tmp->va_start <= addr) {
+                       va = tmp;
+                       if (tmp->va_end >= addr)
+                               break;
+
                        n = n->rb_right;
-               else
-                       break;
+               } else {
+                       n = n->rb_left;
+               }
        }
 
-       if (!va)
-               return false;
-
-       if (va->va_end > end) {
-               *pnext = va;
-               *pprev = node_to_va(rb_prev(&(*pnext)->rb_node));
-       } else {
-               *pprev = va;
-               *pnext = node_to_va(rb_next(&(*pprev)->rb_node));
-       }
-       return true;
+       return va;
 }
 
 /**
- * pvm_determine_end - find the highest aligned address between two vmap_areas
- * @pnext: in/out arg for the next vmap_area
- * @pprev: in/out arg for the previous vmap_area
- * @align: alignment
+ * pvm_determine_end_from_reverse - find the highest aligned address
+ * of free block below VMALLOC_END
+ * @va:
+ *   in - the VA we start the search(reverse order);
+ *   out - the VA with the highest aligned end address.
  *
- * Returns: determined end address
- *
- * Find the highest aligned address between *@pnext and *@pprev below
- * VMALLOC_END.  *@pnext and *@pprev are adjusted so that the aligned
- * down address is between the end addresses of the two vmap_areas.
- *
- * Please note that the address returned by this function may fall
- * inside *@pnext vmap_area.  The caller is responsible for checking
- * that.
+ * Returns: determined end address within vmap_area
  */
-static unsigned long pvm_determine_end(struct vmap_area **pnext,
-                                      struct vmap_area **pprev,
-                                      unsigned long align)
+static unsigned long
+pvm_determine_end_from_reverse(struct vmap_area **va, unsigned long align)
 {
-       const unsigned long vmalloc_end = VMALLOC_END & ~(align - 1);
+       unsigned long vmalloc_end = VMALLOC_END & ~(align - 1);
        unsigned long addr;
 
-       if (*pnext)
-               addr = min((*pnext)->va_start & ~(align - 1), vmalloc_end);
-       else
-               addr = vmalloc_end;
-
-       while (*pprev && (*pprev)->va_end > addr) {
-               *pnext = *pprev;
-               *pprev = node_to_va(rb_prev(&(*pnext)->rb_node));
+       if (likely(*va)) {
+               list_for_each_entry_from_reverse((*va),
+                               &free_vmap_area_list, list) {
+                       addr = min((*va)->va_end & ~(align - 1), vmalloc_end);
+                       if ((*va)->va_start < addr)
+                               return addr;
+               }
        }
 
-       return addr;
+       return 0;
 }
 
 /**
@@ -2565,12 +3146,12 @@ static unsigned long pvm_determine_end(struct vmap_area **pnext,
  * to gigabytes.  To avoid interacting with regular vmallocs, these
  * areas are allocated from top.
  *
- * Despite its complicated look, this allocator is rather simple.  It
- * does everything top-down and scans areas from the end looking for
- * matching slot.  While scanning, if any of the areas overlaps with
- * existing vmap_area, the base address is pulled down to fit the
- * area.  Scanning is repeated till all the areas fit and then all
- * necessary data structures are inserted and the result is returned.
+ * Despite its complicated look, this allocator is rather simple. It
+ * does everything top-down and scans free blocks from the end looking
+ * for matching base. While scanning, if any of the areas do not fit the
+ * base address is pulled down to fit the area. Scanning is repeated till
+ * all the areas fit and then all necessary data structures are inserted
+ * and the result is returned.
  */
 struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
                                     const size_t *sizes, int nr_vms,
@@ -2578,11 +3159,12 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
 {
        const unsigned long vmalloc_start = ALIGN(VMALLOC_START, align);
        const unsigned long vmalloc_end = VMALLOC_END & ~(align - 1);
-       struct vmap_area **vas, *prev, *next;
+       struct vmap_area **vas, *va;
        struct vm_struct **vms;
        int area, area2, last_area, term_area;
-       unsigned long base, start, end, last_end;
+       unsigned long base, start, size, end, last_end;
        bool purged = false;
+       enum fit_type type;
 
        /* verify parameters and allocate data structures */
        BUG_ON(offset_in_page(align) || !is_power_of_2(align));
@@ -2618,7 +3200,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
                goto err_free2;
 
        for (area = 0; area < nr_vms; area++) {
-               vas[area] = kzalloc(sizeof(struct vmap_area), GFP_KERNEL);
+               vas[area] = kmem_cache_zalloc(vmap_area_cachep, GFP_KERNEL);
                vms[area] = kzalloc(sizeof(struct vm_struct), GFP_KERNEL);
                if (!vas[area] || !vms[area])
                        goto err_free;
@@ -2631,49 +3213,29 @@ retry:
        start = offsets[area];
        end = start + sizes[area];
 
-       if (!pvm_find_next_prev(vmap_area_pcpu_hole, &next, &prev)) {
-               base = vmalloc_end - last_end;
-               goto found;
-       }
-       base = pvm_determine_end(&next, &prev, align) - end;
+       va = pvm_find_va_enclose_addr(vmalloc_end);
+       base = pvm_determine_end_from_reverse(&va, align) - end;
 
        while (true) {
-               BUG_ON(next && next->va_end <= base + end);
-               BUG_ON(prev && prev->va_end > base + end);
-
                /*
                 * base might have underflowed, add last_end before
                 * comparing.
                 */
-               if (base + last_end < vmalloc_start + last_end) {
-                       spin_unlock(&vmap_area_lock);
-                       if (!purged) {
-                               purge_vmap_area_lazy();
-                               purged = true;
-                               goto retry;
-                       }
-                       goto err_free;
-               }
+               if (base + last_end < vmalloc_start + last_end)
+                       goto overflow;
 
                /*
-                * If next overlaps, move base downwards so that it's
-                * right below next and then recheck.
+                * Fitting base has not been found.
                 */
-               if (next && next->va_start < base + end) {
-                       base = pvm_determine_end(&next, &prev, align) - end;
-                       term_area = area;
-                       continue;
-               }
+               if (va == NULL)
+                       goto overflow;
 
                /*
-                * If prev overlaps, shift down next and prev and move
-                * base so that it's right below new next and then
-                * recheck.
+                * If this VA does not fit, move base downwards and recheck.
                 */
-               if (prev && prev->va_end > base + start)  {
-                       next = prev;
-                       prev = node_to_va(rb_prev(&next->rb_node));
-                       base = pvm_determine_end(&next, &prev, align) - end;
+               if (base + start < va->va_start || base + end > va->va_end) {
+                       va = node_to_va(rb_prev(&va->rb_node));
+                       base = pvm_determine_end_from_reverse(&va, align) - end;
                        term_area = area;
                        continue;
                }
@@ -2685,21 +3247,40 @@ retry:
                area = (area + nr_vms - 1) % nr_vms;
                if (area == term_area)
                        break;
+
                start = offsets[area];
                end = start + sizes[area];
-               pvm_find_next_prev(base + end, &next, &prev);
+               va = pvm_find_va_enclose_addr(base + end);
        }
-found:
+
        /* we've found a fitting base, insert all va's */
        for (area = 0; area < nr_vms; area++) {
-               struct vmap_area *va = vas[area];
+               int ret;
 
-               va->va_start = base + offsets[area];
-               va->va_end = va->va_start + sizes[area];
-               __insert_vmap_area(va);
-       }
+               start = base + offsets[area];
+               size = sizes[area];
+
+               va = pvm_find_va_enclose_addr(start);
+               if (WARN_ON_ONCE(va == NULL))
+                       /* It is a BUG(), but trigger recovery instead. */
+                       goto recovery;
+
+               type = classify_va_fit_type(va, start, size);
+               if (WARN_ON_ONCE(type == NOTHING_FIT))
+                       /* It is a BUG(), but trigger recovery instead. */
+                       goto recovery;
+
+               ret = adjust_va_to_fit_type(va, start, size, type);
+               if (unlikely(ret))
+                       goto recovery;
 
-       vmap_area_pcpu_hole = base + offsets[last_area];
+               /* Allocated area. */
+               va = vas[area];
+               va->va_start = start;
+               va->va_end = start + size;
+
+               insert_vmap_area(va, &vmap_area_root, &vmap_area_list);
+       }
 
        spin_unlock(&vmap_area_lock);
 
@@ -2711,9 +3292,38 @@ found:
        kfree(vas);
        return vms;
 
+recovery:
+       /* Remove previously inserted areas. */
+       while (area--) {
+               __free_vmap_area(vas[area]);
+               vas[area] = NULL;
+       }
+
+overflow:
+       spin_unlock(&vmap_area_lock);
+       if (!purged) {
+               purge_vmap_area_lazy();
+               purged = true;
+
+               /* Before "retry", check if we recover. */
+               for (area = 0; area < nr_vms; area++) {
+                       if (vas[area])
+                               continue;
+
+                       vas[area] = kmem_cache_zalloc(
+                               vmap_area_cachep, GFP_KERNEL);
+                       if (!vas[area])
+                               goto err_free;
+               }
+
+               goto retry;
+       }
+
 err_free:
        for (area = 0; area < nr_vms; area++) {
-               kfree(vas[area]);
+               if (vas[area])
+                       kmem_cache_free(vmap_area_cachep, vas[area]);
+
                kfree(vms[area]);
        }
 err_free2:
index d96c547..7acd0af 100644 (file)
@@ -346,7 +346,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone
        int zid;
 
        if (!mem_cgroup_disabled())
-               lru_size = lruvec_page_state(lruvec, NR_LRU_BASE + lru);
+               lru_size = lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
        else
                lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru);
 
@@ -2150,7 +2150,7 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file,
         * is being established. Disable active list protection to get
         * rid of the stale workingset quickly.
         */
-       refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);
+       refaults = lruvec_page_state_local(lruvec, WORKINGSET_ACTIVATE);
        if (file && actual_reclaim && lruvec->refaults != refaults) {
                inactive_ratio = 0;
        } else {
@@ -2912,7 +2912,7 @@ static void snapshot_refaults(struct mem_cgroup *root_memcg, pg_data_t *pgdat)
                struct lruvec *lruvec;
 
                lruvec = mem_cgroup_lruvec(pgdat, memcg);
-               refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);
+               refaults = lruvec_page_state_local(lruvec, WORKINGSET_ACTIVATE);
                lruvec->refaults = refaults;
        } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL)));
 }
index a7d4933..fd7e16c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/mm/vmstat.c
  *
index 6419bae..e0b4edc 100644 (file)
@@ -430,9 +430,10 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker,
 
                lruvec = mem_cgroup_lruvec(NODE_DATA(sc->nid), sc->memcg);
                for (pages = 0, i = 0; i < NR_LRU_LISTS; i++)
-                       pages += lruvec_page_state(lruvec, NR_LRU_BASE + i);
-               pages += lruvec_page_state(lruvec, NR_SLAB_RECLAIMABLE);
-               pages += lruvec_page_state(lruvec, NR_SLAB_UNRECLAIMABLE);
+                       pages += lruvec_page_state_local(lruvec,
+                                                        NR_LRU_BASE + i);
+               pages += lruvec_page_state_local(lruvec, NR_SLAB_RECLAIMABLE);
+               pages += lruvec_page_state_local(lruvec, NR_SLAB_UNRECLAIMABLE);
        } else
 #endif
                pages = node_present_pages(sc->nid);
index 1ffecd6..99be52c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * z3fold.c
  *
index 28458f7..de5dd4d 100644 (file)
--- a/mm/zbud.c
+++ b/mm/zbud.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * zbud.c
  *
index 01a771e..a2dd910 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * zpool memory storage api
  *
index 9c05151..4c1f4c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig 6LOWPAN
        tristate "6LoWPAN Support"
        depends on IPV6
index 80d4bf7..aaa83e8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config STP
        tristate
        select LLC
index 4232018..5510b4b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Configuration for 802.1Q VLAN support
 #
index 2a9a607..c546c42 100644 (file)
@@ -373,6 +373,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
+               /* fall through */
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
index e6014e0..3d11fec 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 9P protocol configuration
 #
index 3e8fdd6..d122f53 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Network configuration
 #
index 5cda56e..33164d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux AppleTalk layer.
 #
index 754ea10..271f682 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Asynchronous Transfer Mode (ATM)
 #
index 10462de..3e17a5e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Ethernet netdevice using ATM AAL5 as underlying carrier
  * (RFC1483 obsoleted by RFC2684) for Linux
index b9e67e5..a7972da 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* net/atm/clip.c - RFC1577 Classical IP over ATM */
 
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
index a38c174..b7528e7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* net/atm/common.c - ATM sockets (common part for PVC and SVC) */
 
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
index a031149..5a77c23 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * lec.c: Lan Emulation driver
  *
index 24b53c4..033871e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
 
 #include <linux/kernel.h>
index 705e53e..043fd54 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Amateur Radio protocols and AX.25 device configuration
 #
index db82a40..2efac04 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Bluetooth subsystem configuration
 #
index 9b70317..aac02b5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BT_BNEP
        tristate "BNEP protocol support"
        depends on BT_BREDR
index c7821e7..8af9d56 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Bluetooth BNEP layer.
 #
index 939da0f..c833778 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BT_CMTP
        tristate "CMTP protocol support"
        depends on BT_BREDR && ISDN_CAPI
index 890a9a5..b2262ca 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Bluetooth CMTP layer
 #
index bc8610b..14100f3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BT_HIDP
        tristate "HIDP protocol support"
        depends on BT_BREDR && INPUT
index a9ee115..f41b0aa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Bluetooth HIDP layer
 #
index 335df75..9b9953e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config BT_RFCOMM
        tristate "RFCOMM protocol support"
        depends on BT_BREDR
index fe07988..593e5c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Bluetooth RFCOMM layer.
 #
index b0ca361..1c0a98d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BPF_SYSCALL)      := test_run.o
index e558b46..91f9d87 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig BPFILTER
        bool "BPF based packet filtering framework (BPFILTER)"
        depends on NET && BPF && INET
index 854395f..aa945ab 100644 (file)
@@ -5,7 +5,7 @@
 
 hostprogs-y := bpfilter_umh
 bpfilter_umh-objs := main.o
-KBUILD_HOSTCFLAGS += -Itools/include/ -Itools/include/uapi
+KBUILD_HOSTCFLAGS += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi
 HOSTCC := $(CC)
 
 ifeq ($(CONFIG_BPFILTER_UMH), y)
index 3625d6a..e4fb050 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # 802.1d Ethernet Bridging
 #
index 2db6399..f47f526 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/rtnetlink.h>
index 9a0159a..c3ad90c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Bridge netfilter configuration
 #
index 5fc4aff..2c8fe24 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * 802_3
  *
index 620e54f..96f7243 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_among
  *
index 2271422..0707cc0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_arp
  *
index db85230..d9e77e2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_arpreply
  *
index dfc86a0..eeae23a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_dnat
  *
index ffaa8ce..df37249 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_ip
  *
index 2a5a52a..f3225bc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_ip6
  *
index 165b9d6..fa19955 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_limit
  *
index 707caea..e2eea1d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_log
  *
index 19f0f95..21fd3d3 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_mark
  *
index d98baef..81fb59d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_mark_m
  *
index da1c2fd..61bf8f4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ebt_nflog
  *
index 496a565..c9e3061 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_pkttype
  *
index a7223ea..53ef08e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_redirect
  *
index 11cf9e9..700d338 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_snat
  *
index 46c1fe7..0d6d20c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebt_stp
  *
index 98c221d..80ede37 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Description: EBTables 802.1Q match extension kernelspace module.
  * Authors: Nick Fedchik <nick@fedchik.org.ua>
  *          Bart De Schuymer <bdschuym@pandora.be>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/if_ether.h>
index ec2652a..66e7af1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebtable_broute
  *
index 550324c..78cb9b2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebtable_filter
  *
index c0fb3ca..0888936 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  ebtable_nat
  *
index d369495..eb83051 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # CAIF net configurations
 #
index a4399be..0f9fe84 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Controller Area Network (CAN) network layer core configuration
 #
index cd2d5b9..2e8e6f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config CEPH_LIB
        tristate "Ceph core library"
        depends on INET
index 79eac46..1c811c7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/ceph/ceph_debug.h>
 #include <linux/backing-dev.h>
index 2105a6e..4cc2854 100644 (file)
@@ -271,7 +271,7 @@ static int decode_locker(void **p, void *end, struct ceph_locker *locker)
 
        dout("%s %s%llu cookie %s addr %s\n", __func__,
             ENTITY_NAME(locker->id.name), locker->id.cookie,
-            ceph_pr_addr(&locker->info.addr.in_addr));
+            ceph_pr_addr(&locker->info.addr));
        return 0;
 }
 
index 46f6570..63aef99 100644 (file)
@@ -46,7 +46,7 @@ static int monmap_show(struct seq_file *s, void *p)
 
                seq_printf(s, "\t%s%lld\t%s\n",
                           ENTITY_NAME(inst->name),
-                          ceph_pr_addr(&inst->addr.in_addr));
+                          ceph_pr_addr(&inst->addr));
        }
        return 0;
 }
@@ -82,7 +82,7 @@ static int osdmap_show(struct seq_file *s, void *p)
                char sb[64];
 
                seq_printf(s, "osd%d\t%s\t%3d%%\t(%s)\t%3d%%\n",
-                          i, ceph_pr_addr(&addr->in_addr),
+                          i, ceph_pr_addr(addr),
                           ((map->osd_weight[i]*100) >> 16),
                           ceph_osdmap_state_str(sb, sizeof(sb), state),
                           ((ceph_get_primary_affinity(map, i)*100) >> 16));
index 3083988..cd0b094 100644 (file)
@@ -186,17 +186,18 @@ static atomic_t addr_str_seq = ATOMIC_INIT(0);
 
 static struct page *zero_page;         /* used in certain error cases */
 
-const char *ceph_pr_addr(const struct sockaddr_storage *ss)
+const char *ceph_pr_addr(const struct ceph_entity_addr *addr)
 {
        int i;
        char *s;
-       struct sockaddr_in *in4 = (struct sockaddr_in *) ss;
-       struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) ss;
+       struct sockaddr_storage ss = addr->in_addr; /* align */
+       struct sockaddr_in *in4 = (struct sockaddr_in *)&ss;
+       struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&ss;
 
        i = atomic_inc_return(&addr_str_seq) & ADDR_STR_COUNT_MASK;
        s = addr_str[i];
 
-       switch (ss->ss_family) {
+       switch (ss.ss_family) {
        case AF_INET:
                snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%hu", &in4->sin_addr,
                         ntohs(in4->sin_port));
@@ -209,7 +210,7 @@ const char *ceph_pr_addr(const struct sockaddr_storage *ss)
 
        default:
                snprintf(s, MAX_ADDR_STR_LEN, "(unknown sockaddr family %hu)",
-                        ss->ss_family);
+                        ss.ss_family);
        }
 
        return s;
@@ -449,7 +450,7 @@ static void set_sock_callbacks(struct socket *sock,
  */
 static int ceph_tcp_connect(struct ceph_connection *con)
 {
-       struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
+       struct sockaddr_storage ss = con->peer_addr.in_addr; /* align */
        struct socket *sock;
        unsigned int noio_flag;
        int ret;
@@ -458,7 +459,7 @@ static int ceph_tcp_connect(struct ceph_connection *con)
 
        /* sock_create_kern() allocates with GFP_KERNEL */
        noio_flag = memalloc_noio_save();
-       ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family,
+       ret = sock_create_kern(read_pnet(&con->msgr->net), ss.ss_family,
                               SOCK_STREAM, IPPROTO_TCP, &sock);
        memalloc_noio_restore(noio_flag);
        if (ret)
@@ -471,18 +472,18 @@ static int ceph_tcp_connect(struct ceph_connection *con)
 
        set_sock_callbacks(sock, con);
 
-       dout("connect %s\n", ceph_pr_addr(&con->peer_addr.in_addr));
+       dout("connect %s\n", ceph_pr_addr(&con->peer_addr));
 
        con_sock_state_connecting(con);
-       ret = sock->ops->connect(sock, (struct sockaddr *)paddr, sizeof(*paddr),
+       ret = sock->ops->connect(sock, (struct sockaddr *)&ss, sizeof(ss),
                                 O_NONBLOCK);
        if (ret == -EINPROGRESS) {
                dout("connect %s EINPROGRESS sk_state = %u\n",
-                    ceph_pr_addr(&con->peer_addr.in_addr),
+                    ceph_pr_addr(&con->peer_addr),
                     sock->sk->sk_state);
        } else if (ret < 0) {
                pr_err("connect %s error %d\n",
-                      ceph_pr_addr(&con->peer_addr.in_addr), ret);
+                      ceph_pr_addr(&con->peer_addr), ret);
                sock_release(sock);
                return ret;
        }
@@ -669,8 +670,7 @@ static void reset_connection(struct ceph_connection *con)
 void ceph_con_close(struct ceph_connection *con)
 {
        mutex_lock(&con->mutex);
-       dout("con_close %p peer %s\n", con,
-            ceph_pr_addr(&con->peer_addr.in_addr));
+       dout("con_close %p peer %s\n", con, ceph_pr_addr(&con->peer_addr));
        con->state = CON_STATE_CLOSED;
 
        con_flag_clear(con, CON_FLAG_LOSSYTX);  /* so we retry next connect */
@@ -694,7 +694,7 @@ void ceph_con_open(struct ceph_connection *con,
                   struct ceph_entity_addr *addr)
 {
        mutex_lock(&con->mutex);
-       dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr));
+       dout("con_open %p %s\n", con, ceph_pr_addr(addr));
 
        WARN_ON(con->state != CON_STATE_CLOSED);
        con->state = CON_STATE_PREOPEN;
@@ -1788,21 +1788,22 @@ static int verify_hello(struct ceph_connection *con)
 {
        if (memcmp(con->in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) {
                pr_err("connect to %s got bad banner\n",
-                      ceph_pr_addr(&con->peer_addr.in_addr));
+                      ceph_pr_addr(&con->peer_addr));
                con->error_msg = "protocol error, bad banner";
                return -1;
        }
        return 0;
 }
 
-static bool addr_is_blank(struct sockaddr_storage *ss)
+static bool addr_is_blank(struct ceph_entity_addr *addr)
 {
-       struct in_addr *addr = &((struct sockaddr_in *)ss)->sin_addr;
-       struct in6_addr *addr6 = &((struct sockaddr_in6 *)ss)->sin6_addr;
+       struct sockaddr_storage ss = addr->in_addr; /* align */
+       struct in_addr *addr4 = &((struct sockaddr_in *)&ss)->sin_addr;
+       struct in6_addr *addr6 = &((struct sockaddr_in6 *)&ss)->sin6_addr;
 
-       switch (ss->ss_family) {
+       switch (ss.ss_family) {
        case AF_INET:
-               return addr->s_addr == htonl(INADDR_ANY);
+               return addr4->s_addr == htonl(INADDR_ANY);
        case AF_INET6:
                return ipv6_addr_any(addr6);
        default:
@@ -1810,25 +1811,25 @@ static bool addr_is_blank(struct sockaddr_storage *ss)
        }
 }
 
-static int addr_port(struct sockaddr_storage *ss)
+static int addr_port(struct ceph_entity_addr *addr)
 {
-       switch (ss->ss_family) {
+       switch (get_unaligned(&addr->in_addr.ss_family)) {
        case AF_INET:
-               return ntohs(((struct sockaddr_in *)ss)->sin_port);
+               return ntohs(get_unaligned(&((struct sockaddr_in *)&addr->in_addr)->sin_port));
        case AF_INET6:
-               return ntohs(((struct sockaddr_in6 *)ss)->sin6_port);
+               return ntohs(get_unaligned(&((struct sockaddr_in6 *)&addr->in_addr)->sin6_port));
        }
        return 0;
 }
 
-static void addr_set_port(struct sockaddr_storage *ss, int p)
+static void addr_set_port(struct ceph_entity_addr *addr, int p)
 {
-       switch (ss->ss_family) {
+       switch (get_unaligned(&addr->in_addr.ss_family)) {
        case AF_INET:
-               ((struct sockaddr_in *)ss)->sin_port = htons(p);
+               put_unaligned(htons(p), &((struct sockaddr_in *)&addr->in_addr)->sin_port);
                break;
        case AF_INET6:
-               ((struct sockaddr_in6 *)ss)->sin6_port = htons(p);
+               put_unaligned(htons(p), &((struct sockaddr_in6 *)&addr->in_addr)->sin6_port);
                break;
        }
 }
@@ -1836,21 +1837,18 @@ static void addr_set_port(struct sockaddr_storage *ss, int p)
 /*
  * Unlike other *_pton function semantics, zero indicates success.
  */
-static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss,
+static int ceph_pton(const char *str, size_t len, struct ceph_entity_addr *addr,
                char delim, const char **ipend)
 {
-       struct sockaddr_in *in4 = (struct sockaddr_in *) ss;
-       struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) ss;
+       memset(&addr->in_addr, 0, sizeof(addr->in_addr));
 
-       memset(ss, 0, sizeof(*ss));
-
-       if (in4_pton(str, len, (u8 *)&in4->sin_addr.s_addr, delim, ipend)) {
-               ss->ss_family = AF_INET;
+       if (in4_pton(str, len, (u8 *)&((struct sockaddr_in *)&addr->in_addr)->sin_addr.s_addr, delim, ipend)) {
+               put_unaligned(AF_INET, &addr->in_addr.ss_family);
                return 0;
        }
 
-       if (in6_pton(str, len, (u8 *)&in6->sin6_addr.s6_addr, delim, ipend)) {
-               ss->ss_family = AF_INET6;
+       if (in6_pton(str, len, (u8 *)&((struct sockaddr_in6 *)&addr->in_addr)->sin6_addr.s6_addr, delim, ipend)) {
+               put_unaligned(AF_INET6, &addr->in_addr.ss_family);
                return 0;
        }
 
@@ -1862,7 +1860,7 @@ static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss,
  */
 #ifdef CONFIG_CEPH_LIB_USE_DNS_RESOLVER
 static int ceph_dns_resolve_name(const char *name, size_t namelen,
-               struct sockaddr_storage *ss, char delim, const char **ipend)
+               struct ceph_entity_addr *addr, char delim, const char **ipend)
 {
        const char *end, *delim_p;
        char *colon_p, *ip_addr = NULL;
@@ -1889,9 +1887,9 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen,
                return -EINVAL;
 
        /* do dns_resolve upcall */
-       ip_len = dns_query(NULL, name, end - name, NULL, &ip_addr, NULL);
+       ip_len = dns_query(NULL, name, end - name, NULL, &ip_addr, NULL, false);
        if (ip_len > 0)
-               ret = ceph_pton(ip_addr, ip_len, ss, -1, NULL);
+               ret = ceph_pton(ip_addr, ip_len, addr, -1, NULL);
        else
                ret = -ESRCH;
 
@@ -1900,13 +1898,13 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen,
        *ipend = end;
 
        pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name), name,
-                       ret, ret ? "failed" : ceph_pr_addr(ss));
+                       ret, ret ? "failed" : ceph_pr_addr(addr));
 
        return ret;
 }
 #else
 static inline int ceph_dns_resolve_name(const char *name, size_t namelen,
-               struct sockaddr_storage *ss, char delim, const char **ipend)
+               struct ceph_entity_addr *addr, char delim, const char **ipend)
 {
        return -EINVAL;
 }
@@ -1917,13 +1915,13 @@ static inline int ceph_dns_resolve_name(const char *name, size_t namelen,
  * then try to extract a hostname to resolve using userspace DNS upcall.
  */
 static int ceph_parse_server_name(const char *name, size_t namelen,
-                       struct sockaddr_storage *ss, char delim, const char **ipend)
+               struct ceph_entity_addr *addr, char delim, const char **ipend)
 {
        int ret;
 
-       ret = ceph_pton(name, namelen, ss, delim, ipend);
+       ret = ceph_pton(name, namelen, addr, delim, ipend);
        if (ret)
-               ret = ceph_dns_resolve_name(name, namelen, ss, delim, ipend);
+               ret = ceph_dns_resolve_name(name, namelen, addr, delim, ipend);
 
        return ret;
 }
@@ -1942,7 +1940,6 @@ int ceph_parse_ips(const char *c, const char *end,
        dout("parse_ips on '%.*s'\n", (int)(end-c), c);
        for (i = 0; i < max_count; i++) {
                const char *ipend;
-               struct sockaddr_storage *ss = &addr[i].in_addr;
                int port;
                char delim = ',';
 
@@ -1951,7 +1948,7 @@ int ceph_parse_ips(const char *c, const char *end,
                        p++;
                }
 
-               ret = ceph_parse_server_name(p, end - p, ss, delim, &ipend);
+               ret = ceph_parse_server_name(p, end - p, &addr[i], delim, &ipend);
                if (ret)
                        goto bad;
                ret = -EINVAL;
@@ -1982,9 +1979,9 @@ int ceph_parse_ips(const char *c, const char *end,
                        port = CEPH_MON_PORT;
                }
 
-               addr_set_port(ss, port);
+               addr_set_port(&addr[i], port);
 
-               dout("parse_ips got %s\n", ceph_pr_addr(ss));
+               dout("parse_ips got %s\n", ceph_pr_addr(&addr[i]));
 
                if (p == end)
                        break;
@@ -2023,12 +2020,12 @@ static int process_banner(struct ceph_connection *con)
         */
        if (memcmp(&con->peer_addr, &con->actual_peer_addr,
                   sizeof(con->peer_addr)) != 0 &&
-           !(addr_is_blank(&con->actual_peer_addr.in_addr) &&
+           !(addr_is_blank(&con->actual_peer_addr) &&
              con->actual_peer_addr.nonce == con->peer_addr.nonce)) {
                pr_warn("wrong peer, want %s/%d, got %s/%d\n",
-                       ceph_pr_addr(&con->peer_addr.in_addr),
+                       ceph_pr_addr(&con->peer_addr),
                        (int)le32_to_cpu(con->peer_addr.nonce),
-                       ceph_pr_addr(&con->actual_peer_addr.in_addr),
+                       ceph_pr_addr(&con->actual_peer_addr),
                        (int)le32_to_cpu(con->actual_peer_addr.nonce));
                con->error_msg = "wrong peer at address";
                return -1;
@@ -2037,16 +2034,16 @@ static int process_banner(struct ceph_connection *con)
        /*
         * did we learn our address?
         */
-       if (addr_is_blank(&con->msgr->inst.addr.in_addr)) {
-               int port = addr_port(&con->msgr->inst.addr.in_addr);
+       if (addr_is_blank(&con->msgr->inst.addr)) {
+               int port = addr_port(&con->msgr->inst.addr);
 
                memcpy(&con->msgr->inst.addr.in_addr,
                       &con->peer_addr_for_me.in_addr,
                       sizeof(con->peer_addr_for_me.in_addr));
-               addr_set_port(&con->msgr->inst.addr.in_addr, port);
+               addr_set_port(&con->msgr->inst.addr, port);
                encode_my_addr(con->msgr);
                dout("process_banner learned my addr is %s\n",
-                    ceph_pr_addr(&con->msgr->inst.addr.in_addr));
+                    ceph_pr_addr(&con->msgr->inst.addr));
        }
 
        return 0;
@@ -2097,7 +2094,7 @@ static int process_connect(struct ceph_connection *con)
                pr_err("%s%lld %s feature set mismatch,"
                       " my %llx < server's %llx, missing %llx\n",
                       ENTITY_NAME(con->peer_name),
-                      ceph_pr_addr(&con->peer_addr.in_addr),
+                      ceph_pr_addr(&con->peer_addr),
                       sup_feat, server_feat, server_feat & ~sup_feat);
                con->error_msg = "missing required protocol features";
                reset_connection(con);
@@ -2107,7 +2104,7 @@ static int process_connect(struct ceph_connection *con)
                pr_err("%s%lld %s protocol version mismatch,"
                       " my %d != server's %d\n",
                       ENTITY_NAME(con->peer_name),
-                      ceph_pr_addr(&con->peer_addr.in_addr),
+                      ceph_pr_addr(&con->peer_addr),
                       le32_to_cpu(con->out_connect.protocol_version),
                       le32_to_cpu(con->in_reply.protocol_version));
                con->error_msg = "protocol version mismatch";
@@ -2141,7 +2138,7 @@ static int process_connect(struct ceph_connection *con)
                     le32_to_cpu(con->in_reply.connect_seq));
                pr_err("%s%lld %s connection reset\n",
                       ENTITY_NAME(con->peer_name),
-                      ceph_pr_addr(&con->peer_addr.in_addr));
+                      ceph_pr_addr(&con->peer_addr));
                reset_connection(con);
                con_out_kvec_reset(con);
                ret = prepare_write_connect(con);
@@ -2198,7 +2195,7 @@ static int process_connect(struct ceph_connection *con)
                        pr_err("%s%lld %s protocol feature mismatch,"
                               " my required %llx > server's %llx, need %llx\n",
                               ENTITY_NAME(con->peer_name),
-                              ceph_pr_addr(&con->peer_addr.in_addr),
+                              ceph_pr_addr(&con->peer_addr),
                               req_feat, server_feat, req_feat & ~server_feat);
                        con->error_msg = "missing required protocol features";
                        reset_connection(con);
@@ -2405,7 +2402,7 @@ static int read_partial_message(struct ceph_connection *con)
        if ((s64)seq - (s64)con->in_seq < 1) {
                pr_info("skipping %s%lld %s seq %lld expected %lld\n",
                        ENTITY_NAME(con->peer_name),
-                       ceph_pr_addr(&con->peer_addr.in_addr),
+                       ceph_pr_addr(&con->peer_addr),
                        seq, con->in_seq + 1);
                con->in_base_pos = -front_len - middle_len - data_len -
                        sizeof_footer(con);
@@ -2984,10 +2981,10 @@ static void ceph_con_workfn(struct work_struct *work)
 static void con_fault(struct ceph_connection *con)
 {
        dout("fault %p state %lu to peer %s\n",
-            con, con->state, ceph_pr_addr(&con->peer_addr.in_addr));
+            con, con->state, ceph_pr_addr(&con->peer_addr));
 
        pr_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name),
-               ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg);
+               ceph_pr_addr(&con->peer_addr), con->error_msg);
        con->error_msg = NULL;
 
        WARN_ON(con->state != CON_STATE_CONNECTING &&
index a53e4fb..895679d 100644 (file)
@@ -76,7 +76,7 @@ struct ceph_monmap *ceph_monmap_decode(void *p, void *end)
             m->num_mon);
        for (i = 0; i < m->num_mon; i++)
                dout("monmap_decode  mon%d is %s\n", i,
-                    ceph_pr_addr(&m->mon_inst[i].addr.in_addr));
+                    ceph_pr_addr(&m->mon_inst[i].addr));
        return m;
 
 bad:
@@ -203,7 +203,7 @@ static void reopen_session(struct ceph_mon_client *monc)
 {
        if (!monc->hunting)
                pr_info("mon%d %s session lost, hunting for new mon\n",
-                   monc->cur_mon, ceph_pr_addr(&monc->con.peer_addr.in_addr));
+                   monc->cur_mon, ceph_pr_addr(&monc->con.peer_addr));
 
        __close_session(monc);
        __open_session(monc);
@@ -1178,7 +1178,7 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
                __resend_generic_request(monc);
 
                pr_info("mon%d %s session established\n", monc->cur_mon,
-                       ceph_pr_addr(&monc->con.peer_addr.in_addr));
+                       ceph_pr_addr(&monc->con.peer_addr));
        }
 
 out:
index 6f739de..9a8eca5 100644 (file)
@@ -4926,7 +4926,7 @@ static int decode_watcher(void **p, void *end, struct ceph_watch_item *item)
 
        dout("%s %s%llu cookie %llu addr %s\n", __func__,
             ENTITY_NAME(item->name), item->cookie,
-            ceph_pr_addr(&item->addr.in_addr));
+            ceph_pr_addr(&item->addr));
        return 0;
 }
 
index a031bd3..3f9ce60 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * 32bit Socket syscall emulation. Based on arch/sparc64/kernel/sys_sparc32.c.
  *
index d4ce054..4ea4347 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Monitoring code for network dropped packet alerts
  *
index 1f13d90..e463662 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * net/core/dst.c      Protocol independent destination cache.
  *
index 548f39d..edd6229 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/export.h>
index 711b161..15f6884 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/workqueue.h>
index a0f0541..dd8b1a4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Common framework for low-level network console, dump, and debugger code
  *
index af6ad46..7b6b1d2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2016 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
  */
index 4066d59..917e6e7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DCB
        bool "Data Center Bridging support"
        default n
index c1282c9..3016e5a 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DCB) += dcbnl.o dcbevent.o
index b270e84..f7c7495 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig IP_DCCP
        tristate "The DCCP Protocol"
        depends on INET
index 8ba3fc9..4a358e6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "DCCP CCIDs Configuration"
 
 config IP_DCCP_CCID2_DEBUG
index dcc7495..0935453 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DECnet configuration
 #
index c1fa478..0ea7528 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  * DECnet       An implementation of the DECnet protocol suite for the LINUX
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 
 HISTORY:
 
index 2fb5e05..e4161e0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DECnet       An implementation of the DECnet protocol suite for the LINUX
  *              operating system.  DECnet is implemented using the  BSD Socket
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 *******************************************************************************/
 
 #include <linux/errno.h>
index a1779de..00f2ed7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DECnet       An implementation of the DECnet protocol suite for the LINUX
  *              operating system.  DECnet is implemented using the  BSD Socket
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 *******************************************************************************/
 
 #include <linux/errno.h>
index 6645847..aea9181 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * DECnet       An implementation of the DECnet protocol suite for the LINUX
  *              operating system.  DECnet is implemented using the  BSD Socket
 /******************************************************************************
     (c) 1995-1998 E.M. Serrat          emserrat@geocities.com
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
-
-    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.
 *******************************************************************************/
 
 #include <linux/errno.h>
index 8d7c109..14ec4ef 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # DECnet netfilter configuration
 #
index b579e52..429c842 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for DECnet netfilter modules
 #
index 50d49f7..0a1c223 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Configuration for DNS Resolver
 #
index d5c13c2..877532d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux DNS Resolver.
 #
index 19aa32f..2d26043 100644 (file)
@@ -54,6 +54,7 @@
  * @options: Request options (or NULL if no options)
  * @_result: Where to place the returned data (or NULL)
  * @_expiry: Where to store the result expiry time (or NULL)
+ * @invalidate: Always invalidate the key after use
  *
  * The data will be returned in the pointer at *result, if provided, and the
  * caller is responsible for freeing it.
@@ -69,7 +70,8 @@
  * Returns the size of the result on success, -ve error code otherwise.
  */
 int dns_query(const char *type, const char *name, size_t namelen,
-             const char *options, char **_result, time64_t *_expiry)
+             const char *options, char **_result, time64_t *_expiry,
+             bool invalidate)
 {
        struct key *rkey;
        struct user_key_payload *upayload;
@@ -157,6 +159,8 @@ int dns_query(const char *type, const char *name, size_t namelen,
        ret = len;
 put:
        up_read(&rkey->sem);
+       if (invalidate)
+               key_invalidate(rkey);
        key_put(rkey);
 out:
        kleave(" = %d", ret);
index cf85535..d449f78 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config HAVE_NET_DSA
        def_bool y
        depends on INET && NETDEVICES && !S390
index 3231775..e03eff9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Ethernet layer.
 #
index 4b683fd..9c58f87 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IEC 62439-3 High-availability Seamless Redundancy
 #
index e45757f..75df90d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for HSR
 #
index 9fa9abd..2d7a197 100644 (file)
@@ -365,6 +365,14 @@ void hsr_prune_nodes(struct timer_list *t)
 
        rcu_read_lock();
        list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
+               /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A]
+                * nor time_in[HSR_PT_SLAVE_B], will ever be updated for
+                * the master port. Thus the master node will be repeatedly
+                * pruned leading to packet loss.
+                */
+               if (hsr_addr_is_self(hsr, node->macaddress_A))
+                       continue;
+
                /* Shorthand */
                time_a = node->time_in[HSR_PT_SLAVE_A];
                time_b = node->time_in[HSR_PT_SLAVE_B];
index d24f985..d1b4655 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IEEE802154_6LOWPAN
        tristate "6lowpan support over IEEE 802.15.4"
        depends on 6LOWPAN
index 6bfb270..f11d637 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_IEEE802154_6LOWPAN) += ieee802154_6lowpan.o
 
 ieee802154_6lowpan-y := core.o rx.o reassembly.o tx.o
index 188135b..5dbbc2c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig IEEE802154
        tristate "IEEE Std 802.15.4 Low-Rate Wireless Personal Area Networks support"
        ---help---
index 31e48b6..6cd1f6d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IFE subsystem configuration
 #
index 2a90d97..1258fcb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the IFE encapsulation protocol
 #
index 8108e97..974de4d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IP configuration
 #
index c01fa79..9c3afd5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "IPsec: " fmt
 
 #include <crypto/algapi.h>
index e9e42f9..00af530 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_BPFILTER) += sockopt.o
index f0165c5..3768822 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * CIPSO - Commercial IP Security Option
  *
  *   http://www.itl.nist.gov/fipspubs/fip188.htm
  *
  * Author: Paul Moore <paul.moore@hp.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index fb065a8..b9ae955 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) "IPsec: " fmt
 
 #include <crypto/aead.h>
index ca95051..30fa771 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
index 6c2febc..eb03153 100644 (file)
@@ -188,6 +188,17 @@ static void ip_ma_put(struct ip_mc_list *im)
             pmc != NULL;                                       \
             pmc = rtnl_dereference(pmc->next_rcu))
 
+static void ip_sf_list_clear_all(struct ip_sf_list *psf)
+{
+       struct ip_sf_list *next;
+
+       while (psf) {
+               next = psf->sf_next;
+               kfree(psf);
+               psf = next;
+       }
+}
+
 #ifdef CONFIG_IP_MULTICAST
 
 /*
@@ -633,6 +644,13 @@ static void igmpv3_clear_zeros(struct ip_sf_list **ppsf)
        }
 }
 
+static void kfree_pmc(struct ip_mc_list *pmc)
+{
+       ip_sf_list_clear_all(pmc->sources);
+       ip_sf_list_clear_all(pmc->tomb);
+       kfree(pmc);
+}
+
 static void igmpv3_send_cr(struct in_device *in_dev)
 {
        struct ip_mc_list *pmc, *pmc_prev, *pmc_next;
@@ -669,7 +687,7 @@ static void igmpv3_send_cr(struct in_device *in_dev)
                        else
                                in_dev->mc_tomb = pmc_next;
                        in_dev_put(pmc->interface);
-                       kfree(pmc);
+                       kfree_pmc(pmc);
                } else
                        pmc_prev = pmc;
        }
@@ -1215,14 +1233,18 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im)
                im->interface = pmc->interface;
                if (im->sfmode == MCAST_INCLUDE) {
                        im->tomb = pmc->tomb;
+                       pmc->tomb = NULL;
+
                        im->sources = pmc->sources;
+                       pmc->sources = NULL;
+
                        for (psf = im->sources; psf; psf = psf->sf_next)
                                psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
                } else {
                        im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
                }
                in_dev_put(pmc->interface);
-               kfree(pmc);
+               kfree_pmc(pmc);
        }
        spin_unlock_bh(&im->lock);
 }
@@ -1243,21 +1265,18 @@ static void igmpv3_clear_delrec(struct in_device *in_dev)
                nextpmc = pmc->next;
                ip_mc_clear_src(pmc);
                in_dev_put(pmc->interface);
-               kfree(pmc);
+               kfree_pmc(pmc);
        }
        /* clear dead sources, too */
        rcu_read_lock();
        for_each_pmc_rcu(in_dev, pmc) {
-               struct ip_sf_list *psf, *psf_next;
+               struct ip_sf_list *psf;
 
                spin_lock_bh(&pmc->lock);
                psf = pmc->tomb;
                pmc->tomb = NULL;
                spin_unlock_bh(&pmc->lock);
-               for (; psf; psf = psf_next) {
-                       psf_next = psf->sf_next;
-                       kfree(psf);
-               }
+               ip_sf_list_clear_all(psf);
        }
        rcu_read_unlock();
 }
@@ -2123,7 +2142,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
 
 static void ip_mc_clear_src(struct ip_mc_list *pmc)
 {
-       struct ip_sf_list *psf, *nextpsf, *tomb, *sources;
+       struct ip_sf_list *tomb, *sources;
 
        spin_lock_bh(&pmc->lock);
        tomb = pmc->tomb;
@@ -2135,14 +2154,8 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc)
        pmc->sfcount[MCAST_EXCLUDE] = 1;
        spin_unlock_bh(&pmc->lock);
 
-       for (psf = tomb; psf; psf = nextpsf) {
-               nextpsf = psf->sf_next;
-               kfree(psf);
-       }
-       for (psf = sources; psf; psf = nextpsf) {
-               nextpsf = psf->sf_next;
-               kfree(psf);
-       }
+       ip_sf_list_clear_all(tomb);
+       ip_sf_list_clear_all(sources);
 }
 
 /* Join a multicast group
index 88c5069..c411c87 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * INET                An implementation of the TCP/IP protocol suite for the LINUX
  *             operating system.  INET is implemented using the  BSD Socket
index ac880be..bfd0ca5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * INET                An implementation of the TCP/IP protocol suite for the LINUX
  *             operating system.  INET is implemented using the  BSD Socket
index ca9a5fe..3205d5f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/types.h>
index 1412b02..3e64942 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IP netfilter configuration
 #
index 2dc83de..214154b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Packet matching code for ARP packets.
  *
index a5e52a9..87ca2c4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* module that allows mangling of the arp payload */
 #include <linux/module.h>
 #include <linux/netfilter.h>
index 8f8713b..c216b9a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Filtering ARP tables module.
  *
index 960625a..6eefde5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * 'raw' table, which is the very first hooked in at PRE_ROUTING and LOCAL_OUT .
  *
index 39895b9..af3fbf7 100644 (file)
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * (C) 2007 by Sebastian Claßen <sebastian.classen@freenet.ag>
  * (C) 2007-2010 by Jan Engelhardt <jengelh@medozas.de>
  *
  * Extracted from xt_TEE.c
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 or later, as
- * published by the Free Software Foundation.
  */
 #include <linux/ip.h>
 #include <linux/module.h>
index e1e56d7..012c404 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index e17b4ee..b2aeb7b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * nf_nat_pptp.c
  *
index 0a8a60c..657d2dc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * nf_nat_snmp_basic.c
  *
  *
  * Copyright (c) 2000 RP Internet (www.rpi.net.au).
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This 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.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Author: James Morris <jmorris@intercode.com.au>
  *
  * Copyright (c) 2006-2010 Patrick McHardy <kaber@trash.net>
index d8e3a1f..b920e1b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/types.h>
index 7ccb5f8..834be7d 100644 (file)
@@ -1113,7 +1113,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
        __u16 srcp = ntohs(inet->inet_sport);
 
        seq_printf(f, "%5d: %08X:%04X %08X:%04X"
-               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
+               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u",
                bucket, src, srcp, dest, destp, sp->sk_state,
                sk_wmem_alloc_get(sp),
                sk_rmem_alloc_get(sp),
index dc91c27..0e482f0 100644 (file)
@@ -1076,7 +1076,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
              srcp  = inet->inet_num;
 
        seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
-               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n",
+               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n",
                i, src, srcp, dest, destp, sp->sk_state,
                sk_wmem_alloc_get(sp),
                sk_rmem_alloc_get(sp),
index c200065..899e34c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 
 #include <linux/inet_diag.h>
index fc36143..645cc30 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Binary Increase Congestion control for TCP
  * Home page:
index 37eebd9..709d238 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * CAIA Delay-Gradient (CDG) congestion control
  *
index bc6c02f..e1862b6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Pluggable TCP congestion control support and newReno
  * congestion control.
index 78bfadf..1b3d032 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP CUBIC: Binary Increase Congestion control for TCP v2.3
  * Home page:
index d1c33c9..bfdfbb9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Sally Floyd's High Speed TCP (RFC 3649) congestion control
  *
index 082d479..88e1f01 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * H-TCP congestion control. The algorithm is detailed in:
  * R.N.Shorten, D.J.Leith:
index 0f7175c..be39327 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP HYBLA
  *
index faddf4f..00e5487 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP Illinois congestion control.
  * Home page:
index ae10ed6..8c643a4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP Low Priority (TCP-LP)
  *
index 9c2a0d3..7c35731 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * INET                An implementation of the TCP/IP protocol suite for the LINUX
  *             operating system.  INET is implemented using the  BSD Socket
index 764298e..95db7a1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP NV: TCP with Congestion Avoidance
  *
index 0c4ed66..f429e85 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * INET                An implementation of the TCP/IP protocol suite for the LINUX
  *             operating system.  INET is implemented using the  BSD Socket
index baed218..0de6935 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <net/tcp.h>
 
 /* The bandwidth estimator estimates the rate at which the network
index addc122..471571e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* Tom Kelly's Scalable TCP
  *
  * See http://www.deneholme.net/tom/scalable/
index 2ac23da..5bad937 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * INET                An implementation of the TCP/IP protocol suite for the LINUX
  *             operating system.  INET is implemented using the  BSD Socket
index 95df7f7..3d8a1d8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Pluggable TCP upper layer protocol support.
  *
index ee113ff..3f51e78 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP Vegas congestion control
  *
index 6fcf482..3b36bb1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP Veno congestion control
  *
index bec9caf..b2e05c4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * TCP Westwood+: end-to-end bandwidth estimation for TCP
  *
index 96e829b..e00570d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *
  *   YeAH TCP
index 33bf8e9..c4b2ccb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* tunnel4.c: Generic IP tunnel transformer.
  *
  * Copyright (C) 2003 David S. Miller (davem@redhat.com)
index 3c58ba0..8fb250e 100644 (file)
@@ -2883,7 +2883,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
        __u16 srcp        = ntohs(inet->inet_sport);
 
        seq_printf(f, "%5d: %08X:%04X %08X:%04X"
-               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
+               " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u",
                bucket, src, srcp, dest, destp, sp->sk_state,
                sk_wmem_alloc_get(sp),
                udp_rqueue_get(sp),
index e93cc03..150e6f0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
index 06347db..5d00e54 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* xfrm4_tunnel.c: Generic IP tunnel transformer.
  *
  * Copyright (C) 2003 David S. Miller (davem@redhat.com)
index cd915e3..ae1344e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IPv6 configuration
 #
index f96d1de..b51630d 100644 (file)
@@ -5661,18 +5661,6 @@ static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = {
        [IFLA_INET6_TOKEN]              = { .len = sizeof(struct in6_addr) },
 };
 
-static int inet6_validate_link_af(const struct net_device *dev,
-                                 const struct nlattr *nla)
-{
-       struct nlattr *tb[IFLA_INET6_MAX + 1];
-
-       if (dev && !__in6_dev_get(dev))
-               return -EAFNOSUPPORT;
-
-       return nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla,
-                                          inet6_af_policy, NULL);
-}
-
 static int check_addr_gen_mode(int mode)
 {
        if (mode != IN6_ADDR_GEN_MODE_EUI64 &&
@@ -5693,14 +5681,44 @@ static int check_stable_privacy(struct inet6_dev *idev, struct net *net,
        return 1;
 }
 
+static int inet6_validate_link_af(const struct net_device *dev,
+                                 const struct nlattr *nla)
+{
+       struct nlattr *tb[IFLA_INET6_MAX + 1];
+       struct inet6_dev *idev = NULL;
+       int err;
+
+       if (dev) {
+               idev = __in6_dev_get(dev);
+               if (!idev)
+                       return -EAFNOSUPPORT;
+       }
+
+       err = nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla,
+                                         inet6_af_policy, NULL);
+       if (err)
+               return err;
+
+       if (!tb[IFLA_INET6_TOKEN] && !tb[IFLA_INET6_ADDR_GEN_MODE])
+               return -EINVAL;
+
+       if (tb[IFLA_INET6_ADDR_GEN_MODE]) {
+               u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]);
+
+               if (check_addr_gen_mode(mode) < 0)
+                       return -EINVAL;
+               if (dev && check_stable_privacy(idev, dev_net(dev), mode) < 0)
+                       return -EINVAL;
+       }
+
+       return 0;
+}
+
 static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
 {
-       int err = -EINVAL;
        struct inet6_dev *idev = __in6_dev_get(dev);
        struct nlattr *tb[IFLA_INET6_MAX + 1];
-
-       if (!idev)
-               return -EAFNOSUPPORT;
+       int err;
 
        if (nla_parse_nested_deprecated(tb, IFLA_INET6_MAX, nla, NULL, NULL) < 0)
                BUG();
@@ -5714,15 +5732,10 @@ static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
        if (tb[IFLA_INET6_ADDR_GEN_MODE]) {
                u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]);
 
-               if (check_addr_gen_mode(mode) < 0 ||
-                   check_stable_privacy(idev, dev_net(dev), mode) < 0)
-                       return -EINVAL;
-
                idev->cnf.addr_gen_mode = mode;
-               err = 0;
        }
 
-       return err;
+       return 0;
 }
 
 static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
index 763a947..5b12466 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IPv6 library code, needed by static components when full IPv6 support is
  * not configured or static.
index 78c9743..68b9e92 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2002 USAGI/WIDE Project
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Authors
  *
  *     Mitsuru KANDA @USAGI       : IPv6 Support
index 1c0bb9f..221c81f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * CALIPSO - Common Architecture Label IPv6 Security Option
  *
@@ -6,25 +7,10 @@
  *
  * Authors: Paul Moore <paul.moore@hp.com>
  *          Huw Davies <huw@codeweavers.com>
- *
  */
 
 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
  * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index ee4a4e5..f07fb24 100644 (file)
@@ -1034,7 +1034,7 @@ void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
        src   = &sp->sk_v6_rcv_saddr;
        seq_printf(seq,
                   "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
-                  "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n",
+                  "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n",
                   bucket,
                   src->s6_addr32[0], src->s6_addr32[1],
                   src->s6_addr32[2], src->s6_addr32[3], srcp,
index 239d4a6..ae6a739 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2002 USAGI/WIDE Project
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Authors
  *
  *     Mitsuru KANDA @USAGI       : IPv6 Support
index ae365df..11a43ee 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IPv6 library code, needed by static components when full IPv6 support is
  * not configured or static.
index ec4e2ed..091f941 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
index b7739ab..1bc88ed 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ILA module
 #
index 25430c9..58956a6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
index 54d165b..51fd332 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * IP Payload Compression Protocol (IPComp) for IPv6 - RFC3173
  *
  * Copyright (C)2003 USAGI/WIDE Project
  *
  * Author      Mitsuru KANDA  <mk@linux-ipv6.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * [Memo]
index 64f0f7b..9180143 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2003-2006 Helsinki University of Technology
  * Copyright (C)2003-2006 USAGI/WIDE Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Authors:
index 086fc66..f7c6f5b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IP netfilter configuration
 #
index 710fa08..3f7d469 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IPv6 raw table, a port of the IPv4 raw table to IPv6
  *
index 4a7dded..e6c9da9 100644 (file)
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * (C) 2007 by Sebastian Claßen <sebastian.classen@freenet.ag>
  * (C) 2007-2010 by Jan Engelhardt <jengelh@medozas.de>
  *
  * Extracted from xt_TEE.c
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 or later, as
- * published by the Free Software Foundation.
  */
 #include <linux/module.h>
 #include <linux/percpu.h>
index c511d20..f6d9a48 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index 5dfd33a..34d51cd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <net/netfilter/nf_tproxy.h>
 #include <linux/module.h>
 #include <net/inet6_hashtables.h>
index 868ae23..af36acc 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * IPv6 library code, needed by static components when full IPv6 support is
  * not configured or static.  These functions are needed by GSO/GRO implementation.
index 84dbe21..96a3559 100644 (file)
@@ -287,7 +287,9 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                        /* Binding to link-local address requires an interface */
                        if (!sk->sk_bound_dev_if)
                                goto out_unlock;
+               }
 
+               if (sk->sk_bound_dev_if) {
                        err = -ENODEV;
                        dev = dev_get_by_index_rcu(sock_net(sk),
                                                   sk->sk_bound_dev_if);
index 7a014ca..848e944 100644 (file)
@@ -2512,6 +2512,12 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
        struct fib6_info *rt;
        struct fib6_node *fn;
 
+       /* l3mdev_update_flow overrides oif if the device is enslaved; in
+        * this case we must match on the real ingress device, so reset it
+        */
+       if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF)
+               fl6->flowi6_oif = skb->dev->ifindex;
+
        /* Get the "current" route for this destination and
         * check if the redirect has come from appropriate router.
         *
index 1991ded..21e7b95 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2003,2004 USAGI/WIDE Project
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Authors     Mitsuru KANDA  <mk@linux-ipv6.org>
  *             YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
  */
index d9e5f68..e11bdb0 100644 (file)
@@ -1,24 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C)2003,2004 USAGI/WIDE Project
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
  * Authors     Mitsuru KANDA  <mk@linux-ipv6.org>
  *             YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
  *
  * Based on net/ipv4/xfrm4_tunnel.c
- *
  */
 #include <linux/module.h>
 #include <linux/xfrm.h>
index 497fbe7..5cfddc9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IUCV
        depends on S390
        def_tristate y if S390
index 7bfdc85..984d7ff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for IUCV
 #
index 78ea5a7..36eb8d1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  IUCV protocol stack for Linux on zSeries
  *
index 9ca83f2..bf7e970 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config AF_KCM
        tristate "KCM sockets"
index 7125613..6c45692 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_AF_KCM) += kcm.o
 
 kcm-y := kcmsock.o kcmproc.o
index 8576080..ed779c2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the key AF.
 #
index 378c73b..655e064 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Layer Two Tunneling Protocol (L2TP)
 #
index 5d47325..de186df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Configuration for L3 master device support
 #
index 84a53a6..59755a9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the L3 device API
 #
index 6481839..6acfc99 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # LAPB Data Link Drive
 #
index fff797d..7be91b4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux LAPB layer.
 #
index 176a6c1..b0e646a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config LLC
        tristate
        depends on NET
index be471fe..0227cce 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MAC80211
        tristate "Generic IEEE 802.11 Networking Stack (mac80211)"
        depends on CFG80211
index d9558ff..9c94baa 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * mac80211 - channel management
  */
index fb45287..742624e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config MAC802154
        tristate "Generic IEEE 802.15.4 Soft Networking Stack (mac802154)"
        depends on IEEE802154
index 5857bb1..4059295 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_MAC802154)        += mac802154.o
 mac802154-objs         := main.o rx.o tx.o mac_cmd.o mib.o \
                           iface.o llsec.o util.o cfg.o trace.o
index 801ea90..d9391be 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # MPLS configuration
 #
index 9ca9236..53e33b6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for MPLS.
 #
index baa0982..198ec4f 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/skbuff.h>
 #include <linux/socket.h>
index 7f2b461..2f1e575 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Configuration for NCSI support
 #
index 436ef68..e205f3b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for NCSI API
 #
index 02b281d..21025c2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Core Netfilter Configuration"
        depends on NET && INET && NETFILTER
 
index 71f0690..b96fd3f 100644 (file)
@@ -163,7 +163,7 @@ nf_hook_entries_grow(const struct nf_hook_entries *old,
 
 static void hooks_validate(const struct nf_hook_entries *hooks)
 {
-#ifdef CONFIG_DEBUG_KERNEL
+#ifdef CONFIG_DEBUG_MISC
        struct nf_hook_ops **orig_ops;
        int prio = INT_MIN;
        size_t i = 0;
index 4083a80..3c27348 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig IP_SET
        tristate "IP set support"
        depends on INET && NETFILTER
index d5be9c2..ff570bf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/export.h>
 #include <linux/netfilter/ipset/pfxlen.h>
 
index 8401cef..f6f1a0d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # IP Virtual Server configuration
 #
index 0df17ca..8e104df 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define KMSG_COMPONENT "IPVS"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
index d07ef9e..0ac6705 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define KMSG_COMPONENT "IPVS"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
index 7554c56..82f36be 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * count the number of connections matching an arbitrary key.
  *
index 976f1dc..b22042a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Connection tracking support for PPTP (Point to Point Tunneling Protocol).
  * PPTP is a a protocol for creating virtual private networks.
index ee9ab10..c2eb365 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ip_conntrack_proto_gre.c - Version 3.0
  *
index 9da3034..dc21a43 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/netfilter.h>
 #include <net/tcp.h>
index 4469519..948b4eb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index 99771aa..593357a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index bfd44db..2413174 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index a61d6df..3574a21 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
index 7b827bc..f42326b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 #include <linux/kernel.h>
index d70742e..aa5f571 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 87b60d6..f54d6ae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <net/ip.h>
 #include <net/tcp.h>
 
index 1dae02a..a5ebd56 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     "TEE" target extension for Xtables
  *     Copyright © Sebastian Claßen, 2007
@@ -5,10 +6,6 @@
  *
  *     based on ipt_ROUTE.c from Cédric de Launois
  *     <delaunois@info.ucl.be>
- *
- *     This program is free software; you can redistribute it and/or
- *     modify it under the terms of the GNU General Public License
- *     version 2 or later, as published by the Free Software Foundation.
  */
 #include <linux/module.h>
 #include <linux/skbuff.h>
index 858d189..349ab56 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* This is a module which is used to mark packets for tracing.
  */
 #include <linux/module.h>
index 5c861d2..f095557 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Implements a dummy match to allow attaching comments to rules
  *
index 29c38aa..eec2f3a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *     xt_connmark - Netfilter module to operate on connection marks
  *
@@ -5,19 +6,6 @@
  *     by Henrik Nordstrom <hno@marasystems.com>
  *     Copyright © CC Computer Consultants GmbH, 2007 - 2008
  *     Jan Engelhardt <jengelh@medozas.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/module.h>
index a30536b..2d2691d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     xt_hashlimit - Netfilter module to limit the number of packets per time
  *     separately for each hashbucket (sourceip/sourceport/dstip/dstport)
index 1d950a6..253c71c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     xt_ipvs - kernel module to match IPVS connection properties
  *
index 7a10355..e1990ba 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2003+ Evgeniy Polyakov <zbr@ioremap.net>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
index 10d61a6..4452cc9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * netfilter module to enforce network quotas
  *
index 2d2fa1d..680015b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/module.h>
 #include <linux/skbuff.h>
index ade024c..11ec2ab 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/types.h>
 #include <linux/module.h>
index a95b503..177b40d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *     xt_u32 - kernel module to match u32 packet content
  *
index d9eaa30..64280a1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # NetLabel configuration
 #
index d0a3acf..3282acf 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel Network Address Lists
  *
@@ -7,25 +8,10 @@
  * as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index ac709f0..a01cf49 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel Network Address Lists
  *
@@ -7,25 +8,10 @@
  * as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_ADDRLIST_H
index 1de8717..249da67 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel CALIPSO/IPv6 Support
  *
@@ -7,25 +8,10 @@
  *
  * Authors: Paul Moore <paul@paul-moore.com>
  *          Huw Davies <huw@codeweavers.com>
- *
  */
 
 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index 9fd291c..ef3e9a7 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel CALIPSO Support
  *
@@ -7,25 +8,10 @@
  *
  * Authors: Paul Moore <paul@paul-moore.com>
  *          Huw Davies <huw@codeweavers.com>
- *
  */
 
 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  * (c) Copyright Huw Davies <huw@codeweavers.com>, 2015
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_CALIPSO
index 5d11219..0f16080 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel CIPSO/IPv4 Support
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index 8758268..85d7ecb 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel CIPSO/IPv4 Support
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_CIPSO_V4
index 41d0e95..f5d34da 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel Domain Hash Table
  *
@@ -7,25 +8,10 @@
  * as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index 1f92477..9f80972 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel Domain Hash Table
  *
@@ -7,25 +8,10 @@
  * as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_DOMAINHASH_H
index ee3e5b6..2b0ef55 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel Kernel API
  *
@@ -6,25 +7,10 @@
  * as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index cae04f2..e7a25fb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel Management Support
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index ea01e42..db20dfb 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel Management Support
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_MGMT_H
index b87dd34..d2e4ab8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel Unlabeled Support
  *
@@ -6,25 +7,10 @@
  * mappings for network protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 - 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/types.h>
index 3a9e5dc..058e3a2 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel Unlabeled Support
  *
@@ -6,25 +7,10 @@
  * mappings for network protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_UNLABELED_H
index 4676f5b..3ed4fea 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * NetLabel NETLINK Interface
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/init.h>
index 4a397cd..3c67afc 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * NetLabel NETLINK Interface
  *
@@ -6,25 +7,10 @@
  * protocols such as CIPSO and RIPSO.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _NETLABEL_USER_H
index 5d6e8c0..20f9679 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Netlink Sockets
 #
index e837917..de42df7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the netlink driver.
 #
index 216ab91..718a97d 100644 (file)
@@ -2642,7 +2642,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v)
                struct sock *s = v;
                struct netlink_sock *nlk = nlk_sk(s);
 
-               seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8d %-8lu\n",
+               seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n",
                           s,
                           s->sk_protocol,
                           nlk->portid,
index 7dda33b..c6255ea 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 
 #include <net/sock.h>
index 2660f5a..603e36c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux NET/ROM layer.
 #
index 6e0fa0c..9b27599 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # NFC sybsystem configuration
 #
index d3e594e..4a9e720 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  *
  * Authors:
  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/nfc.h>
index 947a470..c5f9c3e 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  *
  * Authors:
  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
index fd67f51..97bd3a2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_HCI
        depends on NFC
        tristate "NFC HCI implementation"
index c5dbb68..5a0aaae 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux NFC HCI layer.
 #
index 844673c..e02b9be 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "hci: %s: " fmt, __func__
index 19cb2e4..6f1b096 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "hci: %s: " fmt, __func__
index ab4c8e8..a59c96f 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __LOCAL_HCI_H
index 1fe725d..05c6098 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "hci: %s: " fmt, __func__
index 1f68724..97853c9 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 enum llcp_state {
index d1fc019..475061c 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "llcp: %s: " fmt, __func__
index 4fa0152..cc99751 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011  Intel Corporation. All rights reserved.
  * Copyright (C) 2014 Marvell International Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "llcp: %s: " fmt, __func__
index 17dcd0b..9b87429 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) "llcp: %s: " fmt, __func__
index 85d4819..ff1f295 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config NFC_NCI
        depends on NFC
        tristate "NCI protocol support"
index 04a8e47..1180b3e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  *
  *
  * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
index 6c6f76b..889fefd 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  *
  * Authors:
  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __LOCAL_NFC_H
index e2188de..ba5ffd3 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Instituto Nokia de Tecnologia
  *
  * Authors:
  *    Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
  *    Lauro Ramos Venancio <lauro.venancio@openbossa.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
index bafc3dd..19af948 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig NET_NSH
        tristate "Network Service Header (NSH) protocol"
        default n
index c93c787..de34a61 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NET_NSH) += nsh.o
index ac1cc6e..22d7d56 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Open vSwitch
 #
index cc55b35..b4abad1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Packet configuration
 #
index 9df6134..97d502e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the packet AF.
 #
index 98abfd8..07812ae 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/sock_diag.h>
 #include <linux/net.h>
index 6ec7d55..07f2c21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Phonet protocol
 #
index 3018799..2567af2 100644 (file)
@@ -607,7 +607,7 @@ static int pn_sock_seq_show(struct seq_file *seq, void *v)
                struct pn_sock *pn = pn_sk(sk);
 
                seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu "
-                       "%d %pK %d",
+                       "%d %pK %u",
                        sk->sk_protocol, pn->sobject, pn->dobject,
                        pn->resource, sk->sk_state,
                        sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk),
index d850246..028f514 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # psample packet sampling configuration
 #
index 609b0a7..a04367b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the psample netlink channel
 #
index 1944834..63f89cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Qualcomm IPC Router configuration
 #
 
index be012bf..1c6d6c1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_QRTR) := qrtr.o
 
 obj-$(CONFIG_QRTR_SMD) += qrtr-smd.o
index 801872a..05fa058 100644 (file)
@@ -733,8 +733,8 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
        struct sock *sk = sock->sk;
        struct qrtr_node *node;
        struct sk_buff *skb;
-       u32 type = 0;
        size_t plen;
+       u32 type;
        int rc;
 
        if (msg->msg_flags & ~(MSG_DONTWAIT))
@@ -809,9 +809,9 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
 
                /* control messages already require the type as 'command' */
                skb_copy_bits(skb, 0, &qrtr_type, 4);
-               type = le32_to_cpu(qrtr_type);
        }
 
+       type = le32_to_cpu(qrtr_type);
        rc = enqueue_fn(node, skb, type, &ipc->us, addr);
        if (rc >= 0)
                rc = len;
index b909211..38ea7f0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 config RDS
        tristate "The Reliable Datagram Sockets Protocol"
index 060600b..83a7af8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RF switch subsystem configuration
 #
index 87a80ad..dc47b61 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the RF switch subsystem.
 #
index 742e186..f9b08a6 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2006 - 2007 Ivo van Doorn
  * Copyright (C) 2007 Dmitry Torokhov
  * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
index 41a5cd4..f5afc9b 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2011, NVIDIA Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
 #include <linux/init.h>
index fa24811..3e6638f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Linux Rose (X.25 PLP) layer.
 #
index 86f8853..05610c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # RxRPC session sockets
 #
index ae8c5d7..ffde5b1 100644 (file)
@@ -270,6 +270,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
  * @gfp: The allocation constraints
  * @notify_rx: Where to send notifications instead of socket queue
  * @upgrade: Request service upgrade for call
+ * @intr: The call is interruptible
  * @debug_id: The debug ID for tracing to be assigned to the call
  *
  * Allow a kernel service to begin a call on the nominated socket.  This just
@@ -287,6 +288,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
                                           gfp_t gfp,
                                           rxrpc_notify_rx_t notify_rx,
                                           bool upgrade,
+                                          bool intr,
                                           unsigned int debug_id)
 {
        struct rxrpc_conn_parameters cp;
@@ -311,6 +313,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
        memset(&p, 0, sizeof(p));
        p.user_call_ID = user_call_ID;
        p.tx_total_len = tx_total_len;
+       p.intr = intr;
 
        memset(&cp, 0, sizeof(cp));
        cp.local                = rx->local;
@@ -443,6 +446,31 @@ void rxrpc_kernel_new_call_notification(
 }
 EXPORT_SYMBOL(rxrpc_kernel_new_call_notification);
 
+/**
+ * rxrpc_kernel_set_max_life - Set maximum lifespan on a call
+ * @sock: The socket the call is on
+ * @call: The call to configure
+ * @hard_timeout: The maximum lifespan of the call in jiffies
+ *
+ * Set the maximum lifespan of a call.  The call will end with ETIME or
+ * ETIMEDOUT if it takes longer than this.
+ */
+void rxrpc_kernel_set_max_life(struct socket *sock, struct rxrpc_call *call,
+                              unsigned long hard_timeout)
+{
+       unsigned long now;
+
+       mutex_lock(&call->user_mutex);
+
+       now = jiffies;
+       hard_timeout += now;
+       WRITE_ONCE(call->expect_term_by, hard_timeout);
+       rxrpc_reduce_call_timer(call, hard_timeout, now, rxrpc_timer_set_for_hard);
+
+       mutex_unlock(&call->user_mutex);
+}
+EXPORT_SYMBOL(rxrpc_kernel_set_max_life);
+
 /*
  * connect an RxRPC socket
  * - this just targets it at a specific destination; no actual connection
index 062ca9d..07fc1df 100644 (file)
@@ -482,6 +482,7 @@ enum rxrpc_call_flag {
        RXRPC_CALL_BEGAN_RX_TIMER,      /* We began the expect_rx_by timer */
        RXRPC_CALL_RX_HEARD,            /* The peer responded at least once to this call */
        RXRPC_CALL_RX_UNDERRUN,         /* Got data underrun */
+       RXRPC_CALL_IS_INTR,             /* The call is interruptible */
 };
 
 /*
@@ -711,6 +712,7 @@ struct rxrpc_call_params {
                u32             normal;         /* Max time since last call packet (msec) */
        } timeouts;
        u8                      nr_timeouts;    /* Number of timeouts specified */
+       bool                    intr;           /* The call is interruptible */
 };
 
 struct rxrpc_send_params {
index fe96881..d0ca98d 100644 (file)
@@ -241,6 +241,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
                return call;
        }
 
+       if (p->intr)
+               __set_bit(RXRPC_CALL_IS_INTR, &call->flags);
        call->tx_total_len = p->tx_total_len;
        trace_rxrpc_call(call, rxrpc_call_new_client, atomic_read(&call->usage),
                         here, (const void *)p->user_call_ID);
index 83797b3..5cf5595 100644 (file)
@@ -656,10 +656,14 @@ static int rxrpc_wait_for_channel(struct rxrpc_call *call, gfp_t gfp)
 
                add_wait_queue_exclusive(&call->waitq, &myself);
                for (;;) {
-                       set_current_state(TASK_INTERRUPTIBLE);
+                       if (test_bit(RXRPC_CALL_IS_INTR, &call->flags))
+                               set_current_state(TASK_INTERRUPTIBLE);
+                       else
+                               set_current_state(TASK_UNINTERRUPTIBLE);
                        if (call->call_id)
                                break;
-                       if (signal_pending(current)) {
+                       if (test_bit(RXRPC_CALL_IS_INTR, &call->flags) &&
+                           signal_pending(current)) {
                                ret = -ERESTARTSYS;
                                break;
                        }
index bec64de..45a05d9 100644 (file)
@@ -80,7 +80,8 @@ static int rxrpc_wait_for_tx_window_nonintr(struct rxrpc_sock *rx,
                if (call->state >= RXRPC_CALL_COMPLETE)
                        return call->error;
 
-               if (timeout == 0 &&
+               if (test_bit(RXRPC_CALL_IS_INTR, &call->flags) &&
+                   timeout == 0 &&
                    tx_win == tx_start && signal_pending(current))
                        return -EINTR;
 
@@ -620,6 +621,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
                .call.tx_total_len      = -1,
                .call.user_call_ID      = 0,
                .call.nr_timeouts       = 0,
+               .call.intr              = true,
                .abort_code             = 0,
                .command                = RXRPC_CMD_SEND_DATA,
                .exclusive              = false,
index 5c02ad9..2c72d95 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Traffic control configuration.
 #
index 9f4f420..e573e5a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * net/sched/cls_tcindex.c     Packet classifier for skb->tc_index
  *
index ddd883c..b9a94fd 100644 (file)
@@ -1,11 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * em_canid.c  Ematch rule to match CAN frames according to their CAN IDs
  *
- *              This program is free software; you can distribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              as published by the Free Software Foundation; either version
- *              2 of the License, or (at your option) any later version.
- *
  * Idea:       Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
  * Copyright:  (c) 2011 Czech Technical University in Prague
  *             (c) 2011 Volkswagen Group Research
index ae506c7..f4f9b8c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* net/sched/sch_atm.c - ATM VC selection "queueing discipline" */
 
 /* Written 1998-2000 by Werner Almesberger, EPFL ICA */
index 3deeb06..bad1cbe 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* net/sched/sch_dsmark.c - Differentiated Services field marker */
 
 /* Written 1998-2000 by Werner Almesberger, EPFL ICA */
index a28e09b..cee6971 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* net/sched/sch_hhf.c         Heavy-Hitter Filter (HHF)
  *
  * Copyright (C) 2013 Terry Lam <vtlam@google.com>
index 950ecf6..6e2eb1d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SCTP configuration
 #
index c717ef0..f54a70b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SMC
        tristate "SMC socket protocol family"
        depends on INET && INFINIBAND
index 4df96b4..cb12545 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SMC)      += smc.o
 obj-$(CONFIG_SMC_DIAG) += smc_diag.o
 smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o
index 086d991..0c874e9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  Shared Memory Communications over RDMA (SMC-R) and RoCE
  *
index 371b4cf..f38727e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Shared Memory Communications over RDMA (SMC-R) and RoCE
  *
index 472fbef..72372dc 100644 (file)
@@ -645,14 +645,6 @@ void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags)
 }
 EXPORT_SYMBOL(__sock_tx_timestamp);
 
-/**
- *     sock_sendmsg - send a message through @sock
- *     @sock: socket
- *     @msg: message to send
- *
- *     Sends @msg through @sock, passing through LSM.
- *     Returns the number of bytes sent, or an error code.
- */
 INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
                                           size_t));
 static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
@@ -663,6 +655,14 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
        return ret;
 }
 
+/**
+ *     sock_sendmsg - send a message through @sock
+ *     @sock: socket
+ *     @msg: message to send
+ *
+ *     Sends @msg through @sock, passing through LSM.
+ *     Returns the number of bytes sent, or an error code.
+ */
 int sock_sendmsg(struct socket *sock, struct msghdr *msg)
 {
        int err = security_socket_sendmsg(sock, msg,
@@ -875,15 +875,6 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
 }
 EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
 
-/**
- *     sock_recvmsg - receive a message from @sock
- *     @sock: socket
- *     @msg: message to receive
- *     @flags: message flags
- *
- *     Receives @msg from @sock, passing through LSM. Returns the total number
- *     of bytes received, or an error.
- */
 INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
                                           size_t , int ));
 static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
@@ -893,6 +884,15 @@ static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
                                   msg_data_left(msg), flags);
 }
 
+/**
+ *     sock_recvmsg - receive a message from @sock
+ *     @sock: socket
+ *     @msg: message to receive
+ *     @flags: message flags
+ *
+ *     Receives @msg from @sock, passing through LSM. Returns the total number
+ *     of bytes received, or an error.
+ */
 int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags)
 {
        int err = security_socket_recvmsg(sock, msg, msg_data_left(msg), flags);
index 94da19a..e6146c2 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config STREAM_PARSER
        def_bool n
index 858a126..9313191 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_STREAM_PARSER) += strparser.o
index 83f5617..aa30750 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SUNRPC
        tristate
        depends on MULTIUSER
index 2e0a6f9..d024af4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright 2009, Oracle.  All rights reserved.
  *
index e786102..cdb05b4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/auth.c
  *
index 0c5d789..8be2f20 100644 (file)
@@ -474,12 +474,12 @@ static int rsc_parse(struct cache_detail *cd,
                 * treatment so are checked for validity here.)
                 */
                /* uid */
-               rsci.cred.cr_uid = make_kuid(&init_user_ns, id);
+               rsci.cred.cr_uid = make_kuid(current_user_ns(), id);
 
                /* gid */
                if (get_int(&mesg, &id))
                        goto out;
-               rsci.cred.cr_gid = make_kgid(&init_user_ns, id);
+               rsci.cred.cr_gid = make_kgid(current_user_ns(), id);
 
                /* number of additional gid's */
                if (get_int(&mesg, &N))
@@ -497,7 +497,7 @@ static int rsc_parse(struct cache_detail *cd,
                        kgid_t kgid;
                        if (get_int(&mesg, &id))
                                goto out;
-                       kgid = make_kgid(&init_user_ns, id);
+                       kgid = make_kgid(current_user_ns(), id);
                        if (!gid_valid(kgid))
                                goto out;
                        rsci.cred.cr_group_info->gid[i] = kgid;
index 261131d..d223289 100644 (file)
@@ -40,6 +40,7 @@
 
 static bool cache_defer_req(struct cache_req *req, struct cache_head *item);
 static void cache_revisit_request(struct cache_head *item);
+static bool cache_listeners_exist(struct cache_detail *detail);
 
 static void cache_init(struct cache_head *h, struct cache_detail *detail)
 {
@@ -306,7 +307,8 @@ int cache_check(struct cache_detail *detail,
                                cache_fresh_unlocked(h, detail);
                                break;
                        }
-               }
+               } else if (!cache_listeners_exist(detail))
+                       rv = try_to_negate_entry(detail, h);
        }
 
        if (rv == -EAGAIN) {
index c1f1afa..d6e57da 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/net/sunrpc/clnt.c
  *
index 979d236..126d314 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * net/sunrpc/rpc_pipe.c
  *
index 2277b7c..4a020b6 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * In-kernel rpcbind client supporting versions 2, 3, and 4 of the rpcbind
  * protocol
index 1a12fb0..bb04ae5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/sched.c
  *
index 9faea12..1a864f1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/socklib.c
  *
index 71166b3..2b6dc7e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/stats.c
  *
index 56f9eff..f9edaa9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/sunrpc_syms.c
  *
index dbd1969..e15cb70 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/svc.c
  *
@@ -993,6 +994,58 @@ static int __svc_register(struct net *net, const char *progname,
        return error;
 }
 
+int svc_rpcbind_set_version(struct net *net,
+                           const struct svc_program *progp,
+                           u32 version, int family,
+                           unsigned short proto,
+                           unsigned short port)
+{
+       dprintk("svc: svc_register(%sv%d, %s, %u, %u)\n",
+               progp->pg_name, version,
+               proto == IPPROTO_UDP?  "udp" : "tcp",
+               port, family);
+
+       return __svc_register(net, progp->pg_name, progp->pg_prog,
+                               version, family, proto, port);
+
+}
+EXPORT_SYMBOL_GPL(svc_rpcbind_set_version);
+
+int svc_generic_rpcbind_set(struct net *net,
+                           const struct svc_program *progp,
+                           u32 version, int family,
+                           unsigned short proto,
+                           unsigned short port)
+{
+       const struct svc_version *vers = progp->pg_vers[version];
+       int error;
+
+       if (vers == NULL)
+               return 0;
+
+       if (vers->vs_hidden) {
+               dprintk("svc: svc_register(%sv%d, %s, %u, %u)"
+                       " (but not telling portmap)\n",
+                       progp->pg_name, version,
+                       proto == IPPROTO_UDP?  "udp" : "tcp",
+                       port, family);
+               return 0;
+       }
+
+       /*
+        * Don't register a UDP port if we need congestion
+        * control.
+        */
+       if (vers->vs_need_cong_ctrl && proto == IPPROTO_UDP)
+               return 0;
+
+       error = svc_rpcbind_set_version(net, progp, version,
+                                       family, proto, port);
+
+       return (vers->vs_rpcb_optnl) ? 0 : error;
+}
+EXPORT_SYMBOL_GPL(svc_generic_rpcbind_set);
+
 /**
  * svc_register - register an RPC service with the local portmapper
  * @serv: svc_serv struct for the service to register
@@ -1008,7 +1061,6 @@ int svc_register(const struct svc_serv *serv, struct net *net,
                 const unsigned short port)
 {
        struct svc_program      *progp;
-       const struct svc_version *vers;
        unsigned int            i;
        int                     error = 0;
 
@@ -1018,37 +1070,9 @@ int svc_register(const struct svc_serv *serv, struct net *net,
 
        for (progp = serv->sv_program; progp; progp = progp->pg_next) {
                for (i = 0; i < progp->pg_nvers; i++) {
-                       vers = progp->pg_vers[i];
-                       if (vers == NULL)
-                               continue;
-
-                       dprintk("svc: svc_register(%sv%d, %s, %u, %u)%s\n",
-                                       progp->pg_name,
-                                       i,
-                                       proto == IPPROTO_UDP?  "udp" : "tcp",
-                                       port,
-                                       family,
-                                       vers->vs_hidden ?
-                                       " (but not telling portmap)" : "");
-
-                       if (vers->vs_hidden)
-                               continue;
-
-                       /*
-                        * Don't register a UDP port if we need congestion
-                        * control.
-                        */
-                       if (vers->vs_need_cong_ctrl && proto == IPPROTO_UDP)
-                               continue;
-
-                       error = __svc_register(net, progp->pg_name, progp->pg_prog,
-                                               i, family, proto, port);
-
-                       if (vers->vs_rpcb_optnl) {
-                               error = 0;
-                               continue;
-                       }
 
+                       error = progp->pg_rpcbind_set(net, progp, i,
+                                       family, proto, port);
                        if (error < 0) {
                                printk(KERN_WARNING "svc: failed to register "
                                        "%sv%u RPC service (errno %d).\n",
@@ -1144,6 +1168,114 @@ void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
 static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {}
 #endif
 
+__be32
+svc_return_autherr(struct svc_rqst *rqstp, __be32 auth_err)
+{
+       set_bit(RQ_AUTHERR, &rqstp->rq_flags);
+       return auth_err;
+}
+EXPORT_SYMBOL_GPL(svc_return_autherr);
+
+static __be32
+svc_get_autherr(struct svc_rqst *rqstp, __be32 *statp)
+{
+       if (test_and_clear_bit(RQ_AUTHERR, &rqstp->rq_flags))
+               return *statp;
+       return rpc_auth_ok;
+}
+
+static int
+svc_generic_dispatch(struct svc_rqst *rqstp, __be32 *statp)
+{
+       struct kvec *argv = &rqstp->rq_arg.head[0];
+       struct kvec *resv = &rqstp->rq_res.head[0];
+       const struct svc_procedure *procp = rqstp->rq_procinfo;
+
+       /*
+        * Decode arguments
+        * XXX: why do we ignore the return value?
+        */
+       if (procp->pc_decode &&
+           !procp->pc_decode(rqstp, argv->iov_base)) {
+               *statp = rpc_garbage_args;
+               return 1;
+       }
+
+       *statp = procp->pc_func(rqstp);
+
+       if (*statp == rpc_drop_reply ||
+           test_bit(RQ_DROPME, &rqstp->rq_flags))
+               return 0;
+
+       if (test_bit(RQ_AUTHERR, &rqstp->rq_flags))
+               return 1;
+
+       if (*statp != rpc_success)
+               return 1;
+
+       /* Encode reply */
+       if (procp->pc_encode &&
+           !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) {
+               dprintk("svc: failed to encode reply\n");
+               /* serv->sv_stats->rpcsystemerr++; */
+               *statp = rpc_system_err;
+       }
+       return 1;
+}
+
+__be32
+svc_generic_init_request(struct svc_rqst *rqstp,
+               const struct svc_program *progp,
+               struct svc_process_info *ret)
+{
+       const struct svc_version *versp = NULL; /* compiler food */
+       const struct svc_procedure *procp = NULL;
+
+       if (rqstp->rq_vers >= progp->pg_nvers )
+               goto err_bad_vers;
+         versp = progp->pg_vers[rqstp->rq_vers];
+         if (!versp)
+               goto err_bad_vers;
+
+       /*
+        * Some protocol versions (namely NFSv4) require some form of
+        * congestion control.  (See RFC 7530 section 3.1 paragraph 2)
+        * In other words, UDP is not allowed. We mark those when setting
+        * up the svc_xprt, and verify that here.
+        *
+        * The spec is not very clear about what error should be returned
+        * when someone tries to access a server that is listening on UDP
+        * for lower versions. RPC_PROG_MISMATCH seems to be the closest
+        * fit.
+        */
+       if (versp->vs_need_cong_ctrl && rqstp->rq_xprt &&
+           !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags))
+               goto err_bad_vers;
+
+       if (rqstp->rq_proc >= versp->vs_nproc)
+               goto err_bad_proc;
+       rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc];
+       if (!procp)
+               goto err_bad_proc;
+
+       /* Initialize storage for argp and resp */
+       memset(rqstp->rq_argp, 0, procp->pc_argsize);
+       memset(rqstp->rq_resp, 0, procp->pc_ressize);
+
+       /* Bump per-procedure stats counter */
+       versp->vs_count[rqstp->rq_proc]++;
+
+       ret->dispatch = versp->vs_dispatch;
+       return rpc_success;
+err_bad_vers:
+       ret->mismatch.lovers = progp->pg_lovers;
+       ret->mismatch.hivers = progp->pg_hivers;
+       return rpc_prog_mismatch;
+err_bad_proc:
+       return rpc_proc_unavail;
+}
+EXPORT_SYMBOL_GPL(svc_generic_init_request);
+
 /*
  * Common routine for processing the RPC request.
  */
@@ -1151,11 +1283,11 @@ static int
 svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 {
        struct svc_program      *progp;
-       const struct svc_version *versp = NULL; /* compiler food */
        const struct svc_procedure *procp = NULL;
        struct svc_serv         *serv = rqstp->rq_server;
+       struct svc_process_info process;
        __be32                  *statp;
-       u32                     prog, vers, proc;
+       u32                     prog, vers;
        __be32                  auth_stat, rpc_stat;
        int                     auth_res;
        __be32                  *reply_statp;
@@ -1187,8 +1319,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
        svc_putnl(resv, 0);             /* ACCEPT */
 
        rqstp->rq_prog = prog = svc_getnl(argv);        /* program number */
-       rqstp->rq_vers = vers = svc_getnl(argv);        /* version number */
-       rqstp->rq_proc = proc = svc_getnl(argv);        /* procedure number */
+       rqstp->rq_vers = svc_getnl(argv);       /* version number */
+       rqstp->rq_proc = svc_getnl(argv);       /* procedure number */
 
        for (progp = serv->sv_program; progp; progp = progp->pg_next)
                if (prog == progp->pg_prog)
@@ -1226,29 +1358,22 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
        if (progp == NULL)
                goto err_bad_prog;
 
-       if (vers >= progp->pg_nvers ||
-         !(versp = progp->pg_vers[vers]))
-               goto err_bad_vers;
-
-       /*
-        * Some protocol versions (namely NFSv4) require some form of
-        * congestion control.  (See RFC 7530 section 3.1 paragraph 2)
-        * In other words, UDP is not allowed. We mark those when setting
-        * up the svc_xprt, and verify that here.
-        *
-        * The spec is not very clear about what error should be returned
-        * when someone tries to access a server that is listening on UDP
-        * for lower versions. RPC_PROG_MISMATCH seems to be the closest
-        * fit.
-        */
-       if (versp->vs_need_cong_ctrl && rqstp->rq_xprt &&
-           !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags))
+       rpc_stat = progp->pg_init_request(rqstp, progp, &process);
+       switch (rpc_stat) {
+       case rpc_success:
+               break;
+       case rpc_prog_unavail:
+               goto err_bad_prog;
+       case rpc_prog_mismatch:
                goto err_bad_vers;
+       case rpc_proc_unavail:
+               goto err_bad_proc;
+       }
 
-       procp = versp->vs_proc + proc;
-       if (proc >= versp->vs_nproc || !procp->pc_func)
+       procp = rqstp->rq_procinfo;
+       /* Should this check go into the dispatcher? */
+       if (!procp || !procp->pc_func)
                goto err_bad_proc;
-       rqstp->rq_procinfo = procp;
 
        /* Syntactic check complete */
        serv->sv_stats->rpccnt++;
@@ -1258,13 +1383,6 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
        statp = resv->iov_base +resv->iov_len;
        svc_putnl(resv, RPC_SUCCESS);
 
-       /* Bump per-procedure stats counter */
-       versp->vs_count[proc]++;
-
-       /* Initialize storage for argp and resp */
-       memset(rqstp->rq_argp, 0, procp->pc_argsize);
-       memset(rqstp->rq_resp, 0, procp->pc_ressize);
-
        /* un-reserve some of the out-queue now that we have a
         * better idea of reply size
         */
@@ -1272,43 +1390,18 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
                svc_reserve_auth(rqstp, procp->pc_xdrressize<<2);
 
        /* Call the function that processes the request. */
-       if (!versp->vs_dispatch) {
-               /*
-                * Decode arguments
-                * XXX: why do we ignore the return value?
-                */
-               if (procp->pc_decode &&
-                   !procp->pc_decode(rqstp, argv->iov_base))
+       if (!process.dispatch) {
+               if (!svc_generic_dispatch(rqstp, statp))
+                       goto release_dropit;
+               if (*statp == rpc_garbage_args)
                        goto err_garbage;
-
-               *statp = procp->pc_func(rqstp);
-
-               /* Encode reply */
-               if (*statp == rpc_drop_reply ||
-                   test_bit(RQ_DROPME, &rqstp->rq_flags)) {
-                       if (procp->pc_release)
-                               procp->pc_release(rqstp);
-                       goto dropit;
-               }
-               if (*statp == rpc_autherr_badcred) {
-                       if (procp->pc_release)
-                               procp->pc_release(rqstp);
-                       goto err_bad_auth;
-               }
-               if (*statp == rpc_success && procp->pc_encode &&
-                   !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) {
-                       dprintk("svc: failed to encode reply\n");
-                       /* serv->sv_stats->rpcsystemerr++; */
-                       *statp = rpc_system_err;
-               }
+               auth_stat = svc_get_autherr(rqstp, statp);
+               if (auth_stat != rpc_auth_ok)
+                       goto err_release_bad_auth;
        } else {
                dprintk("svc: calling dispatcher\n");
-               if (!versp->vs_dispatch(rqstp, statp)) {
-                       /* Release reply info */
-                       if (procp->pc_release)
-                               procp->pc_release(rqstp);
-                       goto dropit;
-               }
+               if (!process.dispatch(rqstp, statp))
+                       goto release_dropit; /* Release reply info */
        }
 
        /* Check RPC status result */
@@ -1327,6 +1420,9 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
                goto close;
        return 1;               /* Caller can now send it */
 
+release_dropit:
+       if (procp->pc_release)
+               procp->pc_release(rqstp);
  dropit:
        svc_authorise(rqstp);   /* doesn't hurt to call this twice */
        dprintk("svc: svc_process dropit\n");
@@ -1351,6 +1447,9 @@ err_bad_rpc:
        svc_putnl(resv, 2);
        goto sendit;
 
+err_release_bad_auth:
+       if (procp->pc_release)
+               procp->pc_release(rqstp);
 err_bad_auth:
        dprintk("svc: authentication failed (%d)\n", ntohl(auth_stat));
        serv->sv_stats->rpcbadauth++;
@@ -1369,16 +1468,16 @@ err_bad_prog:
 
 err_bad_vers:
        svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n",
-                      vers, prog, progp->pg_name);
+                      rqstp->rq_vers, rqstp->rq_prog, progp->pg_name);
 
        serv->sv_stats->rpcbadfmt++;
        svc_putnl(resv, RPC_PROG_MISMATCH);
-       svc_putnl(resv, progp->pg_lovers);
-       svc_putnl(resv, progp->pg_hivers);
+       svc_putnl(resv, process.mismatch.lovers);
+       svc_putnl(resv, process.mismatch.hivers);
        goto sendit;
 
 err_bad_proc:
-       svc_printk(rqstp, "unknown procedure (%d)\n", proc);
+       svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc);
 
        serv->sv_stats->rpcbadfmt++;
        svc_putnl(resv, RPC_PROC_UNAVAIL);
index 61530b1..869ce77 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/svc_xprt.c
  *
@@ -136,6 +137,7 @@ static void svc_xprt_free(struct kref *kref)
        struct module *owner = xprt->xpt_class->xcl_owner;
        if (test_bit(XPT_CACHE_AUTH, &xprt->xpt_flags))
                svcauth_unix_info_release(xprt);
+       put_cred(xprt->xpt_cred);
        put_net(xprt->xpt_net);
        /* See comment on corresponding get in xs_setup_bc_tcp(): */
        if (xprt->xpt_bc_xprt)
@@ -252,7 +254,8 @@ void svc_add_new_perm_xprt(struct svc_serv *serv, struct svc_xprt *new)
 
 static int _svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
                            struct net *net, const int family,
-                           const unsigned short port, int flags)
+                           const unsigned short port, int flags,
+                           const struct cred *cred)
 {
        struct svc_xprt_class *xcl;
 
@@ -273,6 +276,7 @@ static int _svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
                        module_put(xcl->xcl_owner);
                        return PTR_ERR(newxprt);
                }
+               newxprt->xpt_cred = get_cred(cred);
                svc_add_new_perm_xprt(serv, newxprt);
                newport = svc_xprt_local_port(newxprt);
                return newport;
@@ -286,15 +290,16 @@ static int _svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
 
 int svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
                    struct net *net, const int family,
-                   const unsigned short port, int flags)
+                   const unsigned short port, int flags,
+                   const struct cred *cred)
 {
        int err;
 
        dprintk("svc: creating transport %s[%d]\n", xprt_name, port);
-       err = _svc_create_xprt(serv, xprt_name, net, family, port, flags);
+       err = _svc_create_xprt(serv, xprt_name, net, family, port, flags, cred);
        if (err == -EPROTONOSUPPORT) {
                request_module("svc%s", xprt_name);
-               err = _svc_create_xprt(serv, xprt_name, net, family, port, flags);
+               err = _svc_create_xprt(serv, xprt_name, net, family, port, flags, cred);
        }
        if (err < 0)
                dprintk("svc: transport %s not found, err %d\n",
@@ -782,9 +787,10 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
                __module_get(xprt->xpt_class->xcl_owner);
                svc_check_conn_limits(xprt->xpt_server);
                newxpt = xprt->xpt_ops->xpo_accept(xprt);
-               if (newxpt)
+               if (newxpt) {
+                       newxpt->xpt_cred = get_cred(xprt->xpt_cred);
                        svc_add_new_temp_xprt(serv, newxpt);
-               else
+               else
                        module_put(xprt->xpt_class->xcl_owner);
        } else if (svc_xprt_reserve_slot(rqstp, xprt)) {
                /* XPT_DATA|XPT_DEFERRED case: */
index 775b8c9..550b214 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/svcauth.c
  *
index fb9041b..5c04ba7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/module.h>
@@ -500,7 +501,7 @@ static int unix_gid_parse(struct cache_detail *cd,
        rv = get_int(&mesg, &id);
        if (rv)
                return -EINVAL;
-       uid = make_kuid(&init_user_ns, id);
+       uid = make_kuid(current_user_ns(), id);
        ug.uid = uid;
 
        expiry = get_expiry(&mesg);
@@ -522,7 +523,7 @@ static int unix_gid_parse(struct cache_detail *cd,
                err = -EINVAL;
                if (rv)
                        goto out;
-               kgid = make_kgid(&init_user_ns, gid);
+               kgid = make_kgid(current_user_ns(), gid);
                if (!gid_valid(kgid))
                        goto out;
                ug.gi->gid[i] = kgid;
@@ -555,7 +556,7 @@ static int unix_gid_show(struct seq_file *m,
                         struct cache_detail *cd,
                         struct cache_head *h)
 {
-       struct user_namespace *user_ns = &init_user_ns;
+       struct user_namespace *user_ns = m->file->f_cred->user_ns;
        struct unix_gid *ug;
        int i;
        int glen;
@@ -796,6 +797,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
        struct kvec     *argv = &rqstp->rq_arg.head[0];
        struct kvec     *resv = &rqstp->rq_res.head[0];
        struct svc_cred *cred = &rqstp->rq_cred;
+       struct user_namespace *userns;
        u32             slen, i;
        int             len   = argv->iov_len;
 
@@ -816,8 +818,10 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
         * (export-specific) anonymous id by nfsd_setuser.
         * Supplementary gid's will be left alone.
         */
-       cred->cr_uid = make_kuid(&init_user_ns, svc_getnl(argv)); /* uid */
-       cred->cr_gid = make_kgid(&init_user_ns, svc_getnl(argv)); /* gid */
+       userns = (rqstp->rq_xprt && rqstp->rq_xprt->xpt_cred) ?
+               rqstp->rq_xprt->xpt_cred->user_ns : &init_user_ns;
+       cred->cr_uid = make_kuid(userns, svc_getnl(argv)); /* uid */
+       cred->cr_gid = make_kgid(userns, svc_getnl(argv)); /* gid */
        slen = svc_getnl(argv);                 /* gids length */
        if (slen > UNX_NGROUPS || (len -= (slen + 2)*4) < 0)
                goto badcred;
@@ -825,7 +829,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
        if (cred->cr_group_info == NULL)
                return SVC_CLOSE;
        for (i = 0; i < slen; i++) {
-               kgid_t kgid = make_kgid(&init_user_ns, svc_getnl(argv));
+               kgid_t kgid = make_kgid(userns, svc_getnl(argv));
                cred->cr_group_info->gid[i] = kgid;
        }
        groups_sort(cred->cr_group_info);
index 43590a9..2934dd7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/svcsock.c
  *
@@ -1332,13 +1333,14 @@ EXPORT_SYMBOL_GPL(svc_alien_sock);
  * @fd: file descriptor of the new listener
  * @name_return: pointer to buffer to fill in with name of listener
  * @len: size of the buffer
+ * @cred: credential
  *
  * Fills in socket name and returns positive length of name if successful.
  * Name is terminated with '\n'.  On error, returns a negative errno
  * value.
  */
 int svc_addsock(struct svc_serv *serv, const int fd, char *name_return,
-               const size_t len)
+               const size_t len, const struct cred *cred)
 {
        int err = 0;
        struct socket *so = sockfd_lookup(fd, &err);
@@ -1371,6 +1373,7 @@ int svc_addsock(struct svc_serv *serv, const int fd, char *name_return,
        salen = kernel_getsockname(svsk->sk_sock, sin);
        if (salen >= 0)
                svc_xprt_set_local(&svsk->sk_xprt, sin, salen);
+       svsk->sk_xprt.xpt_cred = get_cred(cred);
        svc_add_new_perm_xprt(serv, &svsk->sk_xprt);
        return svc_one_sock_name(svsk, name_return, len);
 out:
index 0bea8ff..d75f17b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/sysctl.c
  *
index 08881d0..81ae35b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/timer.c
  *
index aa8177d..48c93b9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * linux/net/sunrpc/xdr.c
  *
index a9d40bc..ad21880 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/net/sunrpc/xprt.c
  *
index 651fa20..50f21a6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Configuration for Switch device support
 #
index 5ed63ed..bd69a31 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the Switch device API
 #
index 9aed6fe..d14dab8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* -*- linux-c -*-
  * sysctl_net.c: sysctl interface to net subsystem.
  *
index e450212..b93bb7b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TIPC configuration
 #
index ddd2e0f..ed536c0 100644 (file)
@@ -77,9 +77,6 @@ static int __net_init tipc_init_net(struct net *net)
                goto out_nametbl;
 
        INIT_LIST_HEAD(&tn->dist_queue);
-       err = tipc_topsrv_start(net);
-       if (err)
-               goto out_subscr;
 
        err = tipc_bcast_init(net);
        if (err)
@@ -88,8 +85,6 @@ static int __net_init tipc_init_net(struct net *net)
        return 0;
 
 out_bclink:
-       tipc_bcast_stop(net);
-out_subscr:
        tipc_nametbl_stop(net);
 out_nametbl:
        tipc_sk_rht_destroy(net);
@@ -99,7 +94,6 @@ out_sk_rht:
 
 static void __net_exit tipc_exit_net(struct net *net)
 {
-       tipc_topsrv_stop(net);
        tipc_net_stop(net);
        tipc_bcast_stop(net);
        tipc_nametbl_stop(net);
@@ -113,6 +107,11 @@ static struct pernet_operations tipc_net_ops = {
        .size = sizeof(struct tipc_net),
 };
 
+static struct pernet_operations tipc_topsrv_net_ops = {
+       .init = tipc_topsrv_init_net,
+       .exit = tipc_topsrv_exit_net,
+};
+
 static int __init tipc_init(void)
 {
        int err;
@@ -143,6 +142,10 @@ static int __init tipc_init(void)
        if (err)
                goto out_socket;
 
+       err = register_pernet_subsys(&tipc_topsrv_net_ops);
+       if (err)
+               goto out_pernet_topsrv;
+
        err = tipc_bearer_setup();
        if (err)
                goto out_bearer;
@@ -150,6 +153,8 @@ static int __init tipc_init(void)
        pr_info("Started in single node mode\n");
        return 0;
 out_bearer:
+       unregister_pernet_subsys(&tipc_topsrv_net_ops);
+out_pernet_topsrv:
        tipc_socket_stop();
 out_socket:
        unregister_pernet_subsys(&tipc_net_ops);
@@ -167,6 +172,7 @@ out_netlink:
 static void __exit tipc_exit(void)
 {
        tipc_bearer_cleanup();
+       unregister_pernet_subsys(&tipc_topsrv_net_ops);
        tipc_socket_stop();
        unregister_pernet_subsys(&tipc_net_ops);
        tipc_netlink_stop();
index d793b43..aa015c2 100644 (file)
@@ -77,8 +77,9 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub,
                             u32 found_lower, u32 found_upper,
                             u32 event, u32 port, u32 node,
                             u32 scope, int must);
-int tipc_topsrv_start(struct net *net);
-void tipc_topsrv_stop(struct net *net);
+
+int __net_init tipc_topsrv_init_net(struct net *net);
+void __net_exit tipc_topsrv_exit_net(struct net *net);
 
 void tipc_sub_put(struct tipc_subscription *subscription);
 void tipc_sub_get(struct tipc_subscription *subscription);
index b45932d..f345662 100644 (file)
@@ -635,7 +635,7 @@ static void tipc_topsrv_work_stop(struct tipc_topsrv *s)
        destroy_workqueue(s->send_wq);
 }
 
-int tipc_topsrv_start(struct net *net)
+static int tipc_topsrv_start(struct net *net)
 {
        struct tipc_net *tn = tipc_net(net);
        const char name[] = "topology_server";
@@ -668,7 +668,7 @@ int tipc_topsrv_start(struct net *net)
        return ret;
 }
 
-void tipc_topsrv_stop(struct net *net)
+static void tipc_topsrv_stop(struct net *net)
 {
        struct tipc_topsrv *srv = tipc_topsrv(net);
        struct socket *lsock = srv->listener;
@@ -693,3 +693,13 @@ void tipc_topsrv_stop(struct net *net)
        idr_destroy(&srv->conn_idr);
        kfree(srv);
 }
+
+int __net_init tipc_topsrv_init_net(struct net *net)
+{
+       return tipc_topsrv_start(net);
+}
+
+void __net_exit tipc_topsrv_exit_net(struct net *net)
+{
+       tipc_topsrv_stop(net);
+}
index 99c1a19..e4328b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # TLS configuration
 #
index 4d6b728..ef0dc74 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the TLS subsystem.
 #
index ca54a7c..b95c408 100644 (file)
@@ -553,8 +553,8 @@ void tls_device_write_space(struct sock *sk, struct tls_context *ctx)
 void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
 {
        struct tls_context *tls_ctx = tls_get_ctx(sk);
-       struct net_device *netdev = tls_ctx->netdev;
        struct tls_offload_context_rx *rx_ctx;
+       struct net_device *netdev;
        u32 is_req_pending;
        s64 resync_req;
        u32 req_seq;
@@ -568,10 +568,15 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
        is_req_pending = resync_req;
 
        if (unlikely(is_req_pending) && req_seq == seq &&
-           atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0))
-               netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk,
-                                                     seq + TLS_HEADER_SIZE - 1,
-                                                     rcd_sn);
+           atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) {
+               seq += TLS_HEADER_SIZE - 1;
+               down_read(&device_offload_lock);
+               netdev = tls_ctx->netdev;
+               if (netdev)
+                       netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, seq,
+                                                             rcd_sn);
+               up_read(&device_offload_lock);
+       }
 }
 
 static int tls_device_reencrypt(struct sock *sk, struct sk_buff *skb)
@@ -934,12 +939,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk)
        if (!netdev)
                goto out;
 
-       if (!(netdev->features & NETIF_F_HW_TLS_RX)) {
-               pr_err_ratelimited("%s: device is missing NETIF_F_HW_TLS_RX cap\n",
-                                  __func__);
-               goto out;
-       }
-
        netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx,
                                        TLS_OFFLOAD_CTX_DIR_RX);
 
@@ -998,7 +997,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event,
 {
        struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 
-       if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
+       if (!dev->tlsdev_ops &&
+           !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
                return NOTIFY_DONE;
 
        switch (event) {
index 3b9e450..a23a5cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Unix Domain Sockets
 #
index 3183d9b..c51a707 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <linux/sock_diag.h>
index 970f964..8abcb81 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Vsock protocol
 #
index e4d97ab..d13762b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # WiMAX LAN device configuration
 #
index 4172204..6310dde 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config WIRELESS_EXT
        bool
 
index b36ad8e..0378161 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This is the linux wireless configuration interface.
  *
index 801d478..cc7b9fd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * lib80211 -- common bits for IEEE802.11 drivers
  *
index fffe4b3..c391b56 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * This is the new netlink-based wireless configuration interface.
  *
index 94c7405..8d3cc15 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __WEXT_COMPAT
 #define __WEXT_COMPAT
 
index 59fcb41..2ecb2e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # CCITT X.25 Packet Layer
 #
index 0255b33..71af2fe 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config XDP_SOCKETS
        bool "XDP sockets"
        depends on BPF_SYSCALL
index 59dbfdf..71e2bda 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_XDP_SOCKETS) += xsk.o xdp_umem.o xsk_queue.o
 obj-$(CONFIG_XDP_SOCKETS_DIAG) += xsk_diag.o
index 1ec8071..c967fc3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # XFRM configuration
 #
index 7a43ae6..b1694d5 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * xfrm_policy.c
  *
index c5d8131..50621d9 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * xfrm_state.c
  *
index eb8d143..1734772 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /* xfrm_user.c: User interface to configure xfrm engine.
  *
  * Copyright (C) 2002 David S. Miller (davem@redhat.com)
index 0561a94..d63cc8a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SAMPLES
        bool "Sample kernel code"
        depends on !UML
index 8e096e0..debf892 100644 (file)
@@ -1,6 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
 # Makefile for Linux samples code
 
-obj-y                  += kobject/ kprobes/ trace_events/ livepatch/ \
-                          hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-                          configfs/ connector/ v4l/ trace_printk/ \
-                          vfio-mdev/ vfs/ qmi/ binderfs/ pidfd/
+obj-$(CONFIG_SAMPLE_ANDROID_BINDERFS)  += binderfs/
+obj-$(CONFIG_SAMPLE_CONFIGFS)          += configfs/
+obj-$(CONFIG_SAMPLE_CONNECTOR)         += connector/
+subdir-y                               += hidraw
+obj-$(CONFIG_SAMPLE_HW_BREAKPOINT)     += hw_breakpoint/
+obj-$(CONFIG_SAMPLE_KDB)               += kdb/
+obj-$(CONFIG_SAMPLE_KFIFO)             += kfifo/
+obj-$(CONFIG_SAMPLE_KOBJECT)           += kobject/
+obj-$(CONFIG_SAMPLE_KPROBES)           += kprobes/
+obj-$(CONFIG_SAMPLE_LIVEPATCH)         += livepatch/
+subdir-y                               += pidfd
+obj-$(CONFIG_SAMPLE_QMI_CLIENT)                += qmi/
+obj-$(CONFIG_SAMPLE_RPMSG_CLIENT)      += rpmsg/
+subdir-$(CONFIG_SAMPLE_SECCOMP)                += seccomp
+obj-$(CONFIG_SAMPLE_TRACE_EVENTS)      += trace_events/
+obj-$(CONFIG_SAMPLE_TRACE_PRINTK)      += trace_printk/
+obj-$(CONFIG_VIDEO_PCI_SKELETON)       += v4l/
+obj-y                                  += vfio-mdev/
+subdir-$(CONFIG_SAMPLE_VFS)            += vfs
index 01ca9f2..ea4c93d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs_example.o
index a9afd99..92d661f 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_SAMPLE_CONFIGFS) += configfs_sample.o
index 0f5c31c..ef4b6fd 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_HW_BREAKPOINT) += data_breakpoint.o
index fbedf39..947cb85 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_KDB) += kdb_hello.o
index bcc9484..0af5250 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_KFIFO) += bytestream-example.o dma-example.o inttype-example.o record-example.o
index 4a19420..bb5d219 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_KOBJECT) += kobject-example.o kset-example.o
index 880e54d..e774592 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # builds the kprobes example kernel modules;
 # then to use one (as root):  insmod <module_name.ko>
 
index 02be898..d693c23 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * NOTE: This example is works on x86 and powerpc.
  * Here's a sample kernel module showing the use of kprobes to dump a
index 7f9060f..186315c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * kretprobe_example.c
  *
index 2472ce3..9f853ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-sample.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-mod.o
 obj-$(CONFIG_SAMPLE_LIVEPATCH) += livepatch-shadow-fix1.o
index 80d06e1..378e2d4 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 62d9795..11c3f43 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index e610ce2..2a074f4 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 01c9cf0..cd76d7e 100644 (file)
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * livepatch-sample.c - Kernel Live Patching Sample Module
  *
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
index 67a73e5..e89ca45 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 91c21d5..50d223b 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 4d79c6d..ecfe83a 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 2b111d2..641943d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_QMI_CLIENT) += qmi_sample_client.o
index 2d4973c..ddf9a5d 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_RPMSG_CLIENT) += rpmsg_client_sample.o
index 00e0b5e..009775b 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 ifndef CROSS_COMPILE
-hostprogs-$(CONFIG_SAMPLE_SECCOMP) := bpf-fancy dropper bpf-direct user-trap
+hostprogs-y := bpf-fancy dropper bpf-direct user-trap
 
 HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include
 HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include
index 0f8d921..b78344e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # builds the trace events example kernel modules;
 # then to use one (as root):  insmod <module_name.ko>
 
index 5522692..1da597a 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/kthread.h>
 
index 19900ab..c0df361 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # builds a module that calls various trace_printk routines
 # then to use one (as root):  insmod <module_name.ko>
 
index e9e0040..7affc3b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 #include <linux/module.h>
 #include <linux/kthread.h>
 #include <linux/irq_work.h>
index 8d7fd61..8c9bc9f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # List of programs to build
 hostprogs-y := uhid-example
 
index 65a351d..f86ab12 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_PCI_SKELETON) := v4l2-pci-skeleton.o
index 7db889c..10d179c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
 obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY) += mdpy.o
 obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY_FB) += mdpy-fb.o
index 4ac9690..e21c9f6 100644 (file)
@@ -1,5 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # List of programs to build
-hostprogs-$(CONFIG_SAMPLE_VFS) := \
+hostprogs-y := \
        test-fsmount \
        test-statx
 
index 7484b9d..e2de6c4 100644 (file)
@@ -138,11 +138,6 @@ cc-disable-warning = $(call try-run,\
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
 
-# cc-ldoption
-# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
-cc-ldoption = $(call try-run,\
-       $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
-
 # ld-option
 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
@@ -192,14 +187,6 @@ clean := -f $(srctree)/scripts/Makefile.clean obj
 # $(Q)$(MAKE) $(hdr-inst)=dir
 hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
 
-# Prefix -I with $(srctree) if it is not an absolute path.
-# skip if -I has no parameter
-addtree = $(if $(patsubst -I%,%,$(1)), \
-$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))
-
-# Find all -I options and call addtree
-flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
-
 # echo command.
 # Short version is used, if $(quiet) equals `quiet_', otherwise full one.
 echo-cmd = $(if $($(quiet)cmd_$(1)),\
index 87ff1dc..8a5c4d6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Kconfig helper macros
 
 # Convenient variables
@@ -18,6 +19,10 @@ if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
 # Return y if <command> exits with 0, n otherwise
 success = $(if-success,$(1),y,n)
 
+# $(failure,<command>)
+# Return n if <command> exits with 0, y otherwise
+failure = $(if-success,$(1),n,y)
+
 # $(cc-option,<flag>)
 # Return y if the compiler supports <flag>, n otherwise
 cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
@@ -26,5 +31,9 @@ cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
 # Return y if the linker supports <flag>, n otherwise
 ld-option = $(success,$(LD) -v $(1))
 
+# check if $(CC) and $(LD) exist
+$(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
+$(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
+
 # gcc version including patch level
 gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
index 768306a..3ab8d1a 100644 (file)
@@ -23,15 +23,16 @@ warning-  := $(empty)
 warning-1 := -Wextra -Wunused -Wno-unused-parameter
 warning-1 += -Wmissing-declarations
 warning-1 += -Wmissing-format-attribute
-warning-1 += $(call cc-option, -Wmissing-prototypes)
+warning-1 += -Wmissing-prototypes
 warning-1 += -Wold-style-definition
-warning-1 += $(call cc-option, -Wmissing-include-dirs)
+warning-1 += -Wmissing-include-dirs
 warning-1 += $(call cc-option, -Wunused-but-set-variable)
 warning-1 += $(call cc-option, -Wunused-const-variable)
 warning-1 += $(call cc-option, -Wpacked-not-aligned)
 warning-1 += $(call cc-option, -Wstringop-truncation)
-warning-1 += $(call cc-disable-warning, missing-field-initializers)
-warning-1 += $(call cc-disable-warning, sign-compare)
+# The following turn off the warnings enabled by -Wextra
+warning-1 += -Wno-missing-field-initializers
+warning-1 += -Wno-sign-compare
 
 warning-2 := -Waggregate-return
 warning-2 += -Wcast-align
@@ -39,8 +40,8 @@ warning-2 += -Wdisabled-optimization
 warning-2 += -Wnested-externs
 warning-2 += -Wshadow
 warning-2 += $(call cc-option, -Wlogical-op)
-warning-2 += $(call cc-option, -Wmissing-field-initializers)
-warning-2 += $(call cc-option, -Wsign-compare)
+warning-2 += -Wmissing-field-initializers
+warning-2 += -Wsign-compare
 warning-2 += $(call cc-option, -Wmaybe-uninitialized)
 warning-2 += $(call cc-option, -Wunused-macros)
 
@@ -66,11 +67,11 @@ KBUILD_CFLAGS += $(warning)
 else
 
 ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
-KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
-KBUILD_CFLAGS += $(call cc-disable-warning, format)
-KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
-KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
-KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
+KBUILD_CFLAGS += -Wno-initializer-overrides
+KBUILD_CFLAGS += -Wno-unused-value
+KBUILD_CFLAGS += -Wno-format
+KBUILD_CFLAGS += -Wno-sign-compare
+KBUILD_CFLAGS += -Wno-format-zero-length
+KBUILD_CFLAGS += -Wno-uninitialized
 endif
 endif
index 73b8041..b6a54bd 100644 (file)
@@ -67,18 +67,16 @@ _hostc_flags   = $(KBUILD_HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   \
 _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
                  $(HOSTCXXFLAGS_$(basetarget).o)
 
-__hostc_flags  = $(_hostc_flags)
-__hostcxx_flags        = $(_hostcxx_flags)
-
+# $(objtree)/$(obj) for including generated headers from checkin source files
 ifeq ($(KBUILD_EXTMOD),)
 ifneq ($(srctree),.)
-__hostc_flags  = -I$(obj) $(call flags,_hostc_flags)
-__hostcxx_flags        = -I$(obj) $(call flags,_hostcxx_flags)
+_hostc_flags   += -I $(objtree)/$(obj)
+_hostcxx_flags += -I $(objtree)/$(obj)
 endif
 endif
 
-hostc_flags    = -Wp,-MD,$(depfile) $(__hostc_flags)
-hostcxx_flags  = -Wp,-MD,$(depfile) $(__hostcxx_flags)
+hostc_flags    = -Wp,-MD,$(depfile) $(_hostc_flags)
+hostcxx_flags  = -Wp,-MD,$(depfile) $(_hostcxx_flags)
 
 #####
 # Compile programs on the host
index 3d61c4b..52b1133 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifdef CONFIG_KCOV
 
 kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC)    += -fsanitize-coverage=trace-pc
index 41e98fa..1b412d4 100644 (file)
@@ -137,36 +137,26 @@ _c_flags += $(if $(patsubst n%,, \
        $(CFLAGS_KCOV))
 endif
 
-__c_flags      = $(_c_flags)
-__a_flags      = $(_a_flags)
-__cpp_flags     = $(_cpp_flags)
-
-# If building the kernel in a separate objtree expand all occurrences
-# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
+# $(srctree)/$(src) for including checkin headers from generated source files
+# $(objtree)/$(obj) for including generated headers from checkin source files
 ifeq ($(KBUILD_EXTMOD),)
 ifneq ($(srctree),.)
-
-# -I$(obj) locates generated .h files
-# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
-#   and locates generated .h files
-# FIXME: Replace both with specific CFLAGS* statements in the makefiles
-__c_flags      = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \
-                 $(call flags,_c_flags)
-__a_flags      = $(call flags,_a_flags)
-__cpp_flags     = $(call flags,_cpp_flags)
+_c_flags   += -I $(srctree)/$(src) -I $(objtree)/$(obj)
+_a_flags   += -I $(srctree)/$(src) -I $(objtree)/$(obj)
+_cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj)
 endif
 endif
 
 c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
                 -include $(srctree)/include/linux/compiler_types.h       \
-                $(__c_flags) $(modkern_cflags)                           \
+                $(_c_flags) $(modkern_cflags)                           \
                 $(basename_flags) $(modname_flags)
 
 a_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
-                $(__a_flags) $(modkern_aflags)
+                $(_a_flags) $(modkern_aflags)
 
 cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
-                $(__cpp_flags)
+                $(_cpp_flags)
 
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
index af49b44..548aeb5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ###
 # This Makefile lists the most basic programs used during the build process.
 # The programs listed herein are what are needed to do the basic stuff,
index 5f227d8..8216080 100644 (file)
@@ -9,7 +9,7 @@ dtc-objs        := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
 dtc-objs       += dtc-lexer.lex.o dtc-parser.tab.o
 
 # Source files need to get at the userspace version of libfdt_env.h to compile
-HOST_EXTRACFLAGS := -I$(src)/libfdt
+HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
 
 ifeq ($(wildcard /usr/include/yaml.h),)
 ifneq ($(CHECK_DTBS),)
@@ -23,8 +23,8 @@ HOSTLDLIBS_dtc        := -lyaml
 endif
 
 # Generated files need one more search path to include headers in source tree
-HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
-HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
+HOSTCFLAGS_dtc-lexer.lex.o := -I $(srctree)/$(src)
+HOSTCFLAGS_dtc-parser.tab.o := -I $(srctree)/$(src)
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
index d437563..6ce8b4a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile.dtc
 #
 # This is not a complete Makefile of itself.  Instead, it is designed to
index 3af3656..1649c2c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile.libfdt
 #
 # This is not a complete Makefile of itself.  Instead, it is designed to
index 80220ed..e9c677a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 preferred-plugin-hostcc := $(if-success,[ $(gcc-version) -ge 40800 ],$(HOSTCXX),$(HOSTCC))
 
 config PLUGIN_HOSTCC
index 62f5f65..3fca193 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 subdir-y := linux
diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py
new file mode 100644 (file)
index 0000000..061aecf
--- /dev/null
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) NXP 2019
+
+import gdb
+import sys
+
+from linux import utils, lists, constants
+
+clk_core_type = utils.CachedType("struct clk_core")
+
+
+def clk_core_for_each_child(hlist_head):
+    return lists.hlist_for_each_entry(hlist_head,
+            clk_core_type.get_type().pointer(), "child_node")
+
+
+class LxClkSummary(gdb.Command):
+    """Print clk tree summary
+
+Output is a subset of /sys/kernel/debug/clk/clk_summary
+
+No calls are made during printing, instead a (c) if printed after values which
+are cached and potentially out of date"""
+
+    def __init__(self):
+        super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA)
+
+    def show_subtree(self, clk, level):
+        gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % (
+                level * 3 + 1, "",
+                30 - level * 3,
+                clk['name'].string(),
+                clk['enable_count'],
+                clk['prepare_count'],
+                clk['protect_count'],
+                clk['rate'],
+                '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else '   '))
+
+        for child in clk_core_for_each_child(clk['children']):
+            self.show_subtree(child, level + 1)
+
+    def invoke(self, arg, from_tty):
+        gdb.write("                                 enable  prepare  protect               \n")
+        gdb.write("   clock                          count    count    count        rate   \n")
+        gdb.write("------------------------------------------------------------------------\n")
+        for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")):
+            self.show_subtree(clk, 0)
+        for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")):
+            self.show_subtree(clk, 0)
+
+
+LxClkSummary()
+
+
+class LxClkCoreLookup(gdb.Function):
+    """Find struct clk_core by name"""
+
+    def __init__(self):
+        super(LxClkCoreLookup, self).__init__("lx_clk_core_lookup")
+
+    def lookup_hlist(self, hlist_head, name):
+        for child in clk_core_for_each_child(hlist_head):
+            if child['name'].string() == name:
+                return child
+            result = self.lookup_hlist(child['children'], name)
+            if result:
+                return result
+
+    def invoke(self, name):
+        name = name.string()
+        return (self.lookup_hlist(gdb.parse_and_eval("clk_root_list"), name) or
+                self.lookup_hlist(gdb.parse_and_eval("clk_orphan_list"), name))
+
+
+LxClkCoreLookup()
diff --git a/scripts/gdb/linux/config.py b/scripts/gdb/linux/config.py
new file mode 100644 (file)
index 0000000..90e1565
--- /dev/null
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2019 Google LLC.
+
+import gdb
+import zlib
+
+from linux import utils
+
+
+class LxConfigDump(gdb.Command):
+    """Output kernel config to the filename specified as the command
+       argument. Equivalent to 'zcat /proc/config.gz > config.txt' on
+       a running target"""
+
+    def __init__(self):
+        super(LxConfigDump, self).__init__("lx-configdump", gdb.COMMAND_DATA,
+                                           gdb.COMPLETE_FILENAME)
+
+    def invoke(self, arg, from_tty):
+        if len(arg) == 0:
+            filename = "config.txt"
+        else:
+            filename = arg
+
+        try:
+            py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
+            py_config_size = gdb.parse_and_eval(
+                    "sizeof(kernel_config_data) - 1 - 8 * 2")
+        except gdb.error as e:
+            raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
+
+        inf = gdb.inferiors()[0]
+        zconfig_buf = utils.read_memoryview(inf, py_config_ptr,
+                                            py_config_size).tobytes()
+
+        config_buf = zlib.decompress(zconfig_buf, 16)
+        with open(filename, 'wb') as f:
+            f.write(config_buf)
+
+        gdb.write("Dumped config to " + filename + "\n")
+
+
+LxConfigDump()
index d3319a8..1d73083 100644 (file)
  *
  */
 
+#include <linux/clk-provider.h>
 #include <linux/fs.h>
+#include <linux/hrtimer.h>
 #include <linux/mount.h>
 #include <linux/of_fdt.h>
+#include <linux/threads.h>
 
 /* We need to stringify expanded macros so that they can be parsed */
 
@@ -36,6 +39,9 @@
 
 import gdb
 
+/* linux/clk-provider.h */
+LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
+
 /* linux/fs.h */
 LX_VALUE(SB_RDONLY)
 LX_VALUE(SB_SYNCHRONOUS)
@@ -44,6 +50,9 @@ LX_VALUE(SB_DIRSYNC)
 LX_VALUE(SB_NOATIME)
 LX_VALUE(SB_NODIRATIME)
 
+/* linux/htimer.h */
+LX_GDBPARSED(hrtimer_resolution)
+
 /* linux/mount.h */
 LX_VALUE(MNT_NOSUID)
 LX_VALUE(MNT_NODEV)
@@ -52,8 +61,16 @@ LX_VALUE(MNT_NOATIME)
 LX_VALUE(MNT_NODIRATIME)
 LX_VALUE(MNT_RELATIME)
 
+/* linux/threads.h */
+LX_VALUE(NR_CPUS)
+
 /* linux/of_fdt.h> */
 LX_VALUE(OF_DT_HEADER)
 
 /* Kernel Configs */
+LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS)
+LX_CONFIG(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
+LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
+LX_CONFIG(CONFIG_NR_CPUS)
 LX_CONFIG(CONFIG_OF)
+LX_CONFIG(CONFIG_TICK_ONESHOT)
index ca11e8d..008e62f 100644 (file)
@@ -135,6 +135,7 @@ and can help identify the state of hotplugged CPUs"""
         gdb.write("Online CPUs   : {}\n".format(list(each_online_cpu())))
         gdb.write("Active CPUs   : {}\n".format(list(each_active_cpu())))
 
+
 LxCpus()
 
 
index 2f335fb..c487ddf 100644 (file)
@@ -16,13 +16,15 @@ import gdb
 from linux import utils
 
 list_head = utils.CachedType("struct list_head")
+hlist_head = utils.CachedType("struct hlist_head")
+hlist_node = utils.CachedType("struct hlist_node")
 
 
 def list_for_each(head):
     if head.type == list_head.get_type().pointer():
         head = head.dereference()
     elif head.type != list_head.get_type():
-        raise gdb.GdbError("Must be struct list_head not {}"
+        raise TypeError("Must be struct list_head not {}"
                            .format(head.type))
 
     node = head['next'].dereference()
@@ -33,9 +35,24 @@ def list_for_each(head):
 
 def list_for_each_entry(head, gdbtype, member):
     for node in list_for_each(head):
-        if node.type != list_head.get_type().pointer():
-            raise TypeError("Type {} found. Expected struct list_head *."
-                            .format(node.type))
+        yield utils.container_of(node, gdbtype, member)
+
+
+def hlist_for_each(head):
+    if head.type == hlist_head.get_type().pointer():
+        head = head.dereference()
+    elif head.type != hlist_head.get_type():
+        raise TypeError("Must be struct hlist_head not {}"
+                           .format(head.type))
+
+    node = head['first'].dereference()
+    while node.address:
+        yield node.address
+        node = node['next'].dereference()
+
+
+def hlist_for_each_entry(head, gdbtype, member):
+    for node in hlist_for_each(head):
         yield utils.container_of(node, gdbtype, member)
 
 
@@ -110,4 +127,5 @@ class LxListChk(gdb.Command):
             raise gdb.GdbError("lx-list-check takes one argument")
         list_check(gdb.parse_and_eval(argv[0]))
 
+
 LxListChk()
index 2f01a95..6a56bba 100644 (file)
@@ -29,6 +29,7 @@ class LxCmdLine(gdb.Command):
     def invoke(self, arg, from_tty):
         gdb.write(gdb.parse_and_eval("saved_command_line").string() + "\n")
 
+
 LxCmdLine()
 
 
@@ -43,6 +44,7 @@ class LxVersion(gdb.Command):
         # linux_banner should contain a newline
         gdb.write(gdb.parse_and_eval("(char *)linux_banner").string())
 
+
 LxVersion()
 
 
@@ -86,6 +88,7 @@ Equivalent to cat /proc/iomem on a running target"""
     def invoke(self, arg, from_tty):
         return show_lx_resources("iomem_resource")
 
+
 LxIOMem()
 
 
@@ -100,6 +103,7 @@ Equivalent to cat /proc/ioports on a running target"""
     def invoke(self, arg, from_tty):
         return show_lx_resources("ioport_resource")
 
+
 LxIOPorts()
 
 
@@ -149,7 +153,7 @@ values of that process namespace"""
         if len(argv) >= 1:
             try:
                 pid = int(argv[0])
-            except:
+            except gdb.error:
                 raise gdb.GdbError("Provide a PID as integer value")
         else:
             pid = 1
@@ -195,6 +199,7 @@ values of that process namespace"""
                         info_opts(FS_INFO, s_flags),
                         info_opts(MNT_INFO, m_flags)))
 
+
 LxMounts()
 
 
@@ -259,7 +264,7 @@ class LxFdtDump(gdb.Command):
 
         try:
             f = open(filename, 'wb')
-        except:
+        except gdb.error:
             raise gdb.GdbError("Could not open file to dump fdt")
 
         f.write(fdt_buf)
@@ -267,4 +272,5 @@ class LxFdtDump(gdb.Command):
 
         gdb.write("Dumped fdt blob to " + filename + "\n")
 
+
 LxFdtDump()
diff --git a/scripts/gdb/linux/rbtree.py b/scripts/gdb/linux/rbtree.py
new file mode 100644 (file)
index 0000000..39db889
--- /dev/null
@@ -0,0 +1,177 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2019 Google LLC.
+
+import gdb
+
+from linux import utils
+
+rb_root_type = utils.CachedType("struct rb_root")
+rb_node_type = utils.CachedType("struct rb_node")
+
+
+def rb_first(root):
+    if root.type == rb_root_type.get_type():
+        node = node.address.cast(rb_root_type.get_type().pointer())
+    elif root.type != rb_root_type.get_type().pointer():
+        raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
+
+    node = root['rb_node']
+    if node is 0:
+        return None
+
+    while node['rb_left']:
+        node = node['rb_left']
+
+    return node
+
+
+def rb_last(root):
+    if root.type == rb_root_type.get_type():
+        node = node.address.cast(rb_root_type.get_type().pointer())
+    elif root.type != rb_root_type.get_type().pointer():
+        raise gdb.GdbError("Must be struct rb_root not {}".format(root.type))
+
+    node = root['rb_node']
+    if node is 0:
+        return None
+
+    while node['rb_right']:
+        node = node['rb_right']
+
+    return node
+
+
+def rb_parent(node):
+    parent = gdb.Value(node['__rb_parent_color'] & ~3)
+    return parent.cast(rb_node_type.get_type().pointer())
+
+
+def rb_empty_node(node):
+    return node['__rb_parent_color'] == node.address
+
+
+def rb_next(node):
+    if node.type == rb_node_type.get_type():
+        node = node.address.cast(rb_node_type.get_type().pointer())
+    elif node.type != rb_node_type.get_type().pointer():
+        raise gdb.GdbError("Must be struct rb_node not {}".format(node.type))
+
+    if rb_empty_node(node):
+        return None
+
+    if node['rb_right']:
+        node = node['rb_right']
+        while node['rb_left']:
+            node = node['rb_left']
+        return node
+
+    parent = rb_parent(node)
+    while parent and node == parent['rb_right']:
+            node = parent
+            parent = rb_parent(node)
+
+    return parent
+
+
+def rb_prev(node):
+    if node.type == rb_node_type.get_type():
+        node = node.address.cast(rb_node_type.get_type().pointer())
+    elif node.type != rb_node_type.get_type().pointer():
+        raise gdb.GdbError("Must be struct rb_node not {}".format(node.type))
+
+    if rb_empty_node(node):
+        return None
+
+    if node['rb_left']:
+        node = node['rb_left']
+        while node['rb_right']:
+            node = node['rb_right']
+        return node.dereference()
+
+    parent = rb_parent(node)
+    while parent and node == parent['rb_left'].dereference():
+            node = parent
+            parent = rb_parent(node)
+
+    return parent
+
+
+class LxRbFirst(gdb.Function):
+    """Lookup and return a node from an RBTree
+
+$lx_rb_first(root): Return the node at the given index.
+If index is omitted, the root node is dereferenced and returned."""
+
+    def __init__(self):
+        super(LxRbFirst, self).__init__("lx_rb_first")
+
+    def invoke(self, root):
+        result = rb_first(root)
+        if result is None:
+            raise gdb.GdbError("No entry in tree")
+
+        return result
+
+
+LxRbFirst()
+
+
+class LxRbLast(gdb.Function):
+    """Lookup and return a node from an RBTree.
+
+$lx_rb_last(root): Return the node at the given index.
+If index is omitted, the root node is dereferenced and returned."""
+
+    def __init__(self):
+        super(LxRbLast, self).__init__("lx_rb_last")
+
+    def invoke(self, root):
+        result = rb_last(root)
+        if result is None:
+            raise gdb.GdbError("No entry in tree")
+
+        return result
+
+
+LxRbLast()
+
+
+class LxRbNext(gdb.Function):
+    """Lookup and return a node from an RBTree.
+
+$lx_rb_next(node): Return the node at the given index.
+If index is omitted, the root node is dereferenced and returned."""
+
+    def __init__(self):
+        super(LxRbNext, self).__init__("lx_rb_next")
+
+    def invoke(self, node):
+        result = rb_next(node)
+        if result is None:
+            raise gdb.GdbError("No entry in tree")
+
+        return result
+
+
+LxRbNext()
+
+
+class LxRbPrev(gdb.Function):
+    """Lookup and return a node from an RBTree.
+
+$lx_rb_prev(node): Return the node at the given index.
+If index is omitted, the root node is dereferenced and returned."""
+
+    def __init__(self):
+        super(LxRbPrev, self).__init__("lx_rb_prev")
+
+    def invoke(self, node):
+        result = rb_prev(node)
+        if result is None:
+            raise gdb.GdbError("No entry in tree")
+
+        return result
+
+
+LxRbPrev()
index 004b0ac..2f5b95f 100644 (file)
@@ -139,8 +139,12 @@ lx-symbols command."""
                 saved_states.append({'breakpoint': bp, 'enabled': bp.enabled})
 
         # drop all current symbols and reload vmlinux
+        orig_vmlinux = 'vmlinux'
+        for obj in gdb.objfiles():
+            if obj.filename.endswith('vmlinux'):
+                orig_vmlinux = obj.filename
         gdb.execute("symbol-file", to_string=True)
-        gdb.execute("symbol-file vmlinux")
+        gdb.execute("symbol-file {0}".format(orig_vmlinux))
 
         self.loaded_modules = []
         module_list = modules.module_list()
index f6ab3cc..0301dc1 100644 (file)
@@ -79,6 +79,7 @@ class LxPs(gdb.Command):
                 pid=task["pid"],
                 comm=task["comm"].string()))
 
+
 LxPs()
 
 
@@ -134,4 +135,5 @@ variable."""
         else:
             raise gdb.GdbError("No task of PID " + str(pid))
 
+
 LxThreadInfoByPidFunc()
diff --git a/scripts/gdb/linux/timerlist.py b/scripts/gdb/linux/timerlist.py
new file mode 100644 (file)
index 0000000..071d0dd
--- /dev/null
@@ -0,0 +1,219 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright 2019 Google LLC.
+
+import binascii
+import gdb
+
+from linux import constants
+from linux import cpus
+from linux import rbtree
+from linux import utils
+
+timerqueue_node_type = utils.CachedType("struct timerqueue_node").get_type()
+hrtimer_type = utils.CachedType("struct hrtimer").get_type()
+
+
+def ktime_get():
+    """Returns the current time, but not very accurately
+
+    We can't read the hardware timer itself to add any nanoseconds
+    that need to be added since we last stored the time in the
+    timekeeper. But this is probably good enough for debug purposes."""
+    tk_core = gdb.parse_and_eval("&tk_core")
+
+    return tk_core['timekeeper']['tkr_mono']['base']
+
+
+def print_timer(rb_node, idx):
+    timerqueue = utils.container_of(rb_node, timerqueue_node_type.pointer(),
+                                    "node")
+    timer = utils.container_of(timerqueue, hrtimer_type.pointer(), "node")
+
+    function = str(timer['function']).split(" ")[1].strip("<>")
+    softexpires = timer['_softexpires']
+    expires = timer['node']['expires']
+    now = ktime_get()
+
+    text = " #{}: <{}>, {}, ".format(idx, timer, function)
+    text += "S:{:02x}\n".format(int(timer['state']))
+    text += " # expires at {}-{} nsecs [in {} to {} nsecs]\n".format(
+            softexpires, expires, softexpires - now, expires - now)
+    return text
+
+
+def print_active_timers(base):
+    curr = base['active']['next']['node']
+    curr = curr.address.cast(rbtree.rb_node_type.get_type().pointer())
+    idx = 0
+    while curr:
+        yield print_timer(curr, idx)
+        curr = rbtree.rb_next(curr)
+        idx += 1
+
+
+def print_base(base):
+    text = " .base:       {}\n".format(base.address)
+    text += " .index:      {}\n".format(base['index'])
+
+    text += " .resolution: {} nsecs\n".format(constants.LX_hrtimer_resolution)
+
+    text += " .get_time:   {}\n".format(base['get_time'])
+    if constants.LX_CONFIG_HIGH_RES_TIMERS:
+        text += "  .offset:     {} nsecs\n".format(base['offset'])
+    text += "active timers:\n"
+    text += "".join([x for x in print_active_timers(base)])
+    return text
+
+
+def print_cpu(hrtimer_bases, cpu, max_clock_bases):
+    cpu_base = cpus.per_cpu(hrtimer_bases, cpu)
+    jiffies = gdb.parse_and_eval("jiffies_64")
+    tick_sched_ptr = gdb.parse_and_eval("&tick_cpu_sched")
+    ts = cpus.per_cpu(tick_sched_ptr, cpu)
+
+    text = "cpu: {}\n".format(cpu)
+    for i in xrange(max_clock_bases):
+        text += " clock {}:\n".format(i)
+        text += print_base(cpu_base['clock_base'][i])
+
+        if constants.LX_CONFIG_HIGH_RES_TIMERS:
+            fmts = [("  .{}   : {} nsecs", 'expires_next'),
+                    ("  .{}    : {}", 'hres_active'),
+                    ("  .{}      : {}", 'nr_events'),
+                    ("  .{}     : {}", 'nr_retries'),
+                    ("  .{}       : {}", 'nr_hangs'),
+                    ("  .{}  : {}", 'max_hang_time')]
+            text += "\n".join([s.format(f, cpu_base[f]) for s, f in fmts])
+            text += "\n"
+
+        if constants.LX_CONFIG_TICK_ONESHOT:
+            fmts = [("  .{}      : {}", 'nohz_mode'),
+                    ("  .{}      : {} nsecs", 'last_tick'),
+                    ("  .{}   : {}", 'tick_stopped'),
+                    ("  .{}   : {}", 'idle_jiffies'),
+                    ("  .{}     : {}", 'idle_calls'),
+                    ("  .{}    : {}", 'idle_sleeps'),
+                    ("  .{} : {} nsecs", 'idle_entrytime'),
+                    ("  .{}  : {} nsecs", 'idle_waketime'),
+                    ("  .{}  : {} nsecs", 'idle_exittime'),
+                    ("  .{} : {} nsecs", 'idle_sleeptime'),
+                    ("  .{}: {} nsecs", 'iowait_sleeptime'),
+                    ("  .{}   : {}", 'last_jiffies'),
+                    ("  .{}     : {}", 'next_timer'),
+                    ("  .{}   : {} nsecs", 'idle_expires')]
+            text += "\n".join([s.format(f, ts[f]) for s, f in fmts])
+            text += "\njiffies: {}\n".format(jiffies)
+
+        text += "\n"
+
+    return text
+
+
+def print_tickdevice(td, cpu):
+    dev = td['evtdev']
+    text = "Tick Device: mode:     {}\n".format(td['mode'])
+    if cpu < 0:
+            text += "Broadcast device\n"
+    else:
+            text += "Per CPU device: {}\n".format(cpu)
+
+    text += "Clock Event Device: "
+    if dev == 0:
+            text += "<NULL>\n"
+            return text
+
+    text += "{}\n".format(dev['name'])
+    text += " max_delta_ns:   {}\n".format(dev['max_delta_ns'])
+    text += " min_delta_ns:   {}\n".format(dev['min_delta_ns'])
+    text += " mult:           {}\n".format(dev['mult'])
+    text += " shift:          {}\n".format(dev['shift'])
+    text += " mode:           {}\n".format(dev['state_use_accessors'])
+    text += " next_event:     {} nsecs\n".format(dev['next_event'])
+
+    text += " set_next_event: {}\n".format(dev['set_next_event'])
+
+    members = [('set_state_shutdown', " shutdown: {}\n"),
+               ('set_state_periodic', " periodic: {}\n"),
+               ('set_state_oneshot', " oneshot:  {}\n"),
+               ('set_state_oneshot_stopped', " oneshot stopped: {}\n"),
+               ('tick_resume', " resume:   {}\n")]
+    for member, fmt in members:
+        if dev[member]:
+            text += fmt.format(dev[member])
+
+    text += " event_handler:  {}\n".format(dev['event_handler'])
+    text += " retries:        {}\n".format(dev['retries'])
+
+    return text
+
+
+def pr_cpumask(mask):
+    nr_cpu_ids = 1
+    if constants.LX_NR_CPUS > 1:
+        nr_cpu_ids = gdb.parse_and_eval("nr_cpu_ids")
+
+    inf = gdb.inferiors()[0]
+    bits = mask['bits']
+    num_bytes = (nr_cpu_ids + 7) / 8
+    buf = utils.read_memoryview(inf, bits, num_bytes).tobytes()
+    buf = binascii.b2a_hex(buf)
+
+    chunks = []
+    i = num_bytes
+    while i > 0:
+        i -= 1
+        start = i * 2
+        end = start + 2
+        chunks.append(buf[start:end])
+        if i != 0 and i % 4 == 0:
+            chunks.append(',')
+
+    extra = nr_cpu_ids % 8
+    if 0 < extra <= 4:
+        chunks[0] = chunks[0][0]  # Cut off the first 0
+
+    return "".join(chunks)
+
+
+class LxTimerList(gdb.Command):
+    """Print /proc/timer_list"""
+
+    def __init__(self):
+        super(LxTimerList, self).__init__("lx-timerlist", gdb.COMMAND_DATA)
+
+    def invoke(self, arg, from_tty):
+        hrtimer_bases = gdb.parse_and_eval("&hrtimer_bases")
+        max_clock_bases = gdb.parse_and_eval("HRTIMER_MAX_CLOCK_BASES")
+
+        text = "Timer List Version: gdb scripts\n"
+        text += "HRTIMER_MAX_CLOCK_BASES: {}\n".format(max_clock_bases)
+        text += "now at {} nsecs\n".format(ktime_get())
+
+        for cpu in cpus.each_online_cpu():
+            text += print_cpu(hrtimer_bases, cpu, max_clock_bases)
+
+        if constants.LX_CONFIG_GENERIC_CLOCKEVENTS:
+            if constants.LX_CONFIG_GENERIC_CLOCKEVENTS_BROADCAST:
+                bc_dev = gdb.parse_and_eval("&tick_broadcast_device")
+                text += print_tickdevice(bc_dev, -1)
+                text += "\n"
+                mask = gdb.parse_and_eval("tick_broadcast_mask")
+                mask = pr_cpumask(mask)
+                text += "tick_broadcast_mask: {}\n".format(mask)
+                if constants.LX_CONFIG_TICK_ONESHOT:
+                    mask = gdb.parse_and_eval("tick_broadcast_oneshot_mask")
+                    mask = pr_cpumask(mask)
+                    text += "tick_broadcast_oneshot_mask: {}\n".format(mask)
+                text += "\n"
+
+            tick_cpu_devices = gdb.parse_and_eval("&tick_cpu_device")
+            for cpu in cpus.each_online_cpu():
+                tick_dev = cpus.per_cpu(tick_cpu_devices, cpu)
+                text += print_tickdevice(tick_dev, cpu)
+                text += "\n"
+
+        gdb.write(text)
+
+
+LxTimerList()
index 5080587..bc67126 100644 (file)
@@ -66,6 +66,7 @@ Note that TYPE and ELEMENT have to be quoted as strings."""
         return container_of(ptr, gdb.lookup_type(typename.string()).pointer(),
                             elementname.string())
 
+
 ContainerOf()
 
 
@@ -148,14 +149,14 @@ def get_gdbserver_type():
     def probe_qemu():
         try:
             return gdb.execute("monitor info version", to_string=True) != ""
-        except:
+        except gdb.error:
             return False
 
     def probe_kgdb():
         try:
             thread_info = gdb.execute("info thread 2", to_string=True)
             return "shadowCPU0" in thread_info
-        except:
+        except gdb.error:
             return False
 
     global gdbserver_type
@@ -172,7 +173,7 @@ def get_gdbserver_type():
 def gdb_eval_or_none(expresssion):
     try:
         return gdb.parse_and_eval(expresssion)
-    except:
+    except gdb.error:
         return None
 
 
index 6e0b0af..eff5a48 100644 (file)
@@ -27,7 +27,11 @@ else:
     import linux.modules
     import linux.dmesg
     import linux.tasks
+    import linux.config
     import linux.cpus
     import linux.lists
+    import linux.rbtree
     import linux.proc
     import linux.constants
+    import linux.timerlist
+    import linux.clk
index 03b7ce9..66c314b 100644 (file)
@@ -31,8 +31,8 @@ $(obj)/parse.tab.h: $(src)/parse.y FORCE
 endif
 
 # -I needed for generated C source (shipped source)
-HOSTCFLAGS_parse.tab.o := -I$(src)
-HOSTCFLAGS_lex.lex.o := -I$(src)
+HOSTCFLAGS_parse.tab.o := -I $(srctree)/$(src)
+HOSTCFLAGS_lex.lex.o := -I $(srctree)/$(src)
 
 # dependencies on generated files need to be listed explicitly
 $(obj)/lex.lex.o: $(obj)/parse.tab.h
index 9f40bcd..e93336b 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 static struct resword {
        const char *name;
        int token;
index 7c5dc31..3f327e2 100644 (file)
@@ -76,15 +76,13 @@ savedefconfig: $(obj)/conf
 defconfig: $(obj)/conf
 ifeq ($(KBUILD_DEFCONFIG),)
        $< $(silent) --defconfig $(Kconfig)
-else
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
+else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),)
        @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
        $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
 else
        @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'"
        $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG)
 endif
-endif
 
 %_defconfig: $(obj)/conf
        $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
@@ -147,8 +145,8 @@ common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
                   symbol.o
 
 $(obj)/lexer.lex.o: $(obj)/parser.tab.h
-HOSTCFLAGS_lexer.lex.o := -I$(src)
-HOSTCFLAGS_parser.tab.o        := -I$(src)
+HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
+HOSTCFLAGS_parser.tab.o        := -I $(srctree)/$(src)
 
 # conf: Used for defconfig, oldconfig and related targets
 hostprogs-y    += conf
index 08ba146..6006154 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
 
+#include <sys/mman.h>
 #include <sys/stat.h>
 #include <ctype.h>
 #include <errno.h>
@@ -36,6 +37,52 @@ static bool is_dir(const char *path)
        return S_ISDIR(st.st_mode);
 }
 
+/* return true if the given two files are the same, false otherwise */
+static bool is_same(const char *file1, const char *file2)
+{
+       int fd1, fd2;
+       struct stat st1, st2;
+       void *map1, *map2;
+       bool ret = false;
+
+       fd1 = open(file1, O_RDONLY);
+       if (fd1 < 0)
+               return ret;
+
+       fd2 = open(file2, O_RDONLY);
+       if (fd2 < 0)
+               goto close1;
+
+       ret = fstat(fd1, &st1);
+       if (ret)
+               goto close2;
+       ret = fstat(fd2, &st2);
+       if (ret)
+               goto close2;
+
+       if (st1.st_size != st2.st_size)
+               goto close2;
+
+       map1 = mmap(NULL, st1.st_size, PROT_READ, MAP_PRIVATE, fd1, 0);
+       if (map1 == MAP_FAILED)
+               goto close2;
+
+       map2 = mmap(NULL, st2.st_size, PROT_READ, MAP_PRIVATE, fd2, 0);
+       if (map2 == MAP_FAILED)
+               goto close2;
+
+       if (bcmp(map1, map2, st1.st_size))
+               goto close2;
+
+       ret = true;
+close2:
+       close(fd2);
+close1:
+       close(fd1);
+
+       return ret;
+}
+
 /*
  * Create the parent directory of the given path.
  *
@@ -179,7 +226,7 @@ const char *conf_get_configname(void)
        return name ? name : ".config";
 }
 
-const char *conf_get_autoconfig_name(void)
+static const char *conf_get_autoconfig_name(void)
 {
        char *name = getenv("KCONFIG_AUTOCONFIG");
 
@@ -194,7 +241,7 @@ char *conf_get_default_confname(void)
        name = expand_string(conf_defname);
        env = getenv(SRCTREE);
        if (env) {
-               sprintf(fullname, "%s/%s", env, name);
+               snprintf(fullname, sizeof(fullname), "%s/%s", env, name);
                if (is_present(fullname))
                        return fullname;
        }
@@ -817,40 +864,35 @@ int conf_write(const char *name)
        FILE *out;
        struct symbol *sym;
        struct menu *menu;
-       const char *basename;
        const char *str;
-       char dirname[PATH_MAX+1], tmpname[PATH_MAX+22], newname[PATH_MAX+8];
+       char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1];
        char *env;
+       bool need_newline = false;
+
+       if (!name)
+               name = conf_get_configname();
+
+       if (!*name) {
+               fprintf(stderr, "config name is empty\n");
+               return -1;
+       }
+
+       if (is_dir(name)) {
+               fprintf(stderr, "%s: Is a directory\n", name);
+               return -1;
+       }
+
+       if (make_parent_dir(name))
+               return -1;
 
-       dirname[0] = 0;
-       if (name && name[0]) {
-               char *slash;
-
-               if (is_dir(name)) {
-                       strcpy(dirname, name);
-                       strcat(dirname, "/");
-                       basename = conf_get_configname();
-               } else if ((slash = strrchr(name, '/'))) {
-                       int size = slash - name + 1;
-                       memcpy(dirname, name, size);
-                       dirname[size] = 0;
-                       if (slash[1])
-                               basename = slash + 1;
-                       else
-                               basename = conf_get_configname();
-               } else
-                       basename = name;
-       } else
-               basename = conf_get_configname();
-
-       sprintf(newname, "%s%s", dirname, basename);
        env = getenv("KCONFIG_OVERWRITECONFIG");
-       if (!env || !*env) {
-               sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
-               out = fopen(tmpname, "w");
-       } else {
+       if (env && *env) {
                *tmpname = 0;
-               out = fopen(newname, "w");
+               out = fopen(name, "w");
+       } else {
+               snprintf(tmpname, sizeof(tmpname), "%s.%d.tmp",
+                        name, (int)getpid());
+               out = fopen(tmpname, "w");
        }
        if (!out)
                return 1;
@@ -871,12 +913,16 @@ int conf_write(const char *name)
                                     "#\n"
                                     "# %s\n"
                                     "#\n", str);
+                       need_newline = false;
                } else if (!(sym->flags & SYMBOL_CHOICE)) {
                        sym_calc_value(sym);
                        if (!(sym->flags & SYMBOL_WRITE))
                                goto next;
+                       if (need_newline) {
+                               fprintf(out, "\n");
+                               need_newline = false;
+                       }
                        sym->flags &= ~SYMBOL_WRITE;
-
                        conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
                }
 
@@ -888,6 +934,12 @@ next:
                if (menu->next)
                        menu = menu->next;
                else while ((menu = menu->parent)) {
+                       if (!menu->sym && menu_is_visible(menu) &&
+                           menu != &rootmenu) {
+                               str = menu_get_prompt(menu);
+                               fprintf(out, "# end of %s\n", str);
+                               need_newline = true;
+                       }
                        if (menu->next) {
                                menu = menu->next;
                                break;
@@ -897,14 +949,20 @@ next:
        fclose(out);
 
        if (*tmpname) {
-               strcat(dirname, basename);
-               strcat(dirname, ".old");
-               rename(newname, dirname);
-               if (rename(tmpname, newname))
+               if (is_same(name, tmpname)) {
+                       conf_message("No change to %s", name);
+                       unlink(tmpname);
+                       sym_set_change_count(0);
+                       return 0;
+               }
+
+               snprintf(oldname, sizeof(oldname), "%s.old", name);
+               rename(name, oldname);
+               if (rename(tmpname, name))
                        return 1;
        }
 
-       conf_message("configuration written to %s", newname);
+       conf_message("configuration written to %s", name);
 
        sym_set_change_count(0);
 
@@ -917,8 +975,6 @@ static int conf_write_dep(const char *name)
        struct file *file;
        FILE *out;
 
-       if (!name)
-               name = ".kconfig.d";
        out = fopen("..config.tmp", "w");
        if (!out)
                return 1;
index 5d4ecf3..e36b342 100644 (file)
@@ -638,7 +638,7 @@ on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data)
 void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
        GtkWidget *dialog;
-       const gchar *intro_text = 
+       const gchar *intro_text =
            "Welcome to gkc, the GTK+ graphical configuration tool\n"
            "For each option, a blank box indicates the feature is disabled, a\n"
            "check indicates it is enabled, and a dot indicates that it is to\n"
index c9df1c8..6354c90 100644 (file)
@@ -378,7 +378,8 @@ FILE *zconf_fopen(const char *name)
        if (!f && name != NULL && name[0] != '/') {
                env = getenv(SRCTREE);
                if (env) {
-                       sprintf(fullname, "%s/%s", env, name);
+                       snprintf(fullname, sizeof(fullname),
+                                "%s/%s", env, name);
                        f = fopen(fullname, "r");
                }
        }
index d871539..cbc7658 100644 (file)
@@ -49,7 +49,6 @@ const char *zconf_curname(void);
 
 /* confdata.c */
 const char *conf_get_configname(void);
-const char *conf_get_autoconfig_name(void);
 char *conf_get_default_confname(void);
 void sym_set_change_count(int count);
 void sym_add_change_count(int count);
index a8999d8..7cb5a7e 100644 (file)
@@ -1,4 +1,4 @@
 This is NOT the official version of dialog.  This version has been
 significantly modified from the original.  It is for use by the Linux
-kernel configuration script.  Please do not bother Savio Lam with 
+kernel configuration script.  Please do not bother Savio Lam with
 questions about this program.
index 5f8c82a..694091f 100644 (file)
@@ -936,7 +936,7 @@ static void conf_save(void)
                                set_config_filename(dialog_input_result);
                                return;
                        }
-                       show_textbox(NULL, "Can't create file!  Probably a nonexistent directory.", 5, 60);
+                       show_textbox(NULL, "Can't create file!", 5, 60);
                        break;
                case 1:
                        show_helptext("Save Alternate Configuration", save_config_help);
old mode 100644 (file)
new mode 100755 (executable)
index ac92c0d..cbafe3b 100644 (file)
@@ -1438,8 +1438,7 @@ static void conf_save(void)
                                set_config_filename(dialog_input_result);
                                return;
                        }
-                       btn_dialog(main_window, "Can't create file! "
-                               "Probably a nonexistent directory.",
+                       btn_dialog(main_window, "Can't create file!",
                                1, "<OK>");
                        break;
                case 1:
diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh
new file mode 100755 (executable)
index 0000000..39e8cb3
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+# Check uniqueness of module names
+check_same_name_modules()
+{
+       for m in $(sed 's:.*/::' modules.order | sort | uniq -d)
+       do
+               echo "warning: same module names found:" >&2
+               sed -n "/\/$m/s:^kernel/:  :p" modules.order >&2
+       done
+}
+
+check_same_name_modules
index 2c6de21..27b42d5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for the different targets used to generate full packages of a kernel
 # It uses the generic clean infrastructure of kbuild
 
index b3048b8..59494e1 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 subdir-y := mdp genheaders
index 70e14c6..d46be47 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
 # Generate tags or cscope files
 # Usage tags.sh <mode>
 #
index aeac367..466cc1f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Security configuration
 #
index 0a1d4ca..c6cb2d9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Kernel hardening options"
 
 config GCC_PLUGIN_STRUCTLEAK
index 3de21f4..d8b1a36 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_APPARMOR
        bool "AppArmor support"
        depends on SECURITY && NET
index 3ba1168..c352532 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 config INTEGRITY
        bool "Integrity subsystem"
index 6022185..a6e19d2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config EVM
        bool "EVM support"
        select KEYS
index 7393c41..a56f561 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for building the Extended Verification Module(EVM)
 #
index a18f8c6..2692c73 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # IBM Integrity Measurement Architecture
 #
 config IMA
index 6462e66..ee502e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Key management configuration
 #
index a0d70d8..91be65d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_LOADPIN
        bool "Pin load of kernel files (modules, fw, etc) to one filesystem"
        depends on SECURITY && BLOCK
index c2d77f8..0ead1c3 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SECURITY_LOADPIN) += loadpin.o
index 4f415c4..18b5fb9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_SAFESETID
         bool "Gate setid transitions to limit CAP_SET{U/G}ID capabilities"
         depends on SECURITY
index 55f032f..5711689 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_SELINUX
        bool "NSA SELinux Support"
        depends on SECURITY_NETWORK && AUDIT && NET && INET
index c61787b..3ec702c 100644 (file)
@@ -4637,6 +4637,14 @@ static int selinux_socket_connect_helper(struct socket *sock,
        err = sock_has_perm(sk, SOCKET__CONNECT);
        if (err)
                return err;
+       if (addrlen < offsetofend(struct sockaddr, sa_family))
+               return -EINVAL;
+
+       /* connect(AF_UNSPEC) has special handling, as it is a documented
+        * way to disconnect the socket
+        */
+       if (address->sa_family == AF_UNSPEC)
+               return 0;
 
        /*
         * If a TCP, DCCP or SCTP socket, check name_connect permission
@@ -4657,8 +4665,6 @@ static int selinux_socket_connect_helper(struct socket *sock,
                 * need to check address->sa_family as it is possible to have
                 * sk->sk_family = PF_INET6 with addr->sa_family = AF_INET.
                 */
-               if (addrlen < offsetofend(struct sockaddr, sa_family))
-                       return -EINVAL;
                switch (address->sa_family) {
                case AF_INET:
                        addr4 = (struct sockaddr_in *)address;
index 8671de0..d30d8d7 100644 (file)
@@ -1,26 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * SELinux interface to the NetLabel subsystem
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef _SELINUX_NETLABEL_H_
index 6fd9954..abaab76 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SELinux NetLabel Support
  *
@@ -5,25 +6,10 @@
  * subsystem.
  *
  * Author: Paul Moore <paul@paul-moore.com>
- *
  */
 
 /*
  * (c) Copyright Hewlett-Packard Development Company, L.P., 2007, 2008
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/spinlock.h>
index 923b120..5a8dfad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_SMACK
        bool "Simplified Mandatory Access Control Kernel Support"
        depends on NET
index ee2ebd5..6dbf6e2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the SMACK LSM
 #
index a00ab7e..9221ea5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_TOMOYO
        bool "TOMOYO Linux Support"
        depends on SECURITY
index 96b2740..a810304 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SECURITY_YAMA
        bool "Yama support"
        depends on SECURITY
index 8b5e065..0fa5d0f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SECURITY_YAMA) := yama.o
 
 yama-y := yama_lsm.o
index 1140e99..3678541 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SOUND
        tristate "Sound card support"
        depends on HAS_IOMEM
index baa5f8e..f0e31f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # AC97 configuration
 #
index f9c2640..f5efa1a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # make for AC97 bus drivers
 #
index c081e18..d70ca0f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_AOA
        tristate "Apple Onboard Audio driver"
        depends on PPC_PMAC
index a8c037f..8dbfb01 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SND_AOA) += core/
 obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/
 obj-$(CONFIG_SND_AOA) += fabrics/
index 0c68e32..8ac13fd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_AOA_ONYX
        tristate "support Onyx chip"
        select I2C
index 3ca475a..1d8a718 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_AOA_FABRIC_LAYOUT
        tristate "layout-id fabric"
        select SND_AOA_SOUNDBUS
index da37c10..3f1d55f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-aoa-fabric-layout-objs += layout.o
 
 obj-$(CONFIG_SND_AOA_FABRIC_LAYOUT) += snd-aoa-fabric-layout.o
index 839d113..ac084df 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_AOA_SOUNDBUS
        tristate "Apple Soundbus support"
        select SND_PCM
index 0e61f5a..e0b61cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SND_AOA_SOUNDBUS) += snd-aoa-soundbus.o
 snd-aoa-soundbus-objs := core.o sysfs.o
 obj-$(CONFIG_SND_AOA_SOUNDBUS_I2S) += i2sbus/
index 1b949b2..1b38c87 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SND_AOA_SOUNDBUS_I2S) += snd-aoa-i2sbus.o
 snd-aoa-i2sbus-objs := core.o pcm.o control.o
index 2886773..dea2c66 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA ARM drivers
 
 menuconfig SND_ARM
index d789cbc..6ed2d4a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Atmel devices (AT91)"
        depends on ARCH_AT91
 
index d4009d1..57bc6f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-atmel-ac97c-objs           := ac97c.o
 
 obj-$(CONFIG_SND_ATMEL_AC97C)  += snd-atmel-ac97c.o
index 63b3ef9..4ee79ad 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA soundcard-configuration
 config SND_TIMER
        tristate
index 45c1336..f84718a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SEQUENCER
        tristate "Sequencer support"
        select SND_TIMER
index 4ea4e3e..f1a6087 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
index 648a12d..09932cc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_MPU401_UART
         tristate
         select SND_RAWMIDI
index 918f83f..3dfd5b3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index b19555b..77dc0ee 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-pcsp-objs := pcsp.o pcsp_lib.o pcsp_mixer.o pcsp_input.o
 obj-$(CONFIG_SND_PCSP) += snd-pcsp.o
index d83ad38..14aacd8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * PC-Speaker driver for Linux
  *
index 9a168a3..d9f9ac6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index b9e96d0..b0a904c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_FIREWIRE
        bool "FireWire sound devices"
        depends on FIREWIRE
index 37062a2..115eadd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
                 dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \
                 dice-alesis.o dice-extension.o dice-mytek.o
index 1123e68..8add0cd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-firewire-digi00x-objs := amdtp-dot.o digi00x-stream.o digi00x-proc.o \
                             digi00x-pcm.o digi00x-hwdep.o \
                             digi00x-transaction.o digi00x-midi.o digi00x.o
index d64f4e2..3aef221 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-fireface-objs := ff.o ff-transaction.o ff-midi.o ff-proc.o amdtp-ff.o \
                     ff-stream.o ff-pcm.o ff-hwdep.o ff-protocol-former.o \
                     ff-protocol-latter.o
index 15ef7f7..3386121 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-fireworks-objs := fireworks_transaction.o fireworks_command.o \
                      fireworks_stream.o fireworks_proc.o fireworks_midi.o \
                      fireworks_pcm.o fireworks_hwdep.o fireworks.o
index b474da7..669d1e8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-oxfw-objs := oxfw-command.o oxfw-stream.o oxfw-pcm.o oxfw-proc.o \
                 oxfw-midi.o oxfw-hwdep.o oxfw-spkr.o oxfw-scs1x.o oxfw.o
 obj-$(CONFIG_SND_OXFW) += snd-oxfw.o
index 0fc955d..a1d21f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-firewire-tascam-objs := tascam-proc.o amdtp-tascam.o tascam-stream.o \
                            tascam-pcm.o tascam-hwdep.o tascam-transaction.o \
                            tascam-midi.o tascam.o
index 2d90e11..f6feced 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_HDA_CORE
        tristate
        select REGMAP
index 5dfa610..a204dce 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * generic arrays
  */
index 9b6f641..154779b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-hda-ext-core-objs := hdac_ext_bus.o hdac_ext_controller.o hdac_ext_stream.o
 
 obj-$(CONFIG_SND_HDA_EXT_CORE) += snd-hda-ext-core.o
index 3060e2a..eea6b63 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio bus
  */
index 10e5d26..14e57ff 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio core bus driver
  */
index b2e9454..b02f745 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio controller helpers
  */
index 95b073e..6907dbe 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio codec core device
  */
@@ -55,6 +56,7 @@ int snd_hdac_device_init(struct hdac_device *codec, struct hdac_bus *bus,
        codec->bus = bus;
        codec->addr = addr;
        codec->type = HDA_DEV_CORE;
+       mutex_init(&codec->widget_lock);
        pm_runtime_set_active(&codec->dev);
        pm_runtime_get_noresume(&codec->dev);
        atomic_set(&codec->in_pm, 0);
@@ -141,7 +143,9 @@ int snd_hdac_device_register(struct hdac_device *codec)
        err = device_add(&codec->dev);
        if (err < 0)
                return err;
+       mutex_lock(&codec->widget_lock);
        err = hda_widget_sysfs_init(codec);
+       mutex_unlock(&codec->widget_lock);
        if (err < 0) {
                device_del(&codec->dev);
                return err;
@@ -158,7 +162,9 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_register);
 void snd_hdac_device_unregister(struct hdac_device *codec)
 {
        if (device_is_registered(&codec->dev)) {
+               mutex_lock(&codec->widget_lock);
                hda_widget_sysfs_exit(codec);
+               mutex_unlock(&codec->widget_lock);
                device_del(&codec->dev);
                snd_hdac_bus_remove_device(codec->bus, codec);
        }
@@ -404,7 +410,9 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec, bool sysfs)
        }
 
        if (sysfs) {
+               mutex_lock(&codec->widget_lock);
                err = hda_widget_sysfs_reinit(codec, start_nid, nums);
+               mutex_unlock(&codec->widget_lock);
                if (err < 0)
                        return err;
        }
index 996dbc8..f399a15 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Regmap support for HD-audio verbs
  *
index 76e9b41..55d53b8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio stream operations
  */
index fb2aa34..909d5ef 100644 (file)
@@ -395,6 +395,7 @@ static int widget_tree_create(struct hdac_device *codec)
        return 0;
 }
 
+/* call with codec->widget_lock held */
 int hda_widget_sysfs_init(struct hdac_device *codec)
 {
        int err;
@@ -411,11 +412,13 @@ int hda_widget_sysfs_init(struct hdac_device *codec)
        return 0;
 }
 
+/* call with codec->widget_lock held */
 void hda_widget_sysfs_exit(struct hdac_device *codec)
 {
        widget_tree_free(codec);
 }
 
+/* call with codec->widget_lock held */
 int hda_widget_sysfs_reinit(struct hdac_device *codec,
                            hda_nid_t start_nid, int num_nodes)
 {
index f21633c..886cb78 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HDMI Channel map support helpers
  */
index d7db1ee..b690ed9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA ISA drivers
 
 config SND_WSS_LIB
index 487ab23..93def7f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 3d6dea3..4eab89b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 5fb619e..5105524 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * AdLib FM card driver.
  */
index 6179775..250db35 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for C-Media CMI8328-based soundcards, such as AudioExcel AV500
  * Copyright (c) 2012 Ondrej Zary
index 6d397e8..91c6b8d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index aee1e4d..c683ac3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index e307066..ff861f2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
index 9a97643..545fb13 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Aztech AZT1605 Driver
  * Copyright (C) 2007,2010  Rene Herman
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #define AZT1605
index 1894411..76251e8 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Aztech AZT2316 Driver
  * Copyright (C) 2007,2010  Rene Herman
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #define AZT2316
index af9eea4..ce409e7 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Aztech AZT1605/AZT2316 Driver
  * Copyright (C) 2007,2010  Rene Herman
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <linux/kernel.h>
index 601bddd..b8406dc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 454fee7..34d0636 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2008 by Jaroslav Kysela <perex@perex.cz>
index 4a47050..8a33402 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA MIPS drivers
 
 menuconfig SND_MIPS
index b977c44..ccc364e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 #
index f456574..12e4216 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config DMASOUND_ATARI
        tristate "Atari DMA sound support"
        depends on ATARI && SOUND
index 3c15316..de8ae83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for the DMA sound driver
 #
index a1a2979..8365368 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/sound/oss/dmasound/dmasound_atari.c
  *
index 81eb82c..23cf828 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/sound/oss/dmasound/dmasound_paula.c
  *
index be4fe15..e25a78d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  *  linux/sound/oss/dmasound/dmasound_q40.c
  *
index 9b61d95..425ceaf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA PA-RISC drivers
 
 menuconfig SND_GSC
index b91e750..10891c3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 #
index 4105d9f..7630f80 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA PCI drivers
 
 menuconfig SND_PCI
index 5261753..c74e769 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 713459c..8156198 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 391830a..8351f8f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-asihpi-objs := asihpi.o hpioctl.o hpimsginit.o\
        hpicmn.o hpifunc.o hpidebug.o hpidspcd.o\
        hpios.o hpi6000.o hpi6205.o hpimsgx.o
index 3209218..782333c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * ALSA driver for the Aureal Vortex family of soundprocessors.
  * Author: Manuel Jander (mjander@embedded.cl)
index 842335d..f9045af 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-aw2-objs := aw2-alsa.o aw2-saa7146.o
 
 obj-$(CONFIG_SND_AW2) += snd-aw2.o
index c1455fc..9e51d3d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-ca0106-objs := ca0106_main.o ca0106_mixer.o ca_midi.o
 snd-ca0106-$(CONFIG_SND_PROC_FS) += ca0106_proc.o
 
index 67e811e..3ed2ceb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index a8f75f8..447e628 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for cs5535audio
 #
index 15075f8..7088870 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-ctxfi-objs := xfi.o ctatc.o ctvmem.o ctpcm.o ctmixer.o ctresource.o \
        ctsrc.o ctamixer.o ctdaio.o ctimap.o cthardware.o cttimer.o \
        cthw20k2.o cthw20k1.o
index 4235907..35d9343 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "HD-Audio"
 
 config SND_HDA
index 1ec706c..8272b50 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * HD-audio codec driver binding
  * Copyright (c) Takashi Iwai <tiwai@suse.de>
index c154b19..fcc3441 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * sysfs interface for HD-audio codec
  *
index c53ca58..f83f21d 100644 (file)
@@ -478,12 +478,45 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
                set_eapd(codec, *p, on);
 }
 
+static int find_ext_mic_pin(struct hda_codec *codec);
+
+static void alc_headset_mic_no_shutup(struct hda_codec *codec)
+{
+       const struct hda_pincfg *pin;
+       int mic_pin = find_ext_mic_pin(codec);
+       int i;
+
+       /* don't shut up pins when unloading the driver; otherwise it breaks
+        * the default pin setup at the next load of the driver
+        */
+       if (codec->bus->shutdown)
+               return;
+
+       snd_array_for_each(&codec->init_pins, i, pin) {
+               /* use read here for syncing after issuing each verb */
+               if (pin->nid != mic_pin)
+                       snd_hda_codec_read(codec, pin->nid, 0,
+                                       AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
+       }
+
+       codec->pins_shutup = 1;
+}
+
 static void alc_shutup_pins(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
 
-       if (!spec->no_shutup_pins)
-               snd_hda_shutup_pins(codec);
+       switch (codec->core.vendor_id) {
+       case 0x10ec0286:
+       case 0x10ec0288:
+       case 0x10ec0298:
+               alc_headset_mic_no_shutup(codec);
+               break;
+       default:
+               if (!spec->no_shutup_pins)
+                       snd_hda_shutup_pins(codec);
+               break;
+       }
 }
 
 /* generic shutup callback;
@@ -502,7 +535,6 @@ static void alc_eapd_shutup(struct hda_codec *codec)
 /* generic EAPD initialization */
 static void alc_auto_init_amp(struct hda_codec *codec, int type)
 {
-       alc_fill_eapd_coef(codec);
        alc_auto_setup_eapd(codec, true);
        alc_write_gpio(codec);
        switch (type) {
@@ -797,10 +829,22 @@ static int alc_build_controls(struct hda_codec *codec)
  * Common callbacks
  */
 
+static void alc_pre_init(struct hda_codec *codec)
+{
+       alc_fill_eapd_coef(codec);
+}
+
+#define is_s4_resume(codec) \
+       ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
+
 static int alc_init(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
 
+       /* hibernation resume needs the full chip initialization */
+       if (is_s4_resume(codec))
+               alc_pre_init(codec);
+
        if (spec->init_hook)
                spec->init_hook(codec);
 
@@ -1538,6 +1582,8 @@ static int patch_alc880(struct hda_codec *codec)
 
        codec->patch_ops.unsol_event = alc880_unsol_event;
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
                       alc880_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -1789,6 +1835,8 @@ static int patch_alc260(struct hda_codec *codec)
 
        spec->shutup = alc_eapd_shutup;
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
                           alc260_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -2492,6 +2540,8 @@ static int patch_alc882(struct hda_codec *codec)
                break;
        }
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
                       alc882_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -2666,6 +2716,8 @@ static int patch_alc262(struct hda_codec *codec)
 #endif
        alc_fix_pll_init(codec, 0x20, 0x0a, 10);
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
                       alc262_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -2810,6 +2862,8 @@ static int patch_alc268(struct hda_codec *codec)
 
        spec->shutup = alc_eapd_shutup;
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
@@ -2924,27 +2978,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
        return alc_parse_auto_config(codec, alc269_ignore, ssids);
 }
 
-static int find_ext_mic_pin(struct hda_codec *codec);
-
-static void alc286_shutup(struct hda_codec *codec)
-{
-       const struct hda_pincfg *pin;
-       int i;
-       int mic_pin = find_ext_mic_pin(codec);
-       /* don't shut up pins when unloading the driver; otherwise it breaks
-        * the default pin setup at the next load of the driver
-        */
-       if (codec->bus->shutdown)
-               return;
-       snd_array_for_each(&codec->init_pins, i, pin) {
-               /* use read here for syncing after issuing each verb */
-               if (pin->nid != mic_pin)
-                       snd_hda_codec_read(codec, pin->nid, 0,
-                                       AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
-       }
-       codec->pins_shutup = 1;
-}
-
 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
 {
        alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
@@ -6964,7 +6997,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
        SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
-       SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
        SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
        SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
        SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
@@ -7007,7 +7042,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
        SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
        SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
-       SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
+       SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
        SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
        SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
        SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
@@ -7736,7 +7771,6 @@ static int patch_alc269(struct hda_codec *codec)
        case 0x10ec0286:
        case 0x10ec0288:
                spec->codec_variant = ALC269_TYPE_ALC286;
-               spec->shutup = alc286_shutup;
                break;
        case 0x10ec0298:
                spec->codec_variant = ALC269_TYPE_ALC298;
@@ -7805,6 +7839,8 @@ static int patch_alc269(struct hda_codec *codec)
                spec->init_hook = alc5505_dsp_init;
        }
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc269_fixup_models,
                       alc269_fixup_tbl, alc269_fixups);
        snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
@@ -7947,6 +7983,8 @@ static int patch_alc861(struct hda_codec *codec)
        spec->power_hook = alc_power_eapd;
 #endif
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
@@ -8044,6 +8082,8 @@ static int patch_alc861vd(struct hda_codec *codec)
 
        spec->shutup = alc_eapd_shutup;
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
@@ -8779,6 +8819,8 @@ static int patch_alc662(struct hda_codec *codec)
                break;
        }
 
+       alc_pre_init(codec);
+
        snd_hda_pick_fixup(codec, alc662_fixup_models,
                       alc662_fixup_tbl, alc662_fixups);
        snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
index f11ce1b..42eb287 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 8178a2a..8fdb5e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-lola-y := lola.o lola_pcm.o lola_clock.o lola_mixer.o
 snd-lola-$(CONFIG_SND_DEBUG) += lola_proc.o
 
index eb04a6c..c295f68 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-lx6464es-objs := lx6464es.o lx_core.o
 obj-$(CONFIG_SND_LX6464ES) += snd-lx6464es.o
index cce159e..16cfeb7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index a1bd44f..3063766 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index b06128e..5993d86 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-pcxhr-objs := pcxhr.o pcxhr_hwdep.o pcxhr_mixer.o pcxhr_core.o pcxhr_mix22.o
 obj-$(CONFIG_SND_PCXHR) += snd-pcxhr.o
index dcd2e64..9a505ba 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-riptide-objs := riptide.o
 
 obj-$(CONFIG_SND_RIPTIDE) += snd-riptide.o
index 88676b5..e8975bc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index a4d08d4..dda900e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index bd3d514..40a1d83 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 7fbb190..10291c4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA PCMCIA drivers
 
 menuconfig SND_PCMCIA
index beef2e3..874f09a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index e892d72..ea0d675 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
index 2bb42ea..b25006e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 0519c60..8789cb5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA PowerMac drivers
 
 menuconfig SND_PPC
index 679c45a..0188ce3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 # Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
index 61139f3..b75fbb3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA SH drivers
 
 menuconfig SND_SUPERH
index 7d09b51..c0bbc50 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Makefile for ALSA
 #
index 297be0c..dc86e40 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # SoC audio configuration
 #
index dd763f5..e321e3b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_ADI
        tristate "Audio support for Analog Devices reference designs"
        depends on MICROBLAZE || ARCH_ZYNQ || COMPILE_TEST
index 64456c1..125f667 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-adi-axi-i2s-objs := axi-i2s.o
 snd-soc-adi-axi-spdif-objs := axi-spdif.o
 
index 33ebec9..9ca9214 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_AMD_ACP
        tristate "AMD Audio Coprocessor support"
        help
index 8e1c571..c4ddc6a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 acp_audio_dma-objs := acp-pcm-dma.o
 snd-soc-acp-da7219mx98357-mach-objs := acp-da7219-max98357a.o
 snd-soc-acp-rt5645-mach-objs := acp-rt5645.o
index c473b9e..06c1d5c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_ATMEL_SOC
        tristate "SoC Audio for the Atmel System-on-Chip"
        depends on HAS_IOMEM
index 3d70061..94de94b 100644 (file)
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Atmel ALSA SoC Audio Class D Amplifier (CLASSD) driver
  *
  * Copyright (C) 2015 Atmel
  *
  * Author: Songjun Wu <songjun.wu@atmel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 or later
- * as published by the Free Software Foundation.
  */
 
 #include <linux/of.h>
index 915c2b0..c61fa4a 100644 (file)
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* Atmel PDMIC driver
  *
  * Copyright (C) 2015 Atmel
  *
  * Author: Songjun Wu <songjun.wu@atmel.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 or later
- * as published by the Free Software Foundation.
  */
 
 #include <linux/of.h>
index a561040..38de7c0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ##
 ## Au1200/Au1550/Au1300 PSC + DBDMA
 ##
index 66d6c52..0792c40 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Au1000/Au1500/Au1100 AC97C controller driver for ASoC
  *
index e97c327..8b17fd7 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * DB1000/DB1500/DB1100 ASoC audio fabric support code.
  *
index 301e1fc..2a4621d 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * DB1200/DB1300/DB1550 ASoC audio fabric support code.
  *
index efff1e2..1e98cc4 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Au1000/Au1500/Au1100 Audio DMA support.
  *
index 450c842..46f2b44 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Au1000/Au1500/Au1100 I2S controller driver for ASoC
  *
index 02f50b7..0037e96 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_BCM2835_SOC_I2S
        tristate "SoC Audio support for the Broadcom BCM2835 I2S module"
        depends on ARCH_BCM2835 || COMPILE_TEST
index fc739d0..b81fa42 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # BCM2835 Platform Support
 snd-soc-bcm2835-i2s-objs := bcm2835-i2s.o
 
index e091991..2333efa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_EP93XX_SOC
        tristate "SoC Audio support for the Cirrus Logic EP93xx series"
        depends on ARCH_EP93XX || COMPILE_TEST
index 3d011ab..f678b4c 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
+#include <linux/soc/cirrus/ep93xx.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 static int edb93xx_hw_params(struct snd_pcm_substream *substream,
                             struct snd_pcm_hw_params *params)
index cd5a939..c6bc447 100644 (file)
@@ -24,6 +24,7 @@
 #include <sound/soc.h>
 
 #include <linux/platform_data/dma-ep93xx.h>
+#include <linux/soc/cirrus/ep93xx.h>
 
 #include "ep93xx-pcm.h"
 
index 0918c5d..beab7c5 100644 (file)
@@ -27,9 +27,8 @@
 #include <sound/initval.h>
 #include <sound/soc.h>
 
-#include <mach/hardware.h>
-#include <mach/ep93xx-regs.h>
 #include <linux/platform_data/dma-ep93xx.h>
+#include <linux/soc/cirrus/ep93xx.h>
 
 #include "ep93xx-pcm.h"
 
index 1ec6618..cb85053 100644 (file)
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/soc/cirrus/ep93xx.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 static struct snd_soc_dai_link simone_dai = {
        .name           = "AC97",
index 11ff7b2..dea4909 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/soc/cirrus/ep93xx.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 #include "../codecs/tlv320aic23.h"
 
index 8f57725..e730d47 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Helper to resolve issues with configs that have SPI enabled but I2C
 # modular, meaning we can't build the codec driver in with I2C support.
 # We use an ordered list of conditional defaults to pick the appropriate
index 85a336b..7feedbb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver of Inno codec for rk3036 by Rockchip Inc.
  *
index 7b0d261..f9830bd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  * Copyright 2009 Sascha Hauer, s.hauer@pengutronix.de
@@ -5,20 +6,6 @@
  *
  * Initial development of this code was funded by
  * Phytec Messtechnik GmbH, http://www.phytec.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
  */
 #include <linux/module.h>
 #include <linux/device.h>
index 3a6d199..8992d3a 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifndef MC13783_MIXER_H
index e0af210..9009a74 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SiRF audio codec driver
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/module.h>
index ba1adc0..a7fe268 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * SiRF inner codec controllers define
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef _SIRF_AUDIO_CODEC_H
index b91b8d5..b9ca3af 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Texas Instruments TLV320AIC26 low power audio CODEC
  * ALSA SoC CODEC driver
index 83608f3..68165de 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * linux/sound/soc/codecs/tlv320aic32x4.c
  *
@@ -6,21 +7,6 @@
  * Author: Javier Martin <javier.martin@vista-silicon.com>
  *
  * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
  */
 
 #include <linux/module.h>
index aa0c6ec..0cd1a15 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_DESIGNWARE_I2S
        tristate "Synopsys I2S Device Driver"
        depends on CLKDEV_LOOKUP
index 3e24c0f..91e1aaa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # SYNOPSYS Platform Support
 obj-$(CONFIG_SND_DESIGNWARE_I2S) += designware_i2s.o
 
index 55ed47c..aa99c00 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "SoC Audio for Freescale CPUs"
 
 comment "Common SoC Audio options for Freescale CPUs:"
index 83f1243..a90c3b2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SIMPLE_CARD_UTILS
        tristate
 
index 4356d5a..df8fbd8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_I2S_HI6210_I2S
        tristate "Hisilicon I2S controller"
        select SND_SOC_GENERIC_DMAENGINE_PCM
index e8095e2..02e7663 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SND_I2S_HI6210_I2S) += hi6210-i2s.o
index 857a951..568efa6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_IMG
        bool "Audio support for Imagination Technologies designs"
        help
index fc1396a..1f868da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_INTEL_SST_TOPLEVEL
        bool "Intel ASoC SST drivers"
        default y
index 488408c..4d0806a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-sst-baytrail-pcm-objs := \
                sst-baytrail-ipc.o sst-baytrail-pcm.o sst-baytrail-dsp.o
 
index e39473a..5407d21 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_SOC_INTEL_MACH
        bool "Intel Machine drivers"
        depends on SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL
index 9c17231..ad2341a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-sst-haswell-pcm-objs := \
                sst-haswell-ipc.o sst-haswell-pcm.o sst-haswell-dsp.o
 
index b3f9c41..6b75716 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_JZ4740_SOC
        tristate "SoC Audio for Ingenic JZ4740 SoC"
        depends on MIPS || COMPILE_TEST
index d32c540..fb10e9a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Jz4740 Platform Support
 #
index 132bb83..5d8a86b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_KIRKWOOD_SOC
        tristate "SoC Audio for the Marvell Kirkwood and Dove chips"
        depends on ARCH_DOVE || ARCH_MVEBU || COMPILE_TEST
index c36b03d..e2d279f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-kirkwood-objs := kirkwood-dma.o kirkwood-i2s.o
 
 obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o
index f70b710..933ab51 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_MEDIATEK
        tristate
 
index 8779fe2..3085bdd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "ASoC support for Amlogic platforms"
        depends on ARCH_MESON || COMPILE_TEST
 
index 219235c..402ef1e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_MXS_SOC
        tristate "SoC Audio for Freescale MXS CPUs"
        depends on ARCH_MXS || COMPILE_TEST
index a371b4f..df2e4be 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  *
  * Based on sound/soc/imx/imx-pcm-dma-mx2.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/device.h>
index 035ea04..4f9c419 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef _MXS_PCM_H
index 156aa7c..269b6d6 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2011 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
@@ -26,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
+#include <linux/io.h>
 #include <linux/time.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
index 9a4c0b2..8f36928 100644 (file)
@@ -1,19 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 
index 2b3f240..f41c2d6 100644 (file)
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright 2011 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <linux/module.h>
index 7f0c954..e1b22fb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ##
 ## NUC900 series AC97 API
 ##
index 67159a6..213d4da 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_PXA2XX_SOC
        tristate "SoC Audio for the Intel PXA2xx chip"
        depends on ARCH_PXA || COMPILE_TEST
index 7847537..fd0fe42 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/module.h>
 #include <sound/soc.h>
index b1764af..8e3e866 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_QCOM
        tristate "ASoC support for QCOM platforms"
        depends on ARCH_QCOM || COMPILE_TEST
index c33b3ca..7e91e96 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_SND_SOC_QDSP6_COMMON) += q6dsp-common.o
 obj-$(CONFIG_SND_SOC_QDSP6_CORE) += q6core.o
 obj-$(CONFIG_SND_SOC_QDSP6_AFE) += q6afe.o
index 957046a..28a80c1 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_ROCKCHIP
        tristate "ASoC support for Rockchip"
        depends on COMPILE_TEST || ARCH_ROCKCHIP
index 0520f5a..6389831 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_SOC_SAMSUNG
        tristate "ASoC support for Samsung"
        depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
index 840058d..094a1c8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_SIRF
        tristate "SoC Audio for the SiRF SoC chips"
        depends on ARCH_SIRF || COMPILE_TEST
index be066de..8be2f0b 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SiRF Audio port driver
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 #include <linux/module.h>
 #include <sound/soc.h>
index f2bc507..a758e26 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SiRF audio card driver
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #include <linux/platform_device.h>
index d70fcd4..8bab119 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SiRF USP in I2S/DSP mode
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 #include <linux/module.h>
 #include <linux/io.h>
index e22e13a..08993b5 100644 (file)
@@ -1,9 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * arch/arm/mach-prima2/include/mach/sirfsoc_usp.h
  *
  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
  */
 
 #ifndef _SIRF_USP_H
index b204c65..048c7b0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_SOF_TOPLEVEL
        bool "Sound Open Firmware Support"
        help
index 603e0db..b86b5f9 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_SOF_INTEL_TOPLEVEL
        bool "SOF support for Intel audio DSPs"
        depends on X86 || COMPILE_TEST
index 8a9343b..defd6d3 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_SOF_XTENSA
        tristate
index 4fb9141..1b053de 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SPEAR_SOC
        tristate
        select SND_SOC_GENERIC_DMAENGINE_PCM
index 21f9cc3..5474fd3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_SPRD
        tristate "SoC Audio for the Spreadtrum SoC chips"
        depends on ARCH_SPRD || COMPILE_TEST
index 64a6900..f881da4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # STM SoC audio configuration
 #
index 4b188d2..787ccb5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # STI platform support
 snd-soc-sti-objs := sti_uniperif.o uniperif_player.o uniperif_reader.o
 
index c66ffa7..bbade25 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "STMicroelectronics STM32 SOC audio support"
 
 config SND_SOC_STM32_SAI
index 8134c3c..9cd7009 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Allwinner SoC Audio support"
        depends on ARCH_SUNXI || COMPILE_TEST
 
index 6875fc3..addadc8 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_TEGRA
        tristate "SoC Audio for the Tegra System-on-Chip"
        depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
index ee7c202..2197f3e 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menu "Audio support for Texas Instruments SoCs"
 depends on DMA_OMAP || TI_EDMA || COMPILE_TEST
 
index ebc9327..d928edf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ##
 ## TXx9 ACLC
 ##
index aa50118..34b2438 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Ux500 SoC audio configuration
 #
index 47f606b..6997317 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_XILINX_I2S
        tristate "Audio support for the Xilinx I2S"
        help
index d79fd38..be7652c 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-xlnx-i2s-objs      := xlnx_i2s.o
 obj-$(CONFIG_SND_SOC_XILINX_I2S) += snd-soc-xlnx-i2s.o
 snd-soc-xlnx-formatter-pcm-objs := xlnx_formatter_pcm.o
index c201beb..74b778f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SOC_XTFPGA_I2S
        tristate "XTFPGA I2S master"
        select REGMAP_MMIO
index 15efbf9..b8707f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-soc-xtfpga-i2s-objs := xtfpga-i2s.o
 
 obj-$(CONFIG_SND_SOC_XTFPGA_I2S) += snd-soc-xtfpga-i2s.o
index 75f67a5..a7842e4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config ZX_SPDIF
        tristate "ZTE ZX SPDIF Driver Support"
        depends on ARCH_ZX || COMPILE_TEST
index 1fc841a..2f7cdef 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_ZX_SPDIF) += zx-spdif.o
 obj-$(CONFIG_ZX_I2S)   += zx-i2s.o
 obj-$(CONFIG_ZX_TDM)   += zx-tdm.o
index dfcd386..59b9f16 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA Sparc drivers
 
 menuconfig SND_SPARC
index 56f1741..441222c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for AMD7930 sound chips found on Sparcs.
  * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net>
index 883678e..138841e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for CS4231 sound chips found on Sparcs.
  * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net>
index 2b8ef5f..0101131 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Driver for DBRI sound chip found on Sparcs.
  * Copyright (C) 2004, 2005 Martin Habets (mhabets@users.sourceforge.net)
index e6485be..44d39fa 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #SPI drivers
 
 menuconfig SND_SPI
index dfe8950..7023526 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_SYNTH_EMUX
        tristate
index dfce6ec..7d353bb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-usb-6fire-objs += chip.o comm.o midi.o control.o firmware.o pcm.o
 obj-$(CONFIG_SND_USB_6FIRE) += snd-usb-6fire.o
 
index 6319b54..e2c53a0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA USB drivers
 
 menuconfig SND_USB
index f09ccc0..9954607 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-bcd2000-y := bcd2000.o
 
 obj-$(CONFIG_SND_BCD2000) += snd-bcd2000.o
\ No newline at end of file
index 3889996..9a99c17 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-usb-caiaq-y := device.o audio.o midi.o control.o
 snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += input.o
 
index 463b136..8f3b24e 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-usb-hiface-objs := chip.o pcm.o
 obj-$(CONFIG_SND_USB_HIFACE) += snd-usb-hiface.o
index 39b4003..ab557e5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config SND_USB_LINE6
        tristate
        select SND_RAWMIDI
index ccefd81..068ecd7 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-ua101-objs := ua101.o
 obj-$(CONFIG_SND_USB_UA101) += snd-ua101.o
index 8adf4d1..21f8919 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 menuconfig SND_X86
        bool "X86 sound devices"
        depends on X86
index 7ff9198..6b5ffb3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 snd-hdmi-lpe-audio-objs += \
        intel_hdmi_audio.o
 
index e4d7beb..d812eff 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # ALSA Xen drivers
 
 config SND_XEN_FRONTEND
index 16511d9..09652ea 100644 (file)
@@ -152,7 +152,8 @@ struct kvm_s390_vm_cpu_subfunc {
        __u8 pcc[16];           /* with MSA4 */
        __u8 ppno[16];          /* with MSA5 */
        __u8 kma[16];           /* with MSA8 */
-       __u8 reserved[1808];
+       __u8 kdsa[16];          /* with MSA9 */
+       __u8 reserved[1792];
 };
 
 /* kvm attributes for crypto */
index dabfcf7..7a0e64c 100644 (file)
@@ -381,6 +381,7 @@ struct kvm_sync_regs {
 #define KVM_X86_QUIRK_LINT0_REENABLED  (1 << 0)
 #define KVM_X86_QUIRK_CD_NW_CLEARED    (1 << 1)
 #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE  (1 << 2)
+#define KVM_X86_QUIRK_OUT_7E_INC_RIP   (1 << 3)
 
 #define KVM_STATE_NESTED_GUEST_MODE    0x00000001
 #define KVM_STATE_NESTED_RUN_PENDING   0x00000002
index f3329ca..ac67bbe 100644 (file)
@@ -27,8 +27,29 @@ enum perf_event_x86_regs {
        PERF_REG_X86_R13,
        PERF_REG_X86_R14,
        PERF_REG_X86_R15,
-
+       /* These are the limits for the GPRs. */
        PERF_REG_X86_32_MAX = PERF_REG_X86_GS + 1,
        PERF_REG_X86_64_MAX = PERF_REG_X86_R15 + 1,
+
+       /* These all need two bits set because they are 128bit */
+       PERF_REG_X86_XMM0  = 32,
+       PERF_REG_X86_XMM1  = 34,
+       PERF_REG_X86_XMM2  = 36,
+       PERF_REG_X86_XMM3  = 38,
+       PERF_REG_X86_XMM4  = 40,
+       PERF_REG_X86_XMM5  = 42,
+       PERF_REG_X86_XMM6  = 44,
+       PERF_REG_X86_XMM7  = 46,
+       PERF_REG_X86_XMM8  = 48,
+       PERF_REG_X86_XMM9  = 50,
+       PERF_REG_X86_XMM10 = 52,
+       PERF_REG_X86_XMM11 = 54,
+       PERF_REG_X86_XMM12 = 56,
+       PERF_REG_X86_XMM13 = 58,
+       PERF_REG_X86_XMM14 = 60,
+       PERF_REG_X86_XMM15 = 62,
+
+       /* These include both GPRs and XMMX registers */
+       PERF_REG_X86_XMM_MAX = PERF_REG_X86_XMM15 + 2,
 };
 #endif /* _ASM_X86_PERF_REGS_H */
index 3b24dc0..9274866 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2002 Andi Kleen */
 
 #include <linux/linkage.h>
@@ -257,6 +258,7 @@ ENTRY(__memcpy_mcsafe)
        /* Copy successful. Return zero */
 .L_done_memcpy_trap:
        xorl %eax, %eax
+.L_done:
        ret
 ENDPROC(__memcpy_mcsafe)
 EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
@@ -273,7 +275,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
        addl    %edx, %ecx
 .E_trailing_bytes:
        mov     %ecx, %eax
-       ret
+       jmp     .L_done
 
        /*
         * For write fault handling, given the destination is unaligned,
index c34fea7..854d084 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef allow-override
   include ../scripts/Makefile.include
   include ../scripts/utilities.mak
index f7663a3..815ac98 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../../../scripts/Makefile.include
 include ../../../scripts/utilities.mak
 
index 4ad1f08..a7afea4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../../scripts/Makefile.include
 include ../../scripts/utilities.mak
 
index 3612073..3b24231 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 feature_dir := $(srctree)/tools/build/feature
 
 ifneq ($(OUTPUT),)
index d360f39..8dadaa0 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 fixdep:
diff --git a/tools/lib/traceevent/Documentation/Makefile b/tools/lib/traceevent/Documentation/Makefile
new file mode 100644 (file)
index 0000000..aa72ab9
--- /dev/null
@@ -0,0 +1,207 @@
+include ../../../scripts/Makefile.include
+include ../../../scripts/utilities.mak
+
+# This Makefile and manpage XSL files were taken from tools/perf/Documentation
+# and modified for libtraceevent.
+
+MAN3_TXT= \
+       $(wildcard libtraceevent-*.txt) \
+       libtraceevent.txt
+
+MAN_TXT = $(MAN3_TXT)
+_MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
+_MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
+_DOC_MAN3=$(patsubst %.txt,%.3,$(MAN3_TXT))
+
+MAN_XML=$(addprefix $(OUTPUT),$(_MAN_XML))
+MAN_HTML=$(addprefix $(OUTPUT),$(_MAN_HTML))
+DOC_MAN3=$(addprefix $(OUTPUT),$(_DOC_MAN3))
+
+# Make the path relative to DESTDIR, not prefix
+ifndef DESTDIR
+prefix?=$(HOME)
+endif
+bindir?=$(prefix)/bin
+htmldir?=$(prefix)/share/doc/libtraceevent-doc
+pdfdir?=$(prefix)/share/doc/libtraceevent-doc
+mandir?=$(prefix)/share/man
+man3dir=$(mandir)/man3
+
+ASCIIDOC=asciidoc
+ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf
+ASCIIDOC_HTML = xhtml11
+MANPAGE_XSL = manpage-normal.xsl
+XMLTO_EXTRA =
+INSTALL?=install
+RM ?= rm -f
+
+ifdef USE_ASCIIDOCTOR
+ASCIIDOC = asciidoctor
+ASCIIDOC_EXTRA = -a compat-mode
+ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
+ASCIIDOC_EXTRA += -a mansource="libtraceevent" -a manmanual="libtraceevent Manual"
+ASCIIDOC_HTML = xhtml5
+endif
+
+XMLTO=xmlto
+
+_tmp_tool_path := $(call get-executable,$(ASCIIDOC))
+ifeq ($(_tmp_tool_path),)
+       missing_tools = $(ASCIIDOC)
+endif
+
+ifndef USE_ASCIIDOCTOR
+_tmp_tool_path := $(call get-executable,$(XMLTO))
+ifeq ($(_tmp_tool_path),)
+       missing_tools += $(XMLTO)
+endif
+endif
+
+#
+# For asciidoc ...
+#      -7.1.2, no extra settings are needed.
+#      8.0-,   set ASCIIDOC8.
+#
+
+#
+# For docbook-xsl ...
+#      -1.68.1,        set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
+#      1.69.0,         no extra settings are needed?
+#      1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
+#      1.71.1,         no extra settings are needed?
+#      1.72.0,         set DOCBOOK_XSL_172.
+#      1.73.0-,        set ASCIIDOC_NO_ROFF
+#
+
+#
+# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
+# of 'the ".ft C" problem' in your generated manpages, and you
+# instead ended up with weird characters around callouts, try
+# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
+#
+
+ifdef ASCIIDOC8
+ASCIIDOC_EXTRA += -a asciidoc7compatible
+endif
+ifdef DOCBOOK_XSL_172
+ASCIIDOC_EXTRA += -a libtraceevent-asciidoc-no-roff
+MANPAGE_XSL = manpage-1.72.xsl
+else
+       ifdef ASCIIDOC_NO_ROFF
+       # docbook-xsl after 1.72 needs the regular XSL, but will not
+       # pass-thru raw roff codes from asciidoc.conf, so turn them off.
+       ASCIIDOC_EXTRA += -a libtraceevent-asciidoc-no-roff
+       endif
+endif
+ifdef MAN_BOLD_LITERAL
+XMLTO_EXTRA += -m manpage-bold-literal.xsl
+endif
+ifdef DOCBOOK_SUPPRESS_SP
+XMLTO_EXTRA += -m manpage-suppress-sp.xsl
+endif
+
+SHELL_PATH ?= $(SHELL)
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+DESTDIR ?=
+DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
+
+export DESTDIR DESTDIR_SQ
+
+#
+# Please note that there is a minor bug in asciidoc.
+# The version after 6.0.3 _will_ include the patch found here:
+#   http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2
+#
+# Until that version is released you may have to apply the patch
+# yourself - yes, all 6 characters of it!
+#
+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
+QUIET_SUBDIR1  =
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifneq ($(V),1)
+       QUIET_ASCIIDOC  = @echo '  ASCIIDOC '$@;
+       QUIET_XMLTO     = @echo '  XMLTO    '$@;
+       QUIET_SUBDIR0   = +@subdir=
+       QUIET_SUBDIR1   = ;$(NO_SUBDIR) \
+                          echo '  SUBDIR   ' $$subdir; \
+                         $(MAKE) $(PRINT_DIR) -C $$subdir
+       export V
+endif
+endif
+
+all: html man
+
+man: man3
+man3: $(DOC_MAN3)
+
+html: $(MAN_HTML)
+
+$(MAN_HTML) $(DOC_MAN3): asciidoc.conf
+
+install: install-man
+
+check-man-tools:
+ifdef missing_tools
+       $(error "You need to install $(missing_tools) for man pages")
+endif
+
+do-install-man: man
+       $(call QUIET_INSTALL, Documentation-man) \
+               $(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \
+               $(INSTALL) -m 644 $(DOC_MAN3) $(DESTDIR)$(man3dir);
+
+install-man: check-man-tools man do-install-man
+
+uninstall: uninstall-man
+
+uninstall-man:
+       $(call QUIET_UNINST, Documentation-man) \
+               $(Q)$(RM) $(addprefix $(DESTDIR)$(man3dir)/,$(DOC_MAN3))
+
+
+ifdef missing_tools
+  DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed)
+else
+  DO_INSTALL_MAN = do-install-man
+endif
+
+CLEAN_FILES =                                  \
+       $(MAN_XML) $(addsuffix +,$(MAN_XML))    \
+       $(MAN_HTML) $(addsuffix +,$(MAN_HTML))  \
+       $(DOC_MAN3) *.3
+
+clean:
+       $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES)
+
+ifdef USE_ASCIIDOCTOR
+$(OUTPUT)%.3 : $(OUTPUT)%.txt
+       $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+       $(ASCIIDOC) -b manpage -d manpage \
+               $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \
+       mv $@+ $@
+endif
+
+$(OUTPUT)%.3 : $(OUTPUT)%.xml
+       $(QUIET_XMLTO)$(RM) $@ && \
+       $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+
+$(OUTPUT)%.xml : %.txt
+       $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+       $(ASCIIDOC) -b docbook -d manpage \
+               $(ASCIIDOC_EXTRA) -alibtraceevent_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \
+       mv $@+ $@
+
+$(MAN_HTML): $(OUTPUT)%.html : %.txt
+       $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+       $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \
+               $(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \
+       mv $@+ $@
diff --git a/tools/lib/traceevent/Documentation/asciidoc.conf b/tools/lib/traceevent/Documentation/asciidoc.conf
new file mode 100644 (file)
index 0000000..0759571
--- /dev/null
@@ -0,0 +1,120 @@
+## linktep: macro
+#
+# Usage: linktep:command[manpage-section]
+#
+# Note, {0} is the manpage section, while {target} is the command.
+#
+# Show TEP link as: <command>(<section>); if section is defined, else just show
+# the command.
+
+[macros]
+(?su)[\\]?(?P<name>linktep):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
+
+[attributes]
+asterisk=&#42;
+plus=&#43;
+caret=&#94;
+startsb=&#91;
+endsb=&#93;
+tilde=&#126;
+
+ifdef::backend-docbook[]
+[linktep-inlinemacro]
+{0%{target}}
+{0#<citerefentry>}
+{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
+{0#</citerefentry>}
+endif::backend-docbook[]
+
+ifdef::backend-docbook[]
+ifndef::tep-asciidoc-no-roff[]
+# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this.
+# v1.72 breaks with this because it replaces dots not in roff requests.
+[listingblock]
+<example><title>{title}</title>
+<literallayout>
+ifdef::doctype-manpage[]
+&#10;.ft C&#10;
+endif::doctype-manpage[]
+|
+ifdef::doctype-manpage[]
+&#10;.ft&#10;
+endif::doctype-manpage[]
+</literallayout>
+{title#}</example>
+endif::tep-asciidoc-no-roff[]
+
+ifdef::tep-asciidoc-no-roff[]
+ifdef::doctype-manpage[]
+# The following two small workarounds insert a simple paragraph after screen
+[listingblock]
+<example><title>{title}</title>
+<literallayout>
+|
+</literallayout><simpara></simpara>
+{title#}</example>
+
+[verseblock]
+<formalpara{id? id="{id}"}><title>{title}</title><para>
+{title%}<literallayout{id? id="{id}"}>
+{title#}<literallayout>
+|
+</literallayout>
+{title#}</para></formalpara>
+{title%}<simpara></simpara>
+endif::doctype-manpage[]
+endif::tep-asciidoc-no-roff[]
+endif::backend-docbook[]
+
+ifdef::doctype-manpage[]
+ifdef::backend-docbook[]
+[header]
+template::[header-declarations]
+<refentry>
+<refmeta>
+<refentrytitle>{mantitle}</refentrytitle>
+<manvolnum>{manvolnum}</manvolnum>
+<refmiscinfo class="source">libtraceevent</refmiscinfo>
+<refmiscinfo class="version">{libtraceevent_version}</refmiscinfo>
+<refmiscinfo class="manual">libtraceevent Manual</refmiscinfo>
+</refmeta>
+<refnamediv>
+  <refname>{manname1}</refname>
+  <refname>{manname2}</refname>
+  <refname>{manname3}</refname>
+  <refname>{manname4}</refname>
+  <refname>{manname5}</refname>
+  <refname>{manname6}</refname>
+  <refname>{manname7}</refname>
+  <refname>{manname8}</refname>
+  <refname>{manname9}</refname>
+  <refname>{manname10}</refname>
+  <refname>{manname11}</refname>
+  <refname>{manname12}</refname>
+  <refname>{manname13}</refname>
+  <refname>{manname14}</refname>
+  <refname>{manname15}</refname>
+  <refname>{manname16}</refname>
+  <refname>{manname17}</refname>
+  <refname>{manname18}</refname>
+  <refname>{manname19}</refname>
+  <refname>{manname20}</refname>
+  <refname>{manname21}</refname>
+  <refname>{manname22}</refname>
+  <refname>{manname23}</refname>
+  <refname>{manname24}</refname>
+  <refname>{manname25}</refname>
+  <refname>{manname26}</refname>
+  <refname>{manname27}</refname>
+  <refname>{manname28}</refname>
+  <refname>{manname29}</refname>
+  <refname>{manname30}</refname>
+  <refpurpose>{manpurpose}</refpurpose>
+</refnamediv>
+endif::backend-docbook[]
+endif::doctype-manpage[]
+
+ifdef::backend-xhtml11[]
+[linktep-inlinemacro]
+<a href="{target}.html">{target}{0?({0})}</a>
+endif::backend-xhtml11[]
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-commands.txt b/tools/lib/traceevent/Documentation/libtraceevent-commands.txt
new file mode 100644 (file)
index 0000000..bec5520
--- /dev/null
@@ -0,0 +1,153 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_register_comm, tep_override_comm, tep_pid_is_registered,
+tep_data_comm_from_pid, tep_data_pid_from_comm, tep_cmdline_pid -
+Manage pid to process name mappings.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_register_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_);
+int *tep_override_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_);
+bool *tep_is_pid_registered*(struct tep_handle pass:[*]_tep_, int _pid_);
+const char pass:[*]*tep_data_comm_from_pid*(struct tep_handle pass:[*]_pevent_, int _pid_);
+struct cmdline pass:[*]*tep_data_pid_from_comm*(struct tep_handle pass:[*]_pevent_, const char pass:[*]_comm_, struct cmdline pass:[*]_next_);
+int *tep_cmdline_pid*(struct tep_handle pass:[*]_pevent_, struct cmdline pass:[*]_cmdline_);
+--
+
+DESCRIPTION
+-----------
+These functions can be used to handle the mapping between pid and process name.
+The library builds a cache of these mappings, which is used to display the name
+of the process, instead of its pid. This information can be retrieved from
+tracefs/saved_cmdlines file.
+
+The _tep_register_comm()_ function registers a _pid_ / process name mapping.
+If a command with the same _pid_ is already registered, an error is returned.
+The _pid_ argument is the process ID, the _comm_ argument is the process name,
+_tep_ is the event context. The _comm_ is duplicated internally.
+
+The _tep_override_comm()_ function registers a _pid_ / process name mapping.
+If a process with the same pid is already registered, the process name string is
+udapted with the new one. The _pid_ argument is the process ID, the _comm_
+argument is the process name, _tep_ is the event context. The _comm_ is
+duplicated internally.
+
+The _tep_is_pid_registered()_ function checks if a pid has a process name
+mapping registered. The _pid_ argument is the process ID, _tep_ is the event
+context.
+
+The _tep_data_comm_from_pid()_ function returns the process name for a given
+pid. The _pid_ argument is the process ID, _tep_ is the event context.
+The returned string should not be freed, but will be freed when the _tep_
+handler is closed.
+
+The _tep_data_pid_from_comm()_ function returns a pid for a given process name.
+The _comm_ argument is the process name, _tep_ is the event context.
+The argument _next_ is the cmdline structure to search for the next pid.
+As there may be more than one pid for a given process, the result of this call
+can be passed back into a recurring call in the _next_ parameter, to search for
+the next pid. If _next_ is NULL, it will return the first pid associated with
+the _comm_. The function performs a linear search, so it may be slow.
+
+The _tep_cmdline_pid()_ function returns the pid associated with a given
+_cmdline_. The _tep_ argument is the event context.
+
+RETURN VALUE
+------------
+_tep_register_comm()_ function returns 0 on success. In case of an error -1 is
+returned and errno is set to indicate the cause of the problem: ENOMEM, if there
+is not enough memory to duplicate the _comm_ or EEXIST if a mapping for this
+_pid_ is already registered.
+
+_tep_override_comm()_ function returns 0 on success. In case of an error -1 is
+returned and errno is set to indicate the cause of the problem: ENOMEM, if there
+is not enough memory to duplicate the _comm_.
+
+_tep_is_pid_registered()_ function returns true if the _pid_ has a process name
+mapped to it, false otherwise.
+
+_tep_data_comm_from_pid()_ function returns the process name as string, or the
+string "<...>" if there is no mapping for the given pid.
+
+_tep_data_pid_from_comm()_ function returns a pointer to a struct cmdline, that
+holds a pid for a given process, or NULL if none is found. This result can be
+passed back into a recurring call as the _next_ parameter of the function.
+
+_tep_cmdline_pid()_ functions returns the pid for the give cmdline. If _cmdline_
+ is NULL, then -1 is returned.
+
+EXAMPLE
+-------
+The following example registers pid for command "ls", in context of event _tep_
+and performs various searches for pid / process name mappings:
+[source,c]
+--
+#include <event-parse.h>
+...
+int ret;
+int ls_pid = 1021;
+struct tep_handle *tep = tep_alloc();
+...
+       ret = tep_register_comm(tep, "ls", ls_pid);
+       if (ret != 0 && errno == EEXIST)
+               ret = tep_override_comm(tep, "ls", ls_pid);
+       if (ret != 0) {
+               /* Failed to register pid / command mapping */
+       }
+...
+       if (tep_is_pid_registered(tep, ls_pid) == 0) {
+               /* Command mapping for ls_pid is not registered */
+       }
+...
+       const char *comm = tep_data_comm_from_pid(tep, ls_pid);
+       if (comm) {
+               /* Found process name for ls_pid */
+       }
+...
+       int pid;
+       struct cmdline *cmd = tep_data_pid_from_comm(tep, "ls", NULL);
+       while (cmd) {
+               pid = tep_cmdline_pid(tep, cmd);
+               /* Found pid for process "ls" */
+               cmd = tep_data_pid_from_comm(tep, "ls", cmd);
+       }
+--
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-cpus.txt b/tools/lib/traceevent/Documentation/libtraceevent-cpus.txt
new file mode 100644 (file)
index 0000000..5ad70e4
--- /dev/null
@@ -0,0 +1,77 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_cpus, tep_set_cpus - Get / set the number of CPUs, which have a tracing
+buffer representing it. Note, the buffer may be empty.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_get_cpus*(struct tep_handle pass:[*]_tep_);
+void *tep_set_cpus*(struct tep_handle pass:[*]_tep_, int _cpus_);
+--
+
+DESCRIPTION
+-----------
+The _tep_get_cpus()_ function gets the number of CPUs, which have a tracing
+buffer representing it. The _tep_ argument is trace event parser context.
+
+The _tep_set_cpus()_ function sets the number of CPUs, which have a tracing
+buffer representing it. The _tep_ argument is trace event parser context.
+The _cpu_ argument is the number of CPUs with tracing data.
+
+RETURN VALUE
+------------
+The _tep_get_cpus()_ functions returns the number of CPUs, which have tracing
+data recorded.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+       tep_set_cpus(tep, 5);
+...
+       printf("We have tracing data for %d CPUs", tep_get_cpus(tep));
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt b/tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt
new file mode 100644 (file)
index 0000000..e64851b
--- /dev/null
@@ -0,0 +1,78 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_read_number - Reads a number from raw data.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_);
+--
+
+DESCRIPTION
+-----------
+The _tep_read_number()_ function reads an integer from raw data, taking into
+account the endianness of the raw data and the current host. The _tep_ argument
+is the trace event parser context. The _ptr_ is a pointer to the raw data, where
+the integer is, and the _size_ is the size of the integer.
+
+RETURN VALUE
+------------
+The _tep_read_number()_ function returns the integer in the byte order of
+the current host. In case of an error, 0 is returned.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+void process_record(struct tep_record *record)
+{
+       int offset = 24;
+       int data = tep_read_number(tep, record->data + offset, 4);
+
+       /* Read the 4 bytes at the offset 24 of data as an integer */
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-event_find.txt b/tools/lib/traceevent/Documentation/libtraceevent-event_find.txt
new file mode 100644 (file)
index 0000000..7bc062c
--- /dev/null
@@ -0,0 +1,103 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_find_event,tep_find_event_by_name,tep_find_event_by_record -
+Find events by given key.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_event pass:[*]*tep_find_event*(struct tep_handle pass:[*]_tep_, int _id_);
+struct tep_event pass:[*]*tep_find_event_by_name*(struct tep_handle pass:[*]_tep_, const char pass:[*]_sys_, const char pass:[*]_name_);
+struct tep_event pass:[*]*tep_find_event_by_record*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_record_);
+--
+
+DESCRIPTION
+-----------
+This set of functions can be used to search for an event, based on a given
+criteria. All functions require a pointer to a _tep_, trace event parser
+context.
+
+The _tep_find_event()_ function searches for an event by given event _id_. The
+event ID is assigned dynamically and can be viewed in event's format file,
+"ID" field.
+
+The tep_find_event_by_name()_ function searches for an event by given
+event _name_, under the system _sys_. If the _sys_ is NULL (not specified),
+the first event with _name_ is returned.
+
+The tep_find_event_by_record()_ function searches for an event from a given
+_record_.
+
+RETURN VALUE
+------------
+All these functions return a pointer to the found event, or NULL if there is no
+such event.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+struct tep_event *event;
+
+event = tep_find_event(tep, 1857);
+if (event == NULL) {
+       /* There is no event with ID 1857 */
+}
+
+event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
+if (event == NULL) {
+       /* There is no kvm_exit event, from kvm system */
+}
+
+void event_from_record(struct tep_record *record)
+{
+ struct tep_event *event = tep_find_event_by_record(tep, record);
+       if (event == NULL) {
+               /* There is no event from given record */
+       }
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-event_get.txt b/tools/lib/traceevent/Documentation/libtraceevent-event_get.txt
new file mode 100644 (file)
index 0000000..6525092
--- /dev/null
@@ -0,0 +1,99 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_event, tep_get_first_event, tep_get_events_count - Access events.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_);
+struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_);
+int *tep_get_events_count*(struct tep_handle pass:[*]_tep_);
+--
+
+DESCRIPTION
+-----------
+The _tep_get_event()_ function returns a pointer to event at the given _index_.
+The _tep_ argument is trace event parser context, the _index_ is the index of
+the requested event.
+
+The _tep_get_first_event()_ function returns a pointer to the first event.
+As events are stored in an array, this function returns the pointer to the
+beginning of the array. The _tep_ argument is trace event parser context.
+
+The _tep_get_events_count()_ function returns the number of the events
+in the array. The _tep_ argument is trace event parser context.
+
+RETURN VALUE
+------------
+The _tep_get_event()_ returns a pointer to the event located at _index_.
+NULL is returned in case of error, in case there are no events or _index_ is
+out of range.
+
+The _tep_get_first_event()_ returns a pointer to the first event. NULL is
+returned in case of error, or in case there are no events.
+
+The _tep_get_events_count()_ returns the number of the events. 0 is
+returned in case of error, or in case there are no events.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+int i,count = tep_get_events_count(tep);
+struct tep_event *event, *events = tep_get_first_event(tep);
+
+if (events == NULL) {
+       /* There are no events */
+} else {
+       for (i = 0; i < count; i++) {
+               event = (events+i);
+               /* process events[i] */
+       }
+
+       /* Get the last event */
+       event = tep_get_event(tep, count-1);
+}
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-event_list.txt b/tools/lib/traceevent/Documentation/libtraceevent-event_list.txt
new file mode 100644 (file)
index 0000000..fba350e
--- /dev/null
@@ -0,0 +1,122 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_list_events, tep_list_events_copy -
+Get list of events, sorted by given criteria.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_event_sort_type* {
+       _TEP_EVENT_SORT_ID_,
+       _TEP_EVENT_SORT_NAME_,
+       _TEP_EVENT_SORT_SYSTEM_,
+};
+
+struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
+struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
+--
+
+DESCRIPTION
+-----------
+The _tep_list_events()_ function returns an array of pointers to the events,
+sorted by the _sort_type_ criteria. The last element of the array is NULL.
+The returned memory must not be freed, it is managed by the library.
+The function is not thread safe. The _tep_ argument is trace event parser
+context. The _sort_type_ argument is the required sort criteria:
+[verse]
+--
+       _TEP_EVENT_SORT_ID_     - sort by the event ID.
+       _TEP_EVENT_SORT_NAME_   - sort by the event (name, system, id) triplet.
+       _TEP_EVENT_SORT_SYSTEM_ - sort by the event (system, name, id) triplet.
+--
+
+The _tep_list_events_copy()_ is a thread safe version of _tep_list_events()_.
+It has the same behavior, but the returned array is allocated internally and
+must be freed by the caller. Note that the content of the array must not be
+freed (see the EXAMPLE below).
+
+RETURN VALUE
+------------
+The _tep_list_events()_ function returns an array of pointers to events.
+In case of an error, NULL is returned. The returned array must not be freed,
+it is managed by the library.
+
+The _tep_list_events_copy()_ function returns an array of pointers to events.
+In case of an error, NULL is returned. The returned array must be freed by
+the caller.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+int i;
+struct tep_event_format **events;
+
+i=0;
+events = tep_list_events(tep, TEP_EVENT_SORT_ID);
+if (events == NULL) {
+       /* Failed to get the events, sorted by ID */
+} else {
+       while(events[i]) {
+               /* walk through the list of the events, sorted by ID */
+               i++;
+       }
+}
+
+i=0;
+events = tep_list_events_copy(tep, TEP_EVENT_SORT_NAME);
+if (events == NULL) {
+       /* Failed to get the events, sorted by name */
+} else {
+       while(events[i]) {
+               /* walk through the list of the events, sorted by name */
+               i++;
+       }
+       free(events);
+}
+
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-field_find.txt b/tools/lib/traceevent/Documentation/libtraceevent-field_find.txt
new file mode 100644 (file)
index 0000000..0896af5
--- /dev/null
@@ -0,0 +1,118 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_find_common_field, tep_find_field, tep_find_any_field -
+Search for a field in an event.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_);
+struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_);
+struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_);
+--
+
+DESCRIPTION
+-----------
+These functions search for a field with given name in an event. The field
+returned can be used to find the field content from within a data record.
+
+The _tep_find_common_field()_ function searches for a common field with _name_
+in the _event_.
+
+The _tep_find_field()_ function searches for an event specific field with
+_name_ in the _event_.
+
+The _tep_find_any_field()_ function searches for any field with _name_ in the
+_event_.
+
+RETURN VALUE
+------------
+The _tep_find_common_field(), _tep_find_field()_ and _tep_find_any_field()_
+functions return a pointer to the found field, or NULL in case there is no field
+with the requested name.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+void get_htimer_info(struct tep_handle *tep, struct tep_record *record)
+{
+       struct tep_format_field *field;
+       struct tep_event *event;
+       long long softexpires;
+       int mode;
+       int pid;
+
+       event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
+
+       field = tep_find_common_field(event, "common_pid");
+       if (field == NULL) {
+               /* Cannot find "common_pid" field in the event */
+       } else {
+               /* Get pid from the data record */
+               pid = tep_read_number(tep, record->data + field->offset,
+                                     field->size);
+       }
+
+       field = tep_find_field(event, "softexpires");
+       if (field == NULL) {
+               /* Cannot find "softexpires" event specific field in the event */
+       } else {
+               /* Get softexpires parameter from the data record */
+               softexpires = tep_read_number(tep, record->data + field->offset,
+                                             field->size);
+       }
+
+       field = tep_find_any_field(event, "mode");
+       if (field == NULL) {
+               /* Cannot find "mode" field in the event */
+       } else
+       {
+               /* Get mode parameter from the data record */
+               mode = tep_read_number(tep, record->data + field->offset,
+                                      field->size);
+       }
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-field_get_val.txt b/tools/lib/traceevent/Documentation/libtraceevent-field_get_val.txt
new file mode 100644 (file)
index 0000000..6324f0d
--- /dev/null
@@ -0,0 +1,122 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_any_field_val, tep_get_common_field_val, tep_get_field_val,
+tep_get_field_raw - Get value of a field.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+*#include <trace-seq.h>*
+
+int *tep_get_any_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+int *tep_get_common_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+int *tep_get_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+void pass:[*]*tep_get_field_raw*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int pass:[*]_len_, int _err_);
+--
+
+DESCRIPTION
+-----------
+These functions can be used to find a field and retrieve its value.
+
+The _tep_get_any_field_val()_ function searches in the _record_ for a field
+with _name_, part of the _event_. If the field is found, its value is stored in
+_val_. If there is an error and _err_ is not zero, then an error string is
+written into _s_.
+
+The _tep_get_common_field_val()_ function does the same as
+_tep_get_any_field_val()_, but searches only in the common fields. This works
+for any event as all events include the common fields.
+
+The _tep_get_field_val()_ function does the same as _tep_get_any_field_val()_,
+but searches only in the event specific fields.
+
+The _tep_get_field_raw()_ function searches in the _record_ for a field with
+_name_, part of the _event_. If the field is found, a pointer to where the field
+exists in the record's raw data is returned. The size of the data is stored in
+_len_. If there is an error and _err_ is not zero, then an error string is
+written into _s_.
+
+RETURN VALUE
+------------
+The _tep_get_any_field_val()_, _tep_get_common_field_val()_ and
+_tep_get_field_val()_ functions return 0 on success, or -1 in case of an error.
+
+The _tep_get_field_raw()_ function returns a pointer to field's raw data, and
+places the length of this data in _len_. In case of an error NULL is returned.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+#include <trace-seq.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+struct tep_event *event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
+...
+void process_record(struct tep_record *record)
+{
+       int len;
+       char *comm;
+       struct tep_event_format *event;
+       unsigned long long val;
+
+       event = tep_find_event_by_record(pevent, record);
+       if (event != NULL) {
+               if (tep_get_common_field_val(NULL, event, "common_type",
+                                            record, &val, 0) == 0) {
+                       /* Got the value of common type field */
+               }
+               if (tep_get_field_val(NULL, event, "pid", record, &val, 0) == 0) {
+                       /* Got the value of pid specific field */
+               }
+               comm = tep_get_field_raw(NULL, event, "comm", record, &len, 0);
+               if (comm != NULL) {
+                       /* Got a pointer to the comm event specific field */
+               }
+       }
+}
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences
+       related APIs. Trace sequences are used to allow a function to call
+       several other functions to create a string of data to use.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-field_print.txt b/tools/lib/traceevent/Documentation/libtraceevent-field_print.txt
new file mode 100644 (file)
index 0000000..9a9df98
--- /dev/null
@@ -0,0 +1,126 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_print_field, tep_print_fields, tep_print_num_field, tep_print_func_field -
+Print the field content.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+*#include <trace-seq.h>*
+
+void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_);
+void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_);
+int *tep_print_num_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
+int *tep_print_func_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
+--
+
+DESCRIPTION
+-----------
+These functions print recorded field's data, according to the field's type.
+
+The _tep_print_field()_ function extracts from the recorded raw _data_ value of
+the _field_ and prints it into _s_, according to the field type.
+
+The _tep_print_fields()_ prints each field name followed by the record's field
+value according to the field's type:
+[verse]
+--
+"field1_name=field1_value field2_name=field2_value ..."
+--
+It iterates all fields of the _event_, and calls _tep_print_field()_ for each of
+them.
+
+The _tep_print_num_field()_ function prints a numeric field with given format
+string. A search is performed in the _event_ for a field with _name_. If such
+field is found, its value is extracted from the _record_ and is printed in the
+_s_, according to the given format string _fmt_. If the argument _err_ is
+non-zero, and an error occures - it is printed in the _s_.
+
+The _tep_print_func_field()_ function prints a function field with given format
+string.  A search is performed in the _event_ for a field with _name_. If such
+field is found, its value is extracted from the _record_. The value is assumed
+to be a function address, and a search is perform to find the name of this
+function. The function name (if found) and its address are printed in the _s_,
+according to the given format string _fmt_. If the argument _err_ is non-zero,
+and an error occures - it is printed in _s_.
+
+RETURN VALUE
+------------
+The _tep_print_num_field()_ and _tep_print_func_field()_ functions return 1
+on success, -1 in case of an error or 0 if the print buffer _s_ is full.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+#include <trace-seq.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+struct trace_seq seq;
+trace_seq_init(&seq);
+struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
+...
+void process_record(struct tep_record *record)
+{
+       struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
+
+       trace_seq_reset(&seq);
+
+       /* Print the value of "common_pid" */
+       tep_print_field(&seq, record->data, field_pid);
+
+       /* Print all fields of the "hrtimer_start" event */
+       tep_print_fields(&seq, record->data, record->size, event);
+
+       /* Print the value of "expires" field with custom format string */
+       tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0);
+
+       /* Print the address and the name of "function" field with custom format string */
+       tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0);
+ }
+ ...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences related APIs.
+       Trace sequences are used to allow a function to call several other functions
+       to create a string of data to use.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-field_read.txt b/tools/lib/traceevent/Documentation/libtraceevent-field_read.txt
new file mode 100644 (file)
index 0000000..64e9e25
--- /dev/null
@@ -0,0 +1,81 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_read_number_field - Reads a number from raw data.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_);
+--
+
+DESCRIPTION
+-----------
+The _tep_read_number_field()_ function reads the value of the _field_ from the
+raw _data_ and stores it in the _value_. The function sets the _value_ according
+to the endianness of the raw data and the current machine and stores it in
+_value_.
+
+RETURN VALUE
+------------
+The _tep_read_number_field()_ function retunrs 0 in case of success, or -1 in
+case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
+...
+void process_record(struct tep_record *record)
+{
+       unsigned long long pid;
+       struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
+
+       if (tep_read_number_field(field_pid, record->data, &pid) != 0) {
+               /* Failed to get "common_pid" value */
+       }
+}
+...
+--
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-fields.txt b/tools/lib/traceevent/Documentation/libtraceevent-fields.txt
new file mode 100644 (file)
index 0000000..1ccb531
--- /dev/null
@@ -0,0 +1,105 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_event_common_fields, tep_event_fields - Get a list of fields for an event.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_);
+struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_);
+--
+
+DESCRIPTION
+-----------
+The _tep_event_common_fields()_ function returns an array of pointers to common
+fields for the _event_. The array is allocated in the function and must be freed
+by free(). The last element of the array is NULL.
+
+The _tep_event_fields()_ function returns an array of pointers to event specific
+fields for the _event_. The array is allocated in the function and must be freed
+by free(). The last element of the array is NULL.
+
+RETURN VALUE
+------------
+Both _tep_event_common_fields()_ and _tep_event_fields()_ functions return
+an array of pointers to tep_format_field structures in case of success, or
+NULL in case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+int i;
+struct tep_format_field **fields;
+struct tep_event *event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
+if (event != NULL) {
+       fields = tep_event_common_fields(event);
+       if (fields != NULL) {
+               i = 0;
+               while (fields[i]) {
+                       /*
+                         walk through the list of the common fields
+                         of the kvm_exit event
+                       */
+                       i++;
+               }
+               free(fields);
+       }
+       fields = tep_event_fields(event);
+       if (fields != NULL) {
+               i = 0;
+               while (fields[i]) {
+                       /*
+                         walk through the list of the event specific
+                         fields of the kvm_exit event
+                       */
+                       i++;
+               }
+               free(fields);
+       }
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-file_endian.txt b/tools/lib/traceevent/Documentation/libtraceevent-file_endian.txt
new file mode 100644 (file)
index 0000000..f401ad3
--- /dev/null
@@ -0,0 +1,91 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_is_file_bigendian, tep_set_file_bigendian - Get / set the endianness of the
+raw data being accessed by the tep handler.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_endian* {
+       TEP_LITTLE_ENDIAN = 0,
+       TEP_BIG_ENDIAN
+};
+
+bool *tep_is_file_bigendian*(struct tep_handle pass:[*]_tep_);
+void *tep_set_file_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
+
+--
+DESCRIPTION
+-----------
+The _tep_is_file_bigendian()_ function gets the endianness of the raw data,
+being accessed by the tep handler. The _tep_ argument is trace event parser
+context.
+
+The _tep_set_file_bigendian()_ function sets the endianness of raw data being
+accessed by the tep handler. The _tep_ argument is trace event parser context.
+[verse]
+--
+The _endian_ argument is the endianness:
+       _TEP_LITTLE_ENDIAN_ - the raw data is in little endian format,
+       _TEP_BIG_ENDIAN_ - the raw data is in big endian format.
+--
+RETURN VALUE
+------------
+The _tep_is_file_bigendian()_ function returns true if the data is in bigendian
+format, false otherwise.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+       tep_set_file_bigendian(tep, TEP_LITTLE_ENDIAN);
+...
+       if (tep_is_file_bigendian(tep)) {
+               /* The raw data is in big endian */
+       } else {
+               /* The raw data is in little endian */
+       }
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-filter.txt b/tools/lib/traceevent/Documentation/libtraceevent-filter.txt
new file mode 100644 (file)
index 0000000..4a9962d
--- /dev/null
@@ -0,0 +1,209 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_filter_alloc, tep_filter_free, tep_filter_reset, tep_filter_make_string,
+tep_filter_copy, tep_filter_compare, tep_filter_match, tep_event_filtered,
+tep_filter_remove_event, tep_filter_strerror, tep_filter_add_filter_str -
+Event filter related APIs.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_event_filter pass:[*]*tep_filter_alloc*(struct tep_handle pass:[*]_tep_);
+void *tep_filter_free*(struct tep_event_filter pass:[*]_filter_);
+void *tep_filter_reset*(struct tep_event_filter pass:[*]_filter_);
+enum tep_errno *tep_filter_add_filter_str*(struct tep_event_filter pass:[*]_filter_, const char pass:[*]_filter_str_);
+int *tep_event_filtered*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+int *tep_filter_remove_event*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+enum tep_errno *tep_filter_match*(struct tep_event_filter pass:[*]_filter_, struct tep_record pass:[*]_record_);
+int *tep_filter_copy*(struct tep_event_filter pass:[*]_dest_, struct tep_event_filter pass:[*]_source_);
+int *tep_filter_compare*(struct tep_event_filter pass:[*]_filter1_, struct tep_event_filter pass:[*]_filter2_);
+char pass:[*]*tep_filter_make_string*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+int *tep_filter_strerror*(struct tep_event_filter pass:[*]_filter_, enum tep_errno _err_, char pass:[*]buf, size_t _buflen_);
+--
+
+DESCRIPTION
+-----------
+Filters can be attached to traced events. They can be used to filter out various
+events when outputting them. Each event can be filtered based on its parameters,
+described in the event's format file. This set of functions can be used to
+create, delete, modify and attach event filters.
+
+The _tep_filter_alloc()_ function creates a new event filter. The _tep_ argument
+is the trace event parser context.
+
+The _tep_filter_free()_ function frees an event filter and all resources that it
+had used.
+
+The _tep_filter_reset()_ function removes all rules from an event filter and
+resets it.
+
+The _tep_filter_add_filter_str()_ function adds a new rule to the _filter_. The
+_filter_str_ argument is the filter string, that contains the rule.
+
+The _tep_event_filtered()_ function checks if the event with _event_id_ has
+_filter_.
+
+The _tep_filter_remove_event()_ function removes a _filter_ for an event with
+_event_id_.
+
+The _tep_filter_match()_ function tests if a _record_ matches given _filter_.
+
+The _tep_filter_copy()_ function copies a _source_ filter into a _dest_ filter.
+
+The _tep_filter_compare()_ function compares two filers - _filter1_ and _filter2_.
+
+The _tep_filter_make_string()_ function constructs a string, displaying
+the _filter_ contents for given _event_id_.
+
+The _tep_filter_strerror()_ function copies the _filter_ error buffer into the
+given _buf_ with the size _buflen_. If the error buffer is empty, in the _buf_
+is copied a string, describing the error _err_.
+
+RETURN VALUE
+------------
+The _tep_filter_alloc()_ function returns a pointer to the newly created event
+filter, or NULL in case of an error.
+
+The _tep_filter_add_filter_str()_ function returns 0 if the rule was
+successfully added or a negative error code.  Use _tep_filter_strerror()_ to see
+actual error message in case of an error.
+
+The _tep_event_filtered()_ function returns 1 if the filter is found for given
+event, or 0 otherwise.
+
+The _tep_filter_remove_event()_ function returns 1 if the vent was removed, or
+0 if the event was not found.
+
+The _tep_filter_match()_ function returns _tep_errno_, according to the result:
+[verse]
+--
+_pass:[TEP_ERRNO__FILTER_MATCH]_       - filter found for event, the record matches.
+_pass:[TEP_ERRNO__FILTER_MISS]_                - filter found for event, the record does not match.
+_pass:[TEP_ERRNO__FILTER_NOT_FOUND]_   - no filter found for record's event.
+_pass:[TEP_ERRNO__NO_FILTER]_          - no rules in the filter.
+--
+or any other _tep_errno_, if an error occurred during the test.
+
+The _tep_filter_copy()_ function returns 0 on success or -1 if not all rules
+ were copied.
+
+The _tep_filter_compare()_ function returns 1 if the two filters hold the same
+content, or 0 if they do not.
+
+The _tep_filter_make_string()_ function returns a string, which must be freed
+with free(), or NULL in case of an error.
+
+The _tep_filter_strerror()_ function returns 0 if message was filled
+successfully, or -1 in case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+char errstr[200];
+int ret;
+
+struct tep_event_filter *filter = tep_filter_alloc(tep);
+struct tep_event_filter *filter1 = tep_filter_alloc(tep);
+ret = tep_filter_add_filter_str(filter, "sched/sched_wakeup:target_cpu==1");
+if(ret < 0) {
+       tep_filter_strerror(filter, ret, errstr, sizeof(errstr));
+       /* Failed to add a new rule to the filter, the error string is in errstr */
+}
+if (tep_filter_copy(filter1, filter) != 0) {
+       /* Failed to copy filter in filter1 */
+}
+...
+if (tep_filter_compare(filter, filter1) != 1) {
+       /* Both filters are different */
+}
+...
+void process_record(struct tep_handle *tep, struct tep_record *record)
+{
+       struct tep_event *event;
+       char *fstring;
+
+       event = tep_find_event_by_record(tep, record);
+
+       if (tep_event_filtered(filter, event->id) == 1) {
+               /* The event has filter */
+               fstring = tep_filter_make_string(filter, event->id);
+               if (fstring != NULL) {
+                       /* The filter for the event is in fstring */
+                       free(fstring);
+               }
+       }
+
+       switch (tep_filter_match(filter, record)) {
+       case TEP_ERRNO__FILTER_MATCH:
+               /* The filter matches the record */
+               break;
+       case TEP_ERRNO__FILTER_MISS:
+               /* The filter does not match the record */
+               break;
+       case TEP_ERRNO__FILTER_NOT_FOUND:
+               /* No filter found for record's event */
+               break;
+       case TEP_ERRNO__NO_FILTER:
+               /* There are no rules in the filter */
+               break
+       default:
+               /* An error occurred during the test */
+               break;
+       }
+
+       if (tep_filter_remove_event(filter, event->id) == 1) {
+               /* The event was removed from the filter */
+       }
+}
+
+...
+tep_filter_reset(filter);
+...
+tep_filter_free(filter);
+tep_filter_free(filter1);
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-func_apis.txt b/tools/lib/traceevent/Documentation/libtraceevent-func_apis.txt
new file mode 100644 (file)
index 0000000..38bfea3
--- /dev/null
@@ -0,0 +1,183 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_find_function, tep_find_function_address, tep_set_function_resolver,
+tep_reset_function_resolver, tep_register_function, tep_register_print_string -
+function related tep APIs
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+typedef char pass:[*](*tep_func_resolver_t*)(void pass:[*]_priv_, unsigned long long pass:[*]_addrp_, char pass:[**]_modp_);
+int *tep_set_function_resolver*(struct tep_handle pass:[*]_tep_, tep_func_resolver_t pass:[*]_func_, void pass:[*]_priv_);
+void *tep_reset_function_resolver*(struct tep_handle pass:[*]_tep_);
+const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_);
+int *tep_register_print_string*(struct tep_handle pass:[*]_tep_, const char pass:[*]_fmt_, unsigned long long _addr_);
+--
+
+DESCRIPTION
+-----------
+Some tools may have already a way to resolve the kernel functions. These APIs
+allow them to keep using it instead of duplicating all the entries inside.
+
+The _tep_func_resolver_t_ type is the prototype of the alternative kernel
+functions resolver. This function receives a pointer to its custom context
+(set with the _tep_set_function_resolver()_ call ) and the address of a kernel
+function, which has to be resolved. In case of success, it should return
+the name of the function and its module (if any) in _modp_.
+
+The _tep_set_function_resolver()_ function registers _func_ as an alternative
+kernel functions resolver. The _tep_ argument is trace event parser context.
+The _priv_ argument is a custom context of the _func_ function. The function
+resolver is used by the APIs _tep_find_function()_,
+_tep_find_function_address()_, and _tep_print_func_field()_ to resolve
+a function address to a function name.
+
+The _tep_reset_function_resolver()_ function resets the kernel functions
+resolver to the default function.  The _tep_ argument is trace event parser
+context.
+
+
+These APIs can be used to find function name and start address, by given
+address. The given address does not have to be exact, it will select
+the function that would contain it.
+
+The _tep_find_function()_ function returns the function name, which contains the
+given address _addr_. The _tep_ argument is the trace event parser context.
+
+The _tep_find_function_address()_ function returns the function start address,
+by given address _addr_. The _addr_ does not have to be exact, it will select
+the function that would contain it. The _tep_ argument is the trace event
+parser context.
+
+The _tep_register_function()_ function registers a function name mapped to an
+address and (optional) module. This mapping is used in case the function tracer
+or events have "%pF" or "%pS" parameter in its format string. It is common to
+pass in the kallsyms function names with their corresponding addresses with this
+function. The _tep_ argument is the trace event parser context. The _name_ is
+the name of the function, the string is copied internally. The _addr_ is
+the start address of the function. The _mod_ is the kernel module
+the function may be in (NULL for none).
+
+The _tep_register_print_string()_ function  registers a string by the address
+it was stored in the kernel. Some strings internal to the kernel with static
+address are passed to certain events. The "%s" in the event's format field
+which has an address needs to know what string would be at that address. The
+tep_register_print_string() supplies the parsing with the mapping between kernel
+addresses and those strings. The _tep_ argument is the trace event parser
+context. The _fmt_ is the string to register, it is copied internally.
+The _addr_ is the address the string was located at.
+
+
+RETURN VALUE
+------------
+The _tep_set_function_resolver()_ function returns 0 in case of success, or -1
+in case of an error.
+
+The _tep_find_function()_ function returns the function name, or NULL in case
+it cannot be found.
+
+The _tep_find_function_address()_ function returns the function start address,
+or 0 in case it cannot be found.
+
+The _tep_register_function()_ function returns 0 in case of success. In case of
+an error -1 is returned, and errno is set to the appropriate error number.
+
+The _tep_register_print_string()_ function returns 0 in case of success. In case
+of an error -1 is returned, and errno is set to the appropriate error number.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+char *my_resolve_kernel_addr(void *context,
+                            unsigned long long *addrp, char **modp)
+{
+       struct db *function_database = context;
+       struct symbol *sym = sql_lookup(function_database, *addrp);
+
+       if (!sym)
+               return NULL;
+
+       *modp = sym->module_name;
+       return sym->name;
+}
+
+void show_function( unsigned long long addr)
+{
+       unsigned long long fstart;
+       const char *fname;
+
+       if (tep_set_function_resolver(tep, my_resolve_kernel_addr,
+                                     function_database) != 0) {
+               /* failed to register my_resolve_kernel_addr */
+       }
+
+       /* These APIs use my_resolve_kernel_addr() to resolve the addr */
+       fname = tep_find_function(tep, addr);
+       fstart = tep_find_function_address(tep, addr);
+
+       /*
+          addr is in function named fname, starting at fstart address,
+          at offset (addr - fstart)
+       */
+
+       tep_reset_function_resolver(tep);
+
+}
+...
+       if (tep_register_function(tep, "kvm_exit",
+                               (unsigned long long) 0x12345678, "kvm") != 0) {
+               /* Failed to register kvm_exit address mapping */
+       }
+...
+       if (tep_register_print_string(tep, "print string",
+                               (unsigned long long) 0x87654321, NULL) != 0) {
+               /* Failed to register "print string" address mapping */
+       }
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-func_find.txt b/tools/lib/traceevent/Documentation/libtraceevent-func_find.txt
new file mode 100644 (file)
index 0000000..04840e2
--- /dev/null
@@ -0,0 +1,88 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_find_function,tep_find_function_address - Find function name / start address.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+--
+
+DESCRIPTION
+-----------
+These functions can be used to find function name and start address, by given
+address. The given address does not have to be exact, it will select the function
+that would contain it.
+
+The _tep_find_function()_ function returns the function name, which contains the
+given address _addr_. The _tep_ argument is the trace event parser context.
+
+The _tep_find_function_address()_ function returns the function start address,
+by given address _addr_. The _addr_ does not have to be exact, it will select the
+function that would contain it. The _tep_ argument is the trace event parser context.
+
+RETURN VALUE
+------------
+The _tep_find_function()_ function returns the function name, or NULL in case
+it cannot be found.
+
+The _tep_find_function_address()_ function returns the function start address,
+or 0 in case it cannot be found.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+void show_function( unsigned long long addr)
+{
+       const char *fname = tep_find_function(tep, addr);
+       unsigned long long fstart = tep_find_function_address(tep, addr);
+
+       /* addr is in function named fname, starting at fstart address, at offset (addr - fstart) */
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-handle.txt b/tools/lib/traceevent/Documentation/libtraceevent-handle.txt
new file mode 100644 (file)
index 0000000..8d56831
--- /dev/null
@@ -0,0 +1,101 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_alloc, tep_free,tep_ref, tep_unref,tep_ref_get - Create, destroy, manage
+references of trace event parser context.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+struct tep_handle pass:[*]*tep_alloc*(void);
+void *tep_free*(struct tep_handle pass:[*]_tep_);
+void *tep_ref*(struct tep_handle pass:[*]_tep_);
+void *tep_unref*(struct tep_handle pass:[*]_tep_);
+int *tep_ref_get*(struct tep_handle pass:[*]_tep_);
+--
+
+DESCRIPTION
+-----------
+These are the main functions to create and destroy tep_handle - the main
+structure, representing the trace event parser context. This context is used as
+the input parameter of most library APIs.
+
+The _tep_alloc()_ function allocates and initializes the tep context.
+
+The _tep_free()_ function will decrement the reference of the _tep_ handler.
+When there is no more references, then it will free the handler, as well
+as clean up all its resources that it had used. The argument _tep_ is
+the pointer to the trace event parser context.
+
+The _tep_ref()_ function adds a reference to the _tep_ handler.
+
+The _tep_unref()_ function removes a reference from the _tep_ handler. When
+the last reference is removed, the _tep_ is destroyed, and all resources that
+it had used are cleaned up.
+
+The _tep_ref_get()_ functions gets the current references of the _tep_ handler.
+
+RETURN VALUE
+------------
+_tep_alloc()_ returns a pointer to a newly created tep_handle structure.
+NULL is returned in case there is not enough free memory to allocate it.
+
+_tep_ref_get()_ returns the current references of _tep_.
+If _tep_ is NULL, 0 is returned.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+
+...
+struct tep_handle *tep = tep_alloc();
+...
+int ref = tep_ref_get(tep);
+tep_ref(tep);
+if ( (ref+1) != tep_ref_get(tep)) {
+       /* Something wrong happened, the counter is not incremented by 1 */
+}
+tep_unref(tep);
+...
+tep_free(tep);
+...
+--
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-header_page.txt b/tools/lib/traceevent/Documentation/libtraceevent-header_page.txt
new file mode 100644 (file)
index 0000000..615d117
--- /dev/null
@@ -0,0 +1,102 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_header_page_size, tep_get_header_timestamp_size, tep_is_old_format -
+Get the data stored in the header page, in kernel context.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_);
+int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_);
+bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_);
+--
+DESCRIPTION
+-----------
+These functions retrieve information from kernel context, stored in tracefs
+events/header_page. Old kernels do not have header page info, so default values
+from user space context are used.
+
+The _tep_get_header_page_size()_ function returns the size of a long integer,
+in kernel context. The _tep_ argument is trace event parser context.
+This information is retrieved from tracefs events/header_page, "commit" field.
+
+The _tep_get_header_timestamp_size()_ function returns the size of timestamps,
+in kernel context. The _tep_ argument is trace event parser context. This
+information is retrieved from tracefs events/header_page, "timestamp" field.
+
+The _tep_is_old_format()_ function returns true if the kernel predates
+the addition of events/header_page, otherwise it returns false.
+
+RETURN VALUE
+------------
+The _tep_get_header_page_size()_ function returns the size of a long integer,
+in bytes.
+
+The _tep_get_header_timestamp_size()_ function returns the size of timestamps,
+in bytes.
+
+The _tep_is_old_format()_ function returns true, if an old kernel is used to
+generate the tracing data, which has no event/header_page. If the kernel is new,
+or _tep_ is NULL, false is returned.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+       int longsize;
+       int timesize;
+       bool old;
+
+       longsize = tep_get_header_page_size(tep);
+       timesize = tep_get_header_timestamp_size(tep);
+       old = tep_is_old_format(tep);
+
+       printf ("%s kernel is used to generate the tracing data.\n",
+               old?"Old":"New");
+       printf("The size of a long integer is %d bytes.\n", longsize);
+       printf("The timestamps size is %d bytes.\n", timesize);
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-host_endian.txt b/tools/lib/traceevent/Documentation/libtraceevent-host_endian.txt
new file mode 100644 (file)
index 0000000..d5d375e
--- /dev/null
@@ -0,0 +1,104 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_is_bigendian, tep_is_local_bigendian, tep_set_local_bigendian - Get / set
+the endianness of the local machine.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_endian* {
+       TEP_LITTLE_ENDIAN = 0,
+       TEP_BIG_ENDIAN
+};
+
+int *tep_is_bigendian*(void);
+bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_);
+void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
+--
+
+DESCRIPTION
+-----------
+
+The _tep_is_bigendian()_ gets the endianness of the machine, executing
+the function.
+
+The _tep_is_local_bigendian()_ function gets the endianness of the local
+machine, saved in the _tep_ handler. The _tep_ argument is the trace event
+parser context. This API is a bit faster than _tep_is_bigendian()_, as it
+returns cached endianness of the local machine instead of checking it each time.
+
+The _tep_set_local_bigendian()_ function sets the endianness of the local
+machine in the _tep_ handler. The _tep_ argument is trace event parser context.
+The _endian_ argument is the endianness:
+[verse]
+--
+       _TEP_LITTLE_ENDIAN_ - the machine is little endian,
+       _TEP_BIG_ENDIAN_ - the machine is big endian.
+--
+
+RETURN VALUE
+------------
+The _tep_is_bigendian()_ function returns non zero if the endianness of the
+machine, executing the code, is big endian and zero otherwise.
+
+The _tep_is_local_bigendian()_ function returns true, if the endianness of the
+local machine, saved in the _tep_ handler, is big endian, or false otherwise.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+       if (tep_is_bigendian())
+               tep_set_local_bigendian(tep, TEP_BIG_ENDIAN);
+       else
+               tep_set_local_bigendian(tep, TEP_LITTLE_ENDIAN);
+...
+       if (tep_is_local_bigendian(tep))
+               printf("This machine you are running on is bigendian\n");
+       else
+               printf("This machine you are running on is little endian\n");
+
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-long_size.txt b/tools/lib/traceevent/Documentation/libtraceevent-long_size.txt
new file mode 100644 (file)
index 0000000..01d78ea
--- /dev/null
@@ -0,0 +1,78 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_long_size, tep_set_long_size - Get / set the size of a long integer on
+the machine, where the trace is generated, in bytes
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_get_long_size*(strucqt tep_handle pass:[*]_tep_);
+void *tep_set_long_size*(struct tep_handle pass:[*]_tep_, int _long_size_);
+--
+
+DESCRIPTION
+-----------
+The _tep_get_long_size()_ function returns the size of a long integer on the machine,
+where the trace is generated. The _tep_ argument is trace event parser context.
+
+The _tep_set_long_size()_ function sets the size of a long integer on the machine,
+where the trace is generated. The _tep_ argument is trace event parser context.
+The _long_size_ is the size of a long integer, in bytes.
+
+RETURN VALUE
+------------
+The _tep_get_long_size()_ function returns the size of a long integer on the machine,
+where the trace is generated, in bytes.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+tep_set_long_size(tep, 4);
+...
+int long_size = tep_get_long_size(tep);
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-page_size.txt b/tools/lib/traceevent/Documentation/libtraceevent-page_size.txt
new file mode 100644 (file)
index 0000000..452c0cf
--- /dev/null
@@ -0,0 +1,82 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_get_page_size, tep_set_page_size - Get / set the size of a memory page on
+the machine, where the trace is generated
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_get_page_size*(struct tep_handle pass:[*]_tep_);
+void *tep_set_page_size*(struct tep_handle pass:[*]_tep_, int _page_size_);
+--
+
+DESCRIPTION
+-----------
+The _tep_get_page_size()_ function returns the size of a memory page on
+the machine, where the trace is generated. The _tep_ argument is trace
+event parser context.
+
+The _tep_set_page_size()_ function stores in the _tep_ context the size of a
+memory page on the machine, where the trace is generated.
+The _tep_ argument is trace event parser context.
+The _page_size_ argument is the size of a memory page, in bytes.
+
+RETURN VALUE
+------------
+The _tep_get_page_size()_ function returns size of the memory page, in bytes.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <unistd.h>
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+       int page_size = getpagesize();
+
+       tep_set_page_size(tep, page_size);
+
+       printf("The page size for this machine is %d\n", tep_get_page_size(tep));
+
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-parse_event.txt b/tools/lib/traceevent/Documentation/libtraceevent-parse_event.txt
new file mode 100644 (file)
index 0000000..f248114
--- /dev/null
@@ -0,0 +1,90 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_parse_event, tep_parse_format - Parse the event format information
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
+enum tep_errno *tep_parse_format*(struct tep_handle pass:[*]_tep_, struct tep_event pass:[*]pass:[*]_eventp_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
+--
+
+DESCRIPTION
+-----------
+The _tep_parse_event()_ function parses the event format and creates an event
+structure to quickly parse raw data for a given event. The _tep_ argument is
+the trace event parser context. The created event structure is stored in the
+_tep_ context. The _buf_ argument is a buffer with _size_, where the event
+format data is. The event format data can be taken from
+tracefs/events/.../.../format files. The _sys_ argument is the system of
+the event.
+
+The _tep_parse_format()_ function does the same as _tep_parse_event()_. The only
+difference is in the extra _eventp_ argument, where the newly created event
+structure is returned.
+
+RETURN VALUE
+------------
+Both _tep_parse_event()_ and _tep_parse_format()_ functions return 0 on success,
+or TEP_ERRNO__... in case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+char *buf;
+int size;
+struct tep_event *event = NULL;
+buf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size);
+if (tep_parse_event(tep, buf, size, "ftrace") != 0) {
+       /* Failed to parse the ftrace print format */
+}
+
+if (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) {
+       /* Failed to parse the ftrace print format */
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-parse_head.txt b/tools/lib/traceevent/Documentation/libtraceevent-parse_head.txt
new file mode 100644 (file)
index 0000000..c90f16c
--- /dev/null
@@ -0,0 +1,82 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_parse_header_page - Parses the data stored in the header page.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_);
+--
+
+DESCRIPTION
+-----------
+The _tep_parse_header_page()_ function parses the header page data from _buf_,
+and initializes the _tep_, trace event parser context, with it. The buffer
+_buf_ is with _size_, and is supposed to be copied from
+tracefs/events/header_page.
+
+Some old kernels do not have header page info, in this case the
+_tep_parse_header_page()_ function  can be called with _size_ equal to 0. The
+_tep_ context is initialized with default values. The _long_size_ can be used in
+this use case, to set the size of a long integer to be used.
+
+RETURN VALUE
+------------
+The _tep_parse_header_page()_ function returns 0 in case of success, or -1
+in case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+char *buf;
+int size;
+buf = read_file("/sys/kernel/tracing/events/header_page", &size);
+if (tep_parse_header_page(tep, buf, size, sizeof(unsigned long)) != 0) {
+       /* Failed to parse the header page */
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-record_parse.txt b/tools/lib/traceevent/Documentation/libtraceevent-record_parse.txt
new file mode 100644 (file)
index 0000000..e9a6911
--- /dev/null
@@ -0,0 +1,137 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_data_type, tep_data_pid,tep_data_preempt_count, tep_data_flags -
+Extract common fields from a record.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *trace_flag_type* {
+       _TRACE_FLAG_IRQS_OFF_,
+       _TRACE_FLAG_IRQS_NOSUPPORT_,
+       _TRACE_FLAG_NEED_RESCHED_,
+       _TRACE_FLAG_HARDIRQ_,
+       _TRACE_FLAG_SOFTIRQ_,
+};
+
+int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+--
+
+DESCRIPTION
+-----------
+This set of functions can be used to extract common fields from a record.
+
+The _tep_data_type()_ function gets the event id from the record _rec_.
+It reads the "common_type" field. The _tep_ argument is the trace event parser
+context.
+
+The _tep_data_pid()_ function gets the process id from the record _rec_.
+It reads the "common_pid" field. The _tep_ argument is the trace event parser
+context.
+
+The _tep_data_preempt_count()_ function gets the preemption count from the
+record _rec_. It reads the "common_preempt_count" field. The _tep_ argument is
+the trace event parser context.
+
+The _tep_data_flags()_ function gets the latency flags from the record _rec_.
+It reads the "common_flags" field. The _tep_ argument is the trace event parser
+context. Supported latency flags are:
+[verse]
+--
+       _TRACE_FLAG_IRQS_OFF_,          Interrupts are disabled.
+       _TRACE_FLAG_IRQS_NOSUPPORT_,    Reading IRQ flag is not supported by the architecture.
+       _TRACE_FLAG_NEED_RESCHED_,      Task needs rescheduling.
+       _TRACE_FLAG_HARDIRQ_,           Hard IRQ is running.
+       _TRACE_FLAG_SOFTIRQ_,           Soft IRQ is running.
+--
+
+RETURN VALUE
+------------
+The _tep_data_type()_ function returns an integer, representing the event id.
+
+The _tep_data_pid()_ function returns an integer, representing the process id
+
+The _tep_data_preempt_count()_ function returns an integer, representing the
+preemption count.
+
+The _tep_data_flags()_ function returns an integer, representing the latency
+flags. Look at the _trace_flag_type_ enum for supported flags.
+
+All these functions in case of an error return a negative integer.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+void process_record(struct tep_record *record)
+{
+       int data;
+
+       data = tep_data_type(tep, record);
+       if (data >= 0) {
+               /* Got the ID of the event */
+       }
+
+       data = tep_data_pid(tep, record);
+       if (data >= 0) {
+               /* Got the process ID */
+       }
+
+       data = tep_data_preempt_count(tep, record);
+       if (data >= 0) {
+               /* Got the preemption count */
+       }
+
+       data = tep_data_flags(tep, record);
+       if (data >= 0) {
+               /* Got the latency flags */
+       }
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-reg_event_handler.txt b/tools/lib/traceevent/Documentation/libtraceevent-reg_event_handler.txt
new file mode 100644 (file)
index 0000000..53d37d7
--- /dev/null
@@ -0,0 +1,156 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_register_event_handler, tep_unregister_event_handler -  Register /
+unregisters a callback function to parse an event information.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_reg_handler* {
+       _TEP_REGISTER_SUCCESS_,
+       _TEP_REGISTER_SUCCESS_OVERWRITE_,
+};
+
+int *tep_register_event_handler*(struct tep_handle pass:[*]_tep_, int _id_, const char pass:[*]_sys_name_, const char pass:[*]_event_name_, tep_event_handler_func _func_, void pass:[*]_context_);
+int *tep_unregister_event_handler*(struct tep_handle pass:[*]tep, int id, const char pass:[*]sys_name, const char pass:[*]event_name, tep_event_handler_func func, void pass:[*]_context_);
+
+typedef int (*pass:[*]tep_event_handler_func*)(struct trace_seq pass:[*]s, struct tep_record pass:[*]record, struct tep_event pass:[*]event, void pass:[*]context);
+--
+
+DESCRIPTION
+-----------
+The _tep_register_event_handler()_ function registers a handler function,
+which is going to be called to parse the information for a given event.
+The _tep_ argument is the trace event parser context. The _id_ argument is
+the id of the event. The _sys_name_ argument is the name of the system,
+the event belongs to. The _event_name_ argument is the name of the event.
+If _id_ is >= 0, it is used to find the event, otherwise _sys_name_ and
+_event_name_ are used. The _func_ is a pointer to the function, which is going
+to be called to parse the event information. The _context_ argument is a pointer
+to the context data, which will be passed to the _func_. If a handler function
+for the same event is already registered, it will be overridden with the new
+one. This mechanism allows a developer to override the parsing of a given event.
+If for some reason the default print format is not sufficient, the developer
+can register a function for an event to be used to parse the data instead.
+
+The _tep_unregister_event_handler()_ function unregisters the handler function,
+previously registered with _tep_register_event_handler()_. The _tep_ argument
+is the trace event parser context. The _id_, _sys_name_, _event_name_, _func_,
+and _context_ are the same arguments, as when the callback function _func_ was
+registered.
+
+The _tep_event_handler_func_ is the type of the custom event handler
+function. The _s_ argument is the trace sequence, it can be used to create a
+custom string, describing the event. A _record_  to get the event from is passed
+as input parameter and also the _event_ - the handle to the record's event. The
+_context_ is custom context, set when the custom event handler is registered.
+
+RETURN VALUE
+------------
+The _tep_register_event_handler()_ function returns _TEP_REGISTER_SUCCESS_
+if the new handler is registered successfully or
+_TEP_REGISTER_SUCCESS_OVERWRITE_ if an existing handler is overwritten.
+If there is not  enough memory to complete the registration,
+TEP_ERRNO__MEM_ALLOC_FAILED is returned.
+
+The _tep_unregister_event_handler()_ function returns 0 if _func_ was removed
+successful or, -1 if the event was not found.
+
+The _tep_event_handler_func_ should return -1 in case of an error,
+or 0 otherwise.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+#include <trace-seq.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+int timer_expire_handler(struct trace_seq *s, struct tep_record *record,
+                        struct tep_event *event, void *context)
+{
+       trace_seq_printf(s, "hrtimer=");
+
+       if (tep_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1)
+               tep_print_num_field(s, "0x%llx", event, "hrtimer", record, 1);
+
+       trace_seq_printf(s, " now=");
+
+       tep_print_num_field(s, "%llu", event, "now", record, 1);
+
+       tep_print_func_field(s, " function=%s", event, "function", record, 0);
+
+       return 0;
+}
+...
+       int ret;
+
+       ret = tep_register_event_handler(tep, -1, "timer", "hrtimer_expire_entry",
+                                        timer_expire_handler, NULL);
+       if (ret < 0) {
+               char buf[32];
+
+               tep_strerror(tep, ret, buf, 32)
+               printf("Failed to register handler for hrtimer_expire_entry: %s\n", buf);
+       } else {
+               switch (ret) {
+               case TEP_REGISTER_SUCCESS:
+                       printf ("Registered handler for hrtimer_expire_entry\n");
+                       break;
+               case TEP_REGISTER_SUCCESS_OVERWRITE:
+                       printf ("Overwrote handler for hrtimer_expire_entry\n");
+                       break;
+               }
+       }
+...
+       ret = tep_unregister_event_handler(tep, -1, "timer", "hrtimer_expire_entry",
+                                          timer_expire_handler, NULL);
+       if ( ret )
+               printf ("Failed to unregister handler for hrtimer_expire_entry\n");
+
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences
+       related APIs. Trace sequences are used to allow a function to call
+       several other functions to create a string of data to use.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-reg_print_func.txt b/tools/lib/traceevent/Documentation/libtraceevent-reg_print_func.txt
new file mode 100644 (file)
index 0000000..708dce9
--- /dev/null
@@ -0,0 +1,155 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_register_print_function,tep_unregister_print_function -
+Registers / Unregisters a helper function.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_func_arg_type* {
+       TEP_FUNC_ARG_VOID,
+       TEP_FUNC_ARG_INT,
+       TEP_FUNC_ARG_LONG,
+       TEP_FUNC_ARG_STRING,
+       TEP_FUNC_ARG_PTR,
+       TEP_FUNC_ARG_MAX_TYPES
+};
+
+typedef unsigned long long (*pass:[*]tep_func_handler*)(struct trace_seq pass:[*]s, unsigned long long pass:[*]args);
+
+int *tep_register_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, enum tep_func_arg_type _ret_type_, char pass:[*]_name_, _..._);
+int *tep_unregister_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, char pass:[*]_name_);
+--
+
+DESCRIPTION
+-----------
+Some events may have helper functions in the print format arguments.
+This allows a plugin to dynamically create a way to process one of
+these functions.
+
+The _tep_register_print_function()_ registers such helper function. The _tep_
+argument is the trace event parser context. The _func_ argument  is a pointer
+to the helper function. The _ret_type_ argument is  the return type of the
+helper function, value from the _tep_func_arg_type_ enum. The _name_ is the name
+of the helper function, as seen in the print format arguments. The _..._ is a
+variable list of _tep_func_arg_type_ enums, the _func_ function arguments.
+This list must end with _TEP_FUNC_ARG_VOID_. See 'EXAMPLE' section.
+
+The _tep_unregister_print_function()_ unregisters a helper function, previously
+registered with _tep_register_print_function()_. The _tep_ argument is the
+trace event parser context. The _func_ and _name_ arguments are the same, used
+when the helper function was registered.
+
+The _tep_func_handler_ is the type of the helper function. The _s_ argument is
+the trace sequence, it can be used to create a custom string.
+The _args_  is a list of arguments, defined when the helper function was
+registered.
+
+RETURN VALUE
+------------
+The _tep_register_print_function()_ function returns 0 in case of success.
+In case of an error, TEP_ERRNO_... code is returned.
+
+The _tep_unregister_print_function()_ returns 0 in case of success, or -1 in
+case of an error.
+
+EXAMPLE
+-------
+Some events have internal functions calls, that appear in the print format
+output. For example "tracefs/events/i915/g4x_wm/format" has:
+[source,c]
+--
+print fmt: "pipe %c, frame=%u, scanline=%u, wm %d/%d/%d, sr %s/%d/%d/%d, hpll %s/%d/%d/%d, fbc %s",
+           ((REC->pipe) + 'A'), REC->frame, REC->scanline, REC->primary,
+           REC->sprite, REC->cursor, yesno(REC->cxsr), REC->sr_plane,
+           REC->sr_cursor, REC->sr_fbc, yesno(REC->hpll), REC->hpll_plane,
+           REC->hpll_cursor, REC->hpll_fbc, yesno(REC->fbc)
+--
+Notice the call to function _yesno()_ in the print arguments. In the kernel
+context, this function has the following implementation:
+[source,c]
+--
+static const char *yesno(int x)
+{
+       static const char *yes = "yes";
+       static const char *no = "no";
+
+       return x ? yes : no;
+}
+--
+The user space event parser has no idea how to handle this _yesno()_ function.
+The _tep_register_print_function()_ API can be used to register a user space
+helper function, mapped to the kernel's _yesno()_:
+[source,c]
+--
+#include <event-parse.h>
+#include <trace-seq.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+static const char *yes_no_helper(int x)
+{
+       return x ? "yes" : "no";
+}
+...
+       if ( tep_register_print_function(tep,
+                                   yes_no_helper,
+                                   TEP_FUNC_ARG_STRING,
+                                   "yesno",
+                                   TEP_FUNC_ARG_INT,
+                                   TEP_FUNC_ARG_VOID) != 0) {
+               /* Failed to register yes_no_helper function */
+       }
+
+/*
+   Now, when the event parser encounters this yesno() function, it will know
+   how to handle it.
+*/
+...
+       if (tep_unregister_print_function(tep, yes_no_helper, "yesno") != 0) {
+               /* Failed to unregister yes_no_helper function */
+       }
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences
+       related APIs. Trace sequences are used to allow a function to call
+       several other functions to create a string of data to use.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-set_flag.txt b/tools/lib/traceevent/Documentation/libtraceevent-set_flag.txt
new file mode 100644 (file)
index 0000000..b059978
--- /dev/null
@@ -0,0 +1,104 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_set_flag, tep_clear_flag, tep_test_flag -
+Manage flags of trace event parser context.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+enum *tep_flag* {
+       _TEP_NSEC_OUTPUT_,
+       _TEP_DISABLE_SYS_PLUGINS_,
+       _TEP_DISABLE_PLUGINS_
+};
+void *tep_set_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_);
+void *tep_clear_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_);
+bool *tep_test_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_);
+--
+
+DESCRIPTION
+-----------
+Trace event parser context flags are defined in *enum tep_flag*:
+[verse]
+--
+_TEP_NSEC_OUTPUT_ - print event's timestamp in nano seconds, instead of micro seconds.
+_TEP_DISABLE_SYS_PLUGINS_ - disable plugins, located in system's plugin
+                       directory. This directory is defined at library compile
+                       time, and usually depends on library installation
+                       prefix: (install_preffix)/lib/traceevent/plugins
+_TEP_DISABLE_PLUGINS_ - disable all library plugins:
+                       - in system's plugin directory
+                       - in directory, defined by the environment variable _TRACEEVENT_PLUGIN_DIR_
+                       - in user's home directory, _~/.traceevent/plugins_
+--
+Note: plugin related flags must me set before calling _tep_load_plugins()_ API.
+
+The _tep_set_flag()_ function sets _flag_ to _tep_ context.
+
+The _tep_clear_flag()_ function clears _flag_ from _tep_ context.
+
+The _tep_test_flag()_ function tests if _flag_ is set to _tep_ context.
+
+RETURN VALUE
+------------
+_tep_test_flag()_ function returns true if _flag_ is set, false otherwise.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+/* Print timestamps in nanoseconds */
+tep_set_flag(tep,  TEP_NSEC_OUTPUT);
+...
+if (tep_test_flag(tep, TEP_NSEC_OUTPUT)) {
+       /* print timestamps in nanoseconds */
+} else {
+       /* print timestamps in microseconds */
+}
+...
+/* Print timestamps in microseconds */
+tep_clear_flag(tep, TEP_NSEC_OUTPUT);
+...
+--
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-strerror.txt b/tools/lib/traceevent/Documentation/libtraceevent-strerror.txt
new file mode 100644 (file)
index 0000000..ee4062a
--- /dev/null
@@ -0,0 +1,85 @@
+libtraceevent(3)
+================
+
+NAME
+----
+tep_strerror - Returns a string describing regular errno and tep error number.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_);
+
+--
+DESCRIPTION
+-----------
+The _tep_strerror()_ function converts tep error number into a human
+readable string.
+The _tep_ argument is trace event parser context. The _errnum_ is a regular
+errno, defined in errno.h, or a tep error number. The string, describing this
+error number is copied in the _buf_ argument. The _buflen_ argument is
+the size of the _buf_.
+
+It as a thread safe wrapper around strerror_r(). The library function has two
+different behaviors - POSIX and GNU specific. The _tep_strerror()_ API always
+behaves as the POSIX version - the error string is copied in the user supplied
+buffer.
+
+RETURN VALUE
+------------
+The _tep_strerror()_ function returns 0, if a valid _errnum_ is passed and the
+string is copied into _buf_. If _errnum_ is not a valid error number,
+-1 is returned and _buf_ is not modified.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+...
+struct tep_handle *tep = tep_alloc();
+...
+char buf[32];
+char *pool = calloc(1, 128);
+if (tep == NULL) {
+       tep_strerror(tep, TEP_ERRNO__MEM_ALLOC_FAILED, buf, 32);
+       printf ("The pool is not initialized, %s", buf);
+}
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent-tseq.txt b/tools/lib/traceevent/Documentation/libtraceevent-tseq.txt
new file mode 100644 (file)
index 0000000..8ac6aa1
--- /dev/null
@@ -0,0 +1,158 @@
+libtraceevent(3)
+================
+
+NAME
+----
+trace_seq_init, trace_seq_destroy, trace_seq_reset, trace_seq_terminate,
+trace_seq_putc, trace_seq_puts, trace_seq_printf, trace_seq_vprintf,
+trace_seq_do_fprintf, trace_seq_do_printf -
+Initialize / destroy a trace sequence.
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+*#include <trace-seq.h>*
+
+void *trace_seq_init*(struct trace_seq pass:[*]_s_);
+void *trace_seq_destroy*(struct trace_seq pass:[*]_s_);
+void *trace_seq_reset*(struct trace_seq pass:[*]_s_);
+void *trace_seq_terminate*(struct trace_seq pass:[*]_s_);
+int *trace_seq_putc*(struct trace_seq pass:[*]_s_, unsigned char _c_);
+int *trace_seq_puts*(struct trace_seq pass:[*]_s_, const char pass:[*]_str_);
+int *trace_seq_printf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, _..._);
+int *trace_seq_vprintf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, va_list _args_);
+int *trace_seq_do_printf*(struct trace_seq pass:[*]_s_);
+int *trace_seq_do_fprintf*(struct trace_seq pass:[*]_s_, FILE pass:[*]_fp_);
+--
+
+DESCRIPTION
+-----------
+Trace sequences are used to allow a function to call several other functions
+to create a string of data to use.
+
+The _trace_seq_init()_ function initializes the trace sequence _s_.
+
+The _trace_seq_destroy()_ function destroys the trace sequence _s_ and frees
+all its resources that it had used.
+
+The _trace_seq_reset()_ function re-initializes the trace sequence _s_. All
+characters already written in _s_ will be deleted.
+
+The _trace_seq_terminate()_ function terminates the trace sequence _s_. It puts
+the null character pass:['\0'] at the end of the buffer.
+
+The _trace_seq_putc()_ function puts a single character _c_ in the trace
+sequence _s_.
+
+The _trace_seq_puts()_ function puts a NULL terminated string _str_ in the
+trace sequence _s_.
+
+The _trace_seq_printf()_ function puts a formated string _fmt _with
+variable arguments _..._ in the trace sequence _s_.
+
+The _trace_seq_vprintf()_ function puts a formated string _fmt _with
+list of arguments _args_ in the trace sequence _s_.
+
+The _trace_seq_do_printf()_ function prints the buffer of trace sequence _s_ to
+the standard output stdout.
+
+The _trace_seq_do_fprintf()_ function prints the buffer of trace sequence _s_
+to the given file _fp_.
+
+RETURN VALUE
+------------
+Both _trace_seq_putc()_ and _trace_seq_puts()_ functions return the number of
+characters put in the trace sequence, or 0 in case of an error
+
+Both _trace_seq_printf()_ and _trace_seq_vprintf()_ functions return 0 if the
+trace oversizes the buffer's free space, the number of characters printed, or
+a negative value in case of an error.
+
+Both _trace_seq_do_printf()_ and _trace_seq_do_fprintf()_ functions return the
+number of printed characters, or -1 in case of an error.
+
+EXAMPLE
+-------
+[source,c]
+--
+#include <event-parse.h>
+#include <trace-seq.h>
+...
+struct trace_seq seq;
+trace_seq_init(&seq);
+...
+void foo_seq_print(struct trace_seq *tseq, char *format, ...)
+{
+       va_list ap;
+       va_start(ap, format);
+       if (trace_seq_vprintf(tseq, format, ap) <= 0) {
+               /* Failed to print in the trace sequence */
+       }
+       va_end(ap);
+}
+
+trace_seq_reset(&seq);
+
+char *str = " MAN page example";
+if (trace_seq_puts(&seq, str) != strlen(str)) {
+       /* Failed to put str in the trace sequence */
+}
+if (trace_seq_putc(&seq, ':') != 1) {
+       /* Failed to put ':' in the trace sequence */
+}
+if (trace_seq_printf(&seq, " trace sequence: %d", 1) <= 0) {
+       /* Failed to print in the trace sequence */
+}
+foo_seq_print( &seq, "  %d\n", 2);
+
+trace_seq_terminate(&seq);
+...
+
+if (trace_seq_do_printf(&seq) < 0 ) {
+       /* Failed to print the sequence buffer to the standard output */
+}
+FILE *fp = fopen("trace.txt", "w");
+if (trace_seq_do_fprintf(&seq, fp) < 0 ) [
+       /* Failed to print the sequence buffer to the trace.txt file */
+}
+
+trace_seq_destroy(&seq);
+...
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences related APIs.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_libtraceevent(3)_, _trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/libtraceevent.txt b/tools/lib/traceevent/Documentation/libtraceevent.txt
new file mode 100644 (file)
index 0000000..fbd977b
--- /dev/null
@@ -0,0 +1,203 @@
+libtraceevent(3)
+================
+
+NAME
+----
+libtraceevent - Linux kernel trace event library
+
+SYNOPSIS
+--------
+[verse]
+--
+*#include <event-parse.h>*
+
+Management of tep handler data structure and access of its members:
+       struct tep_handle pass:[*]*tep_alloc*(void);
+       void *tep_free*(struct tep_handle pass:[*]_tep_);
+       void *tep_ref*(struct tep_handle pass:[*]_tep_);
+       void *tep_unref*(struct tep_handle pass:[*]_tep_);
+       int *tep_ref_get*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_);
+       void *tep_clear_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_);
+       bool *tep_test_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flags_);
+       int *tep_get_cpus*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_cpus*(struct tep_handle pass:[*]_tep_, int _cpus_);
+       int *tep_get_long_size*(strucqt tep_handle pass:[*]_tep_);
+       void *tep_set_long_size*(struct tep_handle pass:[*]_tep_, int _long_size_);
+       int *tep_get_page_size*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_page_size*(struct tep_handle pass:[*]_tep_, int _page_size_);
+       bool *tep_is_latency_format*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_latency_format*(struct tep_handle pass:[*]_tep_, int _lat_);
+       int *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_);
+       int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_);
+       bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_);
+       int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_);
+
+Register / unregister APIs:
+       int *tep_register_trace_clock*(struct tep_handle pass:[*]_tep_, const char pass:[*]_trace_clock_);
+       int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_);
+       int *tep_register_event_handler*(struct tep_handle pass:[*]_tep_, int _id_, const char pass:[*]_sys_name_, const char pass:[*]_event_name_, tep_event_handler_func _func_, void pass:[*]_context_);
+       int *tep_unregister_event_handler*(struct tep_handle pass:[*]tep, int id, const char pass:[*]sys_name, const char pass:[*]event_name, tep_event_handler_func func, void pass:[*]_context_);
+       int *tep_register_print_string*(struct tep_handle pass:[*]_tep_, const char pass:[*]_fmt_, unsigned long long _addr_);
+       int *tep_register_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, enum tep_func_arg_type _ret_type_, char pass:[*]_name_, _..._);
+       int *tep_unregister_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, char pass:[*]_name_);
+
+Plugins management:
+       struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_);
+       void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_);
+       char pass:[*]pass:[*]*tep_plugin_list_options*(void);
+       void *tep_plugin_free_options_list*(char pass:[*]pass:[*]_list_);
+       int *tep_plugin_add_options*(const char pass:[*]_name_, struct tep_plugin_option pass:[*]_options_);
+       void *tep_plugin_remove_options*(struct tep_plugin_option pass:[*]_options_);
+       void *tep_print_plugins*(struct trace_seq pass:[*]_s_, const char pass:[*]_prefix_, const char pass:[*]_suffix_, const struct tep_plugin_list pass:[*]_list_);
+
+Event related APIs:
+       struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_);
+       struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_);
+       int *tep_get_events_count*(struct tep_handle pass:[*]_tep_);
+       struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
+       struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_);
+
+Event printing:
+       void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, bool _use_trace_clock_);
+       void *tep_print_event_data*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, struct tep_record pass:[*]_record_);
+       void *tep_event_info*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, struct tep_record pass:[*]_record_);
+       void *tep_print_event_task*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, struct tep_record pass:[*]_record_);
+       void *tep_print_event_time*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, struct tep_record pass:[*]record, bool _use_trace_clock_);
+       void *tep_set_print_raw*(struct tep_handle pass:[*]_tep_, int _print_raw_);
+
+Event finding:
+       struct tep_event pass:[*]*tep_find_event*(struct tep_handle pass:[*]_tep_, int _id_);
+       struct tep_event pass:[*]*tep_find_event_by_name*(struct tep_handle pass:[*]_tep_, const char pass:[*]_sys_, const char pass:[*]_name_);
+       struct tep_event pass:[*]*tep_find_event_by_record*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_record_);
+
+Parsing of event files:
+       int *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_);
+       enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
+       enum tep_errno *tep_parse_format*(struct tep_handle pass:[*]_tep_, struct tep_event pass:[*]pass:[*]_eventp_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_);
+
+APIs related to fields from event's format files:
+       struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_);
+       struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_);
+       void pass:[*]*tep_get_field_raw*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int pass:[*]_len_, int _err_);
+       int *tep_get_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+       int *tep_get_common_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+       int *tep_get_any_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_);
+       int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_);
+
+Event fields printing:
+       void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_);
+       void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_);
+       int *tep_print_num_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
+       int *tep_print_func_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
+
+Event fields finding:
+       struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_);
+       struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_);
+       struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_);
+
+Functions resolver:
+       int *tep_set_function_resolver*(struct tep_handle pass:[*]_tep_, tep_func_resolver_t pass:[*]_func_, void pass:[*]_priv_);
+       void *tep_reset_function_resolver*(struct tep_handle pass:[*]_tep_);
+       const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+       unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_);
+
+Filter management:
+       struct tep_event_filter pass:[*]*tep_filter_alloc*(struct tep_handle pass:[*]_tep_);
+       enum tep_errno *tep_filter_add_filter_str*(struct tep_event_filter pass:[*]_filter_, const char pass:[*]_filter_str_);
+       enum tep_errno *tep_filter_match*(struct tep_event_filter pass:[*]_filter_, struct tep_record pass:[*]_record_);
+       int *tep_filter_strerror*(struct tep_event_filter pass:[*]_filter_, enum tep_errno _err_, char pass:[*]buf, size_t _buflen_);
+       int *tep_event_filtered*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+       void *tep_filter_reset*(struct tep_event_filter pass:[*]_filter_);
+       void *tep_filter_free*(struct tep_event_filter pass:[*]_filter_);
+       char pass:[*]*tep_filter_make_string*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+       int *tep_filter_remove_event*(struct tep_event_filter pass:[*]_filter_, int _event_id_);
+       int *tep_filter_copy*(struct tep_event_filter pass:[*]_dest_, struct tep_event_filter pass:[*]_source_);
+       int *tep_filter_compare*(struct tep_event_filter pass:[*]_filter1_, struct tep_event_filter pass:[*]_filter2_);
+
+Parsing various data from the records:
+       void *tep_data_latency_format*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_);
+       int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+       int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+       int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+       int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
+
+Command and task related APIs:
+       const char pass:[*]*tep_data_comm_from_pid*(struct tep_handle pass:[*]_tep_, int _pid_);
+       struct cmdline pass:[*]*tep_data_pid_from_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, struct cmdline pass:[*]_next_);
+       int *tep_register_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_);
+       int *tep_override_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_);
+       bool *tep_is_pid_registered*(struct tep_handle pass:[*]_tep_, int _pid_);
+       int *tep_cmdline_pid*(struct tep_handle pass:[*]_tep_, struct cmdline pass:[*]_cmdline_);
+
+Endian related APIs:
+       int *tep_is_bigendian*(void);
+       unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_);
+       bool *tep_is_file_bigendian*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_file_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
+       bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_);
+       void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_);
+
+Trace sequences:
+*#include <trace-seq.h>*
+       void *trace_seq_init*(struct trace_seq pass:[*]_s_);
+       void *trace_seq_reset*(struct trace_seq pass:[*]_s_);
+       void *trace_seq_destroy*(struct trace_seq pass:[*]_s_);
+       int *trace_seq_printf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, ...);
+       int *trace_seq_vprintf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, va_list _args_);
+       int *trace_seq_puts*(struct trace_seq pass:[*]_s_, const char pass:[*]_str_);
+       int *trace_seq_putc*(struct trace_seq pass:[*]_s_, unsigned char _c_);
+       void *trace_seq_terminate*(struct trace_seq pass:[*]_s_);
+       int *trace_seq_do_fprintf*(struct trace_seq pass:[*]_s_, FILE pass:[*]_fp_);
+       int *trace_seq_do_printf*(struct trace_seq pass:[*]_s_);
+--
+
+DESCRIPTION
+-----------
+The libtraceevent(3) library provides APIs to access kernel tracepoint events,
+located in the tracefs file system under the events directory.
+
+ENVIRONMENT
+-----------
+[verse]
+--
+TRACEEVENT_PLUGIN_DIR
+       Additional plugin directory. All shared object files, located in this directory will be loaded as traceevent plugins.
+--
+
+FILES
+-----
+[verse]
+--
+*event-parse.h*
+       Header file to include in order to have access to the library APIs.
+*trace-seq.h*
+       Header file to include in order to have access to trace sequences related APIs.
+       Trace sequences are used to allow a function to call several other functions
+       to create a string of data to use.
+*-ltraceevent*
+       Linker switch to add when building a program that uses the library.
+--
+
+SEE ALSO
+--------
+_trace-cmd(1)_
+
+AUTHOR
+------
+[verse]
+--
+*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
+*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
+--
+REPORTING BUGS
+--------------
+Report bugs to  <linux-trace-devel@vger.kernel.org>
+
+LICENSE
+-------
+libtraceevent is Free Software licensed under the GNU LGPL 2.1
+
+RESOURCES
+---------
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/tools/lib/traceevent/Documentation/manpage-1.72.xsl b/tools/lib/traceevent/Documentation/manpage-1.72.xsl
new file mode 100644 (file)
index 0000000..b4d315c
--- /dev/null
@@ -0,0 +1,14 @@
+<!-- manpage-1.72.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles peculiarities in docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the special values for the roff control characters
+     needed for docbook-xsl 1.72.0 -->
+<xsl:param name="git.docbook.backslash">&#x2593;</xsl:param>
+<xsl:param name="git.docbook.dot"      >&#x2302;</xsl:param>
+
+</xsl:stylesheet>
diff --git a/tools/lib/traceevent/Documentation/manpage-base.xsl b/tools/lib/traceevent/Documentation/manpage-base.xsl
new file mode 100644 (file)
index 0000000..a264fa6
--- /dev/null
@@ -0,0 +1,35 @@
+<!-- manpage-base.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<!-- these params silence some output from xmlto -->
+<xsl:param name="man.output.quietly" select="1"/>
+<xsl:param name="refentry.meta.get.quietly" select="1"/>
+
+<!-- convert asciidoc callouts to man page format;
+     git.docbook.backslash and git.docbook.dot params
+     must be supplied by another XSL file or other means -->
+<xsl:template match="co">
+       <xsl:value-of select="concat(
+                             $git.docbook.backslash,'fB(',
+                             substring-after(@id,'-'),')',
+                             $git.docbook.backslash,'fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+       <xsl:value-of select="$git.docbook.dot"/>
+       <xsl:text>sp&#10;</xsl:text>
+       <xsl:apply-templates/>
+       <xsl:text>&#10;</xsl:text>
+</xsl:template>
+<xsl:template match="callout">
+       <xsl:value-of select="concat(
+                             $git.docbook.backslash,'fB',
+                             substring-after(@arearefs,'-'),
+                             '. ',$git.docbook.backslash,'fR')"/>
+       <xsl:apply-templates/>
+       <xsl:value-of select="$git.docbook.dot"/>
+       <xsl:text>br&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/lib/traceevent/Documentation/manpage-bold-literal.xsl b/tools/lib/traceevent/Documentation/manpage-bold-literal.xsl
new file mode 100644 (file)
index 0000000..608eb5d
--- /dev/null
@@ -0,0 +1,17 @@
+<!-- manpage-bold-literal.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<!-- render literal text as bold (instead of plain or monospace);
+     this makes literal text easier to distinguish in manpages
+     viewed on a tty -->
+<xsl:template match="literal">
+       <xsl:value-of select="$git.docbook.backslash"/>
+       <xsl:text>fB</xsl:text>
+       <xsl:apply-templates/>
+       <xsl:value-of select="$git.docbook.backslash"/>
+       <xsl:text>fR</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/lib/traceevent/Documentation/manpage-normal.xsl b/tools/lib/traceevent/Documentation/manpage-normal.xsl
new file mode 100644 (file)
index 0000000..a48f5b1
--- /dev/null
@@ -0,0 +1,13 @@
+<!-- manpage-normal.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles anything we want to keep away from docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the normal values for the roff control characters -->
+<xsl:param name="git.docbook.backslash">\</xsl:param>
+<xsl:param name="git.docbook.dot"      >.</xsl:param>
+
+</xsl:stylesheet>
diff --git a/tools/lib/traceevent/Documentation/manpage-suppress-sp.xsl b/tools/lib/traceevent/Documentation/manpage-suppress-sp.xsl
new file mode 100644 (file)
index 0000000..a63c763
--- /dev/null
@@ -0,0 +1,21 @@
+<!-- manpage-suppress-sp.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles erroneous, inline .sp in manpage output of some
+     versions of docbook-xsl -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               version="1.0">
+
+<!-- attempt to work around spurious .sp at the tail of the line
+     that some versions of docbook stylesheets seem to add -->
+<xsl:template match="simpara">
+  <xsl:variable name="content">
+    <xsl:apply-templates/>
+  </xsl:variable>
+  <xsl:value-of select="normalize-space($content)"/>
+  <xsl:if test="not(ancestor::authorblurb) and
+                not(ancestor::personblurb)">
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
index 941761d..3292c29 100644 (file)
@@ -50,9 +50,13 @@ man_dir = $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
 pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG)                \
                        --variable pc_path pkg-config | tr ":" " "))
+includedir_relative = traceevent
+includedir = $(prefix)/include/$(includedir_relative)
+includedir_SQ = '$(subst ','\'',$(includedir))'
 
 export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
+export EVENT_PARSE_VERSION
 
 set_plugin_dir := 1
 
@@ -279,6 +283,8 @@ define do_install_pkgconfig_file
                cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE};           \
                sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE};            \
                sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
+               sed -i "s|LIB_DIR|${libdir}|g" ${PKG_CONFIG_FILE}; \
+               sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE}; \
                $(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644);     \
        else                                                                    \
                (echo Failed to locate pkg-config directory) 1>&2;              \
@@ -300,10 +306,10 @@ install_pkgconfig:
 
 install_headers:
        $(call QUIET_INSTALL, headers) \
-               $(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
-               $(call do_install,event-utils.h,$(prefix)/include/traceevent,644); \
-               $(call do_install,trace-seq.h,$(prefix)/include/traceevent,644); \
-               $(call do_install,kbuffer.h,$(prefix)/include/traceevent,644)
+               $(call do_install,event-parse.h,$(DESTDIR)$(includedir_SQ),644); \
+               $(call do_install,event-utils.h,$(DESTDIR)$(includedir_SQ),644); \
+               $(call do_install,trace-seq.h,$(DESTDIR)$(includedir_SQ),644); \
+               $(call do_install,kbuffer.h,$(DESTDIR)$(includedir_SQ),644)
 
 install: install_lib
 
@@ -313,6 +319,38 @@ clean:
                $(RM) TRACEEVENT-CFLAGS tags TAGS; \
                $(RM) $(PKG_CONFIG_FILE)
 
+PHONY += doc
+doc:
+       $(call descend,Documentation)
+
+PHONY += doc-clean
+doc-clean:
+       $(call descend,Documentation,clean)
+
+PHONY += doc-install
+doc-install:
+       $(call descend,Documentation,install)
+
+PHONY += doc-uninstall
+doc-uninstall:
+       $(call descend,Documentation,uninstall)
+
+PHONY += help
+help:
+       @echo 'Possible targets:'
+       @echo''
+       @echo '  all                 - default, compile the library and the'\
+                                     'plugins'
+       @echo '  plugins             - compile the plugins'
+       @echo '  install             - install the library, the plugins,'\
+                                       'the header and pkgconfig files'
+       @echo '  clean               - clean the library and the plugins object files'
+       @echo '  doc                 - compile the documentation files - man'\
+                                       'and html pages, in the Documentation directory'
+       @echo '  doc-clean           - clean the documentation files'
+       @echo '  doc-install         - install the man pages'
+       @echo '  doc-uninstall       - uninstall the man pages'
+       @echo''
 PHONY += force plugins
 force:
 
index 42e4d6c..86384fc 100644 (file)
@@ -1,6 +1,6 @@
 prefix=INSTALL_PREFIX
-libdir=${prefix}/lib64
-includedir=${prefix}/include/traceevent
+libdir=LIB_DIR
+includedir=HEADER_DIR
 
 Name: libtraceevent
 URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
index 8df526c..4dd11a5 100644 (file)
@@ -306,7 +306,7 @@ ignore it:
 
 - To skip validation of a file, add
 
-    OBJECT_FILES_NON_STANDARD_filename.o := n
+    OBJECT_FILES_NON_STANDARD_filename.o := y
 
   to the Makefile.
 
index 53f8be0..8815823 100644 (file)
@@ -7,11 +7,12 @@ ARCH := x86
 endif
 
 # always use the host compiler
+HOSTAR ?= ar
 HOSTCC ?= gcc
 HOSTLD ?= ld
+AR      = $(HOSTAR)
 CC      = $(HOSTCC)
 LD      = $(HOSTLD)
-AR      = ar
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
index 7a111a7..580e344 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ARCH_H
index 472e991..584568f 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
index 46f516d..6e06090 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ORC_TYPES_H
index f3b3781..c807984 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 77ea2b9..5f7cc61 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index 69762f9..a32736f 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef _BUILTIN_H
 #define _BUILTIN_H
index 2fe883c..4427bf8 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _OBJTOOL_CFI_H
index ac743a1..172f991 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <string.h>
@@ -28,6 +16,8 @@
 #include <linux/hashtable.h>
 #include <linux/kernel.h>
 
+#define FAKE_JUMP_OFFSET -1
+
 struct alternative {
        struct list_head list;
        struct instruction *insn;
@@ -568,7 +558,7 @@ static int add_jump_destinations(struct objtool_file *file)
                    insn->type != INSN_JUMP_UNCONDITIONAL)
                        continue;
 
-               if (insn->ignore)
+               if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
                        continue;
 
                rela = find_rela_by_dest_range(insn->sec, insn->offset,
@@ -745,10 +735,10 @@ static int handle_group_alt(struct objtool_file *file,
                clear_insn_state(&fake_jump->state);
 
                fake_jump->sec = special_alt->new_sec;
-               fake_jump->offset = -1;
+               fake_jump->offset = FAKE_JUMP_OFFSET;
                fake_jump->type = INSN_JUMP_UNCONDITIONAL;
                fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
-               fake_jump->ignore = true;
+               fake_jump->func = orig_insn->func;
        }
 
        if (!special_alt->new_len) {
@@ -1957,7 +1947,8 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
                        return 1;
                }
 
-               func = insn->func ? insn->func->pfunc : NULL;
+               if (insn->func)
+                       func = insn->func->pfunc;
 
                if (func && insn->ignore) {
                        WARN_FUNC("BUG: why am I validating an ignored function?",
index 71e54f9..cb60b9a 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _CHECK_H
index dd198d5..e99e1be 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * elf.c - ELF access library
  *
  * Adapted from kpatch (https://github.com/dynup/kpatch):
  * Copyright (C) 2013-2015 Josh Poimboeuf <jpoimboe@redhat.com>
  * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
index 2cc2ed4..e44ca5d 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _OBJTOOL_ELF_H
index 07f3299..0b3528f 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index b0e92a6..ee28322 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _ORC_H
index faa4442..13ccf77 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <unistd.h>
index 3f98dcf..27a4112 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdlib.h>
index 4e50563..fdbaa61 100644 (file)
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
index d5c062e..3506153 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _SPECIAL_H
index f4fbb97..cbb0a02 100644 (file)
@@ -1,18 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _WARN_H
index 9b75344..6876ee4 100644 (file)
@@ -47,7 +47,7 @@ clean:
 
 install: $(ALL_PROGRAMS)
        install -d -m 755 $(DESTDIR)$(bindir);          \
-       for program in $(ALL_PROGRAMS); do              \
+       for program in $(ALL_PROGRAMS) pcitest.sh; do   \
                install $$program $(DESTDIR)$(bindir);  \
        done;                                           \
        for script in $(ALL_SCRIPTS); do                \
index ac841bc..6d148a4 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../../scripts/Makefile.include
 include ../../scripts/utilities.mak
 
index 138fb6e..18ed1b0 100644 (file)
@@ -199,6 +199,18 @@ also be supplied. For example:
 
   perf stat -C 0 -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ...
 
+EVENT QUALIFIERS:
+
+It is also possible to add extra qualifiers to an event:
+
+percore:
+
+Sums up the event counts for all hardware threads in a core, e.g.:
+
+
+  perf stat -e cpu/event=0,umask=0x3,percore=1/
+
+
 EVENT GROUPS
 ------------
 
index 58986f4..de26943 100644 (file)
@@ -406,7 +406,8 @@ symbolic names, e.g. on x86, ax, si. To list the available registers use
 --intr-regs=ax,bx. The list of register is architecture dependent.
 
 --user-regs::
-Capture user registers at sample time. Same arguments as -I.
+Similar to -I, but capture user registers at sample time. To list the available
+user registers use --user-regs=\?.
 
 --running-time::
 Record running and enabled time for read events (:S)
@@ -478,6 +479,11 @@ Also at some cases executing less output write syscalls with bigger data size
 can take less time than executing more output write syscalls with smaller data
 size thus lowering runtime profiling overhead.
 
+-z::
+--compression-level[=n]::
+Produce compressed trace using specified level n (default: 1 - fastest compression,
+22 - smallest trace)
+
 --all-kernel::
 Configure all used events to run in kernel space.
 
index 39c05f8..1e312c2 100644 (file)
@@ -43,6 +43,10 @@ report::
          param1 and param2 are defined as formats for the PMU in
          /sys/bus/event_source/devices/<pmu>/format/*
 
+         'percore' is a event qualifier that sums up the event counts for both
+         hardware threads in a core. For example:
+         perf stat -A -a -e cpu/event,percore=1/,otherevent ...
+
        - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/'
          where M, N, K are numbers (in decimal, hex, octal format).
          Acceptable values for each of 'config', 'config1' and 'config2'
index 593ef49..6967e9b 100644 (file)
@@ -272,6 +272,19 @@ struct {
 
 Two uint64_t for the time of first sample and the time of last sample.
 
+        HEADER_COMPRESSED = 27,
+
+struct {
+       u32     version;
+       u32     type;
+       u32     level;
+       u32     ratio;
+       u32     mmap_len;
+};
+
+Indicates that trace contains records of PERF_RECORD_COMPRESSED type
+that have perf_events records in compressed form.
+
        other bits are reserved and should ignored for now
        HEADER_FEAT_BITS        = 256,
 
@@ -437,6 +450,17 @@ struct auxtrace_error_event {
 Describes a header feature. These are records used in pipe-mode that
 contain information that otherwise would be in perf.data file's header.
 
+       PERF_RECORD_COMPRESSED                  = 81,
+
+struct compressed_event {
+       struct perf_event_header        header;
+       char                            data[];
+};
+
+The header is followed by compressed data frame that can be decompressed
+into array of perf trace records. The size of the entire compressed event
+record including the header is limited by the max value of header.size.
+
 Event types
 
 Define the event attributes with their IDs.
index 864e375..401f0ed 100644 (file)
@@ -22,6 +22,8 @@ OPTIONS
          verbose          - general debug messages
          ordered-events   - ordered events object debug messages
          data-convert     - data convert command debug messages
+         stderr           - write debug output (option -v) to stderr
+                            in browser mode
 
 --buildid-dir::
        Setup buildid cache directory. It has higher priority than
index e1bb528..85fbcd2 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 ifeq ($(src-perf),)
 src-perf := $(srctree)/tools/perf
index c706548..4d46ca6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../scripts/Makefile.include
 include ../scripts/Makefile.arch
 
index 18b1351..1d88fda 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index 7fbca17..88c08ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index dfa6e31..cb19878 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index 7fbca17..88c08ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index 275dea7..4031db7 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index 7f6d538..b7cd91a 100644 (file)
@@ -8,9 +8,10 @@
 
 void perf_regs_load(u64 *regs);
 
+#define PERF_REGS_MAX PERF_REG_X86_XMM_MAX
+#define PERF_XMM_REGS_MASK     (~((1ULL << PERF_REG_X86_XMM0) - 1))
 #ifndef HAVE_ARCH_X86_64_SUPPORT
 #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
-#define PERF_REGS_MAX PERF_REG_X86_32_MAX
 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
 #else
 #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
@@ -18,7 +19,6 @@ void perf_regs_load(u64 *regs);
                       (1ULL << PERF_REG_X86_FS) | \
                       (1ULL << PERF_REG_X86_GS))
 #define PERF_REGS_MASK (((1ULL << PERF_REG_X86_64_MAX) - 1) & ~REG_NOSUPPORT)
-#define PERF_REGS_MAX PERF_REG_X86_64_MAX
 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
 #endif
 #define PERF_REG_IP PERF_REG_X86_IP
@@ -77,6 +77,28 @@ static inline const char *perf_reg_name(int id)
        case PERF_REG_X86_R15:
                return "R15";
 #endif /* HAVE_ARCH_X86_64_SUPPORT */
+
+#define XMM(x) \
+       case PERF_REG_X86_XMM ## x:     \
+       case PERF_REG_X86_XMM ## x + 1: \
+               return "XMM" #x;
+       XMM(0)
+       XMM(1)
+       XMM(2)
+       XMM(3)
+       XMM(4)
+       XMM(5)
+       XMM(6)
+       XMM(7)
+       XMM(8)
+       XMM(9)
+       XMM(10)
+       XMM(11)
+       XMM(12)
+       XMM(13)
+       XMM(14)
+       XMM(15)
+#undef XMM
        default:
                return NULL;
        }
index fead6b3..7886ca5 100644 (file)
@@ -31,6 +31,22 @@ const struct sample_reg sample_reg_masks[] = {
        SMPL_REG(R14, PERF_REG_X86_R14),
        SMPL_REG(R15, PERF_REG_X86_R15),
 #endif
+       SMPL_REG2(XMM0, PERF_REG_X86_XMM0),
+       SMPL_REG2(XMM1, PERF_REG_X86_XMM1),
+       SMPL_REG2(XMM2, PERF_REG_X86_XMM2),
+       SMPL_REG2(XMM3, PERF_REG_X86_XMM3),
+       SMPL_REG2(XMM4, PERF_REG_X86_XMM4),
+       SMPL_REG2(XMM5, PERF_REG_X86_XMM5),
+       SMPL_REG2(XMM6, PERF_REG_X86_XMM6),
+       SMPL_REG2(XMM7, PERF_REG_X86_XMM7),
+       SMPL_REG2(XMM8, PERF_REG_X86_XMM8),
+       SMPL_REG2(XMM9, PERF_REG_X86_XMM9),
+       SMPL_REG2(XMM10, PERF_REG_X86_XMM10),
+       SMPL_REG2(XMM11, PERF_REG_X86_XMM11),
+       SMPL_REG2(XMM12, PERF_REG_X86_XMM12),
+       SMPL_REG2(XMM13, PERF_REG_X86_XMM13),
+       SMPL_REG2(XMM14, PERF_REG_X86_XMM14),
+       SMPL_REG2(XMM15, PERF_REG_X86_XMM15),
        SMPL_REG_END
 };
 
@@ -254,3 +270,31 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op)
 
        return SDT_ARG_VALID;
 }
+
+uint64_t arch__intr_reg_mask(void)
+{
+       struct perf_event_attr attr = {
+               .type                   = PERF_TYPE_HARDWARE,
+               .config                 = PERF_COUNT_HW_CPU_CYCLES,
+               .sample_type            = PERF_SAMPLE_REGS_INTR,
+               .sample_regs_intr       = PERF_XMM_REGS_MASK,
+               .precise_ip             = 1,
+               .disabled               = 1,
+               .exclude_kernel         = 1,
+       };
+       int fd;
+       /*
+        * In an unnamed union, init it here to build on older gcc versions
+        */
+       attr.sample_period = 1;
+
+       event_attr_init(&attr);
+
+       fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
+       if (fd != -1) {
+               close(fd);
+               return (PERF_XMM_REGS_MASK | PERF_REGS_MASK);
+       }
+
+       return PERF_REGS_MASK;
+}
index 7fbca17..88c08ee 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
index 67f9d9f..77deb3a 100644 (file)
@@ -159,8 +159,6 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
        struct perf_evsel *evsel = iter->evsel;
        int err;
 
-       hist__account_cycles(sample->branch_stack, al, sample, false);
-
        bi = he->branch_info;
        err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
 
@@ -199,6 +197,8 @@ static int process_branch_callback(struct perf_evsel *evsel,
        if (a.map != NULL)
                a.map->dso->hit = 1;
 
+       hist__account_cycles(sample->branch_stack, al, sample, false);
+
        ret = hist_entry_iter__add(&iter, &a, PERF_MAX_STACK_DEPTH, ann);
        return ret;
 }
index 24086b7..8e0e06d 100644 (file)
@@ -837,6 +837,9 @@ int cmd_inject(int argc, const char **argv)
        if (inject.session == NULL)
                return -1;
 
+       if (zstd_init(&(inject.session->zstd_data), 0) < 0)
+               pr_warning("Decompression initialization failed.\n");
+
        if (inject.build_ids) {
                /*
                 * to make sure the mmap records are ordered correctly
@@ -867,6 +870,7 @@ int cmd_inject(int argc, const char **argv)
        ret = __cmd_inject(&inject);
 
 out_delete:
+       zstd_fini(&(inject.session->zstd_data));
        perf_session__delete(inject.session);
        return ret;
 }
index c5e1055..e2c3a58 100644 (file)
@@ -133,6 +133,11 @@ static int record__write(struct record *rec, struct perf_mmap *map __maybe_unuse
        return 0;
 }
 
+static int record__aio_enabled(struct record *rec);
+static int record__comp_enabled(struct record *rec);
+static size_t zstd_compress(struct perf_session *session, void *dst, size_t dst_size,
+                           void *src, size_t src_size);
+
 #ifdef HAVE_AIO_SUPPORT
 static int record__aio_write(struct aiocb *cblock, int trace_fd,
                void *buf, size_t size, off_t off)
@@ -183,9 +188,9 @@ static int record__aio_complete(struct perf_mmap *md, struct aiocb *cblock)
        if (rem_size == 0) {
                cblock->aio_fildes = -1;
                /*
-                * md->refcount is incremented in perf_mmap__push() for
-                * every enqueued aio write request so decrement it because
-                * the request is now complete.
+                * md->refcount is incremented in record__aio_pushfn() for
+                * every aio write request started in record__aio_push() so
+                * decrement it because the request is now complete.
                 */
                perf_mmap__put(md);
                rc = 1;
@@ -240,18 +245,89 @@ static int record__aio_sync(struct perf_mmap *md, bool sync_all)
        } while (1);
 }
 
-static int record__aio_pushfn(void *to, struct aiocb *cblock, void *bf, size_t size, off_t off)
+struct record_aio {
+       struct record   *rec;
+       void            *data;
+       size_t          size;
+};
+
+static int record__aio_pushfn(struct perf_mmap *map, void *to, void *buf, size_t size)
 {
-       struct record *rec = to;
-       int ret, trace_fd = rec->session->data->file.fd;
+       struct record_aio *aio = to;
 
-       rec->samples++;
+       /*
+        * map->base data pointed by buf is copied into free map->aio.data[] buffer
+        * to release space in the kernel buffer as fast as possible, calling
+        * perf_mmap__consume() from perf_mmap__push() function.
+        *
+        * That lets the kernel to proceed with storing more profiling data into
+        * the kernel buffer earlier than other per-cpu kernel buffers are handled.
+        *
+        * Coping can be done in two steps in case the chunk of profiling data
+        * crosses the upper bound of the kernel buffer. In this case we first move
+        * part of data from map->start till the upper bound and then the reminder
+        * from the beginning of the kernel buffer till the end of the data chunk.
+        */
+
+       if (record__comp_enabled(aio->rec)) {
+               size = zstd_compress(aio->rec->session, aio->data + aio->size,
+                                    perf_mmap__mmap_len(map) - aio->size,
+                                    buf, size);
+       } else {
+               memcpy(aio->data + aio->size, buf, size);
+       }
+
+       if (!aio->size) {
+               /*
+                * Increment map->refcount to guard map->aio.data[] buffer
+                * from premature deallocation because map object can be
+                * released earlier than aio write request started on
+                * map->aio.data[] buffer is complete.
+                *
+                * perf_mmap__put() is done at record__aio_complete()
+                * after started aio request completion or at record__aio_push()
+                * if the request failed to start.
+                */
+               perf_mmap__get(map);
+       }
+
+       aio->size += size;
+
+       return size;
+}
 
-       ret = record__aio_write(cblock, trace_fd, bf, size, off);
+static int record__aio_push(struct record *rec, struct perf_mmap *map, off_t *off)
+{
+       int ret, idx;
+       int trace_fd = rec->session->data->file.fd;
+       struct record_aio aio = { .rec = rec, .size = 0 };
+
+       /*
+        * Call record__aio_sync() to wait till map->aio.data[] buffer
+        * becomes available after previous aio write operation.
+        */
+
+       idx = record__aio_sync(map, false);
+       aio.data = map->aio.data[idx];
+       ret = perf_mmap__push(map, &aio, record__aio_pushfn);
+       if (ret != 0) /* ret > 0 - no data, ret < 0 - error */
+               return ret;
+
+       rec->samples++;
+       ret = record__aio_write(&(map->aio.cblocks[idx]), trace_fd, aio.data, aio.size, *off);
        if (!ret) {
-               rec->bytes_written += size;
+               *off += aio.size;
+               rec->bytes_written += aio.size;
                if (switch_output_size(rec))
                        trigger_hit(&switch_output_trigger);
+       } else {
+               /*
+                * Decrement map->refcount incremented in record__aio_pushfn()
+                * back if record__aio_write() operation failed to start, otherwise
+                * map->refcount is decremented in record__aio_complete() after
+                * aio write operation finishes successfully.
+                */
+               perf_mmap__put(map);
        }
 
        return ret;
@@ -273,7 +349,7 @@ static void record__aio_mmap_read_sync(struct record *rec)
        struct perf_evlist *evlist = rec->evlist;
        struct perf_mmap *maps = evlist->mmap;
 
-       if (!rec->opts.nr_cblocks)
+       if (!record__aio_enabled(rec))
                return;
 
        for (i = 0; i < evlist->nr_mmaps; i++) {
@@ -307,13 +383,8 @@ static int record__aio_parse(const struct option *opt,
 #else /* HAVE_AIO_SUPPORT */
 static int nr_cblocks_max = 0;
 
-static int record__aio_sync(struct perf_mmap *md __maybe_unused, bool sync_all __maybe_unused)
-{
-       return -1;
-}
-
-static int record__aio_pushfn(void *to __maybe_unused, struct aiocb *cblock __maybe_unused,
-               void *bf __maybe_unused, size_t size __maybe_unused, off_t off __maybe_unused)
+static int record__aio_push(struct record *rec __maybe_unused, struct perf_mmap *map __maybe_unused,
+                           off_t *off __maybe_unused)
 {
        return -1;
 }
@@ -372,6 +443,32 @@ static int record__mmap_flush_parse(const struct option *opt,
        return 0;
 }
 
+#ifdef HAVE_ZSTD_SUPPORT
+static unsigned int comp_level_default = 1;
+
+static int record__parse_comp_level(const struct option *opt, const char *str, int unset)
+{
+       struct record_opts *opts = opt->value;
+
+       if (unset) {
+               opts->comp_level = 0;
+       } else {
+               if (str)
+                       opts->comp_level = strtol(str, NULL, 0);
+               if (!opts->comp_level)
+                       opts->comp_level = comp_level_default;
+       }
+
+       return 0;
+}
+#endif
+static unsigned int comp_level_max = 22;
+
+static int record__comp_enabled(struct record *rec)
+{
+       return rec->opts.comp_level > 0;
+}
+
 static int process_synthesized_event(struct perf_tool *tool,
                                     union perf_event *event,
                                     struct perf_sample *sample __maybe_unused,
@@ -385,6 +482,11 @@ static int record__pushfn(struct perf_mmap *map, void *to, void *bf, size_t size
 {
        struct record *rec = to;
 
+       if (record__comp_enabled(rec)) {
+               size = zstd_compress(rec->session, map->data, perf_mmap__mmap_len(map), bf, size);
+               bf   = map->data;
+       }
+
        rec->samples++;
        return record__write(rec, map, bf, size);
 }
@@ -582,7 +684,7 @@ static int record__mmap_evlist(struct record *rec,
                                 opts->auxtrace_mmap_pages,
                                 opts->auxtrace_snapshot_mode,
                                 opts->nr_cblocks, opts->affinity,
-                                opts->mmap_flush) < 0) {
+                                opts->mmap_flush, opts->comp_level) < 0) {
                if (errno == EPERM) {
                        pr_err("Permission error mapping pages.\n"
                               "Consider increasing "
@@ -771,6 +873,37 @@ static void record__adjust_affinity(struct record *rec, struct perf_mmap *map)
        }
 }
 
+static size_t process_comp_header(void *record, size_t increment)
+{
+       struct compressed_event *event = record;
+       size_t size = sizeof(*event);
+
+       if (increment) {
+               event->header.size += increment;
+               return increment;
+       }
+
+       event->header.type = PERF_RECORD_COMPRESSED;
+       event->header.size = size;
+
+       return size;
+}
+
+static size_t zstd_compress(struct perf_session *session, void *dst, size_t dst_size,
+                           void *src, size_t src_size)
+{
+       size_t compressed;
+       size_t max_record_size = PERF_SAMPLE_MAX_SIZE - sizeof(struct compressed_event) - 1;
+
+       compressed = zstd_compress_stream_to_records(&session->zstd_data, dst, dst_size, src, src_size,
+                                                    max_record_size, process_comp_header);
+
+       session->bytes_transferred += src_size;
+       session->bytes_compressed  += compressed;
+
+       return compressed;
+}
+
 static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
                                    bool overwrite, bool synch)
 {
@@ -779,7 +912,7 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
        int rc = 0;
        struct perf_mmap *maps;
        int trace_fd = rec->data.file.fd;
-       off_t off;
+       off_t off = 0;
 
        if (!evlist)
                return 0;
@@ -805,20 +938,14 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
                                map->flush = 1;
                        }
                        if (!record__aio_enabled(rec)) {
-                               if (perf_mmap__push(map, rec, record__pushfn) != 0) {
+                               if (perf_mmap__push(map, rec, record__pushfn) < 0) {
                                        if (synch)
                                                map->flush = flush;
                                        rc = -1;
                                        goto out;
                                }
                        } else {
-                               int idx;
-                               /*
-                                * Call record__aio_sync() to wait till map->data buffer
-                                * becomes available after previous aio write request.
-                                */
-                               idx = record__aio_sync(map, false);
-                               if (perf_mmap__aio_push(map, rec, idx, record__aio_pushfn, &off) != 0) {
+                               if (record__aio_push(rec, map, &off) < 0) {
                                        record__aio_set_pos(trace_fd, off);
                                        if (synch)
                                                map->flush = flush;
@@ -888,6 +1015,8 @@ static void record__init_features(struct record *rec)
                perf_header__clear_feat(&session->header, HEADER_CLOCKID);
 
        perf_header__clear_feat(&session->header, HEADER_DIR_FORMAT);
+       if (!record__comp_enabled(rec))
+               perf_header__clear_feat(&session->header, HEADER_COMPRESSED);
 
        perf_header__clear_feat(&session->header, HEADER_STAT);
 }
@@ -1186,6 +1315,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
        bool disabled = false, draining = false;
        struct perf_evlist *sb_evlist = NULL;
        int fd;
+       float ratio = 0;
 
        atexit(record__sig_exit);
        signal(SIGCHLD, sig_handler);
@@ -1215,6 +1345,14 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
        fd = perf_data__fd(data);
        rec->session = session;
 
+       if (zstd_init(&session->zstd_data, rec->opts.comp_level) < 0) {
+               pr_err("Compression initialization failed.\n");
+               return -1;
+       }
+
+       session->header.env.comp_type  = PERF_COMP_ZSTD;
+       session->header.env.comp_level = rec->opts.comp_level;
+
        record__init_features(rec);
 
        if (rec->opts.use_clockid && rec->opts.clockid_res_ns)
@@ -1244,6 +1382,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
                err = -1;
                goto out_child;
        }
+       session->header.env.comp_mmap_len = session->evlist->mmap_len;
 
        err = bpf__apply_obj_config();
        if (err) {
@@ -1491,6 +1630,11 @@ out_child:
        record__mmap_read_all(rec, true);
        record__aio_mmap_read_sync(rec);
 
+       if (rec->session->bytes_transferred && rec->session->bytes_compressed) {
+               ratio = (float)rec->session->bytes_transferred/(float)rec->session->bytes_compressed;
+               session->header.env.comp_ratio = ratio + 0.5;
+       }
+
        if (forks) {
                int exit_status;
 
@@ -1537,12 +1681,19 @@ out_child:
                else
                        samples[0] = '\0';
 
-               fprintf(stderr, "[ perf record: Captured and wrote %.3f MB %s%s%s ]\n",
+               fprintf(stderr, "[ perf record: Captured and wrote %.3f MB %s%s%s",
                        perf_data__size(data) / 1024.0 / 1024.0,
                        data->path, postfix, samples);
+               if (ratio) {
+                       fprintf(stderr, ", compressed (original %.3f MB, ratio is %.3f)",
+                                       rec->session->bytes_transferred / 1024.0 / 1024.0,
+                                       ratio);
+               }
+               fprintf(stderr, " ]\n");
        }
 
 out_delete_session:
+       zstd_fini(&session->zstd_data);
        perf_session__delete(session);
 
        if (!opts->no_bpf_event)
@@ -2017,10 +2168,10 @@ static struct option __record_options[] = {
                    "use per-thread mmaps"),
        OPT_CALLBACK_OPTARG('I', "intr-regs", &record.opts.sample_intr_regs, NULL, "any register",
                    "sample selected machine registers on interrupt,"
-                   " use -I ? to list register names", parse_regs),
+                   " use '-I?' to list register names", parse_intr_regs),
        OPT_CALLBACK_OPTARG(0, "user-regs", &record.opts.sample_user_regs, NULL, "any register",
                    "sample selected machine registers on interrupt,"
-                   " use -I ? to list register names", parse_regs),
+                   " use '--user-regs=?' to list register names", parse_user_regs),
        OPT_BOOLEAN(0, "running-time", &record.opts.running_time,
                    "Record running/enabled time of read (:S) events"),
        OPT_CALLBACK('k', "clockid", &record.opts,
@@ -2068,6 +2219,11 @@ static struct option __record_options[] = {
        OPT_CALLBACK(0, "affinity", &record.opts, "node|cpu",
                     "Set affinity mask of trace reading thread to NUMA node cpu mask or cpu of processed mmap buffer",
                     record__parse_affinity),
+#ifdef HAVE_ZSTD_SUPPORT
+       OPT_CALLBACK_OPTARG('z', "compression-level", &record.opts, &comp_level_default,
+                           "n", "Compressed records using specified level (default: 1 - fastest compression, 22 - greatest compression)",
+                           record__parse_comp_level),
+#endif
        OPT_END()
 };
 
@@ -2127,6 +2283,12 @@ int cmd_record(int argc, const char **argv)
                        "cgroup monitoring only available in system-wide mode");
 
        }
+
+       if (rec->opts.comp_level != 0) {
+               pr_debug("Compression enabled, disabling build id collection at the end of the session.\n");
+               rec->no_buildid = true;
+       }
+
        if (rec->opts.record_switch_events &&
            !perf_can_record_switch_events()) {
                ui__error("kernel does not support recording context switch events\n");
@@ -2272,12 +2434,15 @@ int cmd_record(int argc, const char **argv)
 
        if (rec->opts.nr_cblocks > nr_cblocks_max)
                rec->opts.nr_cblocks = nr_cblocks_max;
-       if (verbose > 0)
-               pr_info("nr_cblocks: %d\n", rec->opts.nr_cblocks);
+       pr_debug("nr_cblocks: %d\n", rec->opts.nr_cblocks);
 
        pr_debug("affinity: %s\n", affinity_tags[rec->opts.affinity]);
        pr_debug("mmap flush: %d\n", rec->opts.mmap_flush);
 
+       if (rec->opts.comp_level > comp_level_max)
+               rec->opts.comp_level = comp_level_max;
+       pr_debug("comp level: %d\n", rec->opts.comp_level);
+
        err = __cmd_record(&record, argc, argv);
 out:
        perf_evlist__delete(rec->evlist);
index 4054eb1..1ca533f 100644 (file)
@@ -136,9 +136,6 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
        if (!ui__has_annotation() && !rep->symbol_ipc)
                return 0;
 
-       hist__account_cycles(sample->branch_stack, al, sample,
-                            rep->nonany_branch_mode);
-
        if (sort__mode == SORT_MODE__BRANCH) {
                bi = he->branch_info;
                err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
@@ -181,9 +178,6 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
        if (!ui__has_annotation() && !rep->symbol_ipc)
                return 0;
 
-       hist__account_cycles(sample->branch_stack, al, sample,
-                            rep->nonany_branch_mode);
-
        bi = he->branch_info;
        err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
        if (err)
@@ -282,6 +276,11 @@ static int process_sample_event(struct perf_tool *tool,
        if (al.map != NULL)
                al.map->dso->hit = 1;
 
+       if (ui__has_annotation() || rep->symbol_ipc) {
+               hist__account_cycles(sample->branch_stack, &al, sample,
+                                    rep->nonany_branch_mode);
+       }
+
        ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep);
        if (ret < 0)
                pr_debug("problem adding hist entry, skipping event\n");
@@ -1259,6 +1258,9 @@ repeat:
        if (session == NULL)
                return -1;
 
+       if (zstd_init(&(session->zstd_data), 0) < 0)
+               pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");
+
        if (report.queue_size) {
                ordered_events__set_alloc_size(&session->ordered_events,
                                               report.queue_size);
@@ -1449,7 +1451,7 @@ repeat:
 error:
        if (report.ptime_range)
                zfree(&report.ptime_range);
-
+       zstd_fini(&(session->zstd_data));
        perf_session__delete(session);
        return ret;
 }
index a3c0608..24b8e69 100644 (file)
@@ -847,6 +847,18 @@ static int perf_stat__get_core_cached(struct perf_stat_config *config,
        return perf_stat__get_aggr(config, perf_stat__get_core, map, idx);
 }
 
+static bool term_percore_set(void)
+{
+       struct perf_evsel *counter;
+
+       evlist__for_each_entry(evsel_list, counter) {
+               if (counter->percore)
+                       return true;
+       }
+
+       return false;
+}
+
 static int perf_stat_init_aggr_mode(void)
 {
        int nr;
@@ -867,6 +879,15 @@ static int perf_stat_init_aggr_mode(void)
                stat_config.aggr_get_id = perf_stat__get_core_cached;
                break;
        case AGGR_NONE:
+               if (term_percore_set()) {
+                       if (cpu_map__build_core_map(evsel_list->cpus,
+                                                   &stat_config.aggr_map)) {
+                               perror("cannot build core map");
+                               return -1;
+                       }
+                       stat_config.aggr_get_id = perf_stat__get_core_cached;
+               }
+               break;
        case AGGR_GLOBAL:
        case AGGR_THREAD:
        case AGGR_UNSET:
index 369eae6..d59dee6 100644 (file)
@@ -86,6 +86,7 @@ struct record_opts {
        int          nr_cblocks;
        int          affinity;
        int          mmap_flush;
+       unsigned int comp_level;
 };
 
 enum perf_affinity {
diff --git a/tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json b/tools/perf/pmu-events/arch/arm64/arm/cortex-a57-a72/core-imp-def.json
new file mode 100644 (file)
index 0000000..0ac9b79
--- /dev/null
@@ -0,0 +1,179 @@
+[
+    {
+        "ArchStdEvent": "L1D_CACHE_RD",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_WR",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_REFILL_RD",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_REFILL_WR",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_WB_VICTIM",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_WB_CLEAN",
+    },
+    {
+        "ArchStdEvent": "L1D_CACHE_INVAL",
+    },
+    {
+        "ArchStdEvent": "L1D_TLB_REFILL_RD",
+    },
+    {
+        "ArchStdEvent": "L1D_TLB_REFILL_WR",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_RD",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_WR",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_REFILL_RD",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_REFILL_WR",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_WB_VICTIM",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_WB_CLEAN",
+    },
+    {
+        "ArchStdEvent": "L2D_CACHE_INVAL",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NOT_SHARED",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_NORMAL",
+    },
+    {
+        "ArchStdEvent": "BUS_ACCESS_PERIPH",
+    },
+    {
+        "ArchStdEvent": "MEM_ACCESS_RD",
+    },
+    {
+        "ArchStdEvent": "MEM_ACCESS_WR",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_LD_SPEC",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_ST_SPEC",
+    },
+    {
+        "ArchStdEvent": "UNALIGNED_LDST_SPEC",
+    },
+    {
+        "ArchStdEvent": "LDREX_SPEC",
+    },
+    {
+        "ArchStdEvent": "STREX_PASS_SPEC",
+    },
+    {
+        "ArchStdEvent": "STREX_FAIL_SPEC",
+    },
+    {
+        "ArchStdEvent": "LD_SPEC",
+    },
+    {
+        "ArchStdEvent": "ST_SPEC",
+    },
+    {
+        "ArchStdEvent": "LDST_SPEC",
+    },
+    {
+        "ArchStdEvent": "DP_SPEC",
+    },
+    {
+        "ArchStdEvent": "ASE_SPEC",
+    },
+    {
+        "ArchStdEvent": "VFP_SPEC",
+    },
+    {
+        "ArchStdEvent": "PC_WRITE_SPEC",
+    },
+    {
+        "ArchStdEvent": "CRYPTO_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_IMMED_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_RETURN_SPEC",
+    },
+    {
+        "ArchStdEvent": "BR_INDIRECT_SPEC",
+    },
+    {
+        "ArchStdEvent": "ISB_SPEC",
+    },
+    {
+        "ArchStdEvent": "DSB_SPEC",
+    },
+    {
+        "ArchStdEvent": "DMB_SPEC",
+    },
+    {
+        "ArchStdEvent": "EXC_UNDEF",
+    },
+    {
+        "ArchStdEvent": "EXC_SVC",
+    },
+    {
+        "ArchStdEvent": "EXC_PABORT",
+    },
+    {
+        "ArchStdEvent": "EXC_DABORT",
+    },
+    {
+        "ArchStdEvent": "EXC_IRQ",
+    },
+    {
+        "ArchStdEvent": "EXC_FIQ",
+    },
+    {
+        "ArchStdEvent": "EXC_SMC",
+    },
+    {
+        "ArchStdEvent": "EXC_HVC",
+    },
+    {
+        "ArchStdEvent": "EXC_TRAP_PABORT",
+    },
+    {
+        "ArchStdEvent": "EXC_TRAP_DABORT",
+    },
+    {
+        "ArchStdEvent": "EXC_TRAP_OTHER",
+    },
+    {
+        "ArchStdEvent": "EXC_TRAP_IRQ",
+    },
+    {
+        "ArchStdEvent": "EXC_TRAP_FIQ",
+    },
+    {
+        "ArchStdEvent": "RC_LD_SPEC",
+    },
+    {
+        "ArchStdEvent": "RC_ST_SPEC",
+    },
+]
index 59cd860..927fcdd 100644 (file)
 #
 #
 #Family-model,Version,Filename,EventType
-0x00000000410fd03[[:xdigit:]],v1,arm/cortex-a53,core
+0x00000000410fd030,v1,arm/cortex-a53,core
+0x00000000420f1000,v1,arm/cortex-a53,core
+0x00000000410fd070,v1,arm/cortex-a57-a72,core
+0x00000000410fd080,v1,arm/cortex-a57-a72,core
 0x00000000420f5160,v1,cavium/thunderx2,core
 0x00000000430f0af0,v1,cavium/thunderx2,core
 0x00000000480fd010,v1,hisilicon/hip08,core
index 68c92bb..58f77fd 100644 (file)
@@ -235,6 +235,7 @@ static struct map {
        { "iMPH-U", "uncore_arb" },
        { "CPU-M-CF", "cpum_cf" },
        { "CPU-M-SF", "cpum_sf" },
+       { "UPI LL", "uncore_upi" },
        {}
 };
 
@@ -414,7 +415,6 @@ static int save_arch_std_events(void *data, char *name, char *event,
                                char *metric_name, char *metric_group)
 {
        struct event_struct *es;
-       struct stat *sb = data;
 
        es = malloc(sizeof(*es));
        if (!es)
index 74ef92f..affed7d 100755 (executable)
@@ -456,6 +456,10 @@ class CallGraphLevelItemBase(object):
                self.query_done = False;
                self.child_count = 0
                self.child_items = []
+               if parent_item:
+                       self.level = parent_item.level + 1
+               else:
+                       self.level = 0
 
        def getChildItem(self, row):
                return self.child_items[row]
@@ -877,9 +881,14 @@ class TreeWindowBase(QMdiSubWindow):
                super(TreeWindowBase, self).__init__(parent)
 
                self.model = None
-               self.view = None
                self.find_bar = None
 
+               self.view = QTreeView()
+               self.view.setSelectionMode(QAbstractItemView.ContiguousSelection)
+               self.view.CopyCellsToClipboard = CopyTreeCellsToClipboard
+
+               self.context_menu = TreeContextMenu(self.view)
+
        def DisplayFound(self, ids):
                if not len(ids):
                        return False
@@ -921,7 +930,6 @@ class CallGraphWindow(TreeWindowBase):
 
                self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x))
 
-               self.view = QTreeView()
                self.view.setModel(self.model)
 
                for c, w in ((0, 250), (1, 100), (2, 60), (3, 70), (4, 70), (5, 100)):
@@ -944,7 +952,6 @@ class CallTreeWindow(TreeWindowBase):
 
                self.model = LookupCreateModel("Call Tree", lambda x=glb: CallTreeModel(x))
 
-               self.view = QTreeView()
                self.view.setModel(self.model)
 
                for c, w in ((0, 230), (1, 100), (2, 100), (3, 70), (4, 70), (5, 100)):
@@ -1649,10 +1656,14 @@ class BranchWindow(QMdiSubWindow):
 
                self.view = QTreeView()
                self.view.setUniformRowHeights(True)
+               self.view.setSelectionMode(QAbstractItemView.ContiguousSelection)
+               self.view.CopyCellsToClipboard = CopyTreeCellsToClipboard
                self.view.setModel(self.model)
 
                self.ResizeColumnsToContents()
 
+               self.context_menu = TreeContextMenu(self.view)
+
                self.find_bar = FindBar(self, self, True)
 
                self.finder = ChildDataItemFinder(self.model.root)
@@ -2261,6 +2272,240 @@ class ResizeColumnsToContentsBase(QObject):
                self.data_model.rowsInserted.disconnect(self.UpdateColumnWidths)
                self.ResizeColumnsToContents()
 
+# Convert value to CSV
+
+def ToCSValue(val):
+       if '"' in val:
+               val = val.replace('"', '""')
+       if "," in val or '"' in val:
+               val = '"' + val + '"'
+       return val
+
+# Key to sort table model indexes by row / column, assuming fewer than 1000 columns
+
+glb_max_cols = 1000
+
+def RowColumnKey(a):
+       return a.row() * glb_max_cols + a.column()
+
+# Copy selected table cells to clipboard
+
+def CopyTableCellsToClipboard(view, as_csv=False, with_hdr=False):
+       indexes = sorted(view.selectedIndexes(), key=RowColumnKey)
+       idx_cnt = len(indexes)
+       if not idx_cnt:
+               return
+       if idx_cnt == 1:
+               with_hdr=False
+       min_row = indexes[0].row()
+       max_row = indexes[0].row()
+       min_col = indexes[0].column()
+       max_col = indexes[0].column()
+       for i in indexes:
+               min_row = min(min_row, i.row())
+               max_row = max(max_row, i.row())
+               min_col = min(min_col, i.column())
+               max_col = max(max_col, i.column())
+       if max_col > glb_max_cols:
+               raise RuntimeError("glb_max_cols is too low")
+       max_width = [0] * (1 + max_col - min_col)
+       for i in indexes:
+               c = i.column() - min_col
+               max_width[c] = max(max_width[c], len(str(i.data())))
+       text = ""
+       pad = ""
+       sep = ""
+       if with_hdr:
+               model = indexes[0].model()
+               for col in range(min_col, max_col + 1):
+                       val = model.headerData(col, Qt.Horizontal)
+                       if as_csv:
+                               text += sep + ToCSValue(val)
+                               sep = ","
+                       else:
+                               c = col - min_col
+                               max_width[c] = max(max_width[c], len(val))
+                               width = max_width[c]
+                               align = model.headerData(col, Qt.Horizontal, Qt.TextAlignmentRole)
+                               if align & Qt.AlignRight:
+                                       val = val.rjust(width)
+                               text += pad + sep + val
+                               pad = " " * (width - len(val))
+                               sep = "  "
+               text += "\n"
+               pad = ""
+               sep = ""
+       last_row = min_row
+       for i in indexes:
+               if i.row() > last_row:
+                       last_row = i.row()
+                       text += "\n"
+                       pad = ""
+                       sep = ""
+               if as_csv:
+                       text += sep + ToCSValue(str(i.data()))
+                       sep = ","
+               else:
+                       width = max_width[i.column() - min_col]
+                       if i.data(Qt.TextAlignmentRole) & Qt.AlignRight:
+                               val = str(i.data()).rjust(width)
+                       else:
+                               val = str(i.data())
+                       text += pad + sep + val
+                       pad = " " * (width - len(val))
+                       sep = "  "
+       QApplication.clipboard().setText(text)
+
+def CopyTreeCellsToClipboard(view, as_csv=False, with_hdr=False):
+       indexes = view.selectedIndexes()
+       if not len(indexes):
+               return
+
+       selection = view.selectionModel()
+
+       first = None
+       for i in indexes:
+               above = view.indexAbove(i)
+               if not selection.isSelected(above):
+                       first = i
+                       break
+
+       if first is None:
+               raise RuntimeError("CopyTreeCellsToClipboard internal error")
+
+       model = first.model()
+       row_cnt = 0
+       col_cnt = model.columnCount(first)
+       max_width = [0] * col_cnt
+
+       indent_sz = 2
+       indent_str = " " * indent_sz
+
+       expanded_mark_sz = 2
+       if sys.version_info[0] == 3:
+               expanded_mark = "\u25BC "
+               not_expanded_mark = "\u25B6 "
+       else:
+               expanded_mark = unicode(chr(0xE2) + chr(0x96) + chr(0xBC) + " ", "utf-8")
+               not_expanded_mark =  unicode(chr(0xE2) + chr(0x96) + chr(0xB6) + " ", "utf-8")
+       leaf_mark = "  "
+
+       if not as_csv:
+               pos = first
+               while True:
+                       row_cnt += 1
+                       row = pos.row()
+                       for c in range(col_cnt):
+                               i = pos.sibling(row, c)
+                               if c:
+                                       n = len(str(i.data()))
+                               else:
+                                       n = len(str(i.data()).strip())
+                                       n += (i.internalPointer().level - 1) * indent_sz
+                                       n += expanded_mark_sz
+                               max_width[c] = max(max_width[c], n)
+                       pos = view.indexBelow(pos)
+                       if not selection.isSelected(pos):
+                               break
+
+       text = ""
+       pad = ""
+       sep = ""
+       if with_hdr:
+               for c in range(col_cnt):
+                       val = model.headerData(c, Qt.Horizontal, Qt.DisplayRole).strip()
+                       if as_csv:
+                               text += sep + ToCSValue(val)
+                               sep = ","
+                       else:
+                               max_width[c] = max(max_width[c], len(val))
+                               width = max_width[c]
+                               align = model.headerData(c, Qt.Horizontal, Qt.TextAlignmentRole)
+                               if align & Qt.AlignRight:
+                                       val = val.rjust(width)
+                               text += pad + sep + val
+                               pad = " " * (width - len(val))
+                               sep = "   "
+               text += "\n"
+               pad = ""
+               sep = ""
+
+       pos = first
+       while True:
+               row = pos.row()
+               for c in range(col_cnt):
+                       i = pos.sibling(row, c)
+                       val = str(i.data())
+                       if not c:
+                               if model.hasChildren(i):
+                                       if view.isExpanded(i):
+                                               mark = expanded_mark
+                                       else:
+                                               mark = not_expanded_mark
+                               else:
+                                       mark = leaf_mark
+                               val = indent_str * (i.internalPointer().level - 1) + mark + val.strip()
+                       if as_csv:
+                               text += sep + ToCSValue(val)
+                               sep = ","
+                       else:
+                               width = max_width[c]
+                               if c and i.data(Qt.TextAlignmentRole) & Qt.AlignRight:
+                                       val = val.rjust(width)
+                               text += pad + sep + val
+                               pad = " " * (width - len(val))
+                               sep = "   "
+               pos = view.indexBelow(pos)
+               if not selection.isSelected(pos):
+                       break
+               text = text.rstrip() + "\n"
+               pad = ""
+               sep = ""
+
+       QApplication.clipboard().setText(text)
+
+def CopyCellsToClipboard(view, as_csv=False, with_hdr=False):
+       view.CopyCellsToClipboard(view, as_csv, with_hdr)
+
+def CopyCellsToClipboardHdr(view):
+       CopyCellsToClipboard(view, False, True)
+
+def CopyCellsToClipboardCSV(view):
+       CopyCellsToClipboard(view, True, True)
+
+# Context menu
+
+class ContextMenu(object):
+
+       def __init__(self, view):
+               self.view = view
+               self.view.setContextMenuPolicy(Qt.CustomContextMenu)
+               self.view.customContextMenuRequested.connect(self.ShowContextMenu)
+
+       def ShowContextMenu(self, pos):
+               menu = QMenu(self.view)
+               self.AddActions(menu)
+               menu.exec_(self.view.mapToGlobal(pos))
+
+       def AddCopy(self, menu):
+               menu.addAction(CreateAction("&Copy selection", "Copy to clipboard", lambda: CopyCellsToClipboardHdr(self.view), self.view))
+               menu.addAction(CreateAction("Copy selection as CS&V", "Copy to clipboard as CSV", lambda: CopyCellsToClipboardCSV(self.view), self.view))
+
+       def AddActions(self, menu):
+               self.AddCopy(menu)
+
+class TreeContextMenu(ContextMenu):
+
+       def __init__(self, view):
+               super(TreeContextMenu, self).__init__(view)
+
+       def AddActions(self, menu):
+               i = self.view.currentIndex()
+               text = str(i.data()).strip()
+               if len(text):
+                       menu.addAction(CreateAction('Copy "' + text + '"', "Copy to clipboard", lambda: QApplication.clipboard().setText(text), self.view))
+               self.AddCopy(menu)
+
 # Table window
 
 class TableWindow(QMdiSubWindow, ResizeColumnsToContentsBase):
@@ -2279,9 +2524,13 @@ class TableWindow(QMdiSubWindow, ResizeColumnsToContentsBase):
                self.view.verticalHeader().setVisible(False)
                self.view.sortByColumn(-1, Qt.AscendingOrder)
                self.view.setSortingEnabled(True)
+               self.view.setSelectionMode(QAbstractItemView.ContiguousSelection)
+               self.view.CopyCellsToClipboard = CopyTableCellsToClipboard
 
                self.ResizeColumnsToContents()
 
+               self.context_menu = ContextMenu(self.view)
+
                self.find_bar = FindBar(self, self, True)
 
                self.finder = ChildDataItemFinder(self.data_model)
@@ -2395,6 +2644,10 @@ class TopCallsWindow(QMdiSubWindow, ResizeColumnsToContentsBase):
                self.view.setModel(self.model)
                self.view.setEditTriggers(QAbstractItemView.NoEditTriggers)
                self.view.verticalHeader().setVisible(False)
+               self.view.setSelectionMode(QAbstractItemView.ContiguousSelection)
+               self.view.CopyCellsToClipboard = CopyTableCellsToClipboard
+
+               self.context_menu = ContextMenu(self.view)
 
                self.ResizeColumnsToContents()
 
@@ -2660,6 +2913,60 @@ class HelpOnlyWindow(QMainWindow):
 
                self.setCentralWidget(self.text)
 
+# PostqreSQL server version
+
+def PostqreSQLServerVersion(db):
+       query = QSqlQuery(db)
+       QueryExec(query, "SELECT VERSION()")
+       if query.next():
+               v_str = query.value(0)
+               v_list = v_str.strip().split(" ")
+               if v_list[0] == "PostgreSQL" and v_list[2] == "on":
+                       return v_list[1]
+               return v_str
+       return "Unknown"
+
+# SQLite version
+
+def SQLiteVersion(db):
+       query = QSqlQuery(db)
+       QueryExec(query, "SELECT sqlite_version()")
+       if query.next():
+               return query.value(0)
+       return "Unknown"
+
+# About dialog
+
+class AboutDialog(QDialog):
+
+       def __init__(self, glb, parent=None):
+               super(AboutDialog, self).__init__(parent)
+
+               self.setWindowTitle("About Exported SQL Viewer")
+               self.setMinimumWidth(300)
+
+               pyside_version = "1" if pyside_version_1 else "2"
+
+               text = "<pre>"
+               text += "Python version:     " + sys.version.split(" ")[0] + "\n"
+               text += "PySide version:     " + pyside_version + "\n"
+               text += "Qt version:         " + qVersion() + "\n"
+               if glb.dbref.is_sqlite3:
+                       text += "SQLite version:     " + SQLiteVersion(glb.db) + "\n"
+               else:
+                       text += "PostqreSQL version: " + PostqreSQLServerVersion(glb.db) + "\n"
+               text += "</pre>"
+
+               self.text = QTextBrowser()
+               self.text.setHtml(text)
+               self.text.setReadOnly(True)
+               self.text.setOpenExternalLinks(True)
+
+               self.vbox = QVBoxLayout()
+               self.vbox.addWidget(self.text)
+
+               self.setLayout(self.vbox);
+
 # Font resize
 
 def ResizeFont(widget, diff):
@@ -2732,6 +3039,8 @@ class MainWindow(QMainWindow):
                file_menu.addAction(CreateExitAction(glb.app, self))
 
                edit_menu = menu.addMenu("&Edit")
+               edit_menu.addAction(CreateAction("&Copy", "Copy to clipboard", self.CopyToClipboard, self, QKeySequence.Copy))
+               edit_menu.addAction(CreateAction("Copy as CS&V", "Copy to clipboard as CSV", self.CopyToClipboardCSV, self))
                edit_menu.addAction(CreateAction("&Find...", "Find items", self.Find, self, QKeySequence.Find))
                edit_menu.addAction(CreateAction("Fetch &more records...", "Fetch more records", self.FetchMoreRecords, self, [QKeySequence(Qt.Key_F8)]))
                edit_menu.addAction(CreateAction("&Shrink Font", "Make text smaller", self.ShrinkFont, self, [QKeySequence("Ctrl+-")]))
@@ -2755,6 +3064,21 @@ class MainWindow(QMainWindow):
 
                help_menu = menu.addMenu("&Help")
                help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))
+               help_menu.addAction(CreateAction("&About Exported SQL Viewer", "About this application", self.About, self))
+
+       def Try(self, fn):
+               win = self.mdi_area.activeSubWindow()
+               if win:
+                       try:
+                               fn(win.view)
+                       except:
+                               pass
+
+       def CopyToClipboard(self):
+               self.Try(CopyCellsToClipboardHdr)
+
+       def CopyToClipboardCSV(self):
+               self.Try(CopyCellsToClipboardCSV)
 
        def Find(self):
                win = self.mdi_area.activeSubWindow()
@@ -2773,12 +3097,10 @@ class MainWindow(QMainWindow):
                                pass
 
        def ShrinkFont(self):
-               win = self.mdi_area.activeSubWindow()
-               ShrinkFont(win.view)
+               self.Try(ShrinkFont)
 
        def EnlargeFont(self):
-               win = self.mdi_area.activeSubWindow()
-               EnlargeFont(win.view)
+               self.Try(EnlargeFont)
 
        def EventMenu(self, events, reports_menu):
                branches_events = 0
@@ -2828,6 +3150,10 @@ class MainWindow(QMainWindow):
        def Help(self):
                HelpWindow(self.glb, self)
 
+       def About(self):
+               dialog = AboutDialog(self.glb, self)
+               dialog.exec_()
+
 # XED Disassembler
 
 class xed_state_t(Structure):
index 7f6c520..946ab4b 100644 (file)
@@ -304,7 +304,7 @@ int test__dso_data_cache(struct test *test __maybe_unused, int subtest __maybe_u
        /* Make sure we did not leak any file descriptor. */
        nr_end = open_files_cnt();
        pr_debug("nr start %ld, nr stop %ld\n", nr, nr_end);
-       TEST_ASSERT_VAL("failed leadking files", nr == nr_end);
+       TEST_ASSERT_VAL("failed leaking files", nr == nr_end);
        return 0;
 }
 
@@ -380,6 +380,6 @@ int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_
        /* Make sure we did not leak any file descriptor. */
        nr_end = open_files_cnt();
        pr_debug("nr start %ld, nr stop %ld\n", nr, nr_end);
-       TEST_ASSERT_VAL("failed leadking files", nr == nr_end);
+       TEST_ASSERT_VAL("failed leaking files", nr == nr_end);
        return 0;
 }
index e467235..5363a12 100644 (file)
@@ -107,7 +107,7 @@ make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
 make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
 make_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
 make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
-make_minimal        += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
+make_minimal        += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
 
 # $(run) contains all available tests
 run := make_pure
diff --git a/tools/perf/tests/shell/record+zstd_comp_decomp.sh b/tools/perf/tests/shell/record+zstd_comp_decomp.sh
new file mode 100755 (executable)
index 0000000..5dcba80
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Zstd perf.data compression/decompression
+
+trace_file=$(mktemp /tmp/perf.data.XXX)
+perf_tool=perf
+
+skip_if_no_z_record() {
+       $perf_tool record -h 2>&1 | grep -q '\-z, \-\-compression\-level'
+}
+
+collect_z_record() {
+       echo "Collecting compressed record file:"
+       $perf_tool record -o $trace_file -g -z -F 5000 -- \
+               dd count=500 if=/dev/random of=/dev/null
+}
+
+check_compressed_stats() {
+       echo "Checking compressed events stats:"
+       $perf_tool report -i $trace_file --header --stats | \
+               grep -E "(# compressed : Zstd,)|(COMPRESSED events:)"
+}
+
+check_compressed_output() {
+       $perf_tool inject -i $trace_file -o $trace_file.decomp &&
+       $perf_tool report -i $trace_file --stdio | head -n -3 > $trace_file.comp.output &&
+       $perf_tool report -i $trace_file.decomp --stdio | head -n -3 > $trace_file.decomp.output &&
+       diff $trace_file.comp.output $trace_file.decomp.output
+}
+
+skip_if_no_z_record || exit 2
+collect_z_record && check_compressed_stats && check_compressed_output
+err=$?
+rm -f $trace_file*
+exit $err
index 8dd3102..6d5bbc8 100644 (file)
@@ -145,6 +145,8 @@ perf-y += scripting-engines/
 
 perf-$(CONFIG_ZLIB) += zlib.o
 perf-$(CONFIG_LZMA) += lzma.o
+perf-$(CONFIG_ZSTD) += zstd.o
+
 perf-y += demangle-java.o
 perf-y += demangle-rust.o
 
index 0976298..0b8573f 100644 (file)
@@ -1021,7 +1021,7 @@ static void annotation__count_and_fill(struct annotation *notes, u64 start, u64
                float ipc = n_insn / ((double)ch->cycles / (double)ch->num);
 
                /* Hide data when there are too many overlaps. */
-               if (ch->reset >= 0x7fff || ch->reset >= ch->num / 2)
+               if (ch->reset >= 0x7fff)
                        return;
 
                for (offset = start; offset <= end; offset++) {
index 892e92e..0cd3369 100644 (file)
@@ -2,6 +2,11 @@
 #ifndef PERF_COMPRESS_H
 #define PERF_COMPRESS_H
 
+#include <stdbool.h>
+#ifdef HAVE_ZSTD_SUPPORT
+#include <zstd.h>
+#endif
+
 #ifdef HAVE_ZLIB_SUPPORT
 int gzip_decompress_to_file(const char *input, int output_fd);
 bool gzip_is_compressed(const char *input);
@@ -12,4 +17,52 @@ int lzma_decompress_to_file(const char *input, int output_fd);
 bool lzma_is_compressed(const char *input);
 #endif
 
+struct zstd_data {
+#ifdef HAVE_ZSTD_SUPPORT
+       ZSTD_CStream    *cstream;
+       ZSTD_DStream    *dstream;
+#endif
+};
+
+#ifdef HAVE_ZSTD_SUPPORT
+
+int zstd_init(struct zstd_data *data, int level);
+int zstd_fini(struct zstd_data *data);
+
+size_t zstd_compress_stream_to_records(struct zstd_data *data, void *dst, size_t dst_size,
+                                      void *src, size_t src_size, size_t max_record_size,
+                                      size_t process_header(void *record, size_t increment));
+
+size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size,
+                             void *dst, size_t dst_size);
+#else /* !HAVE_ZSTD_SUPPORT */
+
+static inline int zstd_init(struct zstd_data *data __maybe_unused, int level __maybe_unused)
+{
+       return 0;
+}
+
+static inline int zstd_fini(struct zstd_data *data __maybe_unused)
+{
+       return 0;
+}
+
+static inline
+size_t zstd_compress_stream_to_records(struct zstd_data *data __maybe_unused,
+                                      void *dst __maybe_unused, size_t dst_size __maybe_unused,
+                                      void *src __maybe_unused, size_t src_size __maybe_unused,
+                                      size_t max_record_size __maybe_unused,
+                                      size_t process_header(void *record, size_t increment) __maybe_unused)
+{
+       return 0;
+}
+
+static inline size_t zstd_decompress_stream(struct zstd_data *data __maybe_unused, void *src __maybe_unused,
+                                           size_t src_size __maybe_unused, void *dst __maybe_unused,
+                                           size_t dst_size __maybe_unused)
+{
+       return 0;
+}
+#endif
+
 #endif /* PERF_COMPRESS_H */
index 4f8e2b4..271a90b 100644 (file)
@@ -62,6 +62,11 @@ struct perf_env {
        struct cpu_topology_map *cpu;
        struct cpu_cache_level  *caches;
        int                      caches_cnt;
+       u32                     comp_ratio;
+       u32                     comp_ver;
+       u32                     comp_type;
+       u32                     comp_level;
+       u32                     comp_mmap_len;
        struct numa_node        *numa_nodes;
        struct memory_node      *memory_nodes;
        unsigned long long       memory_bsize;
@@ -80,6 +85,12 @@ struct perf_env {
        } bpf_progs;
 };
 
+enum perf_compress_type {
+       PERF_COMP_NONE = 0,
+       PERF_COMP_ZSTD,
+       PERF_COMP_MAX
+};
+
 struct bpf_prog_info_node;
 struct btf_node;
 
index ba7be74..d1ad6c4 100644 (file)
@@ -68,6 +68,7 @@ static const char *perf_event__names[] = {
        [PERF_RECORD_EVENT_UPDATE]              = "EVENT_UPDATE",
        [PERF_RECORD_TIME_CONV]                 = "TIME_CONV",
        [PERF_RECORD_HEADER_FEATURE]            = "FEATURE",
+       [PERF_RECORD_COMPRESSED]                = "COMPRESSED",
 };
 
 static const char *perf_ns__names[] = {
index 4e908ec..9e99955 100644 (file)
@@ -255,6 +255,7 @@ enum perf_user_event_type { /* above any possible kernel type */
        PERF_RECORD_EVENT_UPDATE                = 78,
        PERF_RECORD_TIME_CONV                   = 79,
        PERF_RECORD_HEADER_FEATURE              = 80,
+       PERF_RECORD_COMPRESSED                  = 81,
        PERF_RECORD_HEADER_MAX
 };
 
@@ -627,6 +628,11 @@ struct feature_event {
        char                            data[];
 };
 
+struct compressed_event {
+       struct perf_event_header        header;
+       char                            data[];
+};
+
 union perf_event {
        struct perf_event_header        header;
        struct mmap_event               mmap;
@@ -660,6 +666,7 @@ union perf_event {
        struct feature_event            feat;
        struct ksymbol_event            ksymbol_event;
        struct bpf_event                bpf_event;
+       struct compressed_event         pack;
 };
 
 void perf_event__print_totals(void);
index 4b6783f..69d0fa8 100644 (file)
@@ -1009,7 +1009,8 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
  */
 int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
                         unsigned int auxtrace_pages,
-                        bool auxtrace_overwrite, int nr_cblocks, int affinity, int flush)
+                        bool auxtrace_overwrite, int nr_cblocks, int affinity, int flush,
+                        int comp_level)
 {
        struct perf_evsel *evsel;
        const struct cpu_map *cpus = evlist->cpus;
@@ -1019,7 +1020,8 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
         * Its value is decided by evsel's write_backward.
         * So &mp should not be passed through const pointer.
         */
-       struct mmap_params mp = { .nr_cblocks = nr_cblocks, .affinity = affinity, .flush = flush };
+       struct mmap_params mp = { .nr_cblocks = nr_cblocks, .affinity = affinity, .flush = flush,
+                                 .comp_level = comp_level };
 
        if (!evlist->mmap)
                evlist->mmap = perf_evlist__alloc_mmap(evlist, false);
@@ -1051,7 +1053,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
 
 int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages)
 {
-       return perf_evlist__mmap_ex(evlist, pages, 0, false, 0, PERF_AFFINITY_SYS, 1);
+       return perf_evlist__mmap_ex(evlist, pages, 0, false, 0, PERF_AFFINITY_SYS, 1, 0);
 }
 
 int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
index c9a0f72..49354fe 100644 (file)
@@ -178,7 +178,7 @@ unsigned long perf_event_mlock_kb_in_pages(void);
 int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
                         unsigned int auxtrace_pages,
                         bool auxtrace_overwrite, int nr_cblocks,
-                        int affinity, int flush);
+                        int affinity, int flush, int comp_level);
 int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages);
 void perf_evlist__munmap(struct perf_evlist *evlist);
 
index a10cf4c..a6f572a 100644 (file)
@@ -813,6 +813,8 @@ static void apply_config_terms(struct perf_evsel *evsel,
                        break;
                case PERF_EVSEL__CONFIG_TERM_DRV_CFG:
                        break;
+               case PERF_EVSEL__CONFIG_TERM_PERCORE:
+                       break;
                default:
                        break;
                }
index 6d190cb..cad54e8 100644 (file)
@@ -50,6 +50,7 @@ enum term_type {
        PERF_EVSEL__CONFIG_TERM_OVERWRITE,
        PERF_EVSEL__CONFIG_TERM_DRV_CFG,
        PERF_EVSEL__CONFIG_TERM_BRANCH,
+       PERF_EVSEL__CONFIG_TERM_PERCORE,
 };
 
 struct perf_evsel_config_term {
@@ -67,6 +68,7 @@ struct perf_evsel_config_term {
                bool    overwrite;
                char    *branch;
                unsigned long max_events;
+               bool    percore;
        } val;
        bool weak;
 };
@@ -158,6 +160,7 @@ struct perf_evsel {
        struct perf_evsel       **metric_events;
        bool                    collect_stat;
        bool                    weak_group;
+       bool                    percore;
        const char              *pmu_name;
        struct {
                perf_evsel__sb_cb_t     *cb;
index 2d2af2a..847ae51 100644 (file)
@@ -1344,6 +1344,30 @@ out:
        return ret;
 }
 
+static int write_compressed(struct feat_fd *ff __maybe_unused,
+                           struct perf_evlist *evlist __maybe_unused)
+{
+       int ret;
+
+       ret = do_write(ff, &(ff->ph->env.comp_ver), sizeof(ff->ph->env.comp_ver));
+       if (ret)
+               return ret;
+
+       ret = do_write(ff, &(ff->ph->env.comp_type), sizeof(ff->ph->env.comp_type));
+       if (ret)
+               return ret;
+
+       ret = do_write(ff, &(ff->ph->env.comp_level), sizeof(ff->ph->env.comp_level));
+       if (ret)
+               return ret;
+
+       ret = do_write(ff, &(ff->ph->env.comp_ratio), sizeof(ff->ph->env.comp_ratio));
+       if (ret)
+               return ret;
+
+       return do_write(ff, &(ff->ph->env.comp_mmap_len), sizeof(ff->ph->env.comp_mmap_len));
+}
+
 static void print_hostname(struct feat_fd *ff, FILE *fp)
 {
        fprintf(fp, "# hostname : %s\n", ff->ph->env.hostname);
@@ -1688,6 +1712,13 @@ static void print_cache(struct feat_fd *ff, FILE *fp __maybe_unused)
        }
 }
 
+static void print_compressed(struct feat_fd *ff, FILE *fp)
+{
+       fprintf(fp, "# compressed : %s, level = %d, ratio = %d\n",
+               ff->ph->env.comp_type == PERF_COMP_ZSTD ? "Zstd" : "Unknown",
+               ff->ph->env.comp_level, ff->ph->env.comp_ratio);
+}
+
 static void print_pmu_mappings(struct feat_fd *ff, FILE *fp)
 {
        const char *delimiter = "# pmu mappings: ";
@@ -2667,6 +2698,27 @@ out:
        return err;
 }
 
+static int process_compressed(struct feat_fd *ff,
+                             void *data __maybe_unused)
+{
+       if (do_read_u32(ff, &(ff->ph->env.comp_ver)))
+               return -1;
+
+       if (do_read_u32(ff, &(ff->ph->env.comp_type)))
+               return -1;
+
+       if (do_read_u32(ff, &(ff->ph->env.comp_level)))
+               return -1;
+
+       if (do_read_u32(ff, &(ff->ph->env.comp_ratio)))
+               return -1;
+
+       if (do_read_u32(ff, &(ff->ph->env.comp_mmap_len)))
+               return -1;
+
+       return 0;
+}
+
 struct feature_ops {
        int (*write)(struct feat_fd *ff, struct perf_evlist *evlist);
        void (*print)(struct feat_fd *ff, FILE *fp);
@@ -2730,6 +2782,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
        FEAT_OPN(DIR_FORMAT,    dir_format,     false),
        FEAT_OPR(BPF_PROG_INFO, bpf_prog_info,  false),
        FEAT_OPR(BPF_BTF,       bpf_btf,        false),
+       FEAT_OPR(COMPRESSED,    compressed,     false),
 };
 
 struct header_print_data {
index 386da49..5b3abe4 100644 (file)
@@ -42,6 +42,7 @@ enum {
        HEADER_DIR_FORMAT,
        HEADER_BPF_PROG_INFO,
        HEADER_BPF_BTF,
+       HEADER_COMPRESSED,
        HEADER_LAST_FEATURE,
        HEADER_FEAT_BITS        = 256,
 };
index 872fab1..f4c3c84 100644 (file)
@@ -58,6 +58,7 @@ enum intel_pt_pkt_state {
        INTEL_PT_STATE_NO_IP,
        INTEL_PT_STATE_ERR_RESYNC,
        INTEL_PT_STATE_IN_SYNC,
+       INTEL_PT_STATE_TNT_CONT,
        INTEL_PT_STATE_TNT,
        INTEL_PT_STATE_TIP,
        INTEL_PT_STATE_TIP_PGD,
@@ -72,8 +73,9 @@ static inline bool intel_pt_sample_time(enum intel_pt_pkt_state pkt_state)
        case INTEL_PT_STATE_NO_IP:
        case INTEL_PT_STATE_ERR_RESYNC:
        case INTEL_PT_STATE_IN_SYNC:
-       case INTEL_PT_STATE_TNT:
+       case INTEL_PT_STATE_TNT_CONT:
                return true;
+       case INTEL_PT_STATE_TNT:
        case INTEL_PT_STATE_TIP:
        case INTEL_PT_STATE_TIP_PGD:
        case INTEL_PT_STATE_FUP:
@@ -888,16 +890,20 @@ static uint64_t intel_pt_next_period(struct intel_pt_decoder *decoder)
        timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
        masked_timestamp = timestamp & decoder->period_mask;
        if (decoder->continuous_period) {
-               if (masked_timestamp != decoder->last_masked_timestamp)
+               if (masked_timestamp > decoder->last_masked_timestamp)
                        return 1;
        } else {
                timestamp += 1;
                masked_timestamp = timestamp & decoder->period_mask;
-               if (masked_timestamp != decoder->last_masked_timestamp) {
+               if (masked_timestamp > decoder->last_masked_timestamp) {
                        decoder->last_masked_timestamp = masked_timestamp;
                        decoder->continuous_period = true;
                }
        }
+
+       if (masked_timestamp < decoder->last_masked_timestamp)
+               return decoder->period_ticks;
+
        return decoder->period_ticks - (timestamp - masked_timestamp);
 }
 
@@ -926,7 +932,10 @@ static void intel_pt_sample_insn(struct intel_pt_decoder *decoder)
        case INTEL_PT_PERIOD_TICKS:
                timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
                masked_timestamp = timestamp & decoder->period_mask;
-               decoder->last_masked_timestamp = masked_timestamp;
+               if (masked_timestamp > decoder->last_masked_timestamp)
+                       decoder->last_masked_timestamp = masked_timestamp;
+               else
+                       decoder->last_masked_timestamp += decoder->period_ticks;
                break;
        case INTEL_PT_PERIOD_NONE:
        case INTEL_PT_PERIOD_MTC:
@@ -1254,7 +1263,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
                                return -ENOENT;
                        }
                        decoder->tnt.count -= 1;
-                       if (!decoder->tnt.count)
+                       if (decoder->tnt.count)
+                               decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
+                       else
                                decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
                        decoder->tnt.payload <<= 1;
                        decoder->state.from_ip = decoder->ip;
@@ -1285,7 +1296,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
 
                if (intel_pt_insn.branch == INTEL_PT_BR_CONDITIONAL) {
                        decoder->tnt.count -= 1;
-                       if (!decoder->tnt.count)
+                       if (decoder->tnt.count)
+                               decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
+                       else
                                decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
                        if (decoder->tnt.payload & BIT63) {
                                decoder->tnt.payload <<= 1;
@@ -1305,8 +1318,11 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
                                return 0;
                        }
                        decoder->ip += intel_pt_insn.length;
-                       if (!decoder->tnt.count)
+                       if (!decoder->tnt.count) {
+                               decoder->sample_timestamp = decoder->timestamp;
+                               decoder->sample_insn_cnt = decoder->timestamp_insn_cnt;
                                return -EAGAIN;
+                       }
                        decoder->tnt.payload <<= 1;
                        continue;
                }
@@ -2365,6 +2381,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
                        err = intel_pt_walk_trace(decoder);
                        break;
                case INTEL_PT_STATE_TNT:
+               case INTEL_PT_STATE_TNT_CONT:
                        err = intel_pt_walk_tnt(decoder);
                        if (err == -EAGAIN)
                                err = intel_pt_walk_trace(decoder);
index 3c520ba..28a9541 100644 (file)
@@ -1234,8 +1234,9 @@ static char *get_kernel_version(const char *root_dir)
        if (!file)
                return NULL;
 
-       version[0] = '\0';
        tmp = fgets(version, sizeof(version), file);
+       if (!tmp)
+               *version = '\0';
        fclose(file);
 
        name = strstr(version, prefix);
index ef3d79b..868c0b0 100644 (file)
@@ -157,6 +157,10 @@ void __weak auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp __mayb
 }
 
 #ifdef HAVE_AIO_SUPPORT
+static int perf_mmap__aio_enabled(struct perf_mmap *map)
+{
+       return map->aio.nr_cblocks > 0;
+}
 
 #ifdef HAVE_LIBNUMA_SUPPORT
 static int perf_mmap__aio_alloc(struct perf_mmap *map, int idx)
@@ -198,7 +202,7 @@ static int perf_mmap__aio_bind(struct perf_mmap *map, int idx, int cpu, int affi
 
        return 0;
 }
-#else
+#else /* !HAVE_LIBNUMA_SUPPORT */
 static int perf_mmap__aio_alloc(struct perf_mmap *map, int idx)
 {
        map->aio.data[idx] = malloc(perf_mmap__mmap_len(map));
@@ -285,81 +289,12 @@ static void perf_mmap__aio_munmap(struct perf_mmap *map)
        zfree(&map->aio.cblocks);
        zfree(&map->aio.aiocb);
 }
-
-int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,
-                       int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off),
-                       off_t *off)
+#else /* !HAVE_AIO_SUPPORT */
+static int perf_mmap__aio_enabled(struct perf_mmap *map __maybe_unused)
 {
-       u64 head = perf_mmap__read_head(md);
-       unsigned char *data = md->base + page_size;
-       unsigned long size, size0 = 0;
-       void *buf;
-       int rc = 0;
-
-       rc = perf_mmap__read_init(md);
-       if (rc < 0)
-               return (rc == -EAGAIN) ? 0 : -1;
-
-       /*
-        * md->base data is copied into md->data[idx] buffer to
-        * release space in the kernel buffer as fast as possible,
-        * thru perf_mmap__consume() below.
-        *
-        * That lets the kernel to proceed with storing more
-        * profiling data into the kernel buffer earlier than other
-        * per-cpu kernel buffers are handled.
-        *
-        * Coping can be done in two steps in case the chunk of
-        * profiling data crosses the upper bound of the kernel buffer.
-        * In this case we first move part of data from md->start
-        * till the upper bound and then the reminder from the
-        * beginning of the kernel buffer till the end of
-        * the data chunk.
-        */
-
-       size = md->end - md->start;
-
-       if ((md->start & md->mask) + size != (md->end & md->mask)) {
-               buf = &data[md->start & md->mask];
-               size = md->mask + 1 - (md->start & md->mask);
-               md->start += size;
-               memcpy(md->aio.data[idx], buf, size);
-               size0 = size;
-       }
-
-       buf = &data[md->start & md->mask];
-       size = md->end - md->start;
-       md->start += size;
-       memcpy(md->aio.data[idx] + size0, buf, size);
-
-       /*
-        * Increment md->refcount to guard md->data[idx] buffer
-        * from premature deallocation because md object can be
-        * released earlier than aio write request started
-        * on mmap->data[idx] is complete.
-        *
-        * perf_mmap__put() is done at record__aio_complete()
-        * after started request completion.
-        */
-       perf_mmap__get(md);
-
-       md->prev = head;
-       perf_mmap__consume(md);
-
-       rc = push(to, &md->aio.cblocks[idx], md->aio.data[idx], size0 + size, *off);
-       if (!rc) {
-               *off += size0 + size;
-       } else {
-               /*
-                * Decrement md->refcount back if aio write
-                * operation failed to start.
-                */
-               perf_mmap__put(md);
-       }
-
-       return rc;
+       return 0;
 }
-#else
+
 static int perf_mmap__aio_mmap(struct perf_mmap *map __maybe_unused,
                               struct mmap_params *mp __maybe_unused)
 {
@@ -374,6 +309,10 @@ static void perf_mmap__aio_munmap(struct perf_mmap *map __maybe_unused)
 void perf_mmap__munmap(struct perf_mmap *map)
 {
        perf_mmap__aio_munmap(map);
+       if (map->data != NULL) {
+               munmap(map->data, perf_mmap__mmap_len(map));
+               map->data = NULL;
+       }
        if (map->base != NULL) {
                munmap(map->base, perf_mmap__mmap_len(map));
                map->base = NULL;
@@ -442,6 +381,19 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int c
 
        map->flush = mp->flush;
 
+       map->comp_level = mp->comp_level;
+
+       if (map->comp_level && !perf_mmap__aio_enabled(map)) {
+               map->data = mmap(NULL, perf_mmap__mmap_len(map), PROT_READ|PROT_WRITE,
+                                MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+               if (map->data == MAP_FAILED) {
+                       pr_debug2("failed to mmap data buffer, error %d\n",
+                                       errno);
+                       map->data = NULL;
+                       return -1;
+               }
+       }
+
        if (auxtrace_mmap__mmap(&map->auxtrace_mmap,
                                &mp->auxtrace_mp, map->base, fd))
                return -1;
@@ -540,7 +492,7 @@ int perf_mmap__push(struct perf_mmap *md, void *to,
 
        rc = perf_mmap__read_init(md);
        if (rc < 0)
-               return (rc == -EAGAIN) ? 0 : -1;
+               return (rc == -EAGAIN) ? 1 : -1;
 
        size = md->end - md->start;
 
index b82f8c2..274ce38 100644 (file)
@@ -40,6 +40,8 @@ struct perf_mmap {
 #endif
        cpu_set_t       affinity_mask;
        u64             flush;
+       void            *data;
+       int             comp_level;
 };
 
 /*
@@ -71,7 +73,7 @@ enum bkw_mmap_state {
 };
 
 struct mmap_params {
-       int                         prot, mask, nr_cblocks, affinity, flush;
+       int prot, mask, nr_cblocks, affinity, flush, comp_level;
        struct auxtrace_mmap_params auxtrace_mp;
 };
 
@@ -99,18 +101,6 @@ union perf_event *perf_mmap__read_event(struct perf_mmap *map);
 
 int perf_mmap__push(struct perf_mmap *md, void *to,
                    int push(struct perf_mmap *map, void *to, void *buf, size_t size));
-#ifdef HAVE_AIO_SUPPORT
-int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,
-                       int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off),
-                       off_t *off);
-#else
-static inline int perf_mmap__aio_push(struct perf_mmap *md __maybe_unused, void *to __maybe_unused, int idx __maybe_unused,
-       int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off) __maybe_unused,
-       off_t *off __maybe_unused)
-{
-       return 0;
-}
-#endif
 
 size_t perf_mmap__mmap_len(struct perf_mmap *map);
 
index 4432bfe..cf0b9b8 100644 (file)
@@ -950,6 +950,7 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = {
        [PARSE_EVENTS__TERM_TYPE_OVERWRITE]             = "overwrite",
        [PARSE_EVENTS__TERM_TYPE_NOOVERWRITE]           = "no-overwrite",
        [PARSE_EVENTS__TERM_TYPE_DRV_CFG]               = "driver-config",
+       [PARSE_EVENTS__TERM_TYPE_PERCORE]               = "percore",
 };
 
 static bool config_term_shrinked;
@@ -970,6 +971,7 @@ config_term_avail(int term_type, struct parse_events_error *err)
        case PARSE_EVENTS__TERM_TYPE_CONFIG2:
        case PARSE_EVENTS__TERM_TYPE_NAME:
        case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
+       case PARSE_EVENTS__TERM_TYPE_PERCORE:
                return true;
        default:
                if (!err)
@@ -1061,6 +1063,14 @@ do {                                                                        \
        case PARSE_EVENTS__TERM_TYPE_MAX_EVENTS:
                CHECK_TYPE_VAL(NUM);
                break;
+       case PARSE_EVENTS__TERM_TYPE_PERCORE:
+               CHECK_TYPE_VAL(NUM);
+               if ((unsigned int)term->val.num > 1) {
+                       err->str = strdup("expected 0 or 1");
+                       err->idx = term->err_val;
+                       return -EINVAL;
+               }
+               break;
        default:
                err->str = strdup("unknown term");
                err->idx = term->err_term;
@@ -1199,6 +1209,10 @@ do {                                                             \
                case PARSE_EVENTS__TERM_TYPE_DRV_CFG:
                        ADD_CONFIG_TERM(DRV_CFG, drv_cfg, term->val.str);
                        break;
+               case PARSE_EVENTS__TERM_TYPE_PERCORE:
+                       ADD_CONFIG_TERM(PERCORE, percore,
+                                       term->val.num ? true : false);
+                       break;
                default:
                        break;
                }
@@ -1260,6 +1274,18 @@ int parse_events_add_tool(struct parse_events_state *parse_state,
        return add_event_tool(list, &parse_state->idx, tool_event);
 }
 
+static bool config_term_percore(struct list_head *config_terms)
+{
+       struct perf_evsel_config_term *term;
+
+       list_for_each_entry(term, config_terms, list) {
+               if (term->type == PERF_EVSEL__CONFIG_TERM_PERCORE)
+                       return term->val.percore;
+       }
+
+       return false;
+}
+
 int parse_events_add_pmu(struct parse_events_state *parse_state,
                         struct list_head *list, char *name,
                         struct list_head *head_config,
@@ -1333,6 +1359,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
                evsel->metric_name = info.metric_name;
                evsel->pmu_name = name;
                evsel->use_uncore_alias = use_uncore_alias;
+               evsel->percore = config_term_percore(&evsel->config_terms);
        }
 
        return evsel ? 0 : -ENOMEM;
index a052cd6..f7139e1 100644 (file)
@@ -75,6 +75,7 @@ enum {
        PARSE_EVENTS__TERM_TYPE_NOOVERWRITE,
        PARSE_EVENTS__TERM_TYPE_OVERWRITE,
        PARSE_EVENTS__TERM_TYPE_DRV_CFG,
+       PARSE_EVENTS__TERM_TYPE_PERCORE,
        __PARSE_EVENTS__TERM_TYPE_NR,
 };
 
index c54bfe8..ca60988 100644 (file)
@@ -283,6 +283,7 @@ inherit                     { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); }
 no-inherit             { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); }
 overwrite              { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); }
 no-overwrite           { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); }
+percore                        { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); }
 ,                      { return ','; }
 "/"                    { BEGIN(INITIAL); return '/'; }
 {name_minus}           { return str(yyscanner, PE_NAME); }
index e6599e2..08581e2 100644 (file)
@@ -5,13 +5,14 @@
 #include <subcmd/parse-options.h>
 #include "util/parse-regs-options.h"
 
-int
-parse_regs(const struct option *opt, const char *str, int unset)
+static int
+__parse_regs(const struct option *opt, const char *str, int unset, bool intr)
 {
        uint64_t *mode = (uint64_t *)opt->value;
        const struct sample_reg *r;
        char *s, *os = NULL, *p;
        int ret = -1;
+       uint64_t mask;
 
        if (unset)
                return 0;
@@ -22,6 +23,11 @@ parse_regs(const struct option *opt, const char *str, int unset)
        if (*mode)
                return -1;
 
+       if (intr)
+               mask = arch__intr_reg_mask();
+       else
+               mask = arch__user_reg_mask();
+
        /* str may be NULL in case no arg is passed to -I */
        if (str) {
                /* because str is read-only */
@@ -37,19 +43,20 @@ parse_regs(const struct option *opt, const char *str, int unset)
                        if (!strcmp(s, "?")) {
                                fprintf(stderr, "available registers: ");
                                for (r = sample_reg_masks; r->name; r++) {
-                                       fprintf(stderr, "%s ", r->name);
+                                       if (r->mask & mask)
+                                               fprintf(stderr, "%s ", r->name);
                                }
                                fputc('\n', stderr);
                                /* just printing available regs */
                                return -1;
                        }
                        for (r = sample_reg_masks; r->name; r++) {
-                               if (!strcasecmp(s, r->name))
+                               if ((r->mask & mask) && !strcasecmp(s, r->name))
                                        break;
                        }
                        if (!r->name) {
-                               ui__warning("unknown register %s,"
-                                           " check man page\n", s);
+                               ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n",
+                                           s, intr ? "-I" : "--user-regs=");
                                goto error;
                        }
 
@@ -65,8 +72,20 @@ parse_regs(const struct option *opt, const char *str, int unset)
 
        /* default to all possible regs */
        if (*mode == 0)
-               *mode = PERF_REGS_MASK;
+               *mode = mask;
 error:
        free(os);
        return ret;
 }
+
+int
+parse_user_regs(const struct option *opt, const char *str, int unset)
+{
+       return __parse_regs(opt, str, unset, false);
+}
+
+int
+parse_intr_regs(const struct option *opt, const char *str, int unset)
+{
+       return __parse_regs(opt, str, unset, true);
+}
index cdefb1a..2b23d25 100644 (file)
@@ -2,5 +2,6 @@
 #ifndef _PERF_PARSE_REGS_OPTIONS_H
 #define _PERF_PARSE_REGS_OPTIONS_H 1
 struct option;
-int parse_regs(const struct option *opt, const char *str, int unset);
+int parse_user_regs(const struct option *opt, const char *str, int unset);
+int parse_intr_regs(const struct option *opt, const char *str, int unset);
 #endif /* _PERF_PARSE_REGS_OPTIONS_H */
index 2acfcc5..2774cec 100644 (file)
@@ -13,6 +13,16 @@ int __weak arch_sdt_arg_parse_op(char *old_op __maybe_unused,
        return SDT_ARG_SKIP;
 }
 
+uint64_t __weak arch__intr_reg_mask(void)
+{
+       return PERF_REGS_MASK;
+}
+
+uint64_t __weak arch__user_reg_mask(void)
+{
+       return PERF_REGS_MASK;
+}
+
 #ifdef HAVE_PERF_REGS_SUPPORT
 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
 {
index c9319f8..cb9c246 100644 (file)
@@ -12,6 +12,7 @@ struct sample_reg {
        uint64_t mask;
 };
 #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
+#define SMPL_REG2(n, b) { .name = #n, .mask = 3ULL << (b) }
 #define SMPL_REG_END { .name = NULL }
 
 extern const struct sample_reg sample_reg_masks[];
@@ -22,6 +23,8 @@ enum {
 };
 
 int arch_sdt_arg_parse_op(char *old_op, char **new_op);
+uint64_t arch__intr_reg_mask(void);
+uint64_t arch__user_reg_mask(void);
 
 #ifdef HAVE_PERF_REGS_SUPPORT
 #include <perf_regs.h>
index bad5f87..2310a17 100644 (file)
 #include "stat.h"
 #include "arch/common.h"
 
+#ifdef HAVE_ZSTD_SUPPORT
+static int perf_session__process_compressed_event(struct perf_session *session,
+                                                 union perf_event *event, u64 file_offset)
+{
+       void *src;
+       size_t decomp_size, src_size;
+       u64 decomp_last_rem = 0;
+       size_t decomp_len = session->header.env.comp_mmap_len;
+       struct decomp *decomp, *decomp_last = session->decomp_last;
+
+       decomp = mmap(NULL, sizeof(struct decomp) + decomp_len, PROT_READ|PROT_WRITE,
+                     MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+       if (decomp == MAP_FAILED) {
+               pr_err("Couldn't allocate memory for decompression\n");
+               return -1;
+       }
+
+       decomp->file_pos = file_offset;
+       decomp->head = 0;
+
+       if (decomp_last) {
+               decomp_last_rem = decomp_last->size - decomp_last->head;
+               memcpy(decomp->data, &(decomp_last->data[decomp_last->head]), decomp_last_rem);
+               decomp->size = decomp_last_rem;
+       }
+
+       src = (void *)event + sizeof(struct compressed_event);
+       src_size = event->pack.header.size - sizeof(struct compressed_event);
+
+       decomp_size = zstd_decompress_stream(&(session->zstd_data), src, src_size,
+                               &(decomp->data[decomp_last_rem]), decomp_len - decomp_last_rem);
+       if (!decomp_size) {
+               munmap(decomp, sizeof(struct decomp) + decomp_len);
+               pr_err("Couldn't decompress data\n");
+               return -1;
+       }
+
+       decomp->size += decomp_size;
+
+       if (session->decomp == NULL) {
+               session->decomp = decomp;
+               session->decomp_last = decomp;
+       } else {
+               session->decomp_last->next = decomp;
+               session->decomp_last = decomp;
+       }
+
+       pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
+
+       return 0;
+}
+#else /* !HAVE_ZSTD_SUPPORT */
+#define perf_session__process_compressed_event perf_session__process_compressed_event_stub
+#endif
+
 static int perf_session__deliver_event(struct perf_session *session,
                                       union perf_event *event,
                                       struct perf_tool *tool,
@@ -197,6 +252,21 @@ static void perf_session__delete_threads(struct perf_session *session)
        machine__delete_threads(&session->machines.host);
 }
 
+static void perf_session__release_decomp_events(struct perf_session *session)
+{
+       struct decomp *next, *decomp;
+       size_t decomp_len;
+       next = session->decomp;
+       decomp_len = session->header.env.comp_mmap_len;
+       do {
+               decomp = next;
+               if (decomp == NULL)
+                       break;
+               next = decomp->next;
+               munmap(decomp, decomp_len + sizeof(struct decomp));
+       } while (1);
+}
+
 void perf_session__delete(struct perf_session *session)
 {
        if (session == NULL)
@@ -205,6 +275,7 @@ void perf_session__delete(struct perf_session *session)
        auxtrace_index__free(&session->auxtrace_index);
        perf_session__destroy_kernel_maps(session);
        perf_session__delete_threads(session);
+       perf_session__release_decomp_events(session);
        perf_env__exit(&session->header.env);
        machines__exit(&session->machines);
        if (session->data)
@@ -358,6 +429,14 @@ static int process_stat_round_stub(struct perf_session *perf_session __maybe_unu
        return 0;
 }
 
+static int perf_session__process_compressed_event_stub(struct perf_session *session __maybe_unused,
+                                                      union perf_event *event __maybe_unused,
+                                                      u64 file_offset __maybe_unused)
+{
+       dump_printf(": unhandled!\n");
+       return 0;
+}
+
 void perf_tool__fill_defaults(struct perf_tool *tool)
 {
        if (tool->sample == NULL)
@@ -430,6 +509,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
                tool->time_conv = process_event_op2_stub;
        if (tool->feature == NULL)
                tool->feature = process_event_op2_stub;
+       if (tool->compressed == NULL)
+               tool->compressed = perf_session__process_compressed_event;
 }
 
 static void swap_sample_id_all(union perf_event *event, void *data)
@@ -1373,7 +1454,9 @@ static s64 perf_session__process_user_event(struct perf_session *session,
        int fd = perf_data__fd(session->data);
        int err;
 
-       dump_event(session->evlist, event, file_offset, &sample);
+       if (event->header.type != PERF_RECORD_COMPRESSED ||
+           tool->compressed == perf_session__process_compressed_event_stub)
+               dump_event(session->evlist, event, file_offset, &sample);
 
        /* These events are processed right away */
        switch (event->header.type) {
@@ -1426,6 +1509,11 @@ static s64 perf_session__process_user_event(struct perf_session *session,
                return tool->time_conv(session, event);
        case PERF_RECORD_HEADER_FEATURE:
                return tool->feature(session, event);
+       case PERF_RECORD_COMPRESSED:
+               err = tool->compressed(session, event, file_offset);
+               if (err)
+                       dump_event(session->evlist, event, file_offset, &sample);
+               return err;
        default:
                return -EINVAL;
        }
@@ -1708,6 +1796,8 @@ static int perf_session__flush_thread_stacks(struct perf_session *session)
 
 volatile int session_done;
 
+static int __perf_session__process_decomp_events(struct perf_session *session);
+
 static int __perf_session__process_pipe_events(struct perf_session *session)
 {
        struct ordered_events *oe = &session->ordered_events;
@@ -1788,6 +1878,10 @@ more:
        if (skip > 0)
                head += skip;
 
+       err = __perf_session__process_decomp_events(session);
+       if (err)
+               goto out_err;
+
        if (!session_done())
                goto more;
 done:
@@ -1836,6 +1930,39 @@ fetch_mmaped_event(struct perf_session *session,
        return event;
 }
 
+static int __perf_session__process_decomp_events(struct perf_session *session)
+{
+       s64 skip;
+       u64 size, file_pos = 0;
+       struct decomp *decomp = session->decomp_last;
+
+       if (!decomp)
+               return 0;
+
+       while (decomp->head < decomp->size && !session_done()) {
+               union perf_event *event = fetch_mmaped_event(session, decomp->head, decomp->size, decomp->data);
+
+               if (!event)
+                       break;
+
+               size = event->header.size;
+
+               if (size < sizeof(struct perf_event_header) ||
+                   (skip = perf_session__process_event(session, event, file_pos)) < 0) {
+                       pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
+                               decomp->file_pos + decomp->head, event->header.size, event->header.type);
+                       return -EINVAL;
+               }
+
+               if (skip)
+                       size += skip;
+
+               decomp->head += size;
+       }
+
+       return 0;
+}
+
 /*
  * On 64bit we can mmap the data file in one go. No need for tiny mmap
  * slices. On 32bit we use 32MB.
@@ -1945,6 +2072,10 @@ more:
        head += size;
        file_pos += size;
 
+       err = __perf_session__process_decomp_events(session);
+       if (err)
+               goto out;
+
        ui_progress__update(prog, size);
 
        if (session_done())
index d96eccd..dd8920b 100644 (file)
@@ -8,6 +8,7 @@
 #include "machine.h"
 #include "data.h"
 #include "ordered-events.h"
+#include "util/compress.h"
 #include <linux/kernel.h>
 #include <linux/rbtree.h>
 #include <linux/perf_event.h>
@@ -35,6 +36,19 @@ struct perf_session {
        struct ordered_events   ordered_events;
        struct perf_data        *data;
        struct perf_tool        *tool;
+       u64                     bytes_transferred;
+       u64                     bytes_compressed;
+       struct zstd_data        zstd_data;
+       struct decomp           *decomp;
+       struct decomp           *decomp_last;
+};
+
+struct decomp {
+       struct decomp *next;
+       u64 file_pos;
+       u64 head;
+       size_t size;
+       char data[];
 };
 
 struct perf_tool;
index 3324f23..4c53bae 100644 (file)
@@ -88,9 +88,17 @@ static void aggr_printout(struct perf_stat_config *config,
                        config->csv_sep);
                        break;
        case AGGR_NONE:
-               fprintf(config->output, "CPU%*d%s",
-                       config->csv_output ? 0 : -4,
-                       perf_evsel__cpus(evsel)->map[id], config->csv_sep);
+               if (evsel->percore) {
+                       fprintf(config->output, "S%d-C%*d%s",
+                               cpu_map__id_to_socket(id),
+                               config->csv_output ? 0 : -5,
+                               cpu_map__id_to_cpu(id), config->csv_sep);
+               } else {
+                       fprintf(config->output, "CPU%*d%s ",
+                               config->csv_output ? 0 : -5,
+                               perf_evsel__cpus(evsel)->map[id],
+                               config->csv_sep);
+               }
                break;
        case AGGR_THREAD:
                fprintf(config->output, "%*s-%*d%s",
@@ -594,6 +602,41 @@ static void aggr_cb(struct perf_stat_config *config,
        }
 }
 
+static void print_counter_aggrdata(struct perf_stat_config *config,
+                                  struct perf_evsel *counter, int s,
+                                  char *prefix, bool metric_only,
+                                  bool *first)
+{
+       struct aggr_data ad;
+       FILE *output = config->output;
+       u64 ena, run, val;
+       int id, nr;
+       double uval;
+
+       ad.id = id = config->aggr_map->map[s];
+       ad.val = ad.ena = ad.run = 0;
+       ad.nr = 0;
+       if (!collect_data(config, counter, aggr_cb, &ad))
+               return;
+
+       nr = ad.nr;
+       ena = ad.ena;
+       run = ad.run;
+       val = ad.val;
+       if (*first && metric_only) {
+               *first = false;
+               aggr_printout(config, counter, id, nr);
+       }
+       if (prefix && !metric_only)
+               fprintf(output, "%s", prefix);
+
+       uval = val * counter->scale;
+       printout(config, id, nr, counter, uval, prefix,
+                run, ena, 1.0, &rt_stat);
+       if (!metric_only)
+               fputc('\n', output);
+}
+
 static void print_aggr(struct perf_stat_config *config,
                       struct perf_evlist *evlist,
                       char *prefix)
@@ -601,9 +644,7 @@ static void print_aggr(struct perf_stat_config *config,
        bool metric_only = config->metric_only;
        FILE *output = config->output;
        struct perf_evsel *counter;
-       int s, id, nr;
-       double uval;
-       u64 ena, run, val;
+       int s;
        bool first;
 
        if (!(config->aggr_map || config->aggr_get_id))
@@ -616,33 +657,14 @@ static void print_aggr(struct perf_stat_config *config,
         * Without each counter has its own line.
         */
        for (s = 0; s < config->aggr_map->nr; s++) {
-               struct aggr_data ad;
                if (prefix && metric_only)
                        fprintf(output, "%s", prefix);
 
-               ad.id = id = config->aggr_map->map[s];
                first = true;
                evlist__for_each_entry(evlist, counter) {
-                       ad.val = ad.ena = ad.run = 0;
-                       ad.nr = 0;
-                       if (!collect_data(config, counter, aggr_cb, &ad))
-                               continue;
-                       nr = ad.nr;
-                       ena = ad.ena;
-                       run = ad.run;
-                       val = ad.val;
-                       if (first && metric_only) {
-                               first = false;
-                               aggr_printout(config, counter, id, nr);
-                       }
-                       if (prefix && !metric_only)
-                               fprintf(output, "%s", prefix);
-
-                       uval = val * counter->scale;
-                       printout(config, id, nr, counter, uval, prefix,
-                                run, ena, 1.0, &rt_stat);
-                       if (!metric_only)
-                               fputc('\n', output);
+                       print_counter_aggrdata(config, counter, s,
+                                              prefix, metric_only,
+                                              &first);
                }
                if (metric_only)
                        fputc('\n', output);
@@ -1089,6 +1111,30 @@ static void print_footer(struct perf_stat_config *config)
                        "the same PMU. Try reorganizing the group.\n");
 }
 
+static void print_percore(struct perf_stat_config *config,
+                         struct perf_evsel *counter, char *prefix)
+{
+       bool metric_only = config->metric_only;
+       FILE *output = config->output;
+       int s;
+       bool first = true;
+
+       if (!(config->aggr_map || config->aggr_get_id))
+               return;
+
+       for (s = 0; s < config->aggr_map->nr; s++) {
+               if (prefix && metric_only)
+                       fprintf(output, "%s", prefix);
+
+               print_counter_aggrdata(config, counter, s,
+                                      prefix, metric_only,
+                                      &first);
+       }
+
+       if (metric_only)
+               fputc('\n', output);
+}
+
 void
 perf_evlist__print_counters(struct perf_evlist *evlist,
                            struct perf_stat_config *config,
@@ -1139,7 +1185,10 @@ perf_evlist__print_counters(struct perf_evlist *evlist,
                        print_no_aggr_metric(config, evlist, prefix);
                else {
                        evlist__for_each_entry(evlist, counter) {
-                               print_counter(config, counter, prefix);
+                               if (counter->percore)
+                                       print_percore(config, counter, prefix);
+                               else
+                                       print_counter(config, counter, prefix);
                        }
                }
                break;
index 2856cc9..c3115d9 100644 (file)
@@ -277,9 +277,11 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
                if (!evsel->snapshot)
                        perf_evsel__compute_deltas(evsel, cpu, thread, count);
                perf_counts_values__scale(count, config->scale, NULL);
-               if (config->aggr_mode == AGGR_NONE)
-                       perf_stat__update_shadow_stats(evsel, count->val, cpu,
-                                                      &rt_stat);
+               if ((config->aggr_mode == AGGR_NONE) && (!evsel->percore)) {
+                       perf_stat__update_shadow_stats(evsel, count->val,
+                                                      cpu, &rt_stat);
+               }
+
                if (config->aggr_mode == AGGR_THREAD) {
                        if (config->stats)
                                perf_stat__update_shadow_stats(evsel,
index 50678d3..403045a 100644 (file)
@@ -15,6 +15,7 @@
 #include "map.h"
 #include "symbol.h"
 #include "unwind.h"
+#include "callchain.h"
 
 #include <api/fs/fs.h>
 
@@ -327,7 +328,7 @@ static int thread__prepare_access(struct thread *thread)
 {
        int err = 0;
 
-       if (symbol_conf.use_callchain)
+       if (dwarf_callchain_users)
                err = __thread__prepare_access(thread);
 
        return err;
index 2503916..9096a6e 100644 (file)
@@ -28,6 +28,7 @@ typedef int (*event_attr_op)(struct perf_tool *tool,
 
 typedef int (*event_op2)(struct perf_session *session, union perf_event *event);
 typedef s64 (*event_op3)(struct perf_session *session, union perf_event *event);
+typedef int (*event_op4)(struct perf_session *session, union perf_event *event, u64 data);
 
 typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event,
                        struct ordered_events *oe);
@@ -72,6 +73,7 @@ struct perf_tool {
                        stat,
                        stat_round,
                        feature;
+       event_op4       compressed;
        event_op3       auxtrace;
        bool            ordered_events;
        bool            ordering_requires_timestamps;
index f3c666a..25e1406 100644 (file)
@@ -617,8 +617,6 @@ static unw_accessors_t accessors = {
 
 static int _unwind__prepare_access(struct thread *thread)
 {
-       if (!dwarf_callchain_users)
-               return 0;
        thread->addr_space = unw_create_addr_space(&accessors, 0);
        if (!thread->addr_space) {
                pr_err("unwind: Can't create unwind address space.\n");
@@ -631,15 +629,11 @@ static int _unwind__prepare_access(struct thread *thread)
 
 static void _unwind__flush_access(struct thread *thread)
 {
-       if (!dwarf_callchain_users)
-               return;
        unw_flush_cache(thread->addr_space, 0, 0);
 }
 
 static void _unwind__finish_access(struct thread *thread)
 {
-       if (!dwarf_callchain_users)
-               return;
        unw_destroy_addr_space(thread->addr_space);
 }
 
index 9778b31..c081197 100644 (file)
@@ -5,6 +5,7 @@
 #include "session.h"
 #include "debug.h"
 #include "env.h"
+#include "callchain.h"
 
 struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
 struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
@@ -24,6 +25,9 @@ int unwind__prepare_access(struct thread *thread, struct map *map,
        struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
        int err;
 
+       if (!dwarf_callchain_users)
+               return 0;
+
        if (thread->addr_space) {
                pr_debug("unwind: thread map already set, dso=%s\n",
                         map->dso->name);
@@ -65,12 +69,18 @@ out_register:
 
 void unwind__flush_access(struct thread *thread)
 {
+       if (!dwarf_callchain_users)
+               return;
+
        if (thread->unwind_libunwind_ops)
                thread->unwind_libunwind_ops->flush_access(thread);
 }
 
 void unwind__finish_access(struct thread *thread)
 {
+       if (!dwarf_callchain_users)
+               return;
+
        if (thread->unwind_libunwind_ops)
                thread->unwind_libunwind_ops->finish_access(thread);
 }
diff --git a/tools/perf/util/zstd.c b/tools/perf/util/zstd.c
new file mode 100644 (file)
index 0000000..23bdb98
--- /dev/null
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <string.h>
+
+#include "util/compress.h"
+#include "util/debug.h"
+
+int zstd_init(struct zstd_data *data, int level)
+{
+       size_t ret;
+
+       data->dstream = ZSTD_createDStream();
+       if (data->dstream == NULL) {
+               pr_err("Couldn't create decompression stream.\n");
+               return -1;
+       }
+
+       ret = ZSTD_initDStream(data->dstream);
+       if (ZSTD_isError(ret)) {
+               pr_err("Failed to initialize decompression stream: %s\n", ZSTD_getErrorName(ret));
+               return -1;
+       }
+
+       if (!level)
+               return 0;
+
+       data->cstream = ZSTD_createCStream();
+       if (data->cstream == NULL) {
+               pr_err("Couldn't create compression stream.\n");
+               return -1;
+       }
+
+       ret = ZSTD_initCStream(data->cstream, level);
+       if (ZSTD_isError(ret)) {
+               pr_err("Failed to initialize compression stream: %s\n", ZSTD_getErrorName(ret));
+               return -1;
+       }
+
+       return 0;
+}
+
+int zstd_fini(struct zstd_data *data)
+{
+       if (data->dstream) {
+               ZSTD_freeDStream(data->dstream);
+               data->dstream = NULL;
+       }
+
+       if (data->cstream) {
+               ZSTD_freeCStream(data->cstream);
+               data->cstream = NULL;
+       }
+
+       return 0;
+}
+
+size_t zstd_compress_stream_to_records(struct zstd_data *data, void *dst, size_t dst_size,
+                                      void *src, size_t src_size, size_t max_record_size,
+                                      size_t process_header(void *record, size_t increment))
+{
+       size_t ret, size, compressed = 0;
+       ZSTD_inBuffer input = { src, src_size, 0 };
+       ZSTD_outBuffer output;
+       void *record;
+
+       while (input.pos < input.size) {
+               record = dst;
+               size = process_header(record, 0);
+               compressed += size;
+               dst += size;
+               dst_size -= size;
+               output = (ZSTD_outBuffer){ dst, (dst_size > max_record_size) ?
+                                               max_record_size : dst_size, 0 };
+               ret = ZSTD_compressStream(data->cstream, &output, &input);
+               ZSTD_flushStream(data->cstream, &output);
+               if (ZSTD_isError(ret)) {
+                       pr_err("failed to compress %ld bytes: %s\n",
+                               (long)src_size, ZSTD_getErrorName(ret));
+                       memcpy(dst, src, src_size);
+                       return src_size;
+               }
+               size = output.pos;
+               size = process_header(record, size);
+               compressed += size;
+               dst += size;
+               dst_size -= size;
+       }
+
+       return compressed;
+}
+
+size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size,
+                             void *dst, size_t dst_size)
+{
+       size_t ret;
+       ZSTD_inBuffer input = { src, src_size, 0 };
+       ZSTD_outBuffer output = { dst, dst_size, 0 };
+
+       while (input.pos < input.size) {
+               ret = ZSTD_decompressStream(data->dstream, &output, &input);
+               if (ZSTD_isError(ret)) {
+                       pr_err("failed to decompress (B): %ld -> %ld : %s\n",
+                              src_size, output.size, ZSTD_getErrorName(ret));
+                       break;
+               }
+               output.dst  = dst + output.pos;
+               output.size = dst_size - output.pos;
+       }
+
+       return output.pos;
+}
index 6ff8383..e364b17 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * test module to check whether the TSC-based delay routine continues
  * to work properly after cpufreq transitions. Needs ACPI to work
index 815d155..5c342e6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../scripts/Makefile.include
 
 bindir ?= /usr/bin
index 275ad8a..4711f57 100755 (executable)
@@ -64,6 +64,7 @@ my %default = (
     "STOP_TEST_AFTER"          => 600,
     "MAX_MONITOR_WAIT"         => 1800,
     "GRUB_REBOOT"              => "grub2-reboot",
+    "GRUB_BLS_GET"             => "grubby --info=ALL",
     "SYSLINUX"                 => "extlinux",
     "SYSLINUX_PATH"            => "/boot/extlinux",
     "CONNECT_TIMEOUT"          => 25,
@@ -125,6 +126,7 @@ my $last_grub_menu;
 my $grub_file;
 my $grub_number;
 my $grub_reboot;
+my $grub_bls_get;
 my $syslinux;
 my $syslinux_path;
 my $syslinux_label;
@@ -295,6 +297,7 @@ my %option_map = (
     "GRUB_MENU"                        => \$grub_menu,
     "GRUB_FILE"                        => \$grub_file,
     "GRUB_REBOOT"              => \$grub_reboot,
+    "GRUB_BLS_GET"             => \$grub_bls_get,
     "SYSLINUX"                 => \$syslinux,
     "SYSLINUX_PATH"            => \$syslinux_path,
     "SYSLINUX_LABEL"           => \$syslinux_label,
@@ -440,7 +443,7 @@ EOF
     ;
 $config_help{"REBOOT_TYPE"} = << "EOF"
  Way to reboot the box to the test kernel.
- Only valid options so far are "grub", "grub2", "syslinux", and "script".
+ Only valid options so far are "grub", "grub2", "grub2bls", "syslinux", and "script".
 
  If you specify grub, it will assume grub version 1
  and will search in /boot/grub/menu.lst for the title \$GRUB_MENU
@@ -454,6 +457,8 @@ $config_help{"REBOOT_TYPE"} = << "EOF"
  If you specify grub2, then you also need to specify both \$GRUB_MENU
  and \$GRUB_FILE.
 
+ If you specify grub2bls, then you also need to specify \$GRUB_MENU.
+
  If you specify syslinux, then you may use SYSLINUX to define the syslinux
  command (defaults to extlinux), and SYSLINUX_PATH to specify the path to
  the syslinux install (defaults to /boot/extlinux). But you have to specify
@@ -479,6 +484,9 @@ $config_help{"GRUB_MENU"} = << "EOF"
  menu must be a non-nested menu. Add the quotes used in the menu
  to guarantee your selection, as the first menuentry with the content
  of \$GRUB_MENU that is found will be used.
+
+ For grub2bls, \$GRUB_MENU is searched on the result of \$GRUB_BLS_GET
+ command for the lines that begin with "title".
 EOF
     ;
 $config_help{"GRUB_FILE"} = << "EOF"
@@ -695,7 +703,7 @@ sub get_mandatory_configs {
        }
     }
 
-    if ($rtype eq "grub") {
+    if (($rtype eq "grub") or ($rtype eq "grub2bls")) {
        get_mandatory_config("GRUB_MENU");
     }
 
@@ -1871,36 +1879,37 @@ sub run_scp_mod {
     return run_scp($src, $dst, $cp_scp);
 }
 
-sub get_grub2_index {
+sub _get_grub_index {
+
+    my ($command, $target, $skip) = @_;
 
     return if (defined($grub_number) && defined($last_grub_menu) &&
               $last_grub_menu eq $grub_menu && defined($last_machine) &&
               $last_machine eq $machine);
 
-    doprint "Find grub2 menu ... ";
+    doprint "Find $reboot_type menu ... ";
     $grub_number = -1;
 
     my $ssh_grub = $ssh_exec;
-    $ssh_grub =~ s,\$SSH_COMMAND,cat $grub_file,g;
+    $ssh_grub =~ s,\$SSH_COMMAND,$command,g;
 
     open(IN, "$ssh_grub |")
-       or dodie "unable to get $grub_file";
+       or dodie "unable to execute $command";
 
     my $found = 0;
-    my $grub_menu_qt = quotemeta($grub_menu);
 
     while (<IN>) {
-       if (/^menuentry.*$grub_menu_qt/) {
+       if (/$target/) {
            $grub_number++;
            $found = 1;
            last;
-       } elsif (/^menuentry\s|^submenu\s/) {
+       } elsif (/$skip/) {
            $grub_number++;
        }
     }
     close(IN);
 
-    dodie "Could not find '$grub_menu' in $grub_file on $machine"
+    dodie "Could not find '$grub_menu' through $command on $machine"
        if (!$found);
     doprint "$grub_number\n";
     $last_grub_menu = $grub_menu;
@@ -1909,46 +1918,34 @@ sub get_grub2_index {
 
 sub get_grub_index {
 
-    if ($reboot_type eq "grub2") {
-       get_grub2_index;
-       return;
-    }
+    my $command;
+    my $target;
+    my $skip;
+    my $grub_menu_qt;
 
-    if ($reboot_type ne "grub") {
+    if ($reboot_type !~ /^grub/) {
        return;
     }
-    return if (defined($grub_number) && defined($last_grub_menu) &&
-              $last_grub_menu eq $grub_menu && defined($last_machine) &&
-              $last_machine eq $machine);
 
-    doprint "Find grub menu ... ";
-    $grub_number = -1;
-
-    my $ssh_grub = $ssh_exec;
-    $ssh_grub =~ s,\$SSH_COMMAND,cat /boot/grub/menu.lst,g;
-
-    open(IN, "$ssh_grub |")
-       or dodie "unable to get menu.lst";
-
-    my $found = 0;
-    my $grub_menu_qt = quotemeta($grub_menu);
+    $grub_menu_qt = quotemeta($grub_menu);
 
-    while (<IN>) {
-       if (/^\s*title\s+$grub_menu_qt\s*$/) {
-           $grub_number++;
-           $found = 1;
-           last;
-       } elsif (/^\s*title\s/) {
-           $grub_number++;
-       }
+    if ($reboot_type eq "grub") {
+       $command = "cat /boot/grub/menu.lst";
+       $target = '^\s*title\s+' . $grub_menu_qt . '\s*$';
+       $skip = '^\s*title\s';
+    } elsif ($reboot_type eq "grub2") {
+       $command = "cat $grub_file";
+       $target = '^menuentry.*' . $grub_menu_qt;
+       $skip = '^menuentry\s|^submenu\s';
+    } elsif ($reboot_type eq "grub2bls") {
+        $command = $grub_bls_get;
+        $target = '^title=.*' . $grub_menu_qt;
+        $skip = '^title=';
+    } else {
+       return;
     }
-    close(IN);
 
-    dodie "Could not find '$grub_menu' in /boot/grub/menu on $machine"
-       if (!$found);
-    doprint "$grub_number\n";
-    $last_grub_menu = $grub_menu;
-    $last_machine = $machine;
+    _get_grub_index($command, $target, $skip);
 }
 
 sub wait_for_input
@@ -4303,7 +4300,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 
     if (!$buildonly) {
        $target = "$ssh_user\@$machine";
-       if ($reboot_type eq "grub") {
+       if (($reboot_type eq "grub") or ($reboot_type eq "grub2bls")) {
            dodie "GRUB_MENU not defined" if (!defined($grub_menu));
        } elsif ($reboot_type eq "grub2") {
            dodie "GRUB_MENU not defined" if (!defined($grub_menu));
@@ -4423,7 +4420,9 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
 }
 
 if (defined($final_post_ktest)) {
-    run_command $final_post_ktest;
+
+    my $cp_final_post_ktest = eval_kernel_version $final_post_ktest;
+    run_command $cp_final_post_ktest;
 }
 
 if ($opt{"POWEROFF_ON_SUCCESS"}) {
index 8c893a5..c3bc933 100644 (file)
 # option to boot to with GRUB_REBOOT
 #GRUB_FILE = /boot/grub2/grub.cfg
 
-# The tool for REBOOT_TYPE = grub2 to set the next reboot kernel
+# The tool for REBOOT_TYPE = grub2 or grub2bls to set the next reboot kernel
 # to boot into (one shot mode).
 # (default grub2_reboot)
 #GRUB_REBOOT = grub2_reboot
 
 # The grub title name for the test kernel to boot
-# (Only mandatory if REBOOT_TYPE = grub or grub2)
+# (Only mandatory if REBOOT_TYPE = grub or grub2 or grub2bls)
 #
 # Note, ktest.pl will not update the grub menu.lst, you need to
 # manually add an option for the test. ktest.pl will search
 # do a: GRUB_MENU = 'Test Kernel'
 # For customizing, add your entry in /etc/grub.d/40_custom.
 #
+# For grub2bls, a search of "title"s are done. The menu is found
+# by searching for the contents of GRUB_MENU in the line that starts
+# with "title".
+#
 #GRUB_MENU = Test Kernel
 
 # For REBOOT_TYPE = syslinux, the name of the syslinux executable
 # default (undefined)
 #POST_KTEST = ${SSH} ~/dismantle_test
 
+# If you want to remove the kernel entry in Boot Loader Specification (BLS)
+# environment, use kernel-install command.
+# Here's the example:
+#POST_KTEST = ssh root@Test "/usr/bin/kernel-install remove $KERNEL_VERSION"
+
 # The default test type (default test)
 # The test types may be:
 #   build   - only build the kernel, do nothing else
 # or on some systems:
 #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION
 
+# If you want to add the kernel entry in Boot Loader Specification (BLS)
+# environment, use kernel-install command.
+# Here's the example:
+#POST_INSTALL = ssh root@Test "/usr/bin/kernel-install add $KERNEL_VERSION /boot/vmlinuz-$KERNEL_VERSION"
+
 # If for some reason you just want to boot the kernel and you do not
 # want the test to install anything new. For example, you may just want
 # to boot test the same kernel over and over and do not want to go through
 # For REBOOT_TYPE = grub2, you must define both GRUB_MENU and
 # GRUB_FILE.
 #
+# For REBOOT_TYPE = grub2bls, you must define GRUB_MENU.
+#
 # For REBOOT_TYPE = syslinux, you must define SYSLINUX_LABEL, and
 # perhaps modify SYSLINUX (default extlinux) and SYSLINUX_PATH
 # (default /boot/extlinux)
index e1286d2..c4a9196 100644 (file)
@@ -68,8 +68,11 @@ device_dax-y += device_dax_test.o
 device_dax-y += config_check.o
 
 dax_pmem-y := $(DAX_SRC)/pmem/pmem.o
+dax_pmem-y += dax_pmem_test.o
 dax_pmem_core-y := $(DAX_SRC)/pmem/core.o
+dax_pmem_core-y += dax_pmem_core_test.o
 dax_pmem_compat-y := $(DAX_SRC)/pmem/compat.o
+dax_pmem_compat-y += dax_pmem_compat_test.o
 dax_pmem-y += config_check.o
 
 libnvdimm-y := $(NVDIMM_SRC)/core.o
diff --git a/tools/testing/nvdimm/dax_pmem_compat_test.c b/tools/testing/nvdimm/dax_pmem_compat_test.c
new file mode 100644 (file)
index 0000000..7cd1877
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2019 Intel Corporation. All rights reserved.
+
+#include <linux/module.h>
+#include <linux/printk.h>
+#include "watermark.h"
+
+nfit_test_watermark(dax_pmem_compat);
diff --git a/tools/testing/nvdimm/dax_pmem_core_test.c b/tools/testing/nvdimm/dax_pmem_core_test.c
new file mode 100644 (file)
index 0000000..a4249cd
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2019 Intel Corporation. All rights reserved.
+
+#include <linux/module.h>
+#include <linux/printk.h>
+#include "watermark.h"
+
+nfit_test_watermark(dax_pmem_core);
diff --git a/tools/testing/nvdimm/dax_pmem_test.c b/tools/testing/nvdimm/dax_pmem_test.c
new file mode 100644 (file)
index 0000000..fd4c94a
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright(c) 2019 Intel Corporation. All rights reserved.
+
+#include <linux/module.h>
+#include <linux/printk.h>
+#include "watermark.h"
+
+nfit_test_watermark(dax_pmem);
index 85ffdcf..bb4225c 100644 (file)
@@ -3171,6 +3171,9 @@ static __init int nfit_test_init(void)
        acpi_nfit_test();
        device_dax_test();
        mcsafe_test();
+       dax_pmem_test();
+       dax_pmem_core_test();
+       dax_pmem_compat_test();
 
        nfit_test_setup(nfit_test_lookup, nfit_test_evaluate_dsm);
 
index ed05287..43fc4f3 100644 (file)
@@ -6,6 +6,9 @@ int pmem_test(void);
 int libnvdimm_test(void);
 int acpi_nfit_test(void);
 int device_dax_test(void);
+int dax_pmem_test(void);
+int dax_pmem_core_test(void);
+int dax_pmem_compat_test(void);
 
 /*
  * dummy routine for nfit_test to validate it is linking to the properly
index 933c3a6..cbb003d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -I. -I../../include -g -O2 -Wall -fsanitize=address
 LDFLAGS += -fsanitize=address -fsanitize=undefined
 TARGETS = main
index 9175035..8059ce8 100644 (file)
@@ -1,4 +1,3 @@
-kselftest
 gpiogpio-event-mon
 gpiogpio-hammer
 gpioinclude/
index f2ebf8c..9781ca7 100644 (file)
@@ -71,6 +71,9 @@ override LDFLAGS =
 override MAKEFLAGS =
 endif
 
+# Append kselftest to KBUILD_OUTPUT to avoid cluttering
+# KBUILD_OUTPUT with selftest objects and headers installed
+# by selftests Makefile or lib.mk.
 ifneq ($(KBUILD_SRC),)
 override LDFLAGS =
 endif
@@ -79,19 +82,13 @@ ifneq ($(O),)
        BUILD := $(O)
 else
        ifneq ($(KBUILD_OUTPUT),)
-               BUILD := $(KBUILD_OUTPUT)
+               BUILD := $(KBUILD_OUTPUT)/kselftest
        else
                BUILD := $(shell pwd)
                DEFAULT_INSTALL_HDR_PATH := 1
        endif
 endif
 
-# KSFT_TAP_LEVEL is used from KSFT framework to prevent nested TAP header
-# printing from tests. Applicable to run_tests case where run_tests adds
-# TAP header prior running tests and when a test program invokes another
-# with system() call. Export it here to cover override RUN_TESTS defines.
-export KSFT_TAP_LEVEL=`echo 1`
-
 # Prepare for headers install
 top_srcdir ?= ../../..
 include $(top_srcdir)/scripts/subarch.include
@@ -169,14 +166,22 @@ clean_hotplug:
 run_pstore_crash:
        make -C pstore run_crash
 
-INSTALL_PATH ?= install
+# Use $BUILD as the default install root. $BUILD points to the
+# right output location for the following cases:
+# 1. output_dir=kernel_src
+# 2. a separate output directory is specified using O= KBUILD_OUTPUT
+# 3. a separate output directory is specified using KBUILD_OUTPUT
+#
+INSTALL_PATH ?= $(BUILD)/install
 INSTALL_PATH := $(abspath $(INSTALL_PATH))
 ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
 
-install:
+install: all
 ifdef INSTALL_PATH
        @# Ask all targets to install their files
-       mkdir -p $(INSTALL_PATH)
+       mkdir -p $(INSTALL_PATH)/kselftest
+       install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
+       install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
        @for TARGET in $(TARGETS); do \
                BUILD_TARGET=$$BUILD/$$TARGET;  \
                make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
@@ -186,24 +191,20 @@ ifdef INSTALL_PATH
        echo "#!/bin/sh" > $(ALL_SCRIPT)
        echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT)
        echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT)
+       echo ". ./kselftest/runner.sh" >> $(ALL_SCRIPT)
        echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
        echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT)
-       echo "  OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT)
-       echo "  cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT)
-       echo "else" >> $(ALL_SCRIPT)
-       echo "  OUTPUT=/dev/stdout" >> $(ALL_SCRIPT)
+       echo "  logfile=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT)
+       echo "  cat /dev/null > \$$logfile" >> $(ALL_SCRIPT)
        echo "fi" >> $(ALL_SCRIPT)
-       echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT)
-       echo "export skip=4" >> $(ALL_SCRIPT)
 
        for TARGET in $(TARGETS); do \
                BUILD_TARGET=$$BUILD/$$TARGET;  \
-               echo "echo ; echo TAP version 13" >> $(ALL_SCRIPT);     \
-               echo "echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
-               echo "echo ========================================" >> $(ALL_SCRIPT); \
                echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
                echo "cd $$TARGET" >> $(ALL_SCRIPT); \
+               echo -n "run_many" >> $(ALL_SCRIPT); \
                make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
+               echo "" >> $(ALL_SCRIPT);           \
                echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
        done;
 
index 72c25a3..7c46271 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 SUBDIRS := ion
 
 TEST_PROGS := run.sh
index 88cfe88..0eb7ab6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 
 INCLUDEDIR := -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/
 CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
index 901b85e..8f3655e 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "../kselftest.h"
 
+#define COUNT_ISN_BPS  4
+#define COUNT_WPS      4
 
 /* Breakpoint access modes */
 enum {
@@ -220,7 +222,7 @@ static void trigger_tests(void)
                        if (!local && !global)
                                continue;
 
-                       for (i = 0; i < 4; i++) {
+                       for (i = 0; i < COUNT_ISN_BPS; i++) {
                                dummy_funcs[i]();
                                check_trapped();
                        }
@@ -292,7 +294,7 @@ static void launch_instruction_breakpoints(char *buf, int local, int global)
 {
        int i;
 
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < COUNT_ISN_BPS; i++) {
                set_breakpoint_addr(dummy_funcs[i], i);
                toggle_breakpoint(i, BP_X, 1, local, global, 1);
                ptrace(PTRACE_CONT, child_pid, NULL, 0);
@@ -314,7 +316,7 @@ static void launch_watchpoints(char *buf, int mode, int len,
        else
                mode_str = "read";
 
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < COUNT_WPS; i++) {
                set_breakpoint_addr(&dummy_var[i], i);
                toggle_breakpoint(i, mode, len, local, global, 1);
                ptrace(PTRACE_CONT, child_pid, NULL, 0);
@@ -330,8 +332,15 @@ static void launch_watchpoints(char *buf, int mode, int len,
 static void launch_tests(void)
 {
        char buf[1024];
+       unsigned int tests = 0;
        int len, local, global, i;
 
+       tests += 3 * COUNT_ISN_BPS;
+       tests += sizeof(long) / 2 * 3 * COUNT_WPS;
+       tests += sizeof(long) / 2 * 3 * COUNT_WPS;
+       tests += 2;
+       ksft_set_plan(tests);
+
        /* Instruction breakpoints */
        for (local = 0; local < 2; local++) {
                for (global = 0; global < 2; global++) {
index 2d95e5a..ab59d81 100644 (file)
@@ -118,7 +118,7 @@ static bool set_watchpoint(pid_t pid, int size, int wp)
        return false;
 }
 
-static bool run_test(int wr_size, int wp_size, int wr, int wp)
+static bool arun_test(int wr_size, int wp_size, int wr, int wp)
 {
        int status;
        siginfo_t siginfo;
@@ -214,6 +214,7 @@ int main(int argc, char **argv)
        bool result;
 
        ksft_print_header();
+       ksft_set_plan(213);
 
        act.sa_handler = sigalrm;
        sigemptyset(&act.sa_mask);
index f82dcc1..cf868b5 100644 (file)
@@ -173,6 +173,7 @@ int main(int argc, char **argv)
        int opt;
        bool do_suspend = true;
        bool succeeded = true;
+       unsigned int tests = 0;
        cpu_set_t available_cpus;
        int err;
        int cpu;
@@ -191,6 +192,13 @@ int main(int argc, char **argv)
                }
        }
 
+       for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
+               if (!CPU_ISSET(cpu, &available_cpus))
+                       continue;
+               tests++;
+       }
+       ksft_set_plan(tests);
+
        if (do_suspend)
                suspend();
 
index 3ab39a6..df0ef02 100644 (file)
@@ -430,8 +430,6 @@ int main(int argc, char **argv)
 {
        char *tmp1, *tmp2, *our_path;
 
-       ksft_print_header();
-
        /* Find our path */
        tmp1 = strdup(argv[0]);
        if (!tmp1)
@@ -445,6 +443,8 @@ int main(int argc, char **argv)
        mpid = getpid();
 
        if (fork_wait()) {
+               ksft_print_header();
+               ksft_set_plan(12);
                ksft_print_msg("[RUN]\t+++ Tests with uid == 0 +++\n");
                return do_tests(0, our_path);
        }
@@ -452,6 +452,8 @@ int main(int argc, char **argv)
        ksft_print_msg("==================================================\n");
 
        if (fork_wait()) {
+               ksft_print_header();
+               ksft_set_plan(9);
                ksft_print_msg("[RUN]\t+++ Tests with uid != 0 +++\n");
                return do_tests(1, our_path);
        }
diff --git a/tools/testing/selftests/drivers/.gitignore b/tools/testing/selftests/drivers/.gitignore
new file mode 100644 (file)
index 0000000..f6aebcc
--- /dev/null
@@ -0,0 +1 @@
+/dma-buf/udmabuf
index f22c3f7..79cb16b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -I../../../../../usr/include/
 
 TEST_GEN_PROGS := udmabuf
index c49dcea..e318133 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS = -Wall
 
 TEST_GEN_FILES := open-unlink create-read
index 64073e0..b02279d 100644 (file)
@@ -6,4 +6,5 @@ execveat.moved
 execveat.path.ephemeral
 execveat.ephemeral
 execveat.denatured
-xxxxxxxx*
\ No newline at end of file
+/recursion-depth
+xxxxxxxx*
index 427c41b..33339e3 100644 (file)
@@ -1,11 +1,15 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS = -Wall
+CFLAGS += -Wno-nonnull
+CFLAGS += -D_GNU_SOURCE
 
 TEST_GEN_PROGS := execveat
 TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
 # Makefile is a run-time dependency, since it's accessed by the execveat test
 TEST_FILES := Makefile
 
+TEST_GEN_PROGS += recursion-depth
+
 EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*
 
 include ../lib.mk
diff --git a/tools/testing/selftests/exec/recursion-depth.c b/tools/testing/selftests/exec/recursion-depth.c
new file mode 100644 (file)
index 0000000..2dbd5bc
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019 Alexey Dobriyan <adobriyan@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Test that pointing #! script interpreter to self doesn't recurse. */
+#include <errno.h>
+#include <sched.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mount.h>
+#include <unistd.h>
+
+int main(void)
+{
+       if (unshare(CLONE_NEWNS) == -1) {
+               if (errno == ENOSYS || errno == EPERM) {
+                       fprintf(stderr, "error: unshare, errno %d\n", errno);
+                       return 4;
+               }
+               fprintf(stderr, "error: unshare, errno %d\n", errno);
+               return 1;
+       }
+       if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) == -1) {
+               fprintf(stderr, "error: mount '/', errno %d\n", errno);
+               return 1;
+       }
+       /* Require "exec" filesystem. */
+       if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1) {
+               fprintf(stderr, "error: mount ramfs, errno %d\n", errno);
+               return 1;
+       }
+
+#define FILENAME "/tmp/1"
+
+       int fd = creat(FILENAME, 0700);
+       if (fd == -1) {
+               fprintf(stderr, "error: creat, errno %d\n", errno);
+               return 1;
+       }
+#define S "#!" FILENAME "\n"
+       if (write(fd, S, strlen(S)) != strlen(S)) {
+               fprintf(stderr, "error: write, errno %d\n", errno);
+               return 1;
+       }
+       close(fd);
+
+       int rv = execve(FILENAME, NULL, NULL);
+       if (rv == -1 && errno == ELOOP) {
+               return 0;
+       }
+       fprintf(stderr, "error: execve, rv %d, errno %d\n", rv, errno);
+       return 1;
+}
index 261c81f..012b2cf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for firmware loading selftests
 
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/tracing-error-log.tc b/tools/testing/selftests/ftrace/test.d/ftrace/tracing-error-log.tc
new file mode 100644 (file)
index 0000000..021c03f
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: ftrace - test tracing error log support
+
+fail() { #msg
+    echo $1
+    exit_fail
+}
+
+# event tracing is currently the only ftrace tracer that uses the
+# tracing error_log, hence this check
+if [ ! -f set_event ]; then
+    echo "event tracing is not supported"
+    exit_unsupported
+fi
+
+ftrace_errlog_check 'event filter parse error' '((sig >= 10 && sig < 15) || dsig ^== 17) && comm != bash' 'events/signal/signal_generate/filter'
+
+exit 0
index 7b96e80..779ec11 100644 (file)
@@ -109,3 +109,15 @@ LOCALHOST=127.0.0.1
 yield() {
     ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1
 }
+
+ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file
+    pos=$(echo -n "${2%^*}" | wc -c) # error position
+    command=$(echo "$2" | tr -d ^)
+    echo "Test command: $command"
+    echo > error_log
+    (! echo "$command" > "$3" ) 2> /dev/null
+    grep "$1: error:" -A 3 error_log
+    N=$(tail -n 1 error_log | wc -c)
+    # "  Command: " and "^\n" => 13
+    test $(expr 13 + $pos) -eq $N
+}
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
new file mode 100644 (file)
index 0000000..29faaec
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Kprobe event parser error log check
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+[ -f error_log ] || exit_unsupported
+
+check_error() { # command-with-error-pos-by-^
+    ftrace_errlog_check 'trace_kprobe' "$1" 'kprobe_events'
+}
+
+if grep -q 'r\[maxactive\]' README; then
+check_error 'p^100 vfs_read'           # MAXACT_NO_KPROBE
+check_error 'r^1a111 vfs_read'         # BAD_MAXACT
+check_error 'r^100000 vfs_read'                # MAXACT_TOO_BIG
+fi
+
+check_error 'p ^non_exist_func'                # BAD_PROBE_ADDR (enoent)
+check_error 'p ^hoge-fuga'             # BAD_PROBE_ADDR (bad syntax)
+check_error 'p ^hoge+1000-1000'                # BAD_PROBE_ADDR (bad syntax)
+check_error 'r ^vfs_read+10'           # BAD_RETPROBE
+check_error 'p:^/bar vfs_read'         # NO_GROUP_NAME
+check_error 'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read'        # GROUP_TOO_LONG
+
+check_error 'p:^foo.1/bar vfs_read'    # BAD_GROUP_NAME
+check_error 'p:foo/^ vfs_read'         # NO_EVENT_NAME
+check_error 'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read'        # EVENT_TOO_LONG
+check_error 'p:foo/^bar.1 vfs_read'    # BAD_EVENT_NAME
+
+check_error 'p vfs_read ^$retval'      # RETVAL_ON_PROBE
+check_error 'p vfs_read ^$stack10000'  # BAD_STACK_NUM
+
+if grep -q '$arg<N>' README; then
+check_error 'p vfs_read ^$arg10000'    # BAD_ARG_NUM
+fi
+
+check_error 'p vfs_read ^$none_var'    # BAD_VAR
+
+check_error 'p vfs_read ^%none_reg'    # BAD_REG_NAME
+check_error 'p vfs_read ^@12345678abcde'       # BAD_MEM_ADDR
+check_error 'p vfs_read ^@+10'         # FILE_ON_KPROBE
+
+check_error 'p vfs_read ^+0@0)'                # DEREF_NEED_BRACE
+check_error 'p vfs_read ^+0ab1(@0)'    # BAD_DEREF_OFFS
+check_error 'p vfs_read +0(+0(@0^)'    # DEREF_OPEN_BRACE
+
+if grep -A1 "fetcharg:" README | grep -q '\$comm' ; then
+check_error 'p vfs_read +0(^$comm)'    # COMM_CANT_DEREF
+fi
+
+check_error 'p vfs_read ^&1'           # BAD_FETCH_ARG
+
+
+# We've introduced this limitation with array support
+if grep -q ' <type>\\\[<array-size>\\\]' README; then
+check_error 'p vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))'   # TOO_MANY_OPS?
+check_error 'p vfs_read +0(@11):u8[10^'                # ARRAY_NO_CLOSE
+check_error 'p vfs_read +0(@11):u8[10]^a'      # BAD_ARRAY_SUFFIX
+check_error 'p vfs_read +0(@11):u8[^10a]'      # BAD_ARRAY_NUM
+check_error 'p vfs_read +0(@11):u8[^256]'      # ARRAY_TOO_BIG
+fi
+
+check_error 'p vfs_read @11:^unknown_type'     # BAD_TYPE
+check_error 'p vfs_read $stack0:^string'       # BAD_STRING
+check_error 'p vfs_read @11:^b10@a/16'         # BAD_BITFIELD
+
+check_error 'p vfs_read ^arg123456789012345678901234567890=@11'        # ARG_NAME_TOO_LOG
+check_error 'p vfs_read ^=@11'                 # NO_ARG_NAME
+check_error 'p vfs_read ^var.1=@11'            # BAD_ARG_NAME
+check_error 'p vfs_read var1=@11 ^var1=@12'    # USED_ARG_NAME
+check_error 'p vfs_read ^+1234567(+1234567(+1234567(+1234567(+1234567(+1234567(@1234))))))'    # ARG_TOO_LONG
+check_error 'p vfs_read arg1=^'                        # NO_ARG_BODY
+
+# instruction boundary check is valid on x86 (at this moment)
+case $(uname -m) in
+  x86_64|i[3456]86)
+    echo 'p vfs_read' > kprobe_events
+    if grep -q FTRACE ../kprobes/list ; then
+       check_error 'p ^vfs_read+3'             # BAD_INSN_BNDRY (only if function-tracer is enabled)
+    fi
+    ;;
+esac
+
+exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/uprobe_syntax_errors.tc b/tools/testing/selftests/ftrace/test.d/kprobe/uprobe_syntax_errors.tc
new file mode 100644 (file)
index 0000000..14229d5
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Uprobe event parser error log check
+
+[ -f uprobe_events ] || exit_unsupported # this is configurable
+
+[ -f error_log ] || exit_unsupported
+
+check_error() { # command-with-error-pos-by-^
+    ftrace_errlog_check 'trace_uprobe' "$1" 'uprobe_events'
+}
+
+check_error 'p ^/non_exist_file:100'   # FILE_NOT_FOUND
+check_error 'p ^/sys:100'              # NO_REGULAR_FILE
+check_error 'p /bin/sh:^10a'           # BAD_UPROBE_OFFS
+check_error 'p /bin/sh:10(^1a)'                # BAD_REFCNT
+check_error 'p /bin/sh:10(10^'         # REFCNT_OPEN_BRACE
+check_error 'p /bin/sh:10(10)^a'       # BAD_REFCNT_SUFFIX
+
+check_error 'p /bin/sh:10 ^@+ab'       # BAD_FILE_OFFS
+check_error 'p /bin/sh:10 ^@symbol'    # SYM_ON_UPROBE
+
+exit 0
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
deleted file mode 100644 (file)
index 9912616..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# description: event trigger - test extended error support
-
-
-fail() { #msg
-    echo $1
-    exit_fail
-}
-
-if [ ! -f set_event ]; then
-    echo "event tracing is not supported"
-    exit_unsupported
-fi
-
-if [ ! -f synthetic_events ]; then
-    echo "synthetic event is not supported"
-    exit_unsupported
-fi
-
-echo "Test extended error support"
-echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
-! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null
-if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then
-    fail "Failed to generate extended error in histogram"
-fi
-
-exit 0
index 54cd5c4..8d20957 100644 (file)
@@ -395,6 +395,7 @@ int main(int argc, char *argv[])
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Test requeue functionality\n", basename(argv[0]));
        ksft_print_msg(
                "\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n",
index 08187a1..742624c 100644 (file)
@@ -79,6 +79,7 @@ int main(int argc, char *argv[])
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Detect mismatched requeue_pi operations\n",
               basename(argv[0]));
 
index f0542a3..a0f5934 100644 (file)
@@ -144,6 +144,7 @@ int main(int argc, char *argv[])
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Test signal handling during requeue_pi\n",
               basename(argv[0]));
        ksft_print_msg("\tArguments: <none>\n");
index 6216de8..a458d42 100644 (file)
@@ -98,6 +98,7 @@ int main(int argc, char **argv)
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg(
                "%s: Test the futex value of private file mappings in FUTEX_WAIT\n",
                basename(argv[0]));
index bab3dfe..04b9547 100644 (file)
@@ -69,6 +69,7 @@ int main(int argc, char *argv[])
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Block on a futex and wait for timeout\n",
               basename(argv[0]));
        ksft_print_msg("\tArguments: timeout=%ldns\n", timeout_ns);
index 2697532..3a1d12a 100644 (file)
@@ -100,6 +100,7 @@ int main(int argc, char **argv)
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Test the uninitialized futex value in FUTEX_WAIT\n",
               basename(argv[0]));
 
index da15a63..a34a6bb 100644 (file)
@@ -65,6 +65,7 @@ int main(int argc, char *argv[])
        }
 
        ksft_print_header();
+       ksft_set_plan(1);
        ksft_print_msg("%s: Test the unexpected futex value in FUTEX_WAIT\n",
               basename(argv[0]));
 
index 47aa988..b4d39f6 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := kcmp_test
index 8e9b27a..aa91d20 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for kexec tests
 
 uname_M := $(shell uname -m 2>/dev/null || echo not)
index fa2ccc5..5b3e746 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for kmod loading selftests
 
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
index 47e1d99..ec15c4f 100644 (file)
@@ -33,6 +33,7 @@ struct ksft_count {
 };
 
 static struct ksft_count ksft_cnt;
+static unsigned int ksft_plan;
 
 static inline int ksft_test_num(void)
 {
@@ -61,13 +62,21 @@ static inline void ksft_print_header(void)
                printf("TAP version 13\n");
 }
 
+static inline void ksft_set_plan(unsigned int plan)
+{
+       ksft_plan = plan;
+       printf("1..%d\n", ksft_plan);
+}
+
 static inline void ksft_print_cnts(void)
 {
-       printf("Pass %d Fail %d Xfail %d Xpass %d Skip %d Error %d\n",
+       if (ksft_plan != ksft_test_num())
+               printf("# Planned tests != run tests (%u != %u)\n",
+                       ksft_plan, ksft_test_num());
+       printf("# Pass %d Fail %d Xfail %d Xpass %d Skip %d Error %d\n",
                ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
                ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
                ksft_cnt.ksft_xskip, ksft_cnt.ksft_error);
-       printf("1..%d\n", ksft_test_num());
 }
 
 static inline void ksft_print_msg(const char *msg, ...)
@@ -111,7 +120,7 @@ static inline void ksft_test_result_skip(const char *msg, ...)
        ksft_cnt.ksft_xskip++;
 
        va_start(args, msg);
-       printf("ok %d # skip ", ksft_test_num());
+       printf("not ok %d # SKIP ", ksft_test_num());
        vprintf(msg, args);
        va_end(args);
 }
@@ -172,7 +181,7 @@ static inline int ksft_exit_skip(const char *msg, ...)
                va_list args;
 
                va_start(args, msg);
-               printf("1..%d # Skipped: ", ksft_test_num());
+               printf("not ok %d # SKIP ", 1 + ksft_test_num());
                vprintf(msg, args);
                va_end(args);
        } else {
diff --git a/tools/testing/selftests/kselftest/prefix.pl b/tools/testing/selftests/kselftest/prefix.pl
new file mode 100755 (executable)
index 0000000..ec7e481
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+# SPDX-License-Identifier: GPL-2.0
+# Prefix all lines with "# ", unbuffered. Command being piped in may need
+# to have unbuffering forced with "stdbuf -i0 -o0 -e0 $cmd".
+use strict;
+
+binmode STDIN;
+binmode STDOUT;
+
+STDOUT->autoflush(1);
+
+my $needed = 1;
+while (1) {
+       my $char;
+       my $bytes = sysread(STDIN, $char, 1);
+       exit 0 if ($bytes == 0);
+       if ($needed) {
+               print "# ";
+               $needed = 0;
+       }
+       print $char;
+       $needed = 1 if ($char eq "\n");
+}
diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
new file mode 100644 (file)
index 0000000..eff3ee3
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Runs a set of tests in a given subdirectory.
+export skip_rc=4
+export logfile=/dev/stdout
+export per_test_logging=
+
+# There isn't a shell-agnostic way to find the path of a sourced file,
+# so we must rely on BASE_DIR being set to find other tools.
+if [ -z "$BASE_DIR" ]; then
+       echo "Error: BASE_DIR must be set before sourcing." >&2
+       exit 1
+fi
+
+# If Perl is unavailable, we must fall back to line-at-a-time prefixing
+# with sed instead of unbuffered output.
+tap_prefix()
+{
+       if [ ! -x /usr/bin/perl ]; then
+               sed -e 's/^/# /'
+       else
+               "$BASE_DIR"/kselftest/prefix.pl
+       fi
+}
+
+# If stdbuf is unavailable, we must fall back to line-at-a-time piping.
+tap_unbuffer()
+{
+       if ! which stdbuf >/dev/null ; then
+               "$@"
+       else
+               stdbuf -i0 -o0 -e0 "$@"
+       fi
+}
+
+run_one()
+{
+       DIR="$1"
+       TEST="$2"
+       NUM="$3"
+
+       BASENAME_TEST=$(basename $TEST)
+
+       TEST_HDR_MSG="selftests: $DIR: $BASENAME_TEST"
+       echo "# $TEST_HDR_MSG"
+       if [ ! -x "$TEST" ]; then
+               echo -n "# Warning: file $TEST is "
+               if [ ! -e "$TEST" ]; then
+                       echo "missing!"
+               else
+                       echo "not executable, correct this."
+               fi
+               echo "not ok $test_num $TEST_HDR_MSG"
+       else
+               cd `dirname $TEST` > /dev/null
+               (((((tap_unbuffer ./$BASENAME_TEST 2>&1; echo $? >&3) |
+                       tap_prefix >&4) 3>&1) |
+                       (read xs; exit $xs)) 4>>"$logfile" &&
+               echo "ok $test_num $TEST_HDR_MSG") ||
+               (if [ $? -eq $skip_rc ]; then   \
+                       echo "not ok $test_num $TEST_HDR_MSG # SKIP"
+               else
+                       echo "not ok $test_num $TEST_HDR_MSG"
+               fi)
+               cd - >/dev/null
+       fi
+}
+
+run_many()
+{
+       echo "TAP version 13"
+       DIR=$(basename "$PWD")
+       test_num=0
+       total=$(echo "$@" | wc -w)
+       echo "1..$total"
+       for TEST in "$@"; do
+               BASENAME_TEST=$(basename $TEST)
+               test_num=$(( test_num + 1 ))
+               if [ -n "$per_test_logging" ]; then
+                       logfile="/tmp/$BASENAME_TEST"
+                       cat /dev/null > "$logfile"
+               fi
+               run_one "$DIR" "$TEST" "$test_num"
+       done
+}
index 2689d1e..df1bf92 100644 (file)
@@ -1,9 +1,14 @@
 /x86_64/cr4_cpuid_sync_test
 /x86_64/evmcs_test
+/x86_64/hyperv_cpuid
+/x86_64/kvm_create_max_vcpus
 /x86_64/platform_info_test
 /x86_64/set_sregs_test
+/x86_64/smm_test
+/x86_64/state_test
 /x86_64/sync_regs_test
 /x86_64/vmx_close_while_nested_test
+/x86_64/vmx_set_nested_state_test
 /x86_64/vmx_tsc_adjust_test
-/x86_64/state_test
+/clear_dirty_log_test
 /dirty_log_test
index f8588cc..a035295 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 include ../../../../scripts/Kbuild.include
 
 all:
@@ -20,6 +21,8 @@ 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/vmx_close_while_nested_test
 TEST_GEN_PROGS_x86_64 += x86_64/smm_test
+TEST_GEN_PROGS_x86_64 += x86_64/kvm_create_max_vcpus
+TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
 TEST_GEN_PROGS_x86_64 += dirty_log_test
 TEST_GEN_PROGS_x86_64 += clear_dirty_log_test
 
index 93f99c6..f50a15c 100644 (file)
@@ -314,7 +314,7 @@ static void run_test(enum vm_guest_mode mode, unsigned long iterations,
 #ifdef USE_CLEAR_DIRTY_LOG
        struct kvm_enable_cap cap = {};
 
-       cap.cap = KVM_CAP_MANUAL_DIRTY_LOG_PROTECT;
+       cap.cap = KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2;
        cap.args[0] = 1;
        vm_enable_cap(vm, &cap);
 #endif
@@ -430,7 +430,7 @@ int main(int argc, char *argv[])
        int opt, i;
 
 #ifdef USE_CLEAR_DIRTY_LOG
-       if (!kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT)) {
+       if (!kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2)) {
                fprintf(stderr, "KVM_CLEAR_DIRTY_LOG not available, skipping tests\n");
                exit(KSFT_SKIP);
        }
index 07b71ad..8c6b961 100644 (file)
@@ -118,6 +118,10 @@ void vcpu_events_get(struct kvm_vm *vm, uint32_t vcpuid,
                     struct kvm_vcpu_events *events);
 void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
                     struct kvm_vcpu_events *events);
+void vcpu_nested_state_get(struct kvm_vm *vm, uint32_t vcpuid,
+                          struct kvm_nested_state *state);
+int vcpu_nested_state_set(struct kvm_vm *vm, uint32_t vcpuid,
+                         struct kvm_nested_state *state, bool ignore_error);
 
 const char *exit_reason_str(unsigned int exit_reason);
 
index 4ca96b2..e911385 100644 (file)
@@ -1250,6 +1250,38 @@ void vcpu_events_set(struct kvm_vm *vm, uint32_t vcpuid,
                ret, errno);
 }
 
+void vcpu_nested_state_get(struct kvm_vm *vm, uint32_t vcpuid,
+                          struct kvm_nested_state *state)
+{
+       struct vcpu *vcpu = vcpu_find(vm, vcpuid);
+       int ret;
+
+       TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid);
+
+       ret = ioctl(vcpu->fd, KVM_GET_NESTED_STATE, state);
+       TEST_ASSERT(ret == 0,
+               "KVM_SET_NESTED_STATE failed, ret: %i errno: %i",
+               ret, errno);
+}
+
+int vcpu_nested_state_set(struct kvm_vm *vm, uint32_t vcpuid,
+                         struct kvm_nested_state *state, bool ignore_error)
+{
+       struct vcpu *vcpu = vcpu_find(vm, vcpuid);
+       int ret;
+
+       TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid);
+
+       ret = ioctl(vcpu->fd, KVM_SET_NESTED_STATE, state);
+       if (!ignore_error) {
+               TEST_ASSERT(ret == 0,
+                       "KVM_SET_NESTED_STATE failed, ret: %i errno: %i",
+                       ret, errno);
+       }
+
+       return ret;
+}
+
 /*
  * VM VCPU System Regs Get
  *
diff --git a/tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/x86_64/kvm_create_max_vcpus.c
new file mode 100644 (file)
index 0000000..50e9299
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * kvm_create_max_vcpus
+ *
+ * Copyright (C) 2019, Google LLC.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ *
+ * Test for KVM_CAP_MAX_VCPUS and KVM_CAP_MAX_VCPU_ID.
+ */
+
+#define _GNU_SOURCE /* for program_invocation_short_name */
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "test_util.h"
+
+#include "kvm_util.h"
+#include "asm/kvm.h"
+#include "linux/kvm.h"
+
+void test_vcpu_creation(int first_vcpu_id, int num_vcpus)
+{
+       struct kvm_vm *vm;
+       int i;
+
+       printf("Testing creating %d vCPUs, with IDs %d...%d.\n",
+              num_vcpus, first_vcpu_id, first_vcpu_id + num_vcpus - 1);
+
+       vm = vm_create(VM_MODE_P52V48_4K, DEFAULT_GUEST_PHY_PAGES, O_RDWR);
+
+       for (i = 0; i < num_vcpus; i++) {
+               int vcpu_id = first_vcpu_id + i;
+
+               /* This asserts that the vCPU was created. */
+               vm_vcpu_add(vm, vcpu_id, 0, 0);
+       }
+
+       kvm_vm_free(vm);
+}
+
+int main(int argc, char *argv[])
+{
+       int kvm_max_vcpu_id = kvm_check_cap(KVM_CAP_MAX_VCPU_ID);
+       int kvm_max_vcpus = kvm_check_cap(KVM_CAP_MAX_VCPUS);
+
+       printf("KVM_CAP_MAX_VCPU_ID: %d\n", kvm_max_vcpu_id);
+       printf("KVM_CAP_MAX_VCPUS: %d\n", kvm_max_vcpus);
+
+       /*
+        * Upstream KVM prior to 4.8 does not support KVM_CAP_MAX_VCPU_ID.
+        * Userspace is supposed to use KVM_CAP_MAX_VCPUS as the maximum ID
+        * in this case.
+        */
+       if (!kvm_max_vcpu_id)
+               kvm_max_vcpu_id = kvm_max_vcpus;
+
+       TEST_ASSERT(kvm_max_vcpu_id >= kvm_max_vcpus,
+                   "KVM_MAX_VCPU_ID (%d) must be at least as large as KVM_MAX_VCPUS (%d).",
+                   kvm_max_vcpu_id, kvm_max_vcpus);
+
+       test_vcpu_creation(0, kvm_max_vcpus);
+
+       if (kvm_max_vcpu_id > kvm_max_vcpus)
+               test_vcpu_creation(
+                       kvm_max_vcpu_id - kvm_max_vcpus, kvm_max_vcpus);
+
+       return 0;
+}
diff --git a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c b/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
new file mode 100644 (file)
index 0000000..61a2163
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ * vmx_set_nested_state_test
+ *
+ * Copyright (C) 2019, Google LLC.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ *
+ * This test verifies the integrity of calling the ioctl KVM_SET_NESTED_STATE.
+ */
+
+#include "test_util.h"
+#include "kvm_util.h"
+#include "processor.h"
+#include "vmx.h"
+
+#include <errno.h>
+#include <linux/kvm.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+/*
+ * Mirror of VMCS12_REVISION in arch/x86/kvm/vmx/vmcs12.h. If that value
+ * changes this should be updated.
+ */
+#define VMCS12_REVISION 0x11e57ed0
+#define VCPU_ID 5
+
+void test_nested_state(struct kvm_vm *vm, struct kvm_nested_state *state)
+{
+       volatile struct kvm_run *run;
+
+       vcpu_nested_state_set(vm, VCPU_ID, state, false);
+       run = vcpu_state(vm, VCPU_ID);
+       vcpu_run(vm, VCPU_ID);
+       TEST_ASSERT(run->exit_reason == KVM_EXIT_SHUTDOWN,
+               "Got exit_reason other than KVM_EXIT_SHUTDOWN: %u (%s),\n",
+               run->exit_reason,
+               exit_reason_str(run->exit_reason));
+}
+
+void test_nested_state_expect_errno(struct kvm_vm *vm,
+                                   struct kvm_nested_state *state,
+                                   int expected_errno)
+{
+       volatile struct kvm_run *run;
+       int rv;
+
+       rv = vcpu_nested_state_set(vm, VCPU_ID, state, true);
+       TEST_ASSERT(rv == -1 && errno == expected_errno,
+               "Expected %s (%d) from vcpu_nested_state_set but got rv: %i errno: %s (%d)",
+               strerror(expected_errno), expected_errno, rv, strerror(errno),
+               errno);
+       run = vcpu_state(vm, VCPU_ID);
+       vcpu_run(vm, VCPU_ID);
+       TEST_ASSERT(run->exit_reason == KVM_EXIT_SHUTDOWN,
+               "Got exit_reason other than KVM_EXIT_SHUTDOWN: %u (%s),\n",
+               run->exit_reason,
+               exit_reason_str(run->exit_reason));
+}
+
+void test_nested_state_expect_einval(struct kvm_vm *vm,
+                                    struct kvm_nested_state *state)
+{
+       test_nested_state_expect_errno(vm, state, EINVAL);
+}
+
+void test_nested_state_expect_efault(struct kvm_vm *vm,
+                                    struct kvm_nested_state *state)
+{
+       test_nested_state_expect_errno(vm, state, EFAULT);
+}
+
+void set_revision_id_for_vmcs12(struct kvm_nested_state *state,
+                               u32 vmcs12_revision)
+{
+       /* Set revision_id in vmcs12 to vmcs12_revision. */
+       *(u32 *)(state->data) = vmcs12_revision;
+}
+
+void set_default_state(struct kvm_nested_state *state)
+{
+       memset(state, 0, sizeof(*state));
+       state->flags = KVM_STATE_NESTED_RUN_PENDING |
+                      KVM_STATE_NESTED_GUEST_MODE;
+       state->format = 0;
+       state->size = sizeof(*state);
+}
+
+void set_default_vmx_state(struct kvm_nested_state *state, int size)
+{
+       memset(state, 0, size);
+       state->flags = KVM_STATE_NESTED_GUEST_MODE  |
+                       KVM_STATE_NESTED_RUN_PENDING |
+                       KVM_STATE_NESTED_EVMCS;
+       state->format = 0;
+       state->size = size;
+       state->vmx.vmxon_pa = 0x1000;
+       state->vmx.vmcs_pa = 0x2000;
+       state->vmx.smm.flags = 0;
+       set_revision_id_for_vmcs12(state, VMCS12_REVISION);
+}
+
+void test_vmx_nested_state(struct kvm_vm *vm)
+{
+       /* Add a page for VMCS12. */
+       const int state_sz = sizeof(struct kvm_nested_state) + getpagesize();
+       struct kvm_nested_state *state =
+               (struct kvm_nested_state *)malloc(state_sz);
+
+       /* The format must be set to 0. 0 for VMX, 1 for SVM. */
+       set_default_vmx_state(state, state_sz);
+       state->format = 1;
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * We cannot virtualize anything if the guest does not have VMX
+        * enabled.
+        */
+       set_default_vmx_state(state, state_sz);
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * We cannot virtualize anything if the guest does not have VMX
+        * enabled.  We expect KVM_SET_NESTED_STATE to return 0 if vmxon_pa
+        * is set to -1ull.
+        */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = -1ull;
+       test_nested_state(vm, state);
+
+       /* Enable VMX in the guest CPUID. */
+       vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
+
+       /* It is invalid to have vmxon_pa == -1ull and SMM flags non-zero. */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = -1ull;
+       state->vmx.smm.flags = 1;
+       test_nested_state_expect_einval(vm, state);
+
+       /* It is invalid to have vmxon_pa == -1ull and vmcs_pa != -1ull. */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = -1ull;
+       state->vmx.vmcs_pa = 0;
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * Setting vmxon_pa == -1ull and vmcs_pa == -1ull exits early without
+        * setting the nested state.
+        */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = -1ull;
+       state->vmx.vmcs_pa = -1ull;
+       test_nested_state(vm, state);
+
+       /* It is invalid to have vmxon_pa set to a non-page aligned address. */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = 1;
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * It is invalid to have KVM_STATE_NESTED_SMM_GUEST_MODE and
+        * KVM_STATE_NESTED_GUEST_MODE set together.
+        */
+       set_default_vmx_state(state, state_sz);
+       state->flags = KVM_STATE_NESTED_GUEST_MODE  |
+                     KVM_STATE_NESTED_RUN_PENDING;
+       state->vmx.smm.flags = KVM_STATE_NESTED_SMM_GUEST_MODE;
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * It is invalid to have any of the SMM flags set besides:
+        *      KVM_STATE_NESTED_SMM_GUEST_MODE
+        *      KVM_STATE_NESTED_SMM_VMXON
+        */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.smm.flags = ~(KVM_STATE_NESTED_SMM_GUEST_MODE |
+                               KVM_STATE_NESTED_SMM_VMXON);
+       test_nested_state_expect_einval(vm, state);
+
+       /* Outside SMM, SMM flags must be zero. */
+       set_default_vmx_state(state, state_sz);
+       state->flags = 0;
+       state->vmx.smm.flags = KVM_STATE_NESTED_SMM_GUEST_MODE;
+       test_nested_state_expect_einval(vm, state);
+
+       /* Size must be large enough to fit kvm_nested_state and vmcs12. */
+       set_default_vmx_state(state, state_sz);
+       state->size = sizeof(*state);
+       test_nested_state(vm, state);
+
+       /* vmxon_pa cannot be the same address as vmcs_pa. */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = 0;
+       state->vmx.vmcs_pa = 0;
+       test_nested_state_expect_einval(vm, state);
+
+       /* The revision id for vmcs12 must be VMCS12_REVISION. */
+       set_default_vmx_state(state, state_sz);
+       set_revision_id_for_vmcs12(state, 0);
+       test_nested_state_expect_einval(vm, state);
+
+       /*
+        * Test that if we leave nesting the state reflects that when we get
+        * it again.
+        */
+       set_default_vmx_state(state, state_sz);
+       state->vmx.vmxon_pa = -1ull;
+       state->vmx.vmcs_pa = -1ull;
+       state->flags = 0;
+       test_nested_state(vm, state);
+       vcpu_nested_state_get(vm, VCPU_ID, state);
+       TEST_ASSERT(state->size >= sizeof(*state) && state->size <= state_sz,
+                   "Size must be between %d and %d.  The size returned was %d.",
+                   sizeof(*state), state_sz, state->size);
+       TEST_ASSERT(state->vmx.vmxon_pa == -1ull, "vmxon_pa must be -1ull.");
+       TEST_ASSERT(state->vmx.vmcs_pa == -1ull, "vmcs_pa must be -1ull.");
+
+       free(state);
+}
+
+int main(int argc, char *argv[])
+{
+       struct kvm_vm *vm;
+       struct kvm_nested_state state;
+       struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1);
+
+       if (!kvm_check_cap(KVM_CAP_NESTED_STATE)) {
+               printf("KVM_CAP_NESTED_STATE not available, skipping test\n");
+               exit(KSFT_SKIP);
+       }
+
+       /*
+        * AMD currently does not implement set_nested_state, so for now we
+        * just early out.
+        */
+       if (!(entry->ecx & CPUID_VMX)) {
+               fprintf(stderr, "nested VMX not enabled, skipping test\n");
+               exit(KSFT_SKIP);
+       }
+
+       vm = vm_create_default(VCPU_ID, 0, 0);
+
+       /* Passing a NULL kvm_nested_state causes a EFAULT. */
+       test_nested_state_expect_efault(vm, NULL);
+
+       /* 'size' cannot be smaller than sizeof(kvm_nested_state). */
+       set_default_state(&state);
+       state.size = 0;
+       test_nested_state_expect_einval(vm, &state);
+
+       /*
+        * Setting the flags 0xf fails the flags check.  The only flags that
+        * can be used are:
+        *     KVM_STATE_NESTED_GUEST_MODE
+        *     KVM_STATE_NESTED_RUN_PENDING
+        *     KVM_STATE_NESTED_EVMCS
+        */
+       set_default_state(&state);
+       state.flags = 0xf;
+       test_nested_state_expect_einval(vm, &state);
+
+       /*
+        * If KVM_STATE_NESTED_RUN_PENDING is set then
+        * KVM_STATE_NESTED_GUEST_MODE has to be set as well.
+        */
+       set_default_state(&state);
+       state.flags = KVM_STATE_NESTED_RUN_PENDING;
+       test_nested_state_expect_einval(vm, &state);
+
+       /*
+        * TODO: When SVM support is added for KVM_SET_NESTED_STATE
+        *       add tests here to support it like VMX.
+        */
+       if (entry->ecx & CPUID_VMX)
+               test_vmx_nested_state(vm);
+
+       kvm_vm_free(vm);
+       return 0;
+}
index 5979fdc..0773371 100644 (file)
@@ -3,17 +3,12 @@
 CC := $(CROSS_COMPILE)gcc
 
 ifeq (0,$(MAKELEVEL))
-    ifneq ($(O),)
-       OUTPUT := $(O)
-    else
-       ifneq ($(KBUILD_OUTPUT),)
-               OUTPUT := $(KBUILD_OUTPUT)
-       else
-               OUTPUT := $(shell pwd)
-               DEFAULT_INSTALL_HDR_PATH := 1
-       endif
+    ifeq ($(OUTPUT),)
+       OUTPUT := $(shell pwd)
+       DEFAULT_INSTALL_HDR_PATH := 1
     endif
 endif
+selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
 
 # The following are built by lib.mk common compile rules.
 # TEST_CUSTOM_PROGS should be used by tests that require
@@ -65,44 +60,13 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 endif
 
 .ONESHELL:
-define RUN_TEST_PRINT_RESULT
-       TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST";  \
-       echo $$TEST_HDR_MSG;                                    \
-       echo "========================================";        \
-       if [ ! -x $$TEST ]; then        \
-               echo "$$TEST_HDR_MSG: Warning: file $$BASENAME_TEST is not executable, correct this.";\
-               echo "not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]"; \
-       else                                    \
-               cd `dirname $$TEST` > /dev/null; \
-               if [ "X$(summary)" != "X" ]; then       \
-                       (./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && \
-                       echo "ok 1..$$test_num $$TEST_HDR_MSG [PASS]") || \
-                       (if [ $$? -eq $$skip ]; then    \
-                               echo "not ok 1..$$test_num $$TEST_HDR_MSG [SKIP]";                              \
-                       else echo "not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]";                                 \
-                       fi;)                    \
-               else                            \
-                       (./$$BASENAME_TEST &&   \
-                       echo "ok 1..$$test_num $$TEST_HDR_MSG [PASS]") ||                                               \
-                       (if [ $$? -eq $$skip ]; then \
-                               echo "not ok 1..$$test_num $$TEST_HDR_MSG [SKIP]"; \
-                       else echo "not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]";                         \
-                       fi;)            \
-               fi;                             \
-               cd - > /dev/null;               \
-       fi;
-endef
-
 define RUN_TESTS
-       @export KSFT_TAP_LEVEL=`echo 1`;                \
-       test_num=`echo 0`;                              \
-       skip=`echo 4`;                                  \
-       echo "TAP version 13";                          \
-       for TEST in $(1); do                            \
-               BASENAME_TEST=`basename $$TEST`;        \
-               test_num=`echo $$test_num+1 | bc`;      \
-               $(call RUN_TEST_PRINT_RESULT,$(TEST),$(BASENAME_TEST),$(test_num),$(skip))                                              \
-       done;
+       @BASE_DIR="$(selfdir)";                 \
+       . $(selfdir)/kselftest/runner.sh;       \
+       if [ "X$(summary)" != "X" ]; then       \
+               per_test_logging=1;             \
+       fi;                                     \
+       run_many $(1)
 endef
 
 run_tests: all
@@ -139,24 +103,12 @@ else
        $(error Error: set INSTALL_PATH to use install)
 endif
 
-define EMIT_TESTS
-       @test_num=`echo 0`;                             \
+emit_tests:
        for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
                BASENAME_TEST=`basename $$TEST`;        \
-               test_num=`echo $$test_num+1 | bc`;      \
-               TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST";  \
-               echo "echo $$TEST_HDR_MSG";     \
-               if [ ! -x $$TEST ]; then        \
-                       echo "echo \"$$TEST_HDR_MSG: Warning: file $$BASENAME_TEST is not executable, correct this.\"";         \
-                       echo "echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\""; \
-               else
-                       echo "(./$$BASENAME_TEST >> \$$OUTPUT 2>&1 && echo \"ok 1..$$test_num $$TEST_HDR_MSG [PASS]\") || (if [ \$$? -eq \$$skip ]; then echo \"not ok 1..$$test_num $$TEST_HDR_MSG [SKIP]\"; else echo \"not ok 1..$$test_num $$TEST_HDR_MSG [FAIL]\"; fi;)"; \
-               fi;             \
-       done;
-endef
-
-emit_tests:
-       $(EMIT_TESTS)
+               echo "  \\";                            \
+               echo -n "       \"$$BASENAME_TEST\"";   \
+       done;                                           \
 
 # define if isn't already. It is undefined in make O= case.
 ifeq ($(RM),)
index 9f26635..a105f09 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for lib/ function selftests
 
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
index 0284553..97e3bdf 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -g -I../../../../usr/include/
 
 TEST_GEN_PROGS := membarrier_test
index 6793f8e..70b4ddb 100644 (file)
@@ -304,6 +304,7 @@ static int test_membarrier_query(void)
 int main(int argc, char **argv)
 {
        ksft_print_header();
+       ksft_set_plan(13);
 
        test_membarrier_query();
        test_membarrier();
index 4b7e107..a93e6b6 100755 (executable)
@@ -15,6 +15,7 @@ GW_IP6=2001:db8:1::2
 SRC_IP6=2001:db8:1::3
 
 DEV_ADDR=192.51.100.1
+DEV_ADDR6=2001:db8:1::1
 DEV=dummy0
 
 log_test()
@@ -55,8 +56,8 @@ setup()
 
        $IP link add dummy0 type dummy
        $IP link set dev dummy0 up
-       $IP address add 198.51.100.1/24 dev dummy0
-       $IP -6 address add 2001:db8:1::1/64 dev dummy0
+       $IP address add $DEV_ADDR/24 dev dummy0
+       $IP -6 address add $DEV_ADDR6/64 dev dummy0
 
        set +e
 }
@@ -186,8 +187,13 @@ fib_rule4_test()
        match="oif $DEV"
        fib_rule4_test_match_n_redirect "$match" "$match" "oif redirect to table"
 
+       # need enable forwarding and disable rp_filter temporarily as all the
+       # addresses are in the same subnet and egress device == ingress device.
+       ip netns exec testns sysctl -w net.ipv4.ip_forward=1
+       ip netns exec testns sysctl -w net.ipv4.conf.$DEV.rp_filter=0
        match="from $SRC_IP iif $DEV"
        fib_rule4_test_match_n_redirect "$match" "$match" "iif redirect to table"
+       ip netns exec testns sysctl -w net.ipv4.ip_forward=0
 
        match="tos 0x10"
        fib_rule4_test_match_n_redirect "$match" "$match" "tos redirect to table"
index f102a65..1be55e7 100755 (executable)
@@ -8,6 +8,11 @@ ksft_skip=4
 ret=0
 test_inet_nat=true
 
+cleanup()
+{
+       for i in 0 1 2; do ip netns del ns$i;done
+}
+
 nft --version > /dev/null 2>&1
 if [ $? -ne 0 ];then
        echo "SKIP: Could not run test without nft tool"
@@ -21,6 +26,13 @@ if [ $? -ne 0 ];then
 fi
 
 ip netns add ns0
+if [ $? -ne 0 ];then
+       echo "SKIP: Could not create net namespace"
+       exit $ksft_skip
+fi
+
+trap cleanup EXIT
+
 ip netns add ns1
 ip netns add ns2
 
@@ -351,7 +363,7 @@ EOF
 test_masquerade6()
 {
        local family=$1
-       local natflags=$1
+       local natflags=$2
        local lret=0
 
        ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
@@ -396,18 +408,13 @@ EOF
 
        ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
        if [ $? -ne 0 ] ; then
-<<<<<<< HEAD
-               echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading"
-=======
-               echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags"
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+               echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags"
                lret=1
        fi
 
        # ns1 should have seen packets from ns0, due to masquerade
        expect="packets 1 bytes 104"
        for dir in "in6" "out6" ; do
-
                cnt=$(ip netns exec ns1 nft list counter inet filter ns0${dir} | grep -q "$expect")
                if [ $? -ne 0 ]; then
                        bad_counter ns1 ns0$dir "$expect"
@@ -437,38 +444,27 @@ EOF
                fi
        done
 
-<<<<<<< HEAD
-       ip netns exec ns0 nft flush chain $family nat postrouting
-=======
        ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1
        if [ $? -ne 0 ] ; then
                echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)"
                lret=1
        fi
 
-       ip netns exec ns0 nft flush chain ip6 nat postrouting
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+       ip netns exec ns0 nft flush chain $family nat postrouting
        if [ $? -ne 0 ]; then
                echo "ERROR: Could not flush $family nat postrouting" 1>&2
                lret=1
        fi
 
-<<<<<<< HEAD
-       test $lret -eq 0 && echo "PASS: $family IPv6 masquerade for ns2"
-=======
-       test $lret -eq 0 && echo "PASS: IPv6 masquerade $natflags for ns2"
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+       test $lret -eq 0 && echo "PASS: $family IPv6 masquerade $natflags for ns2"
 
        return $lret
 }
 
 test_masquerade()
 {
-<<<<<<< HEAD
        local family=$1
-=======
-       local natflags=$1
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+       local natflags=$2
        local lret=0
 
        ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
@@ -513,11 +509,7 @@ EOF
 
        ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
        if [ $? -ne 0 ] ; then
-<<<<<<< HEAD
-               echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading"
-=======
-               echo "ERROR: cannot ping ns1 from ns2 with active ip masquere $natflags"
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+               echo "ERROR: cannot ping ns1 from ns2 with active $family masquerade $natflags"
                lret=1
        fi
 
@@ -553,27 +545,19 @@ EOF
                fi
        done
 
-<<<<<<< HEAD
-       ip netns exec ns0 nft flush chain $family nat postrouting
-=======
        ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
        if [ $? -ne 0 ] ; then
                echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)"
                lret=1
        fi
 
-       ip netns exec ns0 nft flush chain ip nat postrouting
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+       ip netns exec ns0 nft flush chain $family nat postrouting
        if [ $? -ne 0 ]; then
                echo "ERROR: Could not flush $family nat postrouting" 1>&2
                lret=1
        fi
 
-<<<<<<< HEAD
-       test $lret -eq 0 && echo "PASS: $family IP masquerade for ns2"
-=======
-       test $lret -eq 0 && echo "PASS: IP masquerade $natflags for ns2"
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+       test $lret -eq 0 && echo "PASS: $family IP masquerade $natflags for ns2"
 
        return $lret
 }
@@ -846,21 +830,14 @@ reset_counters
 $test_inet_nat && test_local_dnat inet
 $test_inet_nat && test_local_dnat6 inet
 
+for flags in "" "fully-random"; do
 reset_counters
-<<<<<<< HEAD
-test_masquerade ip
-test_masquerade6 ip6
+test_masquerade ip $flags
+test_masquerade6 ip6 $flags
 reset_counters
-$test_inet_nat && test_masquerade inet
-$test_inet_nat && test_masquerade6 inet
-=======
-test_masquerade ""
-test_masquerade6 ""
-
-reset_counters
-test_masquerade "fully-random"
-test_masquerade6 "fully-random"
->>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1
+$test_inet_nat && test_masquerade inet $flags
+$test_inet_nat && test_masquerade6 inet $flags
+done
 
 reset_counters
 test_redirect ip
@@ -869,6 +846,4 @@ reset_counters
 $test_inet_nat && test_redirect inet
 $test_inet_nat && test_redirect6 inet
 
-for i in 0 1 2; do ip netns del ns$i;done
-
 exit $ret
index 9ff7c7f..dd9bd50 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 TEST_GEN_PROGS := owner pidns
 
 CFLAGS := -Wall -Werror
index 08cbfbb..8a20e03 100755 (executable)
@@ -1,16 +1,7 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Microsemi. All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would 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.
-#
 # Author: Logan Gunthorpe <logang@deltatee.com>
 
 REMOTE_HOST=
diff --git a/tools/testing/selftests/pidfd/.gitignore b/tools/testing/selftests/pidfd/.gitignore
new file mode 100644 (file)
index 0000000..822a1e6
--- /dev/null
@@ -0,0 +1 @@
+pidfd_test
index deaf807..443fedb 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -g -I../../../../usr/include/
 
 TEST_GEN_PROGS := pidfd_test
index d59378a..5bae179 100644 (file)
@@ -371,6 +371,7 @@ static int test_pidfd_send_signal_syscall_support(void)
 int main(int argc, char **argv)
 {
        ksft_print_header();
+       ksft_set_plan(4);
 
        test_pidfd_send_signal_syscall_support();
        test_pidfd_send_signal_simple_success();
index d056486..93e9af3 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 TEST_GEN_PROGS := copy_first_unaligned alignment_handler
 
 top_srcdir = ../../../../..
index ea2b7bd..9b9491a 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -I$(CURDIR)
 
 TEST_GEN_PROGS := load_unaligned_zeropad
index 161b884..01b2277 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 TEST_GEN_PROGS := ipc_unmuxed
 
 CFLAGS += -I../../../../../usr/include
index fb82068..18b885d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 TEST_GEN_PROGS := test-vphn
 
 CFLAGS += -m64
index 5163dc8..9f09fcd 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -Wall -O2 -Wno-unused-function
 CFLAGS += -D_GNU_SOURCE
 
index a5d8f0a..6216375 100644 (file)
@@ -63,30 +63,6 @@ static clockid_t get_clockid(int fd)
        return (((unsigned int) ~fd) << 3) | CLOCKFD;
 }
 
-static void handle_alarm(int s)
-{
-       printf("received signal %d\n", s);
-}
-
-static int install_handler(int signum, void (*handler)(int))
-{
-       struct sigaction action;
-       sigset_t mask;
-
-       /* Unblock the signal. */
-       sigemptyset(&mask);
-       sigaddset(&mask, signum);
-       sigprocmask(SIG_UNBLOCK, &mask, NULL);
-
-       /* Install the signal handler. */
-       action.sa_handler = handler;
-       action.sa_flags = 0;
-       sigemptyset(&action.sa_mask);
-       sigaction(signum, &action, NULL);
-
-       return 0;
-}
-
 static long ppb_to_scaled_ppm(int ppb)
 {
        /*
@@ -112,8 +88,6 @@ static void usage(char *progname)
 {
        fprintf(stderr,
                "usage: %s [options]\n"
-               " -a val     request a one-shot alarm after 'val' seconds\n"
-               " -A val     request a periodic alarm every 'val' seconds\n"
                " -c         query the ptp clock's capabilities\n"
                " -d name    device to open\n"
                " -e val     read 'val' external time stamp events\n"
@@ -148,15 +122,9 @@ int main(int argc, char *argv[])
        struct ptp_pin_desc desc;
        struct timespec ts;
        struct timex tx;
-
-       static timer_t timerid;
-       struct itimerspec timeout;
-       struct sigevent sigevent;
-
        struct ptp_clock_time *pct;
        struct ptp_sys_offset *sysoff;
 
-
        char *progname;
        unsigned int i;
        int c, cnt, fd;
@@ -170,10 +138,8 @@ int main(int argc, char *argv[])
        int gettime = 0;
        int index = 0;
        int list_pins = 0;
-       int oneshot = 0;
        int pct_offset = 0;
        int n_samples = 0;
-       int periodic = 0;
        int perout = -1;
        int pin_index = -1, pin_func;
        int pps = -1;
@@ -185,14 +151,8 @@ int main(int argc, char *argv[])
 
        progname = strrchr(argv[0], '/');
        progname = progname ? 1+progname : argv[0];
-       while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) {
+       while (EOF != (c = getopt(argc, argv, "cd:e:f:ghi:k:lL:p:P:sSt:T:v"))) {
                switch (c) {
-               case 'a':
-                       oneshot = atoi(optarg);
-                       break;
-               case 'A':
-                       periodic = atoi(optarg);
-                       break;
                case 'c':
                        capabilities = 1;
                        break;
@@ -393,49 +353,6 @@ int main(int argc, char *argv[])
                }
        }
 
-       if (oneshot) {
-               install_handler(SIGALRM, handle_alarm);
-               /* Create a timer. */
-               sigevent.sigev_notify = SIGEV_SIGNAL;
-               sigevent.sigev_signo = SIGALRM;
-               if (timer_create(clkid, &sigevent, &timerid)) {
-                       perror("timer_create");
-                       return -1;
-               }
-               /* Start the timer. */
-               memset(&timeout, 0, sizeof(timeout));
-               timeout.it_value.tv_sec = oneshot;
-               if (timer_settime(timerid, 0, &timeout, NULL)) {
-                       perror("timer_settime");
-                       return -1;
-               }
-               pause();
-               timer_delete(timerid);
-       }
-
-       if (periodic) {
-               install_handler(SIGALRM, handle_alarm);
-               /* Create a timer. */
-               sigevent.sigev_notify = SIGEV_SIGNAL;
-               sigevent.sigev_signo = SIGALRM;
-               if (timer_create(clkid, &sigevent, &timerid)) {
-                       perror("timer_create");
-                       return -1;
-               }
-               /* Start the timer. */
-               memset(&timeout, 0, sizeof(timeout));
-               timeout.it_interval.tv_sec = periodic;
-               timeout.it_value.tv_sec = periodic;
-               if (timer_settime(timerid, 0, &timeout, NULL)) {
-                       perror("timer_settime");
-                       return -1;
-               }
-               while (1) {
-                       pause();
-               }
-               timer_delete(timerid);
-       }
-
        if (perout >= 0) {
                if (clock_gettime(clkid, &ts)) {
                        perror("clock_gettime");
index 8a2bc55..cb21c76 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -iquote../../../../include/uapi -Wall
 
 TEST_GEN_PROGS := peeksiginfo
index c30c52e..d646953 100644 (file)
@@ -1,5 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0+ OR MIT
-CFLAGS += -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./
+
+ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
+CLANG_FLAGS += -no-integrated-as
+endif
+
+CFLAGS += -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ \
+         $(CLANG_FLAGS)
 LDLIBS += -lpthread
 
 # Own dependencies because we only want to build against 1st prerequisite, but
index 3cea198..84f28f1 100644 (file)
@@ -5,7 +5,54 @@
  * (C) Copyright 2016-2018 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
-#define RSEQ_SIG       0x53053053
+/*
+ * RSEQ_SIG uses the udf A32 instruction with an uncommon immediate operand
+ * value 0x5de3. This traps if user-space reaches this instruction by mistake,
+ * and the uncommon operand ensures the kernel does not move the instruction
+ * pointer to attacker-controlled code on rseq abort.
+ *
+ * The instruction pattern in the A32 instruction set is:
+ *
+ * e7f5def3    udf    #24035    ; 0x5de3
+ *
+ * This translates to the following instruction pattern in the T16 instruction
+ * set:
+ *
+ * little endian:
+ * def3        udf    #243      ; 0xf3
+ * e7f5        b.n    <7f5>
+ *
+ * pre-ARMv6 big endian code:
+ * e7f5        b.n    <7f5>
+ * def3        udf    #243      ; 0xf3
+ *
+ * ARMv6+ -mbig-endian generates mixed endianness code vs data: little-endian
+ * code and big-endian data. Ensure the RSEQ_SIG data signature matches code
+ * endianness. Prior to ARMv6, -mbig-endian generates big-endian code and data
+ * (which match), so there is no need to reverse the endianness of the data
+ * representation of the signature. However, the choice between BE32 and BE8
+ * is done by the linker, so we cannot know whether code and data endianness
+ * will be mixed before the linker is invoked.
+ */
+
+#define RSEQ_SIG_CODE  0xe7f5def3
+
+#ifndef __ASSEMBLER__
+
+#define RSEQ_SIG_DATA                                                  \
+       ({                                                              \
+               int sig;                                                \
+               asm volatile ("b 2f\n\t"                                \
+                             "1: .inst " __rseq_str(RSEQ_SIG_CODE) "\n\t" \
+                             "2:\n\t"                                  \
+                             "ldr %[sig], 1b\n\t"                      \
+                             : [sig] "=r" (sig));                      \
+               sig;                                                    \
+       })
+
+#define RSEQ_SIG       RSEQ_SIG_DATA
+
+#endif
 
 #define rseq_smp_mb()  __asm__ __volatile__ ("dmb" ::: "memory", "cc")
 #define rseq_smp_rmb() __asm__ __volatile__ ("dmb" ::: "memory", "cc")
@@ -30,18 +77,35 @@ do {                                                                        \
 #include "rseq-skip.h"
 #else /* !RSEQ_SKIP_FASTPATH */
 
-#define __RSEQ_ASM_DEFINE_TABLE(version, flags,        start_ip,               \
+#define __RSEQ_ASM_DEFINE_TABLE(label, version, flags, start_ip,       \
                                post_commit_offset, abort_ip)           \
-               ".pushsection __rseq_table, \"aw\"\n\t"                 \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                    \
                ".balign 32\n\t"                                        \
+               __rseq_str(label) ":\n\t"                                       \
                ".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".word " __rseq_str(label) "b, 0x0\n\t"                 \
                ".popsection\n\t"
 
-#define RSEQ_ASM_DEFINE_TABLE(start_ip, post_commit_ip, abort_ip)      \
-       __RSEQ_ASM_DEFINE_TABLE(0x0, 0x0, start_ip,                     \
+#define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip) \
+       __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip,              \
                                (post_commit_ip - start_ip), abort_ip)
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(exit_ip) ", 0x0\n\t" \
+               ".popsection\n\t"
+
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)               \
                RSEQ_INJECT_ASM(1)                                      \
                "adr r0, " __rseq_str(cs_label) "\n\t"                  \
@@ -61,7 +125,8 @@ do {                                                                 \
                __rseq_str(table_label) ":\n\t"                         \
                ".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
-               ".word " __rseq_str(RSEQ_SIG) "\n\t"                    \
+               ".arm\n\t"                                              \
+               ".inst " __rseq_str(RSEQ_SIG_CODE) "\n\t"               \
                __rseq_str(label) ":\n\t"                               \
                teardown                                                \
                "b %l[" __rseq_str(abort_label) "]\n\t"
@@ -86,7 +151,12 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -148,7 +218,12 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -214,7 +289,10 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -266,7 +344,12 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -336,7 +419,12 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -407,7 +495,13 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -485,7 +579,12 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                "str %[src], %[rseq_scratch0]\n\t"
                "str %[dst], %[rseq_scratch1]\n\t"
                "str %[len], %[rseq_scratch2]\n\t"
@@ -604,7 +703,12 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                "str %[src], %[rseq_scratch0]\n\t"
                "str %[dst], %[rseq_scratch1]\n\t"
                "str %[len], %[rseq_scratch2]\n\t"
index 954f346..200dae9 100644 (file)
@@ -6,7 +6,20 @@
  * (C) Copyright 2018 - Will Deacon <will.deacon@arm.com>
  */
 
-#define RSEQ_SIG       0xd428bc00      /* BRK #0x45E0 */
+/*
+ * aarch64 -mbig-endian generates mixed endianness code vs data:
+ * little-endian code and big-endian data. Ensure the RSEQ_SIG signature
+ * matches code endianness.
+ */
+#define RSEQ_SIG_CODE  0xd428bc00      /* BRK #0x45E0.  */
+
+#ifdef __AARCH64EB__
+#define RSEQ_SIG_DATA  0x00bc28d4      /* BRK #0x45E0.  */
+#else
+#define RSEQ_SIG_DATA  RSEQ_SIG_CODE
+#endif
+
+#define RSEQ_SIG       RSEQ_SIG_DATA
 
 #define rseq_smp_mb()  __asm__ __volatile__ ("dmb ish" ::: "memory")
 #define rseq_smp_rmb() __asm__ __volatile__ ("dmb ishld" ::: "memory")
@@ -82,19 +95,35 @@ do {                                                                                \
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags, start_ip,               \
                                post_commit_offset, abort_ip)                   \
-       "       .pushsection    __rseq_table, \"aw\"\n"                         \
+       "       .pushsection    __rseq_cs, \"aw\"\n"                            \
        "       .balign 32\n"                                                   \
        __rseq_str(label) ":\n"                                                 \
        "       .long   " __rseq_str(version) ", " __rseq_str(flags) "\n"       \
        "       .quad   " __rseq_str(start_ip) ", "                             \
                          __rseq_str(post_commit_offset) ", "                   \
                          __rseq_str(abort_ip) "\n"                             \
+       "       .popsection\n\t"                                                \
+       "       .pushsection __rseq_cs_ptr_array, \"aw\"\n"                             \
+       "       .quad " __rseq_str(label) "b\n"                                 \
        "       .popsection\n"
 
 #define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip)       \
        __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip,                      \
                                (post_commit_ip - start_ip), abort_ip)
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                          \
+       "       .pushsection __rseq_exit_point_array, \"aw\"\n"                 \
+       "       .quad " __rseq_str(start_ip) ", " __rseq_str(exit_ip) "\n"      \
+       "       .popsection\n"
+
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)                       \
        RSEQ_INJECT_ASM(1)                                                      \
        "       adrp    " RSEQ_ASM_TMP_REG ", " __rseq_str(cs_label) "\n"       \
@@ -105,7 +134,7 @@ do {                                                                                \
 
 #define RSEQ_ASM_DEFINE_ABORT(label, abort_label)                              \
        "       b       222f\n"                                                 \
-       "       .inst   "       __rseq_str(RSEQ_SIG) "\n"                       \
+       "       .inst   "       __rseq_str(RSEQ_SIG_CODE) "\n"                  \
        __rseq_str(label) ":\n"                                                 \
        "       b       %l[" __rseq_str(abort_label) "]\n"                      \
        "222:\n"
@@ -182,6 +211,11 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -231,6 +265,11 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -282,6 +321,9 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -325,6 +367,11 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -379,6 +426,11 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -433,6 +485,12 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error3])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -490,6 +548,11 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
@@ -545,6 +608,11 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(1, 2f, 3f, 4f)
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
+#endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
index 7f48ecf..e989e7c 100644 (file)
@@ -7,7 +7,39 @@
  * (C) Copyright 2016-2018 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
-#define RSEQ_SIG       0x53053053
+/*
+ * RSEQ_SIG uses the break instruction. The instruction pattern is:
+ *
+ * On MIPS:
+ *     0350000d        break     0x350
+ *
+ * On nanoMIPS:
+ *      00100350        break     0x350
+ *
+ * On microMIPS:
+ *      0000d407        break     0x350
+ *
+ * For nanoMIPS32 and microMIPS, the instruction stream is encoded as 16-bit
+ * halfwords, so the signature halfwords need to be swapped accordingly for
+ * little-endian.
+ */
+#if defined(__nanomips__)
+# ifdef __MIPSEL__
+#  define RSEQ_SIG     0x03500010
+# else
+#  define RSEQ_SIG     0x00100350
+# endif
+#elif defined(__mips_micromips)
+# ifdef __MIPSEL__
+#  define RSEQ_SIG     0xd4070000
+# else
+#  define RSEQ_SIG     0x0000d407
+# endif
+#elif defined(__mips__)
+# define RSEQ_SIG      0x0350000d
+#else
+/* Unknown MIPS architecture. */
+#endif
 
 #define rseq_smp_mb()  __asm__ __volatile__ ("sync" ::: "memory")
 #define rseq_smp_rmb() rseq_smp_mb()
@@ -54,20 +86,38 @@ do {                                                                        \
 # error unsupported _MIPS_SZLONG
 #endif
 
-#define __RSEQ_ASM_DEFINE_TABLE(version, flags,        start_ip, \
+#define __RSEQ_ASM_DEFINE_TABLE(label, version, flags, start_ip, \
                                post_commit_offset, abort_ip) \
-               ".pushsection __rseq_table, \"aw\"\n\t" \
+               ".pushsection __rseq_cs, \"aw\"\n\t" \
                ".balign 32\n\t" \
+               __rseq_str(label) ":\n\t"                                       \
                ".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                LONG " " U32_U64_PAD(__rseq_str(start_ip)) "\n\t" \
                LONG " " U32_U64_PAD(__rseq_str(post_commit_offset)) "\n\t" \
                LONG " " U32_U64_PAD(__rseq_str(abort_ip)) "\n\t" \
+               ".popsection\n\t" \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t" \
+               LONG " " U32_U64_PAD(__rseq_str(label) "b") "\n\t" \
                ".popsection\n\t"
 
-#define RSEQ_ASM_DEFINE_TABLE(start_ip, post_commit_ip, abort_ip) \
-       __RSEQ_ASM_DEFINE_TABLE(0x0, 0x0, start_ip, \
+#define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip) \
+       __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip, \
                                (post_commit_ip - start_ip), abort_ip)
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip) \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t" \
+               LONG " " U32_U64_PAD(__rseq_str(start_ip)) "\n\t" \
+               LONG " " U32_U64_PAD(__rseq_str(exit_ip)) "\n\t" \
+               ".popsection\n\t"
+
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs) \
                RSEQ_INJECT_ASM(1) \
                LONG_LA " $4, " __rseq_str(cs_label) "\n\t" \
@@ -113,7 +163,12 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -173,7 +228,12 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -237,7 +297,10 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -289,7 +352,12 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -357,7 +425,12 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -426,7 +499,13 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -500,7 +579,12 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                LONG_S " %[src], %[rseq_scratch0]\n\t"
                LONG_S "  %[dst], %[rseq_scratch1]\n\t"
                LONG_S " %[len], %[rseq_scratch2]\n\t"
@@ -616,7 +700,12 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 
        rseq_workaround_gcc_asm_size_guess();
        __asm__ __volatile__ goto (
-               RSEQ_ASM_DEFINE_TABLE(1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_TABLE(9, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                LONG_S " %[src], %[rseq_scratch0]\n\t"
                LONG_S " %[dst], %[rseq_scratch1]\n\t"
                LONG_S " %[len], %[rseq_scratch2]\n\t"
index 52630c9..76be901 100644 (file)
@@ -6,7 +6,15 @@
  * (C) Copyright 2016-2018 - Boqun Feng <boqun.feng@gmail.com>
  */
 
-#define RSEQ_SIG       0x53053053
+/*
+ * RSEQ_SIG is used with the following trap instruction:
+ *
+ * powerpc-be:    0f e5 00 0b           twui   r5,11
+ * powerpc64-le:  0b 00 e5 0f           twui   r5,11
+ * powerpc64-be:  0f e5 00 0b           twui   r5,11
+ */
+
+#define RSEQ_SIG       0x0fe5000b
 
 #define rseq_smp_mb()          __asm__ __volatile__ ("sync"    ::: "memory", "cc")
 #define rseq_smp_lwsync()      __asm__ __volatile__ ("lwsync"  ::: "memory", "cc")
@@ -33,8 +41,8 @@ do {                                                                  \
 #else /* !RSEQ_SKIP_FASTPATH */
 
 /*
- * The __rseq_table section can be used by debuggers to better handle
- * single-stepping through the restartable critical sections.
+ * The __rseq_cs_ptr_array and __rseq_cs sections can be used by debuggers to
+ * better handle single-stepping through the restartable critical sections.
  */
 
 #ifdef __PPC64__
@@ -46,11 +54,14 @@ do {                                                                        \
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                         \
                        start_ip, post_commit_offset, abort_ip)                 \
-               ".pushsection __rseq_table, \"aw\"\n\t"                         \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                            \
                ".balign 32\n\t"                                                \
                __rseq_str(label) ":\n\t"                                       \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t"      \
                ".quad " __rseq_str(start_ip) ", " __rseq_str(post_commit_offset) ", " __rseq_str(abort_ip) "\n\t" \
+               ".popsection\n\t"                                               \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"                  \
+               ".quad " __rseq_str(label) "b\n\t"                              \
                ".popsection\n\t"
 
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)                       \
@@ -63,6 +74,19 @@ do {                                                                 \
                "std %%r17, %[" __rseq_str(rseq_cs) "]\n\t"                     \
                __rseq_str(label) ":\n\t"
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".quad " __rseq_str(start_ip) ", " __rseq_str(exit_ip) "\n\t" \
+               ".popsection\n\t"
+
 #else /* #ifdef __PPC64__ */
 
 #define STORE_WORD     "stw "
@@ -72,12 +96,29 @@ do {                                                                        \
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                         \
                        start_ip, post_commit_offset, abort_ip)                 \
-               ".pushsection __rseq_table, \"aw\"\n\t"                         \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                            \
                ".balign 32\n\t"                                                \
                __rseq_str(label) ":\n\t"                                       \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t"      \
                /* 32-bit only supported on BE */                               \
                ".long 0x0, " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) "\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".long 0x0, " __rseq_str(label) "b\n\t"                 \
+               ".popsection\n\t"
+
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                          \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"              \
+               /* 32-bit only supported on BE */                               \
+               ".long 0x0, " __rseq_str(start_ip) ", 0x0, " __rseq_str(exit_ip) "\n\t" \
                ".popsection\n\t"
 
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)                       \
@@ -169,6 +210,11 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -224,6 +270,11 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -286,6 +337,9 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -337,6 +391,11 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -400,6 +459,11 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -465,6 +529,12 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
@@ -532,6 +602,11 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* setup for mempcy */
                "mr %%r19, %[len]\n\t"
                "mr %%r20, %[src]\n\t"
@@ -601,6 +676,11 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* setup for mempcy */
                "mr %%r19, %[len]\n\t"
                "mr %%r20, %[src]\n\t"
index 0afdf79..8ef94ad 100644 (file)
@@ -44,22 +44,54 @@ do {                                                                        \
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                 \
                                start_ip, post_commit_offset, abort_ip) \
-               ".pushsection __rseq_table, \"aw\"\n\t"                 \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                    \
                ".balign 32\n\t"                                        \
                __rseq_str(label) ":\n\t"                               \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".quad " __rseq_str(start_ip) ", " __rseq_str(post_commit_offset) ", " __rseq_str(abort_ip) "\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".quad " __rseq_str(label) "b\n\t"                      \
+               ".popsection\n\t"
+
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".quad " __rseq_str(start_ip) ", " __rseq_str(exit_ip) "\n\t" \
                ".popsection\n\t"
 
 #elif __s390__
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                 \
                                start_ip, post_commit_offset, abort_ip) \
-               ".pushsection __rseq_table, \"aw\"\n\t"                 \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                    \
                ".balign 32\n\t"                                        \
                __rseq_str(label) ":\n\t"                               \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".long 0x0, " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) "\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".long 0x0, " __rseq_str(label) "b\n\t"                 \
+               ".popsection\n\t"
+
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".long 0x0, " __rseq_str(start_ip) ", 0x0, " __rseq_str(exit_ip) "\n\t" \
                ".popsection\n\t"
 
 #define LONG_L                 "l"
@@ -92,14 +124,14 @@ do {                                                                       \
                ".long " __rseq_str(RSEQ_SIG) "\n\t"                    \
                __rseq_str(label) ":\n\t"                               \
                teardown                                                \
-               "j %l[" __rseq_str(abort_label) "]\n\t"                 \
+               "jg %l[" __rseq_str(abort_label) "]\n\t"                \
                ".popsection\n\t"
 
 #define RSEQ_ASM_DEFINE_CMPFAIL(label, teardown, cmpfail_label)                \
                ".pushsection __rseq_failure, \"ax\"\n\t"               \
                __rseq_str(label) ":\n\t"                               \
                teardown                                                \
-               "j %l[" __rseq_str(cmpfail_label) "]\n\t"               \
+               "jg %l[" __rseq_str(cmpfail_label) "]\n\t"              \
                ".popsection\n\t"
 
 static inline __attribute__((always_inline))
@@ -109,6 +141,11 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -167,6 +204,11 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -227,6 +269,9 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -275,6 +320,11 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -346,6 +396,12 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
@@ -414,6 +470,11 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                LONG_S " %[src], %[rseq_scratch0]\n\t"
                LONG_S " %[dst], %[rseq_scratch1]\n\t"
                LONG_S " %[len], %[rseq_scratch2]\n\t"
index 089410a..b2da600 100644 (file)
@@ -7,8 +7,25 @@
 
 #include <stdint.h>
 
+/*
+ * RSEQ_SIG is used with the following reserved undefined instructions, which
+ * trap in user-space:
+ *
+ * x86-32:    0f b9 3d 53 30 05 53      ud1    0x53053053,%edi
+ * x86-64:    0f b9 3d 53 30 05 53      ud1    0x53053053(%rip),%edi
+ */
 #define RSEQ_SIG       0x53053053
 
+/*
+ * Due to a compiler optimization bug in gcc-8 with asm goto and TLS asm input
+ * operands, we cannot use "m" input operands, and rather pass the __rseq_abi
+ * address through a "r" input operand.
+ */
+
+/* Offset of cpu_id and rseq_cs fields in struct rseq. */
+#define RSEQ_CPU_ID_OFFSET     4
+#define RSEQ_CS_OFFSET         8
+
 #ifdef __x86_64__
 
 #define rseq_smp_mb()  \
@@ -37,32 +54,49 @@ do {                                                                        \
 
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                 \
                                start_ip, post_commit_offset, abort_ip) \
-               ".pushsection __rseq_table, \"aw\"\n\t"                 \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                    \
                ".balign 32\n\t"                                        \
                __rseq_str(label) ":\n\t"                               \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".quad " __rseq_str(start_ip) ", " __rseq_str(post_commit_offset) ", " __rseq_str(abort_ip) "\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".quad " __rseq_str(label) "b\n\t"                      \
                ".popsection\n\t"
 
+
 #define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip) \
        __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip,              \
                                (post_commit_ip - start_ip), abort_ip)
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".quad " __rseq_str(start_ip) ", " __rseq_str(exit_ip) "\n\t" \
+               ".popsection\n\t"
+
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)               \
                RSEQ_INJECT_ASM(1)                                      \
                "leaq " __rseq_str(cs_label) "(%%rip), %%rax\n\t"       \
-               "movq %%rax, %[" __rseq_str(rseq_cs) "]\n\t"            \
+               "movq %%rax, " __rseq_str(rseq_cs) "\n\t"               \
                __rseq_str(label) ":\n\t"
 
 #define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
                RSEQ_INJECT_ASM(2)                                      \
-               "cmpl %[" __rseq_str(cpu_id) "], %[" __rseq_str(current_cpu_id) "]\n\t" \
+               "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \
                "jnz " __rseq_str(label) "\n\t"
 
 #define RSEQ_ASM_DEFINE_ABORT(label, teardown, abort_label)            \
                ".pushsection __rseq_failure, \"ax\"\n\t"               \
-               /* Disassembler-friendly signature: nopl <sig>(%rip). */\
-               ".byte 0x0f, 0x1f, 0x05\n\t"                            \
+               /* Disassembler-friendly signature: ud1 <sig>(%rip),%edi. */ \
+               ".byte 0x0f, 0xb9, 0x3d\n\t"                            \
                ".long " __rseq_str(RSEQ_SIG) "\n\t"                    \
                __rseq_str(label) ":\n\t"                               \
                teardown                                                \
@@ -83,15 +117,20 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -102,8 +141,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  [v]                   "m" (*v),
                  [expect]              "r" (expect),
                  [newv]                "r" (newv)
@@ -140,16 +178,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "movq %[v], %%rbx\n\t"
                "cmpq %%rbx, %[expectnot]\n\t"
                "je %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "movq %[v], %%rbx\n\t"
                "cmpq %%rbx, %[expectnot]\n\t"
                "je %l[error2]\n\t"
@@ -164,8 +207,7 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expectnot]           "r" (expectnot),
@@ -199,12 +241,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
 #endif
                /* final store */
                "addq %[count], %[v]\n\t"
@@ -213,8 +258,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [count]               "er" (count)
@@ -244,15 +288,20 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -266,8 +315,7 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* try store input */
                  [v2]                  "m" (*v2),
                  [newv2]               "r" (newv2),
@@ -314,9 +362,15 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
@@ -325,7 +379,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
                "cmpq %[v2], %[expect2]\n\t"
@@ -338,8 +392,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* cmp2 input */
                  [v2]                  "m" (*v2),
                  [expect2]             "r" (expect2),
@@ -381,18 +434,23 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                "movq %[src], %[rseq_scratch0]\n\t"
                "movq %[dst], %[rseq_scratch1]\n\t"
                "movq %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f)
                "cmpq %[v], %[expect]\n\t"
                "jnz 7f\n\t"
 #endif
@@ -440,8 +498,7 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 #endif
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expect]              "r" (expect),
@@ -520,31 +577,47 @@ do {                                                                      \
  */
 #define __RSEQ_ASM_DEFINE_TABLE(label, version, flags,                 \
                                start_ip, post_commit_offset, abort_ip) \
-               ".pushsection __rseq_table, \"aw\"\n\t"                 \
+               ".pushsection __rseq_cs, \"aw\"\n\t"                    \
                ".balign 32\n\t"                                        \
                __rseq_str(label) ":\n\t"                               \
                ".long " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
                ".long " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
+               ".popsection\n\t"                                       \
+               ".pushsection __rseq_cs_ptr_array, \"aw\"\n\t"          \
+               ".long " __rseq_str(label) "b, 0x0\n\t"                 \
                ".popsection\n\t"
 
 #define RSEQ_ASM_DEFINE_TABLE(label, start_ip, post_commit_ip, abort_ip) \
        __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip,              \
                                (post_commit_ip - start_ip), abort_ip)
 
+/*
+ * Exit points of a rseq critical section consist of all instructions outside
+ * of the critical section where a critical section can either branch to or
+ * reach through the normal course of its execution. The abort IP and the
+ * post-commit IP are already part of the __rseq_cs section and should not be
+ * explicitly defined as additional exit points. Knowing all exit points is
+ * useful to assist debuggers stepping over the critical section.
+ */
+#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip)                  \
+               ".pushsection __rseq_exit_point_array, \"aw\"\n\t"      \
+               ".long " __rseq_str(start_ip) ", 0x0, " __rseq_str(exit_ip) ", 0x0\n\t" \
+               ".popsection\n\t"
+
 #define RSEQ_ASM_STORE_RSEQ_CS(label, cs_label, rseq_cs)               \
                RSEQ_INJECT_ASM(1)                                      \
-               "movl $" __rseq_str(cs_label) ", %[rseq_cs]\n\t"        \
+               "movl $" __rseq_str(cs_label) ", " __rseq_str(rseq_cs) "\n\t"   \
                __rseq_str(label) ":\n\t"
 
 #define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
                RSEQ_INJECT_ASM(2)                                      \
-               "cmpl %[" __rseq_str(cpu_id) "], %[" __rseq_str(current_cpu_id) "]\n\t" \
+               "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \
                "jnz " __rseq_str(label) "\n\t"
 
 #define RSEQ_ASM_DEFINE_ABORT(label, teardown, abort_label)            \
                ".pushsection __rseq_failure, \"ax\"\n\t"               \
-               /* Disassembler-friendly signature: nopl <sig>. */      \
-               ".byte 0x0f, 0x1f, 0x05\n\t"                            \
+               /* Disassembler-friendly signature: ud1 <sig>,%edi. */  \
+               ".byte 0x0f, 0xb9, 0x3d\n\t"                            \
                ".long " __rseq_str(RSEQ_SIG) "\n\t"                    \
                __rseq_str(label) ":\n\t"                               \
                teardown                                                \
@@ -565,15 +638,20 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -584,8 +662,7 @@ int rseq_cmpeqv_storev(intptr_t *v, intptr_t expect, intptr_t newv, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  [v]                   "m" (*v),
                  [expect]              "r" (expect),
                  [newv]                "r" (newv)
@@ -622,16 +699,21 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[v], %%ebx\n\t"
                "cmpl %%ebx, %[expectnot]\n\t"
                "je %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "movl %[v], %%ebx\n\t"
                "cmpl %%ebx, %[expectnot]\n\t"
                "je %l[error2]\n\t"
@@ -646,8 +728,7 @@ int rseq_cmpnev_storeoffp_load(intptr_t *v, intptr_t expectnot,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expectnot]           "r" (expectnot),
@@ -681,12 +762,15 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
 #endif
                /* final store */
                "addl %[count], %[v]\n\t"
@@ -695,8 +779,7 @@ int rseq_addv(intptr_t *v, intptr_t count, int cpu)
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [count]               "ir" (count)
@@ -726,15 +809,20 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -749,8 +837,7 @@ int rseq_cmpeqv_trystorev_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* try store input */
                  [v2]                  "m" (*v2),
                  [newv2]               "m" (newv2),
@@ -788,16 +875,21 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[expect], %%eax\n\t"
                "cmpl %[v], %%eax\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "movl %[expect], %%eax\n\t"
                "cmpl %[v], %%eax\n\t"
                "jnz %l[error2]\n\t"
@@ -813,8 +905,7 @@ int rseq_cmpeqv_trystorev_storev_release(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* try store input */
                  [v2]                  "m" (*v2),
                  [newv2]               "r" (newv2),
@@ -853,9 +944,15 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error3])
+#endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
@@ -864,7 +961,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), %l[error1])
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
                "cmpl %[expect2], %[v2]\n\t"
@@ -878,8 +975,7 @@ int rseq_cmpeqv_cmpeqv_storev(intptr_t *v, intptr_t expect,
                RSEQ_ASM_DEFINE_ABORT(4, "", abort)
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* cmp2 input */
                  [v2]                  "m" (*v2),
                  [expect2]             "r" (expect2),
@@ -922,19 +1018,24 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                "movl %[src], %[rseq_scratch0]\n\t"
                "movl %[dst], %[rseq_scratch1]\n\t"
                "movl %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 7f\n\t"
@@ -984,8 +1085,7 @@ int rseq_cmpeqv_trymemcpy_storev(intptr_t *v, intptr_t expect,
 #endif
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expect]              "m" (expect),
@@ -1030,19 +1130,24 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 
        __asm__ __volatile__ goto (
                RSEQ_ASM_DEFINE_TABLE(3, 1f, 2f, 4f) /* start, commit, abort */
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[cmpfail])
+#ifdef RSEQ_COMPARE_TWICE
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error1])
+               RSEQ_ASM_DEFINE_EXIT_POINT(1f, %l[error2])
+#endif
                "movl %[src], %[rseq_scratch0]\n\t"
                "movl %[dst], %[rseq_scratch1]\n\t"
                "movl %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
-               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_CS_OFFSET(%[rseq_abi]))
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_CPU_ID_OFFSET(%[rseq_abi]), 6f)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 7f\n\t"
@@ -1093,8 +1198,7 @@ int rseq_cmpeqv_trymemcpy_storev_release(intptr_t *v, intptr_t expect,
 #endif
                : /* gcc asm goto does not allow outputs */
                : [cpu_id]              "r" (cpu),
-                 [current_cpu_id]      "m" (__rseq_abi.cpu_id),
-                 [rseq_cs]             "m" (__rseq_abi.rseq_cs),
+                 [rseq_abi]            "r" (&__rseq_abi),
                  /* final store input */
                  [v]                   "m" (*v),
                  [expect]              "m" (expect),
index 4847e97..7159eb7 100644 (file)
 #include <syscall.h>
 #include <assert.h>
 #include <signal.h>
+#include <limits.h>
 
 #include "rseq.h"
 
 #define ARRAY_SIZE(arr)        (sizeof(arr) / sizeof((arr)[0]))
 
-__attribute__((tls_model("initial-exec"))) __thread
-volatile struct rseq __rseq_abi = {
+__thread volatile struct rseq __rseq_abi = {
        .cpu_id = RSEQ_CPU_ID_UNINITIALIZED,
 };
 
-static __attribute__((tls_model("initial-exec"))) __thread
-volatile int refcount;
+/*
+ * Shared with other libraries. This library may take rseq ownership if it is
+ * still 0 when executing the library constructor. Set to 1 by library
+ * constructor when handling rseq. Set to 0 in destructor if handling rseq.
+ */
+int __rseq_handled;
+
+/* Whether this library have ownership of rseq registration. */
+static int rseq_ownership;
+
+static __thread volatile uint32_t __rseq_refcount;
 
 static void signal_off_save(sigset_t *oldset)
 {
@@ -69,8 +78,14 @@ int rseq_register_current_thread(void)
        int rc, ret = 0;
        sigset_t oldset;
 
+       if (!rseq_ownership)
+               return 0;
        signal_off_save(&oldset);
-       if (refcount++)
+       if (__rseq_refcount == UINT_MAX) {
+               ret = -1;
+               goto end;
+       }
+       if (__rseq_refcount++)
                goto end;
        rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG);
        if (!rc) {
@@ -78,9 +93,9 @@ int rseq_register_current_thread(void)
                goto end;
        }
        if (errno != EBUSY)
-               __rseq_abi.cpu_id = -2;
+               __rseq_abi.cpu_id = RSEQ_CPU_ID_REGISTRATION_FAILED;
        ret = -1;
-       refcount--;
+       __rseq_refcount--;
 end:
        signal_restore(oldset);
        return ret;
@@ -91,13 +106,20 @@ int rseq_unregister_current_thread(void)
        int rc, ret = 0;
        sigset_t oldset;
 
+       if (!rseq_ownership)
+               return 0;
        signal_off_save(&oldset);
-       if (--refcount)
+       if (!__rseq_refcount) {
+               ret = -1;
+               goto end;
+       }
+       if (--__rseq_refcount)
                goto end;
        rc = sys_rseq(&__rseq_abi, sizeof(struct rseq),
                      RSEQ_FLAG_UNREGISTER, RSEQ_SIG);
        if (!rc)
                goto end;
+       __rseq_refcount = 1;
        ret = -1;
 end:
        signal_restore(oldset);
@@ -115,3 +137,20 @@ int32_t rseq_fallback_current_cpu(void)
        }
        return cpu;
 }
+
+void __attribute__((constructor)) rseq_init(void)
+{
+       /* Check whether rseq is handled by another library. */
+       if (__rseq_handled)
+               return;
+       __rseq_handled = 1;
+       rseq_ownership = 1;
+}
+
+void __attribute__((destructor)) rseq_fini(void)
+{
+       if (!rseq_ownership)
+               return;
+       __rseq_handled = 0;
+       rseq_ownership = 0;
+}
index 6c1126e..d40d60e 100644 (file)
@@ -44,6 +44,7 @@
 #endif
 
 extern __thread volatile struct rseq __rseq_abi;
+extern int __rseq_handled;
 
 #define rseq_likely(x)         __builtin_expect(!!(x), 1)
 #define rseq_unlikely(x)       __builtin_expect(!!(x), 0)
index f68fbf8..3e96d5d 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS = -Wall
 TEST_GEN_PROGS = sas
 
index 228c2ae..ad0f8df 100644 (file)
@@ -109,6 +109,7 @@ int main(void)
        int err;
 
        ksft_print_header();
+       ksft_set_plan(3);
 
        sigemptyset(&act.sa_mask);
        act.sa_flags = SA_ONSTACK | SA_SIGINFO;
index 4685b3e..b87facc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS := -static -ffreestanding -nostartfiles -s
 
 TEST_GEN_PROGS := get_size
index 9cdadf3..aa64104 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for static keys selftests
 
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
index 7f79382..3824b66 100644 (file)
@@ -86,6 +86,7 @@ int main(void)
        int err;
 
        ksft_print_header();
+       ksft_set_plan(3 + 7);
 
        sync_api_supported();
 
index 95c320b..110301f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for sysctl selftests.
 # Expects kernel.sysctl_writes_strict=1.
 
index 780ce71..6a970b1 100755 (executable)
@@ -24,19 +24,21 @@ TEST_FILE=$(mktemp)
 
 # This represents
 #
-# TEST_ID:TEST_COUNT:ENABLED
+# TEST_ID:TEST_COUNT:ENABLED:TARGET
 #
 # TEST_ID: is the test id number
 # TEST_COUNT: number of times we should run the test
 # ENABLED: 1 if enabled, 0 otherwise
+# TARGET: test target file required on the test_sysctl module
 #
 # Once these are enabled please leave them as-is. Write your own test,
 # we have tons of space.
-ALL_TESTS="0001:1:1"
-ALL_TESTS="$ALL_TESTS 0002:1:1"
-ALL_TESTS="$ALL_TESTS 0003:1:1"
-ALL_TESTS="$ALL_TESTS 0004:1:1"
-ALL_TESTS="$ALL_TESTS 0005:3:1"
+ALL_TESTS="0001:1:1:int_0001"
+ALL_TESTS="$ALL_TESTS 0002:1:1:string_0001"
+ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002"
+ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001"
+ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003"
+ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001"
 
 test_modprobe()
 {
@@ -149,6 +151,9 @@ reset_vals()
                string_0001)
                        VAL="(none)"
                        ;;
+               bitmap_0001)
+                       VAL=""
+                       ;;
                *)
                        ;;
        esac
@@ -157,8 +162,10 @@ reset_vals()
 
 set_orig()
 {
-       if [ ! -z $TARGET ]; then
-               echo "${ORIG}" > "${TARGET}"
+       if [ ! -z $TARGET ] && [ ! -z $ORIG ]; then
+               if [ -f ${TARGET} ]; then
+                       echo "${ORIG}" > "${TARGET}"
+               fi
        fi
 }
 
@@ -177,9 +184,25 @@ verify()
        return 0
 }
 
+# proc files get read a page at a time, which can confuse diff,
+# and get you incorrect results on proc files with long data. To use
+# diff against them you must first extract the output to a file, and
+# then compare against that file.
+verify_diff_proc_file()
+{
+       TMP_DUMP_FILE=$(mktemp)
+       cat $1 > $TMP_DUMP_FILE
+
+       if ! diff -w -q $TMP_DUMP_FILE $2; then
+               return 1
+       else
+               return 0
+       fi
+}
+
 verify_diff_w()
 {
-       echo "$TEST_STR" | diff -q -w -u - $1
+       echo "$TEST_STR" | diff -q -w -u - $1 > /dev/null
        return $?
 }
 
@@ -600,9 +623,70 @@ run_stringtests()
        test_rc
 }
 
+target_exists()
+{
+       TARGET="${SYSCTL}/$1"
+       TEST_ID="$2"
+
+       if [ ! -f ${TARGET} ] ; then
+               echo "Target for test $TEST_ID: $TARGET not exist, skipping test ..."
+               return 0
+       fi
+       return 1
+}
+
+run_bitmaptest() {
+       # Total length of bitmaps string to use, a bit under
+       # the maximum input size of the test node
+       LENGTH=$((RANDOM % 65000))
+
+       # First bit to set
+       BIT=$((RANDOM % 1024))
+
+       # String containing our list of bits to set
+       TEST_STR=$BIT
+
+       # build up the string
+       while [ "${#TEST_STR}" -le "$LENGTH" ]; do
+               # Make sure next entry is discontiguous,
+               # skip ahead at least 2
+               BIT=$((BIT + $((2 + RANDOM % 10))))
+
+               # Add new bit to the list
+               TEST_STR="${TEST_STR},${BIT}"
+
+               # Randomly make it a range
+               if [ "$((RANDOM % 2))" -eq "1" ]; then
+                       RANGE_END=$((BIT + $((1 + RANDOM % 10))))
+                       TEST_STR="${TEST_STR}-${RANGE_END}"
+                       BIT=$RANGE_END
+               fi
+       done
+
+       echo -n "Checking bitmap handler... "
+       TEST_FILE=$(mktemp)
+       echo -n "$TEST_STR" > $TEST_FILE
+
+       cat $TEST_FILE > $TARGET 2> /dev/null
+       if [ $? -ne 0 ]; then
+               echo "FAIL" >&2
+               rc=1
+               test_rc
+       fi
+
+       if ! verify_diff_proc_file "$TARGET" "$TEST_FILE"; then
+               echo "FAIL" >&2
+               rc=1
+       else
+               echo "ok"
+               rc=0
+       fi
+       test_rc
+}
+
 sysctl_test_0001()
 {
-       TARGET="${SYSCTL}/int_0001"
+       TARGET="${SYSCTL}/$(get_test_target 0001)"
        reset_vals
        ORIG=$(cat "${TARGET}")
        TEST_STR=$(( $ORIG + 1 ))
@@ -614,7 +698,7 @@ sysctl_test_0001()
 
 sysctl_test_0002()
 {
-       TARGET="${SYSCTL}/string_0001"
+       TARGET="${SYSCTL}/$(get_test_target 0002)"
        reset_vals
        ORIG=$(cat "${TARGET}")
        TEST_STR="Testing sysctl"
@@ -627,7 +711,7 @@ sysctl_test_0002()
 
 sysctl_test_0003()
 {
-       TARGET="${SYSCTL}/int_0002"
+       TARGET="${SYSCTL}/$(get_test_target 0003)"
        reset_vals
        ORIG=$(cat "${TARGET}")
        TEST_STR=$(( $ORIG + 1 ))
@@ -640,7 +724,7 @@ sysctl_test_0003()
 
 sysctl_test_0004()
 {
-       TARGET="${SYSCTL}/uint_0001"
+       TARGET="${SYSCTL}/$(get_test_target 0004)"
        reset_vals
        ORIG=$(cat "${TARGET}")
        TEST_STR=$(( $ORIG + 1 ))
@@ -653,13 +737,21 @@ sysctl_test_0004()
 
 sysctl_test_0005()
 {
-       TARGET="${SYSCTL}/int_0003"
+       TARGET="${SYSCTL}/$(get_test_target 0005)"
        reset_vals
        ORIG=$(cat "${TARGET}")
 
        run_limit_digit_int_array
 }
 
+sysctl_test_0006()
+{
+       TARGET="${SYSCTL}/bitmap_0001"
+       reset_vals
+       ORIG=""
+       run_bitmaptest
+}
+
 list_tests()
 {
        echo "Test ID list:"
@@ -673,10 +765,9 @@ list_tests()
        echo "0003 x $(get_test_count 0003) - tests proc_dointvec()"
        echo "0004 x $(get_test_count 0004) - tests proc_douintvec()"
        echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array"
+       echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap()"
 }
 
-test_reqs
-
 usage()
 {
        NUM_TESTS=$(grep -o ' ' <<<"$ALL_TESTS" | grep -c .)
@@ -724,25 +815,35 @@ function get_test_count()
 {
        test_num $1
        TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}')
-       LAST_TWO=${TEST_DATA#*:*}
-       echo ${LAST_TWO%:*}
+       echo ${TEST_DATA} | awk -F":" '{print $2}'
 }
 
 function get_test_enabled()
 {
        test_num $1
        TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}')
-       echo ${TEST_DATA#*:*:}
+       echo ${TEST_DATA} | awk -F":" '{print $3}'
+}
+
+function get_test_target()
+{
+       test_num $1
+       TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}')
+       echo ${TEST_DATA} | awk -F":" '{print $4}'
 }
 
 function run_all_tests()
 {
        for i in $ALL_TESTS ; do
-               TEST_ID=${i%:*:*}
+               TEST_ID=${i%:*:*:*}
                ENABLED=$(get_test_enabled $TEST_ID)
                TEST_COUNT=$(get_test_count $TEST_ID)
+               TEST_TARGET=$(get_test_target $TEST_ID)
+               if target_exists $TEST_TARGET $TEST_ID; then
+                       continue
+               fi
                if [[ $ENABLED -eq "1" ]]; then
-                       test_case $TEST_ID $TEST_COUNT
+                       test_case $TEST_ID $TEST_COUNT $TEST_TARGET
                fi
        done
 }
@@ -775,12 +876,14 @@ function watch_case()
 
 function test_case()
 {
-       NUM_TESTS=$DEFAULT_NUM_TESTS
-       if [ $# -eq 2 ]; then
-               NUM_TESTS=$2
-       fi
+       NUM_TESTS=$2
 
        i=0
+
+       if target_exists $3 $1; then
+               continue
+       fi
+
        while [ $i -lt $NUM_TESTS ]; do
                test_num $1
                watch_log $i ${TEST_NAME}_test_$1 noclear
@@ -803,15 +906,15 @@ function parse_args()
                elif [[ "$1" = "-t" ]]; then
                        shift
                        test_num $1
-                       test_case $1 $(get_test_count $1)
+                       test_case $1 $(get_test_count $1) $(get_test_target $1)
                elif [[ "$1" = "-c" ]]; then
                        shift
                        test_num $1
                        test_num $2
-                       test_case $1 $2
+                       test_case $1 $2 $(get_test_target $1)
                elif [[ "$1" = "-s" ]]; then
                        shift
-                       test_case $1 1
+                       test_case $1 1 $(get_test_target $1)
                elif [[ "$1" = "-l" ]]; then
                        list_tests
                elif [[ "$1" = "-h" || "$1" = "--help" ]]; then
@@ -825,8 +928,8 @@ function parse_args()
 test_reqs
 allow_user_defaults
 check_production_sysctl_writes_strict
-test_modprobe
 load_req_mod
+test_modprobe
 
 trap "test_finish" EXIT
 
index 953c812..aa11ccc 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -Wall -O2
 CFLAGS += -D_GNU_SOURCE
 
index d401b63..640a40f 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 # Makefile for user memory selftests
 
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
index b9566a6..114863d 100755 (executable)
@@ -1,16 +1,7 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would 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.
-#
 # Test creates several zram devices with different filesystems on them.
 # It fills each device with zeros and checks that compression works.
 #
index 74569b8..e83b404 100755 (executable)
@@ -1,16 +1,7 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would 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.
-#
 # Test checks that we can create swap zram device.
 #
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
index 9e73a4f..6f872f2 100755 (executable)
@@ -1,16 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would 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.
-#
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 # Modified: Naresh Kamboju <naresh.kamboju@linaro.org>
 
index 66ba092..5be687b 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 all: test
 test: vsock_diag_test
 vsock_diag_test: vsock_diag_test.o timeout.o control.o
index 8c4a6f0..c352383 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 CC = gcc
 LIBUSB_CFLAGS = $(shell pkg-config --cflags libusb-1.0)
 LIBUSB_LIBS = $(shell pkg-config --libs libusb-1.0)
index ec3a0b7..5a3726e 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015 Karol Kosik <karo9@interia.eu>
  *              2015 Samsung Electronics
@@ -6,19 +7,6 @@
  * Based on tools/usb/usbip/libsrc/usbip_host_driver.c, which is:
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <fcntl.h>
index 54cb658..1ce0bbd 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015 Karol Kosik <karo9@interia.eu>
  *              2015 Samsung Electronics
@@ -6,19 +7,6 @@
  * Based on tools/usb/usbip/libsrc/usbip_host_driver.c, which is:
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __USBIP_DEVICE_DRIVER_H
index d79c758..2813aa8 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
@@ -6,19 +7,6 @@
  * Refactored from usbip_host_driver.c, which is:
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
index a64b803..f46967c 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
@@ -6,19 +7,6 @@
  * Refactored from usbip_host_driver.c, which is:
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __USBIP_HOST_COMMON_H
index 4de6edc..573e73e 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
  *               Krzysztof Opasiak <k.opasiak@samsung.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <unistd.h>
index 77f07e7..6ba996c 100644 (file)
@@ -1,22 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
  *               Krzysztof Opasiak <k.opasiak@samsung.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __USBIP_HOST_DRIVER_H
index 73d8eee..f7c7220 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * command structure borrowed from udev
  * (git://git.kernel.org/pub/scm/linux/hotplug/udev.git)
  *
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
index 84fe66a..e317792 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __USBIP_H
index ba88728..b4aeb9f 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
  *               Krzysztof Opasiak <k.opasiak@samsung.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/stat.h>
index e121cfb..f1cf922 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <libudev.h>
index 777f728..aec9931 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <ctype.h>
index 8d4ccf4..8625b0f 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
  *               Krzysztof Opasiak <k.opasiak@samsung.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
index 8ffcd47..d595d72 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/socket.h>
index a4a496c..66a44d4 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <libudev.h>
index 32864c5..48398a7 100644 (file)
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *               Igor Kotrasinski <i.kotrasinsk@samsung.com>
  *               Krzysztof Opasiak <k.opasiak@samsung.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifdef HAVE_CONFIG_H
index 3d7b42e..76a2e12 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
index 5916fd3..4fc1385 100644 (file)
@@ -1,19 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
  *               2005-2007 Takahiro Hirofuchi
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __UTILS_H
index a1d35b8..94d3aff 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-m += vhost_test.o
 EXTRA_CFLAGS += -Idrivers/vhost
index e0e8723..e161ff5 100644 (file)
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
 PREFIX ?= /usr
 SBINDIR ?= sbin
 INSTALL ?= install
index be78347..1cfea94 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-y  += lib/
index ea434dd..aad9284 100644 (file)
@@ -57,3 +57,6 @@ config HAVE_KVM_VCPU_ASYNC_IOCTL
 
 config HAVE_KVM_VCPU_RUN_PID_CHANGE
        bool
+
+config HAVE_KVM_NO_POLL
+       bool
index f412ebc..90cedeb 100644 (file)
@@ -56,7 +56,7 @@
 __asm__(".arch_extension       virt");
 #endif
 
-DEFINE_PER_CPU(kvm_cpu_context_t, kvm_host_cpu_state);
+DEFINE_PER_CPU(kvm_host_data_t, kvm_host_data);
 static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
 
 /* Per-CPU variable containing the currently running vcpu. */
@@ -224,9 +224,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_MAX_VCPUS:
                r = KVM_MAX_VCPUS;
                break;
-       case KVM_CAP_NR_MEMSLOTS:
-               r = KVM_USER_MEM_SLOTS;
-               break;
        case KVM_CAP_MSI_DEVID:
                if (!kvm)
                        r = -EINVAL;
@@ -360,8 +357,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 {
        int *last_ran;
+       kvm_host_data_t *cpu_data;
 
        last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran);
+       cpu_data = this_cpu_ptr(&kvm_host_data);
 
        /*
         * We might get preempted before the vCPU actually runs, but
@@ -373,18 +372,21 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
        }
 
        vcpu->cpu = cpu;
-       vcpu->arch.host_cpu_context = this_cpu_ptr(&kvm_host_cpu_state);
+       vcpu->arch.host_cpu_context = &cpu_data->host_ctxt;
 
        kvm_arm_set_running_vcpu(vcpu);
        kvm_vgic_load(vcpu);
        kvm_timer_vcpu_load(vcpu);
        kvm_vcpu_load_sysregs(vcpu);
        kvm_arch_vcpu_load_fp(vcpu);
+       kvm_vcpu_pmu_restore_guest(vcpu);
 
        if (single_task_running())
                vcpu_clear_wfe_traps(vcpu);
        else
                vcpu_set_wfe_traps(vcpu);
+
+       vcpu_ptrauth_setup_lazy(vcpu);
 }
 
 void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
@@ -393,6 +395,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
        kvm_vcpu_put_sysregs(vcpu);
        kvm_timer_vcpu_put(vcpu);
        kvm_vgic_put(vcpu);
+       kvm_vcpu_pmu_restore_host(vcpu);
 
        vcpu->cpu = -1;
 
@@ -545,6 +548,9 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
        if (likely(vcpu->arch.has_run_once))
                return 0;
 
+       if (!kvm_arm_vcpu_is_finalized(vcpu))
+               return -EPERM;
+
        vcpu->arch.has_run_once = true;
 
        if (likely(irqchip_in_kernel(kvm))) {
@@ -1121,6 +1127,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
                if (unlikely(!kvm_vcpu_initialized(vcpu)))
                        break;
 
+               r = -EPERM;
+               if (!kvm_arm_vcpu_is_finalized(vcpu))
+                       break;
+
                r = -EFAULT;
                if (copy_from_user(&reg_list, user_list, sizeof(reg_list)))
                        break;
@@ -1174,6 +1184,17 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 
                return kvm_arm_vcpu_set_events(vcpu, &events);
        }
+       case KVM_ARM_VCPU_FINALIZE: {
+               int what;
+
+               if (!kvm_vcpu_initialized(vcpu))
+                       return -ENOEXEC;
+
+               if (get_user(what, (const int __user *)argp))
+                       return -EFAULT;
+
+               return kvm_arm_vcpu_finalize(vcpu, what);
+       }
        default:
                r = -EINVAL;
        }
@@ -1554,11 +1575,11 @@ static int init_hyp_mode(void)
        }
 
        for_each_possible_cpu(cpu) {
-               kvm_cpu_context_t *cpu_ctxt;
+               kvm_host_data_t *cpu_data;
 
-               cpu_ctxt = per_cpu_ptr(&kvm_host_cpu_state, cpu);
-               kvm_init_host_cpu_context(cpu_ctxt, cpu);
-               err = create_hyp_mappings(cpu_ctxt, cpu_ctxt + 1, PAGE_HYP);
+               cpu_data = per_cpu_ptr(&kvm_host_data, cpu);
+               kvm_init_host_cpu_context(&cpu_data->host_ctxt, cpu);
+               err = create_hyp_mappings(cpu_data, cpu_data + 1, PAGE_HYP);
 
                if (err) {
                        kvm_err("Cannot map host CPU state: %d\n", err);
@@ -1669,6 +1690,10 @@ int kvm_arch_init(void *opaque)
        if (err)
                return err;
 
+       err = kvm_arm_init_sve();
+       if (err)
+               return err;
+
        if (!in_hyp_mode) {
                err = init_hyp_mode();
                if (err)
index 5fb0f16..f0d13d9 100644 (file)
@@ -51,9 +51,9 @@
 #include <linux/slab.h>
 #include <linux/sort.h>
 #include <linux/bsearch.h>
+#include <linux/io.h>
 
 #include <asm/processor.h>
-#include <asm/io.h>
 #include <asm/ioctl.h>
 #include <linux/uaccess.h>
 #include <asm/pgtable.h>
@@ -1135,11 +1135,11 @@ EXPORT_SYMBOL_GPL(kvm_get_dirty_log);
 
 #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
 /**
- * kvm_get_dirty_log_protect - get a snapshot of dirty pages, and if any pages
+ * kvm_get_dirty_log_protect - get a snapshot of dirty pages
  *     and reenable dirty page tracking for the corresponding pages.
  * @kvm:       pointer to kvm instance
  * @log:       slot id and address to which we copy the log
- * @is_dirty:  flag set if any page is dirty
+ * @flush:     true if TLB flush is needed by caller
  *
  * We need to keep it in mind that VCPU threads can write to the bitmap
  * concurrently. So, to avoid losing track of dirty pages we keep the
@@ -1224,6 +1224,7 @@ EXPORT_SYMBOL_GPL(kvm_get_dirty_log_protect);
  *     and reenable dirty page tracking for the corresponding pages.
  * @kvm:       pointer to kvm instance
  * @log:       slot id and address from which to fetch the bitmap of dirty pages
+ * @flush:     true if TLB flush is needed by caller
  */
 int kvm_clear_dirty_log_protect(struct kvm *kvm,
                                struct kvm_clear_dirty_log *log, bool *flush)
@@ -1251,7 +1252,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
        if (!dirty_bitmap)
                return -ENOENT;
 
-       n = kvm_dirty_bitmap_bytes(memslot);
+       n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
 
        if (log->first_page > memslot->npages ||
            log->num_pages > memslot->npages - log->first_page ||
@@ -1264,8 +1265,8 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
                return -EFAULT;
 
        spin_lock(&kvm->mmu_lock);
-       for (offset = log->first_page,
-            i = offset / BITS_PER_LONG, n = log->num_pages / BITS_PER_LONG; n--;
+       for (offset = log->first_page, i = offset / BITS_PER_LONG,
+                n = DIV_ROUND_UP(log->num_pages, BITS_PER_LONG); n--;
             i++, offset += BITS_PER_LONG) {
                unsigned long mask = *dirty_bitmap_buffer++;
                atomic_long_t *p = (atomic_long_t *) &dirty_bitmap[i];
@@ -1742,6 +1743,70 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
 }
 EXPORT_SYMBOL_GPL(gfn_to_page);
 
+static int __kvm_map_gfn(struct kvm_memory_slot *slot, gfn_t gfn,
+                        struct kvm_host_map *map)
+{
+       kvm_pfn_t pfn;
+       void *hva = NULL;
+       struct page *page = KVM_UNMAPPED_PAGE;
+
+       if (!map)
+               return -EINVAL;
+
+       pfn = gfn_to_pfn_memslot(slot, gfn);
+       if (is_error_noslot_pfn(pfn))
+               return -EINVAL;
+
+       if (pfn_valid(pfn)) {
+               page = pfn_to_page(pfn);
+               hva = kmap(page);
+       } else {
+               hva = memremap(pfn_to_hpa(pfn), PAGE_SIZE, MEMREMAP_WB);
+       }
+
+       if (!hva)
+               return -EFAULT;
+
+       map->page = page;
+       map->hva = hva;
+       map->pfn = pfn;
+       map->gfn = gfn;
+
+       return 0;
+}
+
+int kvm_vcpu_map(struct kvm_vcpu *vcpu, gfn_t gfn, struct kvm_host_map *map)
+{
+       return __kvm_map_gfn(kvm_vcpu_gfn_to_memslot(vcpu, gfn), gfn, map);
+}
+EXPORT_SYMBOL_GPL(kvm_vcpu_map);
+
+void kvm_vcpu_unmap(struct kvm_vcpu *vcpu, struct kvm_host_map *map,
+                   bool dirty)
+{
+       if (!map)
+               return;
+
+       if (!map->hva)
+               return;
+
+       if (map->page)
+               kunmap(map->page);
+       else
+               memunmap(map->hva);
+
+       if (dirty) {
+               kvm_vcpu_mark_page_dirty(vcpu, map->gfn);
+               kvm_release_pfn_dirty(map->pfn);
+       } else {
+               kvm_release_pfn_clean(map->pfn);
+       }
+
+       map->hva = NULL;
+       map->page = NULL;
+}
+EXPORT_SYMBOL_GPL(kvm_vcpu_unmap);
+
 struct page *kvm_vcpu_gfn_to_page(struct kvm_vcpu *vcpu, gfn_t gfn)
 {
        kvm_pfn_t pfn;
@@ -2255,7 +2320,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
        u64 block_ns;
 
        start = cur = ktime_get();
-       if (vcpu->halt_poll_ns) {
+       if (vcpu->halt_poll_ns && !kvm_arch_no_poll(vcpu)) {
                ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
 
                ++vcpu->stat.halt_attempted_poll;
@@ -2886,6 +2951,16 @@ out:
 }
 #endif
 
+static int kvm_device_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+       struct kvm_device *dev = filp->private_data;
+
+       if (dev->ops->mmap)
+               return dev->ops->mmap(dev, vma);
+
+       return -ENODEV;
+}
+
 static int kvm_device_ioctl_attr(struct kvm_device *dev,
                                 int (*accessor)(struct kvm_device *dev,
                                                 struct kvm_device_attr *attr),
@@ -2930,6 +3005,13 @@ static int kvm_device_release(struct inode *inode, struct file *filp)
        struct kvm_device *dev = filp->private_data;
        struct kvm *kvm = dev->kvm;
 
+       if (dev->ops->release) {
+               mutex_lock(&kvm->lock);
+               list_del(&dev->vm_node);
+               dev->ops->release(dev);
+               mutex_unlock(&kvm->lock);
+       }
+
        kvm_put_kvm(kvm);
        return 0;
 }
@@ -2938,6 +3020,7 @@ static const struct file_operations kvm_device_fops = {
        .unlocked_ioctl = kvm_device_ioctl,
        .release = kvm_device_release,
        KVM_COMPAT(kvm_device_ioctl),
+       .mmap = kvm_device_mmap,
 };
 
 struct kvm_device *kvm_device_from_filp(struct file *filp)
@@ -3046,7 +3129,7 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
        case KVM_CAP_CHECK_EXTENSION_VM:
        case KVM_CAP_ENABLE_CAP_VM:
 #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
-       case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT:
+       case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2:
 #endif
                return 1;
 #ifdef CONFIG_KVM_MMIO
@@ -3065,6 +3148,8 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
 #endif
        case KVM_CAP_MAX_VCPU_ID:
                return KVM_MAX_VCPU_ID;
+       case KVM_CAP_NR_MEMSLOTS:
+               return KVM_USER_MEM_SLOTS;
        default:
                break;
        }
@@ -3082,7 +3167,7 @@ static int kvm_vm_ioctl_enable_cap_generic(struct kvm *kvm,
 {
        switch (cap->cap) {
 #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
-       case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT:
+       case KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2:
                if (cap->flags || (cap->args[0] & ~1))
                        return -EINVAL;
                kvm->manual_dirty_log_protect = cap->args[0];
index 89a414f..2d9523b 100644 (file)
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
 config IRQ_BYPASS_MANAGER
        tristate
index 901228d..bd7f9a7 100644 (file)
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_IRQ_BYPASS_MANAGER) += irqbypass.o